Search in sources :

Example 96 with Variables

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;
}
Also used : Variables(org.pentaho.di.core.variables.Variables) InputStream(java.io.InputStream) TransMeta(org.pentaho.di.trans.TransMeta) TableOutputMeta(org.pentaho.di.trans.steps.tableoutput.TableOutputMeta) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 97 with Variables

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;
}
Also used : Variables(org.pentaho.di.core.variables.Variables) InputStream(java.io.InputStream) TransMeta(org.pentaho.di.trans.TransMeta) TableOutputMeta(org.pentaho.di.trans.steps.tableoutput.TableOutputMeta) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 98 with Variables

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]);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) RowMeta(org.pentaho.di.core.row.RowMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 99 with Variables

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());
    }
}
Also used : Variables(org.pentaho.di.core.variables.Variables) S3ServiceException(org.jets3t.service.S3ServiceException) S3Service(org.jets3t.service.S3Service) Test(org.junit.Test)

Example 100 with Variables

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());
    }
}
Also used : Variables(org.pentaho.di.core.variables.Variables) S3ServiceException(org.jets3t.service.S3ServiceException) S3Service(org.jets3t.service.S3Service) Test(org.junit.Test)

Aggregations

Variables (org.pentaho.di.core.variables.Variables)119 Test (org.junit.Test)67 TransMeta (org.pentaho.di.trans.TransMeta)31 ArrayList (java.util.ArrayList)25 CheckResultInterface (org.pentaho.di.core.CheckResultInterface)20 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)20 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)20 StepMeta (org.pentaho.di.trans.step.StepMeta)18 RowMeta (org.pentaho.di.core.row.RowMeta)17 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)16 VariableSpace (org.pentaho.di.core.variables.VariableSpace)14 Repository (org.pentaho.di.repository.Repository)12 TableView (org.pentaho.di.ui.core.widget.TableView)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)9 FormData (org.eclipse.swt.layout.FormData)9 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)9 Label (org.eclipse.swt.widgets.Label)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)7