Package org.mule.util.concurrent

Examples of org.mule.util.concurrent.Latch.await()


    public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException
    {
        Latch latch = work.provideStartLatch();
        executor.execute(work);
        latch.await();
    }

}
View Full Code Here


            public void run()
            {
                workExecutedLatch.release();
            }
        });
        if (!workExecutedLatch.await(1000, TimeUnit.MILLISECONDS))
        {
            fail("Work should be executed and it was not");
        }
    }
View Full Code Here

        MuleClient client = muleContext.getClient();
        MuleMessage result = client.send("http://localhost:" + dynamicPort.getNumber()
                                         + "/services/proxyWithWsdl", msg, null);
        String resString = result.getPayloadAsString();
        assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
        assertTrue(resString.indexOf("<test xmlns=\"http://foo\"") != -1);
    }

    @Test
    public void testServerClientProxyWithWsdl2() throws Exception
View Full Code Here

        MuleClient client = muleContext.getClient();
        MuleMessage result = client.send("http://localhost:" + dynamicPort.getNumber()
                                         + "/services/proxyWithWsdl2", msg, null);
        String resString = result.getPayloadAsString();
        assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
        assertTrue(resString.indexOf("<test xmlns=\"http://foo\"") != -1);
    }

    @Test
    public void testServerClientProxyWithTransform() throws Exception
View Full Code Here

        //This seems a little odd that we forward the exception to the outbound endpoint, but I guess users
        // can just add a filter
        assertNotNull(result);
        int status = result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0);
        assertEquals(401, status);
        assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
    }
}
View Full Code Here

        assertEquals(0, eventCounter1.get());

        multicaster.addApplicationListener(subscriptionBean);
        client.send("vm://event.multicaster", "Test Spring MuleEvent", null);

        assertTrue(whenFinished.await(DEFAULT_LATCH_TIMEOUT, TimeUnit.MILLISECONDS));
        assertEquals(1, eventCounter1.get());
        eventCounter1.set(0);

        multicaster.removeAllListeners();
        client.send("vm://event.multicaster", "Test Spring MuleEvent", null);
View Full Code Here

        bean.setEventCallback(new CountingEventCallback(eventCounter1, 1, whenFinished));

        MuleClient client = muleContext.getClient();
        client.send("vm://event.multicaster", "Test Spring MuleEvent", null);

        whenFinished.await(DEFAULT_LATCH_TIMEOUT, TimeUnit.MILLISECONDS);
        assertEquals(1, eventCounter1.get());
    }

    @Test
    public void testReceivingASpringEvent() throws Exception
View Full Code Here

                connectorExceptionCounter.incrementAndGet();
                latch.countDown();
            }
        });

        latch.await(500, TimeUnit.MILLISECONDS);
        assertEquals("There shouldn't have been any exceptions", 0, connectorExceptionCounter.get());
    }
}
View Full Code Here

        if (variant.equals(ConfigVariant.FLOW))
        {
            ((Flow) service).process(getTestEvent("test"));
            Thread.sleep(200);
            ((Flow) service).dispose();
            assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
        }
        else
        {
            ((Service) service).dispatchEvent(getTestEvent("test"));
            Thread.sleep(200);
View Full Code Here

        else
        {
            ((Service) service).dispatchEvent(getTestEvent("test"));
            Thread.sleep(200);
            ((Service) service).dispose();
            assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
        }
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.