fix memory leaks in tests, #20659
This commit is contained in:
parent
6a13d99bfc
commit
be448e9fbb
36 changed files with 144 additions and 153 deletions
|
|
@ -23,16 +23,21 @@ import java.util.concurrent.TimeUnit;
|
|||
public class CustomRouteTest extends JUnitSuite {
|
||||
|
||||
@Rule
|
||||
public AkkaJUnitActorSystemResource actorSystemResource =
|
||||
new AkkaJUnitActorSystemResource("CustomRouteTest");
|
||||
public AkkaJUnitActorSystemResource actorSystemResource = new AkkaJUnitActorSystemResource("CustomRouteTest");
|
||||
|
||||
private final ActorSystem system = actorSystemResource.getSystem();
|
||||
private Camel camel = (Camel) CamelExtension.get(system);
|
||||
private ActorSystem system = null;
|
||||
private Camel camel = null;
|
||||
|
||||
public static class MyActor extends UntypedActor {
|
||||
@Override public void onReceive(Object o) {}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void beforeEach() {
|
||||
system = actorSystemResource.getSystem();
|
||||
camel = (Camel) CamelExtension.get(system);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomProducerRoute() throws Exception {
|
||||
MockEndpoint mockEndpoint = camel.context().getEndpoint("mock:mockProducer", MockEndpoint.class);
|
||||
|
|
@ -118,6 +123,7 @@ public class CustomRouteTest extends JUnitSuite {
|
|||
private void assertMockEndpoint(MockEndpoint mockEndpoint) throws InterruptedException {
|
||||
mockEndpoint.expectedMessageCount(1);
|
||||
mockEndpoint.expectedMessagesMatches(new Predicate() {
|
||||
@Override
|
||||
public boolean matches(Exchange exchange) {
|
||||
return exchange.getIn().getBody().equals("test");
|
||||
}
|
||||
|
|
@ -126,8 +132,8 @@ public class CustomRouteTest extends JUnitSuite {
|
|||
}
|
||||
|
||||
public static class CustomRouteBuilder extends RouteBuilder {
|
||||
private String uri;
|
||||
private String fromUri;
|
||||
private final String uri;
|
||||
private final String fromUri;
|
||||
|
||||
public CustomRouteBuilder(String from, String to) {
|
||||
fromUri = from;
|
||||
|
|
@ -164,7 +170,7 @@ public class CustomRouteTest extends JUnitSuite {
|
|||
}
|
||||
|
||||
public static class EndpointProducer extends UntypedProducerActor {
|
||||
private String uri;
|
||||
private final String uri;
|
||||
|
||||
public EndpointProducer(String uri) {
|
||||
this.uri = uri;
|
||||
|
|
@ -192,8 +198,8 @@ public class CustomRouteTest extends JUnitSuite {
|
|||
}
|
||||
|
||||
public static class TestAckConsumer extends UntypedConsumerActor {
|
||||
private String myuri;
|
||||
private String to;
|
||||
private final String myuri;
|
||||
private final String to;
|
||||
|
||||
public TestAckConsumer(String uri, String to){
|
||||
myuri = uri;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue