Exemple #1
0
  public void testReceiversServiceLifecycle() throws Exception {
    Service service = getTestService();
    service.setInboundRouter(new DefaultInboundRouterCollection());
    InboundEndpoint endpoint = getTestInboundEndpoint("in", "test://in");
    service.getInboundRouter().addEndpoint(endpoint);
    connector = (TestConnector) endpoint.getConnector();

    assertEquals(0, connector.receivers.size());

    connector.start();
    assertEquals(0, connector.receivers.size());

    service.start();
    assertEquals(1, connector.receivers.size());
    assertTrue(((AbstractMessageReceiver) connector.receivers.get("in")).isConnected());
    assertTrue(((AbstractMessageReceiver) connector.receivers.get("in")).isStarted());

    connector.stop();
    assertEquals(1, connector.receivers.size());
    assertFalse(((AbstractMessageReceiver) connector.receivers.get("in")).isConnected());
    assertFalse(((AbstractMessageReceiver) connector.receivers.get("in")).isStarted());

    connector.start();
    assertEquals(1, connector.receivers.size());
    assertTrue(((AbstractMessageReceiver) connector.receivers.get("in")).isConnected());
    assertTrue(((AbstractMessageReceiver) connector.receivers.get("in")).isStarted());

    service.stop();
    assertEquals(0, connector.receivers.size());

    connector.stop();
    assertEquals(0, connector.receivers.size());
  }
Exemple #2
0
 protected Router lookupInboundRouterFromService(String serviceName) throws Exception {
   Service c = muleContext.getRegistry().lookupService(serviceName);
   assertNotNull(c);
   List routers = c.getInboundRouter().getRouters();
   assertEquals(1, routers.size());
   assertTrue(routers.get(0) instanceof Router);
   return (Router) routers.get(0);
 }
Exemple #3
0
 public void testEndpointURIParamsConfig() {
   Service d = muleContext.getRegistry().lookupService("testPropertiesComponent");
   assertNotNull(d);
   final InboundRouterCollection router = d.getInboundRouter();
   assertNotNull(router);
   final List endpoints = router.getEndpoints();
   assertNotNull(endpoints);
   assertFalse(endpoints.isEmpty());
   final ImmutableEndpoint inboundEndpoint = (ImmutableEndpoint) endpoints.get(0);
   assertNotNull(inboundEndpoint);
   final List transformers = inboundEndpoint.getTransformers();
   assertFalse(transformers.isEmpty());
   assertNotNull(transformers.get(0));
   final List responseTransformers = inboundEndpoint.getResponseTransformers();
   assertFalse(responseTransformers.isEmpty());
   assertNotNull(responseTransformers.get(0));
 }