2011-05-23 11:37:56 -04:00
|
|
|
package akka.camel;
|
|
|
|
|
|
|
|
|
|
import akka.japi.SideEffect;
|
|
|
|
|
|
|
|
|
|
import org.junit.AfterClass;
|
|
|
|
|
import org.junit.BeforeClass;
|
2011-09-15 09:46:12 +02:00
|
|
|
import org.junit.Ignore;
|
2011-05-23 11:37:56 -04:00
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
import static akka.actor.Actors.*;
|
|
|
|
|
import static akka.camel.CamelContextManager.*;
|
|
|
|
|
import static akka.camel.CamelServiceManager.*;
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Martin Krasser
|
|
|
|
|
*/
|
|
|
|
|
public class ConsumerJavaTestBase {
|
|
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
|
public static void setUpBeforeClass() {
|
|
|
|
|
startCamelService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AfterClass
|
|
|
|
|
public static void tearDownAfterClass() {
|
|
|
|
|
stopCamelService();
|
|
|
|
|
registry().local().shutdownAll();
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-15 09:46:12 +02:00
|
|
|
@Test @Ignore // TODO: fix race
|
|
|
|
|
|
|
|
|
|
// org.apache.camel.CamelExchangeException: No consumers available
|
|
|
|
|
// on endpoint: Endpoint[direct://error-handler-test-java]
|
|
|
|
|
|
2011-05-23 11:37:56 -04:00
|
|
|
public void shouldHandleExceptionThrownByActorAndGenerateCustomResponse() {
|
|
|
|
|
getMandatoryService().awaitEndpointActivation(1, new SideEffect() {
|
|
|
|
|
public void apply() {
|
2011-09-08 11:02:17 +02:00
|
|
|
actorOf(SampleErrorHandlingConsumer.class);
|
2011-05-23 11:37:56 -04:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
String result = getMandatoryTemplate().requestBody("direct:error-handler-test-java", "hello", String.class);
|
|
|
|
|
assertEquals("error: hello", result);
|
|
|
|
|
}
|
|
|
|
|
}
|