forked from akka/akka-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsumerJavaTestBase.java
41 lines (33 loc) · 1.05 KB
/
ConsumerJavaTestBase.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package akka.camel;
import akka.japi.SideEffect;
import org.junit.AfterClass;
import org.junit.BeforeClass;
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();
}
@Test
public void shouldHandleExceptionThrownByActorAndGenerateCustomResponse() {
getMandatoryService().awaitEndpointActivation(1, new SideEffect() {
public void apply() {
actorOf(SampleErrorHandlingConsumer.class).start();
}
});
String result = getMandatoryTemplate().requestBody("direct:error-handler-test-java", "hello", String.class);
assertEquals("error: hello", result);
}
}