Package co.paralleluniverse.strands

Examples of co.paralleluniverse.strands.SuspendableRunnable


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

    @Test
    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());
View Full Code Here


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

    @Test
    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());
View Full Code Here

        return ((Document) groupBy.getValueAsObject()).get(FIELD_INT_SUM_NAME).getValueAsString();
    }
   
    @Test
    public void testGroupByQuery() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                MongoIterator<Element> groupBy = mongoColl.groupBy(GROUP_BY_BUILDER.build());
                assertEquals(FIELD_INT_SUM, getGroupByResultAsString(groupBy.next()));
            }
View Full Code Here

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

    @Test
    public void testGroupByBuilder() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                MongoIterator<Element> groupBy = mongoColl.groupBy(GROUP_BY_BUILDER);
                assertEquals(FIELD_INT_SUM, getGroupByResultAsString(groupBy.next()));
            }
View Full Code Here

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

    @Test
    public void testGroupByQueryFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    MongoIterator<Element> groupBy = addListenerCalledFlagSetter(mongoColl.groupByAsync(GROUP_BY_BUILDER.build())).get();
                    assertEquals(FIELD_INT_SUM, getGroupByResultAsString(groupBy.next()));
View Full Code Here

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

    @Test
    public void testGroupByBuilderFuture() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    MongoIterator<Element> groupBy = addListenerCalledFlagSetter(mongoColl.groupByAsync(GROUP_BY_BUILDER)).get();
                    assertEquals(FIELD_INT_SUM, getGroupByResultAsString(groupBy.next()));
View Full Code Here

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

    @Test
    public void testInsert() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                deleteTestSet();
                int inserted = mongoColl.insert(FIRST_TEST_ELEM, SECOND_TEST_ELEM);
                assertEquals((int) TEST_SET_SIZE, inserted);
View Full Code Here

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

    @Test
    public void testInsertContinueOnError() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                deleteTestSet();
                int inserted = mongoColl.insert(true, FIRST_TEST_ELEM, SECOND_TEST_ELEM);
                assertEquals((int) TEST_SET_SIZE, inserted);
View Full Code Here

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

    @Test
    public void testInsertContinueOnErrorDurable() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                deleteTestSet();
                int inserted = mongoColl.insert(true, Durability.ACK, FIRST_TEST_ELEM, SECOND_TEST_ELEM);
                assertEquals((int) TEST_SET_SIZE, inserted);
View Full Code Here

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

    @Test
    public void testInsertDurable() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                deleteTestSet();
                int inserted = mongoColl.insert(Durability.ACK, FIRST_TEST_ELEM, SECOND_TEST_ELEM);
                assertEquals((int) TEST_SET_SIZE, inserted);
View Full Code Here

TOP

Related Classes of co.paralleluniverse.strands.SuspendableRunnable

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.