Search in sources :

Example 41 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class PurRepositoryAttribute method getAttributeDatabaseMeta.

public DatabaseMeta getAttributeDatabaseMeta(String code) {
    DataProperty property = dataNode.getProperty(code);
    if (property == null || Utils.isEmpty(property.getString())) {
        return null;
    }
    ObjectId id = new StringObjectId(property.getString());
    return DatabaseMeta.findDatabase(databases, id);
}
Also used : ObjectId(org.pentaho.di.repository.ObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) DataProperty(org.pentaho.platform.api.repository2.unified.data.node.DataProperty) StringObjectId(org.pentaho.di.repository.StringObjectId)

Example 42 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class TableOutputMetaTest method testSaveRep.

@Test
public void testSaveRep() throws Exception {
    TableOutputMeta tableOutputMeta = new TableOutputMeta();
    tableOutputMeta.loadXML(getTestNode(), databases, metaStore);
    StringObjectId id_step = new StringObjectId("stepid");
    StringObjectId id_transformation = new StringObjectId("transid");
    Repository rep = mock(Repository.class);
    tableOutputMeta.saveRep(rep, metaStore, id_transformation, id_step);
    verify(rep).saveDatabaseMetaStepAttribute(id_transformation, id_step, "id_connection", null);
    verify(rep).saveStepAttribute(id_transformation, id_step, "schema", "public");
    verify(rep).saveStepAttribute(id_transformation, id_step, "table", "sales_csv");
    verify(rep).saveStepAttribute(id_transformation, id_step, "commit", "1000");
    verify(rep).saveStepAttribute(id_transformation, id_step, "truncate", true);
    verify(rep).saveStepAttribute(id_transformation, id_step, "ignore_errors", false);
    verify(rep).saveStepAttribute(id_transformation, id_step, "use_batch", true);
    verify(rep).saveStepAttribute(id_transformation, id_step, "specify_fields", true);
    verify(rep).saveStepAttribute(id_transformation, id_step, "partitioning_enabled", false);
    verify(rep).saveStepAttribute(id_transformation, id_step, "partitioning_field", null);
    verify(rep).saveStepAttribute(id_transformation, id_step, "partitioning_daily", false);
    verify(rep).saveStepAttribute(id_transformation, id_step, "partitioning_monthly", true);
    verify(rep).saveStepAttribute(id_transformation, id_step, "tablename_in_field", false);
    verify(rep).saveStepAttribute(id_transformation, id_step, "tablename_field", null);
    verify(rep).saveStepAttribute(id_transformation, id_step, "tablename_in_table", true);
    verify(rep).saveStepAttribute(id_transformation, id_step, "return_keys", false);
    verify(rep).saveStepAttribute(id_transformation, id_step, "return_field", null);
    verify(rep).saveStepAttribute(id_transformation, id_step, 0, "column_name", "ORDERNUMBER");
    verify(rep).saveStepAttribute(id_transformation, id_step, 0, "stream_name", "ORDERNUMBER");
    verify(rep).saveStepAttribute(id_transformation, id_step, 1, "column_name", "QUANTITYORDERED");
    verify(rep).saveStepAttribute(id_transformation, id_step, 1, "stream_name", "QUANTITYORDERED");
    verify(rep).saveStepAttribute(id_transformation, id_step, 2, "column_name", "PRICEEACH");
    verify(rep).saveStepAttribute(id_transformation, id_step, 2, "stream_name", "PRICEEACH");
    verifyNoMoreInteractions(rep);
}
Also used : Repository(org.pentaho.di.repository.Repository) MemoryRepository(org.pentaho.di.trans.steps.loadsave.MemoryRepository) StringObjectId(org.pentaho.di.repository.StringObjectId) Test(org.junit.Test)

Example 43 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository_DatabaseNames_Test method getDatabaseId_ExactMatch.

@Test
public void getDatabaseId_ExactMatch() throws Exception {
    final String name = UUID.randomUUID().toString();
    final ObjectId expectedId = new StringObjectId("expected");
    doReturn(expectedId).when(databaseDelegate).getDatabaseID(name);
    ObjectId id = repository.getDatabaseID(name);
    assertEquals(expectedId, id);
}
Also used : ObjectId(org.pentaho.di.repository.ObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) Test(org.junit.Test)

Example 44 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository_GetObjectInformation_Test method getObjectInformation_ExistingTrans_IsDeletedFlagNotSet.

@Test
public void getObjectInformation_ExistingTrans_IsDeletedFlagNotSet() throws Exception {
    KettleDatabaseRepositoryTransDelegate transDelegate = spy(new KettleDatabaseRepositoryTransDelegate(repository));
    RowMeta meta = createMetaForJob();
    Object[] values = new Object[meta.size()];
    values[Arrays.asList(meta.getFieldNames()).indexOf(KettleDatabaseRepositoryBase.FIELD_TRANSFORMATION_NAME)] = EXISTING_ID;
    doReturn(new RowMetaAndData(meta, values)).when(transDelegate).getTransformation(new StringObjectId(EXISTING_ID));
    assertIsDeletedNotSet_ForExistingObject(transDelegate, null, RepositoryObjectType.TRANSFORMATION);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) RowMeta(org.pentaho.di.core.row.RowMeta) RepositoryObject(org.pentaho.di.repository.RepositoryObject) StringObjectId(org.pentaho.di.repository.StringObjectId) KettleDatabaseRepositoryTransDelegate(org.pentaho.di.repository.kdr.delegates.KettleDatabaseRepositoryTransDelegate) Test(org.junit.Test)

Example 45 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository_GetObjectInformation_Test method getObjectInformation_AbsentTrans_IsDeletedFlagSet.

@Test
public void getObjectInformation_AbsentTrans_IsDeletedFlagSet() throws Exception {
    KettleDatabaseRepositoryTransDelegate transDelegate = spy(new KettleDatabaseRepositoryTransDelegate(repository));
    RowMeta meta = createMetaForTrans();
    doReturn(new RowMetaAndData(meta, new Object[meta.size()])).when(transDelegate).getTransformation(new StringObjectId(ABSENT_ID));
    assertIsDeletedSet_ForAbsentObject(transDelegate, null, RepositoryObjectType.TRANSFORMATION);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) RowMeta(org.pentaho.di.core.row.RowMeta) RepositoryObject(org.pentaho.di.repository.RepositoryObject) StringObjectId(org.pentaho.di.repository.StringObjectId) KettleDatabaseRepositoryTransDelegate(org.pentaho.di.repository.kdr.delegates.KettleDatabaseRepositoryTransDelegate) 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