use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository_GetObjectInformation_Test method getObjectInformation_AbsentJob_IsDeletedFlagSet.
@Test
public void getObjectInformation_AbsentJob_IsDeletedFlagSet() throws Exception {
KettleDatabaseRepositoryJobDelegate jobDelegate = spy(new KettleDatabaseRepositoryJobDelegate(repository));
RowMeta meta = createMetaForJob();
doReturn(new RowMetaAndData(meta, new Object[meta.size()])).when(jobDelegate).getJob(new StringObjectId(ABSENT_ID));
assertIsDeletedSet_ForAbsentObject(null, jobDelegate, RepositoryObjectType.JOB);
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class RowGeneratorMetaTest method setUp.
@Before
public void setUp() throws KettleException {
rep = new MemoryRepository();
id_step = new StringObjectId("aStringObjectID");
rep.saveStepAttribute(new StringObjectId("transId"), id_step, rowGeneratorRowLimitCode, launchVariable);
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class WebServiceMetaTest method testSaveRep.
@Test
public void testSaveRep() throws Exception {
Node node = getTestNode();
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
IMetaStore metastore = mock(IMetaStore.class);
Repository rep = mock(Repository.class);
WebServiceMeta webServiceMeta = new WebServiceMeta();
webServiceMeta.loadXML(node, Collections.singletonList(dbMeta), metastore);
StringObjectId aTransId = new StringObjectId("aTransId");
StringObjectId aStepId = new StringObjectId("aStepId");
webServiceMeta.saveRep(rep, metastore, aTransId, aStepId);
verify(rep).saveStepAttribute(aTransId, aStepId, "wsUrl", "http://webservices.gama-system.com/exchangerates.asmx?WSDL");
verify(rep).saveStepAttribute(aTransId, aStepId, "wsOperation", "GetCurrentExchangeRate");
verify(rep).saveStepAttribute(aTransId, aStepId, "wsOperationRequest", "opRequestName");
verify(rep).saveStepAttribute(aTransId, aStepId, "wsOperationNamespace", "http://www.gama-system.com/webservices");
verify(rep).saveStepAttribute(aTransId, aStepId, "wsInFieldContainer", null);
verify(rep).saveStepAttribute(aTransId, aStepId, "wsInFieldArgument", null);
verify(rep).saveStepAttribute(aTransId, aStepId, "wsOutFieldContainer", "GetCurrentExchangeRateResult");
verify(rep).saveStepAttribute(aTransId, aStepId, "wsOutFieldArgument", "GetCurrentExchangeRateResult");
verify(rep).saveStepAttribute(aTransId, aStepId, "proxyHost", "aProxy");
verify(rep).saveStepAttribute(aTransId, aStepId, "proxyPort", "4444");
verify(rep).saveStepAttribute(aTransId, aStepId, "httpLogin", "httpUser");
verify(rep).saveStepAttribute(aTransId, aStepId, "httpPassword", "tryandguess");
verify(rep).saveStepAttribute(aTransId, aStepId, "callStep", 1);
verify(rep).saveStepAttribute(aTransId, aStepId, "passingInputData", false);
verify(rep).saveStepAttribute(aTransId, aStepId, "compatible", true);
verify(rep).saveStepAttribute(aTransId, aStepId, "repeating_element", null);
verify(rep).saveStepAttribute(aTransId, aStepId, "reply_as_string", false);
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldIn_name", "Bank");
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldIn_ws_name", "strBank");
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldIn_xsd_type", "string");
verify(rep).saveStepAttribute(aTransId, aStepId, 1, "fieldIn_name", "ToCurrency");
verify(rep).saveStepAttribute(aTransId, aStepId, 1, "fieldIn_ws_name", "strCurrency");
verify(rep).saveStepAttribute(aTransId, aStepId, 1, "fieldIn_xsd_type", "string");
verify(rep).saveStepAttribute(aTransId, aStepId, 2, "fieldIn_name", "Rank");
verify(rep).saveStepAttribute(aTransId, aStepId, 2, "fieldIn_ws_name", "intRank");
verify(rep).saveStepAttribute(aTransId, aStepId, 2, "fieldIn_xsd_type", "int");
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldOut_name", "GetCurrentExchangeRateResult");
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldOut_ws_name", "GetCurrentExchangeRateResult");
verify(rep).saveStepAttribute(aTransId, aStepId, 0, "fieldOut_xsd_type", "decimal");
Mockito.verifyNoMoreInteractions(rep);
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class PurRepositoryUnitTest method testTransRepoAfterSaveExtensionPoint.
@Test
public void testTransRepoAfterSaveExtensionPoint() throws KettleException {
PluginMockInterface pluginInterface = mock(PluginMockInterface.class);
when(pluginInterface.getName()).thenReturn(KettleExtensionPoint.TransImportAfterSaveToRepo.id);
when(pluginInterface.getMainType()).thenReturn((Class) ExtensionPointInterface.class);
when(pluginInterface.getIds()).thenReturn(new String[] { "extensionpointId" });
ExtensionPointInterface extensionPoint = mock(ExtensionPointInterface.class);
when(pluginInterface.loadClass(ExtensionPointInterface.class)).thenReturn(extensionPoint);
PluginRegistry.addPluginType(ExtensionPointPluginType.getInstance());
PluginRegistry.getInstance().registerPlugin(ExtensionPointPluginType.class, pluginInterface);
PurRepository rep = mock(PurRepository.class);
doCallRealMethod().when(rep).saveTransOrJob(any(ISharedObjectsTransformer.class), any(RepositoryElementInterface.class), anyString(), any(Calendar.class), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
IUnifiedRepository pur = mock(IUnifiedRepository.class);
doCallRealMethod().when(rep).setTest(same(pur));
PurRepositoryMeta mockMeta = mock(PurRepositoryMeta.class);
doCallRealMethod().when(rep).init(same(mockMeta));
rep.init(mockMeta);
rep.setTest(pur);
RepositoryFile file = mock(RepositoryFile.class);
when(file.getId()).thenReturn("id");
when(pur.createFile(any(Serializable.class), any(RepositoryFile.class), any(IRepositoryFileData.class), anyString())).thenReturn(file);
TransMeta trans = mock(TransMeta.class);
when(trans.getRepositoryElementType()).thenReturn(RepositoryObjectType.TRANSFORMATION);
when(trans.getName()).thenReturn("trans");
RepositoryDirectory dir = mock(RepositoryDirectory.class);
when(dir.getObjectId()).thenReturn(new StringObjectId("id"));
when(trans.getRepositoryDirectory()).thenReturn(dir);
TransMeta transFromRepo = mock(TransMeta.class);
when(rep.loadTransformation(any(ObjectId.class), isNull(String.class))).thenReturn(transFromRepo);
ISharedObjectsTransformer transformer = mock(ISharedObjectsTransformer.class);
rep.saveTransOrJob(transformer, trans, "", Calendar.getInstance(), false, false, false, false, false);
verify(extensionPoint, times(1)).callExtensionPoint(any(LogChannelInterface.class), same(transFromRepo));
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class ConnectionsControllerTest method createConnection_NameExists.
@Test
public void createConnection_NameExists() throws Exception {
final String dbName = "name";
when(databaseDialog.open()).thenReturn(dbName);
when(databaseMeta.getDatabaseName()).thenReturn(dbName);
when(repository.getDatabaseID(dbName)).thenReturn(new StringObjectId("existing"));
controller.createConnection();
assertShowedAlreadyExistsMessage();
}
Aggregations