Search in sources :

Example 86 with StringObjectId

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);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) KettleDatabaseRepositoryJobDelegate(org.pentaho.di.repository.kdr.delegates.KettleDatabaseRepositoryJobDelegate) RowMeta(org.pentaho.di.core.row.RowMeta) RepositoryObject(org.pentaho.di.repository.RepositoryObject) StringObjectId(org.pentaho.di.repository.StringObjectId) Test(org.junit.Test)

Example 87 with StringObjectId

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);
}
Also used : MemoryRepository(org.pentaho.di.trans.steps.loadsave.MemoryRepository) StringObjectId(org.pentaho.di.repository.StringObjectId) Before(org.junit.Before)

Example 88 with StringObjectId

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);
}
Also used : Repository(org.pentaho.di.repository.Repository) Node(org.w3c.dom.Node) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore) StringObjectId(org.pentaho.di.repository.StringObjectId) Test(org.junit.Test)

Example 89 with StringObjectId

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));
}
Also used : IRepositoryFileData(org.pentaho.platform.api.repository2.unified.IRepositoryFileData) Serializable(java.io.Serializable) RepositoryDirectory(org.pentaho.di.repository.RepositoryDirectory) StringObjectId(org.pentaho.di.repository.StringObjectId) ObjectId(org.pentaho.di.repository.ObjectId) Calendar(java.util.Calendar) TransMeta(org.pentaho.di.trans.TransMeta) Matchers.anyString(org.mockito.Matchers.anyString) StringObjectId(org.pentaho.di.repository.StringObjectId) RepositoryElementInterface(org.pentaho.di.repository.RepositoryElementInterface) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) ExtensionPointInterface(org.pentaho.di.core.extension.ExtensionPointInterface) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) Test(org.junit.Test)

Example 90 with StringObjectId

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

Aggregations

StringObjectId (org.pentaho.di.repository.StringObjectId)123 KettleException (org.pentaho.di.core.exception.KettleException)49 ObjectId (org.pentaho.di.repository.ObjectId)38 Test (org.junit.Test)34 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)25 KettleFileException (org.pentaho.di.core.exception.KettleFileException)21 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)18 MetaStoreNamespaceExistsException (org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException)18 ArrayList (java.util.ArrayList)16 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)15 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)14 RepositoryObject (org.pentaho.di.repository.RepositoryObject)14 TransMeta (org.pentaho.di.trans.TransMeta)14 IdNotFoundException (org.pentaho.di.core.exception.IdNotFoundException)13 KettleSecurityException (org.pentaho.di.core.exception.KettleSecurityException)13 UnifiedRepositoryCreateFileException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryCreateFileException)13 UnifiedRepositoryUpdateFileException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryUpdateFileException)13 Repository (org.pentaho.di.repository.Repository)11 IOException (java.io.IOException)10 FileObject (org.apache.commons.vfs2.FileObject)10