Examples of JacksonEngine


Examples of org.jongo.marshall.jackson.JacksonEngine

        Party party = new Party();
        party.with(new Friend("john"));
        party.with(new Friend("peter"));
        collection.save(party);

        DBObject robert = new JacksonEngine(Mapping.defaultMapping()).marshall(new Friend("Robert")).toDBObject();
        collection.update("{}").with("{$push:{friends:" + robert.toString() + "}}");

        assertThat(collection.count("{ 'friends.name' : 'Robert'}")).isEqualTo(1);
    }
View Full Code Here

Examples of org.jongo.marshall.jackson.JacksonEngine

public class QueryTest {

    @Test
    public void shouldConvertToDBObject() throws Exception {

        Query query = new BsonQueryFactory(new JacksonEngine(Mapping.defaultMapping())).createQuery("{'value':1}");

        DBObject dbObject = query.toDBObject();

        assertThat(dbObject.containsField("value")).isTrue();
        assertThat(dbObject.get("value")).isEqualTo(1);
View Full Code Here

Examples of org.jongo.marshall.jackson.JacksonEngine

    private QueryFactory factory;

    @Before
    public void setUp() throws Exception {
        factory = new BsonQueryFactory(new JacksonEngine(Mapping.defaultMapping()));
    }
View Full Code Here

Examples of org.jongo.marshall.jackson.JacksonEngine

    }

    @Test
    public void shouldBindParameterWithCustomToken() throws Exception {

        QueryFactory factoryWithToken = new BsonQueryFactory(new JacksonEngine(Mapping.defaultMapping()), "@");

        Query query = factoryWithToken.createQuery("{id:@}", 123);

        assertThat(query.toDBObject()).isEqualTo(new BasicDBObject("id", 123));
    }
View Full Code Here

Examples of org.jongo.marshall.jackson.JacksonEngine

    @Test
    public void canHandleObjectSerializedAsAPrimitive() throws Exception {

        Mapping mapping = new Mapping.Builder().addSerializer(Friend.class, new PrimitiveJsonSerializer()).build();
        factory = new BsonQueryFactory(new JacksonEngine(mapping));

        DBObject query = factory.createQuery("{bytes:#}", new Friend("Robert")).toDBObject();

        assertThat(query.get("bytes")).isEqualTo("Robert");
    }
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.