}
}
public void testConnectorListenerSupport() throws Exception
{
Connector connector = getConnectorAndAssert();
Service service = getTestService("anApple", Apple.class);
InboundEndpoint endpoint =
muleContext.getEndpointFactory().getInboundEndpoint(getTestEndpointURI());
try
{
connector.registerListener(null, null, service);
fail("cannot register null");
}
catch (Exception e)
{
// expected
}
try
{
connector.registerListener(endpoint, null, service);
fail("cannot register null");
}
catch (Exception e)
{
// expected
}
try
{
connector.registerListener(null, getSensingNullMessageProcessor(), service);
fail("cannot register null");
}
catch (Exception e)
{
// expected
}
connector.registerListener(endpoint, getSensingNullMessageProcessor(), service);
// this should work
connector.unregisterListener(endpoint, service);
// so should this
try
{
connector.unregisterListener(null, service);
fail("cannot unregister null");
}
catch (Exception e)
{
// expected
}
try
{
connector.unregisterListener(null, service);
fail("cannot unregister null");
}
catch (Exception e)
{
// expected
}
try
{
connector.unregisterListener(null, service);
fail("cannot unregister null");
}
catch (Exception e)
{
// expected
}
connector.unregisterListener(endpoint, service);
muleContext.getRegistry().unregisterService(service.getName());
}