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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations