use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceModelTest method testGetDataServiceServiceLimits.
@Test
public void testGetDataServiceServiceLimits() {
int MAX_SERVICE_ROWS = 100;
long MAX_SERVICE_TIME = 200;
model.setServiceName("service");
model.setServiceStep("step");
model.setServiceMaxRows(MAX_SERVICE_ROWS);
model.setServiceMaxTime(MAX_SERVICE_TIME);
DataServiceMeta dataService = model.getDataService();
assertThat(dataService.getRowLimit(), equalTo(MAX_SERVICE_ROWS));
assertThat(dataService.getTimeLimit(), equalTo(MAX_SERVICE_TIME));
model.setServiceMaxRows(0);
model.setServiceMaxTime(0);
dataService = model.getDataService();
assertThat(dataService.getRowLimit(), equalTo(0));
assertThat(dataService.getTimeLimit(), equalTo(0L));
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class TransImportExtensionPointPluginTest method callExtensionPoint.
@Test
public void callExtensionPoint() throws Exception {
DataServiceReferenceSynchronizer referenceSynchronizer = mock(DataServiceReferenceSynchronizer.class);
TransMeta transMeta = mock(TransMeta.class);
Repository transRepository = mock(Repository.class);
IMetaStore transMetaStore = mock(IMetaStore.class);
when(transRepository.getMetaStore()).thenReturn(transMetaStore);
when(transMeta.getRepository()).thenReturn(transRepository);
when(transMeta.getMetaStore()).thenReturn(transMetaStore);
TransImportExtensionPointPlugin plugin = new TransImportExtensionPointPlugin(referenceSynchronizer);
LogChannelInterface log = mock(LogChannelInterface.class);
plugin.callExtensionPoint(log, null);
verify(referenceSynchronizer, times(0)).sync(same(transMeta), any(Function.class), eq(true));
plugin.callExtensionPoint(log, "Not TransMeta");
verify(referenceSynchronizer, times(0)).sync(same(transMeta), any(Function.class), eq(true));
plugin.callExtensionPoint(log, transMeta);
ArgumentCaptor<Function> exceptionHandlerCaptor = ArgumentCaptor.forClass(Function.class);
verify(referenceSynchronizer).sync(same(transMeta), exceptionHandlerCaptor.capture(), eq(true));
Exception e = new Exception();
exceptionHandlerCaptor.getValue().apply(e);
verify(log).logError(anyString(), same(e));
DataServiceMeta dsMeta = mock(DataServiceMeta.class);
DataServiceAlreadyExistsException dsaee = new DataServiceAlreadyExistsException(dsMeta);
exceptionHandlerCaptor.getValue().apply(dsaee);
verify(log).logBasic(anyString());
}
Aggregations