use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class JobGenerator method generateDateTransformation.
private TransMeta generateDateTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate date dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta != null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class JobGenerator method generateTimeTransformation.
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta != null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class SalesforceUpsertMetaTest method testGetFields.
@Test
public void testGetFields() throws KettleStepException {
SalesforceUpsertMeta meta = new SalesforceUpsertMeta();
meta.setDefault();
RowMetaInterface r = new RowMeta();
meta.getFields(r, "thisStep", null, null, new Variables(), null, null);
assertEquals(1, r.size());
assertEquals("Id", r.getFieldNames()[0]);
meta.setSalesforceIDFieldName("id_field");
r.clear();
meta.getFields(r, "thisStep", null, null, new Variables(), null, null);
assertEquals(1, r.size());
assertEquals("id_field", r.getFieldNames()[0]);
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class S3CsvInputMetaTest method testGetS3Service_notEncryptedKeys.
@Test
public void testGetS3Service_notEncryptedKeys() {
S3CsvInputMeta s3CvsInput = new S3CsvInputMeta();
s3CvsInput.setAwsAccessKey(TEST_ACCESS_KEY);
s3CvsInput.setAwsSecretKey(TEST_AWS_SECRET_KEY);
try {
S3Service s3Service = s3CvsInput.getS3Service(new Variables());
assertNotNull(s3Service);
assertEquals(TEST_ACCESS_KEY, s3Service.getProviderCredentials().getAccessKey());
assertEquals(TEST_AWS_SECRET_KEY, s3Service.getProviderCredentials().getSecretKey());
} catch (S3ServiceException e) {
fail("No exception should be thrown. But it was:" + e.getLocalizedMessage());
}
}
use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.
the class S3CsvInputMetaTest method testGetS3Service_WithEncryptedKeys.
@Test
public void testGetS3Service_WithEncryptedKeys() {
S3CsvInputMeta s3CvsInput = new S3CsvInputMeta();
s3CvsInput.setAwsAccessKey(TEST_ACCESS_KEY_ENCRYPTED);
s3CvsInput.setAwsSecretKey(TEST_AWS_SECRET_KEY_ENCRYPTED);
try {
S3Service s3Service = s3CvsInput.getS3Service(new Variables());
assertNotNull(s3Service);
assertEquals(TEST_ACCESS_KEY, s3Service.getProviderCredentials().getAccessKey());
assertEquals(TEST_AWS_SECRET_KEY, s3Service.getProviderCredentials().getSecretKey());
} catch (S3ServiceException e) {
fail("No exception should be thrown. But it was:" + e.getLocalizedMessage());
}
}
Aggregations