You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrè <mo...@web.de> on 2011/07/13 10:51:12 UTC

UnitTests Timing issues

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.

Re: UnitTests Timing issues

Posted by Andrè <mo...@web.de>.
or could it be that the bean isAuthZBlocked is blocked by camel, till the
second call is done
and the meanwhile incoming message is read just after that call ? 

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