Package net.vz.mongodb.jackson.mock

Examples of net.vz.mongodb.jackson.mock.MockObject


        cursor.hasNext();
        cursor.in("blah", "blah");
    }

    private MockObject insertMockObject() {
        MockObject mockObject = new MockObject("someid", "hello", 10);
        mockObject.simpleList = Arrays.asList("a", "b", "c");
        coll.insert(mockObject);
        return mockObject;
    }
View Full Code Here


        coll.insert(mockObject);
        return mockObject;
    }

    private MockObject insertMockObjectWithEmbedded() {
        MockObject mockObject = new MockObject("someid", "hello", 10);
        MockEmbeddedObject embeddedObject = new MockEmbeddedObject();
        embeddedObject.value = "hello";
        embeddedObject.list = Arrays.asList("a", "b", "c");
        mockObject.object = embeddedObject;
        coll.insert(mockObject);
View Full Code Here

        coll.insert(mockObject);
        return mockObject;
    }

    private MockObject insertMockObjectWithComplexList() {
        MockObject mockObject = new MockObject("someid", "hello", 10);
        MockEmbeddedObject embeddedObject1 = new MockEmbeddedObject();
        embeddedObject1.value = "foo";
        embeddedObject1.list = Arrays.asList("a", "b", "c");
        MockEmbeddedObject embeddedObject2 = new MockEmbeddedObject();
        embeddedObject2.value = "bar";
View Full Code Here

        JacksonDBCollection<Simple, String> resultColl = getCollection(Simple.class, String.class);
        simpleMapReduce(MapReduce.OutputType.REPLACE, resultColl.getName());
    }

    private void simpleMapReduce(MapReduce.OutputType outputType, String collection) {
        coll.insert(new MockObject("foo", 10));
        coll.insert(new MockObject("foo", 15));
        coll.insert(new MockObject("bar", 5));

        MapReduceOutput<Simple, String> output = coll.mapReduce(
                MapReduce.build("function() {emit(this.string, this.integer);}",
                        "function(k, vals) {var sum=0;for(var i in vals) sum += vals[i];return sum;}",
                        outputType, collection, Simple.class, String.class));
View Full Code Here

        JacksonDBCollection<Complex, String> resultColl = getCollection(Complex.class, String.class);
        complexMapReduce(MapReduce.OutputType.REPLACE, resultColl.getName());
    }

    private void complexMapReduce(MapReduce.OutputType outputType, String collection) {
        coll.insert(new MockObject("foo", 10));
        coll.insert(new MockObject("foo", 15));
        coll.insert(new MockObject("bar", 5));

        MapReduceOutput<Complex, String> output = coll.mapReduce(
                MapReduce.build("function() {emit(this.string, {sum: this.integer, product: this.integer});}",
                        "function(k, vals) {var sum=0,product=1;for(var i in vals){sum+=vals[i].sum;product*=vals[i].product;}return {sum:sum,product:product};}",
                        outputType, collection, Complex.class, String.class));
View Full Code Here

TOP

Related Classes of net.vz.mongodb.jackson.mock.MockObject

Copyright © 2018 www.massapicom. 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.