use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class TransientResolverTest method testBuildStreamingTransient.
@Test
public void testBuildStreamingTransient() throws Exception {
RepositoryDirectoryInterface directory = mock(RepositoryDirectoryInterface.class);
when(root.findDirectory("\\path\\to")).thenReturn(directory);
when(repository.getTransformationID("name", directory)).thenReturn(objectId);
when(repository.loadTransformation(objectId, null)).thenReturn(transMeta);
String transientId = TransientResolver.buildTransient("\\path\\to\\name", "streaming:data_service");
String[] parts = transientResolver.splitTransient(transientId);
assertEquals(parts.length, 2);
DataServiceMeta dataServiceMeta = transientResolver.getDataService(transientId);
assertEquals(dataServiceMeta.getStepname(), "data_service");
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class TransientResolverTest method testGetLocalDataService.
@Test
public void testGetLocalDataService() throws Exception {
File localFolder = temporaryFolder.newFolder("local");
File localFile = new File(localFolder, "name.ktr");
Files.write(transMeta.getXML().getBytes(StandardCharsets.UTF_8), localFile);
String transientId = TransientResolver.buildTransient(localFile.getPath(), "data_service");
when(repository.getTransformationID(any(), eq(root))).thenThrow(new KettleException());
DataServiceMeta dataServiceMeta = transientResolver.getDataService(transientId);
assertNotNull(dataServiceMeta);
assertThat(dataServiceMeta.getStepname(), is("data_service"));
assertFalse(dataServiceMeta.isUserDefined());
assertThat(dataServiceMeta, hasServiceCacheOptimization());
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class TransientResolverTest method testBuildLocalTransient.
@Test
public void testBuildLocalTransient() throws Exception {
String transientId = TransientResolver.buildTransient("/path/to/file.ktr", "local:OUTPUT");
String[] parts = transientResolver.splitTransient(transientId);
assertEquals(parts.length, 2);
DataServiceMeta dataServiceMeta = transientResolver.getDataService(transientId);
assertEquals(dataServiceMeta.getStepname(), "OUTPUT");
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceMetaStoreUtilTest method createDataService.
@Override
protected DataServiceMeta createDataService(String dataServiceName, TransMeta transMeta) {
DataServiceMeta dataService = super.createDataService(dataServiceName, transMeta);
PushDownOptimizationMeta optimization = new PushDownOptimizationMeta();
optimization.setName(OPTIMIZATION);
optimization.setStepName(OPTIMIZED_STEP);
TestOptimization optimizationType = new TestOptimization();
optimizationType.setValue(OPTIMIZATION_VALUE);
optimization.setType(optimizationType);
dataService.setPushDownOptimizationMeta(Lists.newArrayList(optimization));
return dataService;
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapStepChooserDialogControllerTest method testRemap.
@Test
public void testRemap() throws Exception {
DataServiceRemapStepChooserModel model = mock(DataServiceRemapStepChooserModel.class);
DataServiceMeta dataService = mock(DataServiceMeta.class);
List<String> stepNames = Arrays.asList("step1", "step2");
DataServiceDelegate delegate = mock(DataServiceDelegate.class);
SwtDialog dialog = mock(SwtDialog.class);
when(model.getServiceStep()).thenReturn("step2");
doNothing().doThrow(Exception.class).when(delegate).save(any(DataServiceMeta.class));
DataServiceRemapStepChooserDialogController controller = spy(new DataServiceRemapStepChooserDialogController(model, dataService, stepNames, delegate));
doReturn(dialog).when(controller).getDialog();
controller.remap();
verify(dataService).setStepname("step2");
verify(delegate).save(same(dataService));
Assert.assertEquals(DataServiceRemapStepChooserDialog.Action.REMAP, controller.getAction());
controller.remap();
verify(delegate).showError(anyString(), anyString());
Assert.assertEquals(DataServiceRemapStepChooserDialog.Action.CANCEL, controller.getAction());
}
Aggregations