// TODO: cast to raw type to get away from generic issue..
@SuppressWarnings({"unchecked", "rawtypes"})
public ContainerMethodExecutor getContainerMethodExecutor(ProtocolDefinition protocol, ProtocolConfiguration protocolConfiguration)
{
final ApplicationContext applicationContext = applicationContextInst.get();
final SuiteContext suiteContext = suiteContextInst.get();
final ClassContext classContext = classContextInst.get();
final Class<?> classContextId = classContext.getActiveId();
final TestContext testContext = testContextInst.get();
final Object testContextId = testContext.getActiveId();
ContainerMethodExecutor executor = ((Protocol)protocol.getProtocol()).getExecutor(
protocolConfiguration,
protocolMetadata.get(), new CommandCallback()
{
@Override
public void fired(Command<?> event)
{
applicationContext.activate();
suiteContext.activate();
classContext.activate(classContextId);
testContext.activate(testContextId);
try
{
remoteEvent.fire(event);
}
finally
{
testContext.deactivate();
classContext.deactivate();
suiteContext.deactivate();
applicationContext.deactivate();
}
}
});
return executor;