Package org.mule.util.concurrent

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


                     + "<soap:Body> <test xmlns=\"http://foo\"></test>" + "</soap:Body>" + "</soap:Envelope>";

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

    public void testServerClientProxyWithTransform() throws Exception
    {
View Full Code Here


    {
        Latch receiveLatch = new Latch();
        setupTestServiceComponent(receiveLatch);

        sendMucMessageFromNewThread();
        assertTrue(receiveLatch.await(60, TimeUnit.SECONDS));
    }

    private void setupTestServiceComponent(Latch receiveLatch) throws Exception
    {
        Object testComponent = getComponent(RECEIVE_SERVICE_NAME);
View Full Code Here

        when(mockHttpConnector.getMuleContext().getExceptionListener()).thenReturn(mockExceptionListener);
        Thread dispatcherThread = createDispatcherThread(httpRequestDispatcher);
        try
        {
            dispatcherThread.start();
            if (!acceptCalledLath.await(WAIT_TIME, TimeUnit.MILLISECONDS))
            {
                fail("retry template should be executed");
            }

            Prober prober = new PollingProber(100, 1);
View Full Code Here

        }).when(mockExecutor).execute(any(HttpRequestDispatcherWork.class));
        Thread dispatcherThread = createDispatcherThread(httpRequestDispatcher);
        dispatcherThread.start();
        try
        {
            if (!acceptCalledLath.await(500, TimeUnit.MILLISECONDS))
            {
                fail("Work should have been scheduled");
            }
        }
        finally
View Full Code Here

        GetMethod method = new GetMethod(url);
        method.addRequestHeader(HttpConstants.HEADER_CONTENT_TYPE, PLAIN_CONTENT_TYPE_HEADER);
        int status = new HttpClient().executeMethod(method);
        assertEquals(HttpConstants.SC_OK, status);

        assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        String expected = testMessage + " Received";
        String response = method.getResponseBodyAsString();
        assertEquals(expected, response);

        Header responseContentType = method.getResponseHeader(HttpConstants.HEADER_CONTENT_TYPE);
View Full Code Here

        setupAssertIncomingMessage(method, latch, expectedContentTypeHeader);

        MuleClient client = muleContext.getClient();
        MuleMessage reply = client.send("vm://sendBy" + method, messagePayload, messageProperties);

        assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        assertNotNull(reply);
        assertEquals("EUC-JP", reply.getEncoding());
        assertEquals(getTestMessage(Locale.JAPAN) + " Received", reply.getPayloadAsString());
    }
View Full Code Here

        }, "polledUMO");

        MuleClient client = muleContext.getClient();
        MuleMessage result = client.request("vm://toclient", 50000);
        assertNotNull(result.getPayload());
        assertTrue("Callback called", latch.await(1000, TimeUnit.MILLISECONDS));
        assertEquals("/foo toClient-only", result.getPayloadAsString());
        // The transform should not have been propagated to the outbound endpoint
        assertFalse(transformPropagated.get());
    }
}
View Full Code Here

        ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject(
            "applicationEventMulticaster")).applicationContext;
        context.publishEvent(new TestApplicationEvent(context));

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

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

        client.send("vm://event.multicaster", "Test Spring MuleEvent", null);
        ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject(
            "applicationEventMulticaster")).applicationContext;
        context.publishEvent(new TestApplicationEvent(context));

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

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

        subscriptionBean.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 testReceiveAndPublishEvent() throws Exception
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.