}
public void testBelatedTransactionDoesntLeak() throws Throwable {
ComponentRegistry componentRegistry = advancedCache(1).getComponentRegistry();
final ControlledCommandFactory ccf = new ControlledCommandFactory(componentRegistry.getCommandsFactory(), PrepareCommand.class);
TestingUtil.replaceField(ccf, "commandsFactory", componentRegistry, ComponentRegistry.class);
//hack: re-add the component registry to the GlobalComponentRegistry's "namedComponents" (CHM) in order to correctly publish it for
// when it will be read by the InboundInvocationHandlder. IIH reads the value from the GlobalComponentRegistry.namedComponents before using it
advancedCache(1).getComponentRegistry().getGlobalComponentRegistry().registerNamedComponentRegistry(componentRegistry, EmbeddedCacheManager.DEFAULT_CACHE_NAME);