Package com.allanbank.mongodb.bson

Examples of com.allanbank.mongodb.bson.Document


    public void testRunCommandDocumentFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document res = addListenerCalledFlagSetter(mongoDb.runCommandAsync(BuilderFactory.start().add("ping", 1))).get();
                    assertEquals("1.0", res.get("ok").getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here


    public void testRunCommandStringFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document res = addListenerCalledFlagSetter(mongoDb.runCommandAsync("ping")).get();
                    assertEquals("1.0", res.get("ok").getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

    public void testRunCommandOptionsFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document res = addListenerCalledFlagSetter(mongoDb.runCommandAsync("ping", null)).get();
                    assertEquals("1.0", res.get("ok").getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

    public void testRunCommandNameIntValueOptionsFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document res = addListenerCalledFlagSetter(mongoDb.runCommandAsync("ping", 1, null)).get();
                    assertEquals("1.0", res.get("ok").getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

    public void testRunCommandNameStringValueOptionsFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document res = addListenerCalledFlagSetter(mongoDb.runCommandAsync("ping", "1", null)).get();
                    assertEquals("1.0", res.get("ok").getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

    public void testFindAndModifyBuilderFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document findAndModify = addListenerCalledFlagSetter(mongoColl.findAndModifyAsync(FIND_AND_MODIFY_BUILDER)).get();
                    assertEquals(UPDATE_VALUE.toString(), findAndModify.get(FIELD_INT_NAME).getValueAsString());
                    assertListenerCalled();
                } catch (ExecutionException ex) {
                    fail(ex.getLocalizedMessage());
                }
            }
View Full Code Here

    @Test
    public void testFindOneQueryDocument() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document find = mongoColl.findOne(FIND_DOCUMENT);
                assertEquals(FIELD_INT_FIRST_VALUE.toString(), find.get(FIELD_INT_NAME).getValueAsString());
            }
        }).start().join();
    }
View Full Code Here

    @Test
    public void testFindOneQuery() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document find = mongoColl.findOne(Find.builder().query(FIND_DOCUMENT).build());
                assertEquals(FIELD_INT_FIRST_VALUE.toString(), find.get(FIELD_INT_NAME).getValueAsString());
            }
        }).start().join();
    }
View Full Code Here

    @Test
    public void testFindOneBuilder() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document find = mongoColl.findOne(Find.builder().query(FIND_DOCUMENT).build());
                assertEquals(FIELD_INT_FIRST_VALUE.toString(), find.get(FIELD_INT_NAME).getValueAsString());
            }
        }).start().join();
    }
View Full Code Here

    public void testFindOneQueryDocumentFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    Document find = addListenerCalledFlagSetter(mongoColl.findOneAsync(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

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.