camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrè <morpheusan...@web.de>
Subject UnitTests Timing issues
Date Wed, 13 Jul 2011 08:51:12 GMT
my tests runs, but to test a received message from another Topic (received at
the bean isAuthZBlocked)
it would have to wait bit, ... (see Log, testing done before Imcoming has
processed)
as you see in my test... i use thread.sleep at the moment, which doesnt
really works , some other idea ? 
Log
[                          main] CamelContextXmlTest            INFO 
Testing done:
de.tarent.abiege.XacmlAuthzServiceWrapper.test.CamelContextXmlTest@453dd5
[                          main] SpringCamelContext             INFO  Apache
Camel 2.6.0-fuse-00-00 (CamelContext:camel-3) is shutting down
[                          main] DefaultShutdownStrategy        INFO 
Starting to graceful shutdown 4 routes (timeout 10 seconds)
[el-3) thread #2 - ShutdownTask] DefaultShutdownStrategy        INFO  Route:
route9 suspension deferred.
[el-3) thread #2 - ShutdownTask] DefaultShutdownStrategy        INFO  Route:
route8 suspended and shutdown deferred, was consuming from:
Endpoint[activemq://topic:services.compliance.AuthZBlockingRequests]

Test
		String response = (String) inputEndpoint.requestBody(
			
"direct:injectRequest",getFileContent("src/main/resources/requests/request.xml"));
		Thread.sleep(2000);

Routes which take a part in this scenario
<route>
        <from
uri="activemq:topic:services.compliance.AuthZBlockingRequests"/>
        <to uri="bean:isAuthZBlocked?method=handleBlockingRequest"/>
    </route>
    <route>
        <from uri="direct:injectRequest"/>
        <filter>
         	<method ref="isAuthZBlocked" method="checkDirectInjectedRequest"/>
            <doTry>
                <to
uri="activemq:topic:services.global.xacml.authzRequests?transferException=true"/>
                <doCatch>
                    <exception>org.apache.camel.RuntimeCamelException
					</exception>
                    <process ref="ExceptionDeWrapper"/>
                </doCatch>
            </doTry>
        </filter>
    </route>
		assertEquals(xacmlResponse, response);
		response = null;
		try {
			Thread.sleep(1000);
			response = (String) inputEndpoint.requestBody("direct:injectRequest",
					getFileContent("src/main/resources/requests/request.xml"));
			Thread.sleep(2000);
		} catch (Exception e) {
			assertIsInstanceOf(CamelComplianceInterferesException.class,
e.getCause());
			catched = true;
		}

--
View this message in context: http://camel.465427.n5.nabble.com/UnitTests-Timing-issues-tp4582016p4582016.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message