Package com.allanbank.mongodb.bson

Examples of com.allanbank.mongodb.bson.Document


    public void testFindOneQueryFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document find = addListenerCalledFlagSetter(mongoColl.findOneAsync(Find.builder().query(FIND_DOCUMENT).build())).get();
                    assertEquals(FIELD_INT_FIRST_VALUE.toString(), find.get(FIELD_INT_NAME).getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here


    public void testFindOneBuilderFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document find = addListenerCalledFlagSetter(mongoColl.findOneAsync(Find.builder().query(FIND_DOCUMENT))).get();
                    assertEquals(FIELD_INT_FIRST_VALUE.toString(), find.get(FIELD_INT_NAME).getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

            }
        }).start().join();
    }

    private static String getMapReduceSizeAsString(MongoIterator<Document> mapReduce) {
        Document res = (Document) mapReduce.next().get("value").getValueAsObject();
        return res.get(FIELD_INT_SUM_NAME).getValueAsString();
    }
View Full Code Here

    @Test
    public void testSaveQuery() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document docLoaded = mongoColl.findOne(FIND_DOCUMENT);
                Document docChanged = updatedDocument(docLoaded);
                int saved = mongoColl.save(docChanged);
                assertEquals(1, saved); // TODO return value seems incompatible with API description, to be better understood
            }
        }).start().join();
    }
View Full Code Here

    @Test
    public void testSaveQueryDurable() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document docLoaded = mongoColl.findOne(FIND_DOCUMENT);
                Document docChanged = updatedDocument(docLoaded);
                int saved = mongoColl.save(docChanged, Durability.ACK);
                assertEquals(1, saved); // TODO return value seems incompatible with API description, to be better understood
            }
        }).start().join();
   
View Full Code Here

    public void testSaveQueryFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document docLoaded = mongoColl.findOne(FIND_DOCUMENT);
                    Document docChanged = updatedDocument(docLoaded);
                    int saved = addListenerCalledFlagSetter(mongoColl.saveAsync(docChanged)).get();
                    assertEquals(1, saved);
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
View Full Code Here

    public void testSaveQueryDurableFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document docLoaded = mongoColl.findOne(FIND_DOCUMENT);
                    Document docChanged = updatedDocument(docLoaded);
                    int saved = addListenerCalledFlagSetter(mongoColl.saveAsync(docChanged, Durability.ACK)).get();
                    assertEquals(1, saved); // TODO return value seems incompatible with API description, to be better understood
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
View Full Code Here

    @Test
    public void testExplainAggregateQuery() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document explain = mongoColl.explain(AGGREGATE_QUERY.build());
                assertNotNull(explain.get(FIELD_AGGREGATE_RESULT_STAGES_NAME));
            }
        }).start().join();
    }
View Full Code Here

    @Test
    public void testExplainAggregateBuilder() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document explain = mongoColl.explain(AGGREGATE_QUERY);
                assertNotNull(explain.get(FIELD_AGGREGATE_RESULT_STAGES_NAME));
            }
        }).start().join();
    }
View Full Code Here

    @Test
    public void testExplainFindQueryDocument() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document explain = mongoColl.explain(FIND_DOCUMENT);
                assertNotNull(explain.get(FIELD_AGGREGATE_RESULT_CURSOR_NAME));
            }
        }).start().join();
    }
View Full Code Here

TOP

Related Classes of com.allanbank.mongodb.bson.Document

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.