Examples of MaxKey


Examples of org.bson.types.MaxKey

            break;
        case BsonConstants.TYPE_INT64:
            value = Long.valueOf(buffer.readLong());
            break;
        case BsonConstants.TYPE_MAX_KEY:
            value = new MaxKey();
            break;
        case BsonConstants.TYPE_MIN_KEY:
            value = new MinKey();
            break;
        case BsonConstants.TYPE_JAVASCRIPT_CODE:
View Full Code Here

Examples of org.bson.types.MaxKey

    }

    @Test
    public void testDecodeObjects() throws Exception {
        List<BSONObject> objects = new ArrayList<BSONObject>();
        objects.add(new BasicBSONObject("key", new MaxKey()).append("foo", "bar"));
        objects.add(new BasicBSONObject("key", new MinKey()).append("test", new MaxKey()));

        for (BSONObject object : objects) {
            byte[] encodedData = new BasicBSONEncoder().encode(object);
            ByteBuf buf = Unpooled.wrappedBuffer(encodedData).order(ByteOrder.LITTLE_ENDIAN);
            BSONObject decodedObject = new BsonDecoder().decodeBson(buf);
View Full Code Here

Examples of org.bson.types.MaxKey

                }

                // build max
                next = new BasicDBObject();
                for (String key : shardKey.keySet()) {
                    next.put(key, new MaxKey());
                }
                next = new BasicDBObject("_id", next);
                ts = getNextTimestamp(ts);
                chunk = getChunk(ns, shardKey, prev, next, ts);
                chunks.insert(chunk);
View Full Code Here

Examples of org.bson.types.MaxKey

        } else if (type.equals("UUID")) {
            val = UUID.randomUUID();
        } else if (type.equals("MinKey")) {
            val = new MinKey();
        } else if (type.equals("MaxKey")) {
            val = new MaxKey();
        }

        if (value == null) {
            value = createDBObject();
        }
View Full Code Here

Examples of org.bson.types.MaxKey

    }

    private static class MaxKeyDeserializer extends JsonDeserializer<MaxKey> {
        @Override
        public MaxKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            return new MaxKey();
        }
View Full Code Here

Examples of org.bson.types.MaxKey

    @Test
    public void testMinMaxKey()
        throws MongoException {
        DBCollection c = collection;
        c.save( BasicDBObjectBuilder.start().add( "min" , new MinKey() ).add( "max" , new MaxKey() ).get() );

        DBObject out = c.findOne();
        MinKey min = (MinKey)(out.get( "min" ) );
        MaxKey max = (MaxKey)(out.get( "max" ) );
        assertTrue( JSON.serialize(min).contains("$minKey") );
        assertTrue( JSON.serialize(max).contains("$maxKey") );
    }
View Full Code Here

Examples of org.bson.types.MaxKey

        cur().put( name , new MinKey() );
    }

    @Override
    public void gotMaxKey(final String name) {
        cur().put( name , new MaxKey() );
    }
View Full Code Here

Examples of org.bson.types.MaxKey

        UUID test_uuid = UUID.randomUUID();
        Pattern test_regex = Pattern.compile( "^test.*regex.*xyz$", Pattern.CASE_INSENSITIVE );
        BasicDBObjectBuilder b = BasicDBObjectBuilder.start();
        b.append( "_id", oid );
        b.append( "null", null );
        b.append( "max", new MaxKey() );
        b.append( "min", new MinKey() );
        b.append( "booleanTrue", true );
        b.append( "booleanFalse", false );
        b.append( "int1", 1 );
        b.append( "int1500", 1500 );
View Full Code Here

Examples of org.bson.types.MaxKey

            case BSON.EOO:
            case BSON.UNDEFINED:
            case BSON.NULL:
                return null;
            case BSON.MAXKEY:
                return new MaxKey();
            case BSON.MINKEY:
                return new MinKey();
            case BSON.BOOLEAN:
                return ( _input.get( record.valueOffset ) != 0 );
            case BSON.NUMBER_INT:
View Full Code Here

Examples of org.bson.types.MaxKey

        serializer.serialize(testMap, buf);
        assertEquals(buf.toString(), "{ \"key1\" : \"val1\" , \"key2\" : \"val2\"}");
       
        // test  MAXKEY
        buf = new StringBuilder();
        serializer.serialize(new MaxKey(), buf);
        assertEquals(buf.toString(), "{ \"$maxKey\" : 1}");
       
        // test  MINKEY
        buf = new StringBuilder();
        serializer.serialize(new MinKey(), buf);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.