Package co.paralleluniverse.strands

Examples of co.paralleluniverse.strands.SuspendableRunnable


    private static final FindAndModify.Builder FIND_AND_MODIFY_BUILDER =
            FindAndModify.builder().query(FIND_DOCUMENT).setUpdate(UPDATE_DOCUMENT).setReturnNew(true);
   
    @Test
    public void testFindAndModifyQuery() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document findAndModify = mongoColl.findAndModify(FIND_AND_MODIFY_BUILDER.build());
                assertEquals(UPDATE_VALUE.toString(), findAndModify.get(FIELD_INT_NAME).getValueAsString());
            }
View Full Code Here


        l.addListener(listenerCalledSetter, executor);
        return l;
    }
   
    protected void setUpTestBase() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                listenerCalledFlag = new AtomicBoolean(false);
                listenerCalledGoChannel = Channels.newChannel(0);
                listenerCalledSetter = new Runnable() { @Override public void run() {
View Full Code Here

            }
        }).start().join();
    }
   
    protected void tearDownTestBase() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                listenerCalledSetter = null;
                listenerCalledGoChannel = null;
                listenerCalledFlag= null;
View Full Code Here

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

    @Test
    public void testFindAndModifyBuilder() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document findAndModify = mongoColl.findAndModify(FIND_AND_MODIFY_BUILDER);
                assertEquals(UPDATE_VALUE.toString(), findAndModify.get(FIELD_INT_NAME).getValueAsString());
            }
View Full Code Here

        }).start().join();
    }
   
    @Test
    public void testFindAndModifyQueryFuture() 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.build())).get();
                    assertEquals(UPDATE_VALUE.toString(), findAndModify.get(FIELD_INT_NAME).getValueAsString());
View Full Code Here

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

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

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

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

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

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

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

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

        }).start().join();
    }
   
    @Test
    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());
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.