Search in sources :

Example 51 with DataServiceMeta

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));
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) Test(org.junit.Test)

Example 52 with DataServiceMeta

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());
}
Also used : Function(java.util.function.Function) Repository(org.pentaho.di.repository.Repository) DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) TransMeta(org.pentaho.di.trans.TransMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) Test(org.junit.Test)

Aggregations

DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)52 Test (org.junit.Test)29 TransMeta (org.pentaho.di.trans.TransMeta)16 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)9 KettleException (org.pentaho.di.core.exception.KettleException)8 DataServiceContext (org.pentaho.di.trans.dataservice.DataServiceContext)6 DataServiceDelegate (org.pentaho.di.trans.dataservice.ui.DataServiceDelegate)6 StepMeta (org.pentaho.di.trans.step.StepMeta)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 Before (org.junit.Before)4 RowMeta (org.pentaho.di.core.row.RowMeta)4 DataServiceResolver (org.pentaho.di.trans.dataservice.resolvers.DataServiceResolver)4 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)4 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)4 MetastoreLocator (org.pentaho.osgi.metastore.locator.api.MetastoreLocator)4 ModelAnnotationGroup (org.pentaho.agilebi.modeler.models.annotations.ModelAnnotationGroup)3 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)3 File (java.io.File)2 IOException (java.io.IOException)2 URL (java.net.URL)2