use of org.pentaho.di.trans.dataservice.ui.UIFactory in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRealTest method testServiceTransKeepsRunningWhenDataServiceIsNotUserDefined.
@Test
public void testServiceTransKeepsRunningWhenDataServiceIsNotUserDefined() throws Exception {
TransMeta transMeta = new TransMeta(getClass().getResource("/GenerateOneMillion.ktr").getPath());
DataServiceMeta dataServiceMeta = new DataServiceMeta(transMeta);
dataServiceMeta.setName("table");
dataServiceMeta.setStepname("Delay Row");
dataServiceMeta.setUserDefined(false);
PentahoCacheSystemConfiguration systemConfiguration = new PentahoCacheSystemConfiguration();
systemConfiguration.setData(new HashMap<>());
PentahoCacheManagerImpl pentahoCacheManager = new PentahoCacheManagerImpl(systemConfiguration, new HeapCacheProvidingService());
ServiceCacheFactory cacheFactory = new ServiceCacheFactory(pentahoCacheManager, Executors.newSingleThreadExecutor());
DataServiceContext dataServiceContext = new DataServiceContext(singletonList(cacheFactory), emptyList(), pentahoCacheManager, new UIFactory(), new LogChannel(""));
SQL countSql = new SQL("select count(*) from table");
DataServiceExecutor countExecutor = new DataServiceExecutor.Builder(countSql, dataServiceMeta, dataServiceContext).build();
countExecutor.executeQuery();
SQL limitSql = new SQL("select field1,field2 from table limit 5");
DataServiceExecutor limitExecutor = new DataServiceExecutor.Builder(limitSql, dataServiceMeta, dataServiceContext).build();
limitExecutor.executeQuery();
limitExecutor.waitUntilFinished();
assertTrue(countExecutor.getGenTrans().isRunning());
assertTrue(countExecutor.getServiceTrans().isRunning());
countExecutor.getServiceTrans().stopAll();
}
Aggregations