DataServiceContext implements Context { @Override public void removeServiceTransExecutor( StreamServiceKey key ) { serviceExecutors.invalidate( key ); serviceExecutors.cleanUp(); } DataServiceContext( List<PushDownFactory> pushDownFactories,
                             List<AutoOptimizationService> autoOptimizationServices,
                             PentahoCacheManager cacheManager, UIFactory uiFactory, LogChannelInterface logChannel ); @VisibleForTesting protected  DataServiceContext( List<PushDownFactory> pushDownFactories,
                                List<AutoOptimizationService> autoOptimizationServices,
                                PentahoCacheManager cacheManager, DataServiceMetaStoreUtil metaStoreUtil,
                                UIFactory uiFactory, LogChannelInterface logChannel ); @Override PentahoCacheManager getCacheManager(); @Override DataServiceMetaStoreUtil getMetaStoreUtil(); @Override List<AutoOptimizationService> getAutoOptimizationServices(); @Override List<PushDownFactory> getPushDownFactories(); @Override LogChannelInterface getLogChannel(); @Override UIFactory getUIFactory(); @Override DataServiceDelegate getDataServiceDelegate(); @Override void addExecutor( DataServiceExecutor executor ); @Override DataServiceExecutor getExecutor( String id ); @Override void removeExecutor( String id ); @Override void addServiceTransExecutor( final StreamingServiceTransExecutor serviceExecutor ); @Override StreamingServiceTransExecutor getServiceTransExecutor( StreamServiceKey key ); @Override void removeServiceTransExecutor( StreamServiceKey key ); @Override void removeServiceTransExecutor( String dataServiceName ); @Override StreamingGeneratedTransExecution getStreamingGeneratedTransExecution( String key ); @Override void addStreamingGeneratedTransExecution( String key,
                                                   StreamingGeneratedTransExecution streamingGeneratedTransExecution ); @Override void removeStreamingGeneratedTransExecution( String key );  }
@Test public void testRemoveServiceTransExecutor() throws Exception { assertNull( context.getServiceTransExecutor( streamKey ) ); assertNull( context.getServiceTransExecutor( streamKey2 ) ); assertNull( context.getServiceTransExecutor( streamKey3 ) ); context.addServiceTransExecutor( streamingExecutor ); context.addServiceTransExecutor( streamingExecutor2 ); context.addServiceTransExecutor( streamingExecutor3 ); assertThat( context.getServiceTransExecutor( streamKey ), sameInstance( streamingExecutor ) ); assertThat( context.getServiceTransExecutor( streamKey2 ), sameInstance( streamingExecutor2 ) ); assertThat( context.getServiceTransExecutor( streamKey3 ), sameInstance( streamingExecutor3 ) ); context.removeServiceTransExecutor( STREAMING_EXECUTOR_ID ); assertNull( context.getServiceTransExecutor( streamKey ) ); assertNull( context.getServiceTransExecutor( streamKey2 ) ); assertThat( context.getServiceTransExecutor( streamKey3 ), sameInstance( streamingExecutor3 ) ); context.removeServiceTransExecutor( STREAMING_EXECUTOR_ID3 ); assertNull( context.getServiceTransExecutor( streamKey ) ); assertNull( context.getServiceTransExecutor( streamKey2 ) ); assertNull( context.getServiceTransExecutor( streamKey3 ) ); }