Search in sources :

Example 16 with ValueMetaBase

use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.

the class JobEntryLogTable method getRecommendedIndexes.

public List<RowMetaInterface> getRecommendedIndexes() {
    List<RowMetaInterface> indexes = new ArrayList<RowMetaInterface>();
    LogTableField keyField = getKeyField();
    if (keyField.isEnabled()) {
        RowMetaInterface batchIndex = new RowMeta();
        ValueMetaInterface keyMeta = new ValueMetaBase(keyField.getFieldName(), keyField.getDataType());
        keyMeta.setLength(keyField.getLength());
        batchIndex.addValueMeta(keyMeta);
        indexes.add(batchIndex);
    }
    return indexes;
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase)

Example 17 with ValueMetaBase

use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.

the class JobLogTable method getRecommendedIndexes.

public List<RowMetaInterface> getRecommendedIndexes() {
    List<RowMetaInterface> indexes = new ArrayList<RowMetaInterface>();
    // 
    if (isBatchIdUsed()) {
        RowMetaInterface batchIndex = new RowMeta();
        LogTableField keyField = getKeyField();
        ValueMetaInterface keyMeta = new ValueMetaBase(keyField.getFieldName(), keyField.getDataType());
        keyMeta.setLength(keyField.getLength());
        batchIndex.addValueMeta(keyMeta);
        indexes.add(batchIndex);
    }
    // The next index includes : ERRORS, STATUS, JOBNAME:
    RowMetaInterface lookupIndex = new RowMeta();
    LogTableField errorsField = findField(ID.ERRORS);
    if (errorsField != null) {
        ValueMetaInterface valueMeta = new ValueMetaBase(errorsField.getFieldName(), errorsField.getDataType());
        valueMeta.setLength(errorsField.getLength());
        lookupIndex.addValueMeta(valueMeta);
    }
    LogTableField statusField = findField(ID.STATUS);
    if (statusField != null) {
        ValueMetaInterface valueMeta = new ValueMetaBase(statusField.getFieldName(), statusField.getDataType());
        valueMeta.setLength(statusField.getLength());
        lookupIndex.addValueMeta(valueMeta);
    }
    LogTableField transNameField = findField(ID.JOBNAME);
    if (transNameField != null) {
        ValueMetaInterface valueMeta = new ValueMetaBase(transNameField.getFieldName(), transNameField.getDataType());
        valueMeta.setLength(transNameField.getLength());
        lookupIndex.addValueMeta(valueMeta);
    }
    indexes.add(lookupIndex);
    return indexes;
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase)

Example 18 with ValueMetaBase

use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.

the class BaseStepTest method emptyFieldName.

@Test(expected = KettleStepException.class)
public void emptyFieldName() throws KettleStepException {
    BaseStep baseStep = new BaseStep(mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans);
    baseStep.setRowHandler(rowHandler);
    RowMetaInterface rowMeta = new RowMeta();
    rowMeta.addValueMeta(new ValueMetaBase("", ValueMetaInterface.TYPE_INTEGER));
    baseStep.putRow(rowMeta, new Object[] { 0 });
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) Test(org.junit.Test)

Example 19 with ValueMetaBase

use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.

the class SalesforceUpdateTest method testWriteToSalesForceForNotNullExtIdField_WithExtIdNO.

@Test
public void testWriteToSalesForceForNotNullExtIdField_WithExtIdNO() throws Exception {
    SalesforceUpdate sfInputStep = new SalesforceUpdate(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
    SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
    SalesforceUpdateData data = generateSalesforceUpdateData();
    sfInputStep.init(meta, data);
    RowMeta rowMeta = new RowMeta();
    ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
    rowMeta.addValueMeta(valueMeta);
    smh.initStepDataInterface.inputRowMeta = rowMeta;
    sfInputStep.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
    assertEquals(0, data.sfBuffer[0].getFieldsToNull().length);
    assertEquals(1, SalesforceConnection.getChildren(data.sfBuffer[0]).length);
    assertEquals(Constants.PARTNER_SOBJECT_NS, SalesforceConnection.getChildren(data.sfBuffer[0])[0].getName().getNamespaceURI());
    assertEquals(ACCOUNT_ID, SalesforceConnection.getChildren(data.sfBuffer[0])[0].getName().getLocalPart());
    assertEquals("001i000001c5Nv9AAE", SalesforceConnection.getChildren(data.sfBuffer[0])[0].getValue());
    assertFalse(SalesforceConnection.getChildren(data.sfBuffer[0])[0].hasChildren());
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) Test(org.junit.Test)

Example 20 with ValueMetaBase

use of org.pentaho.di.core.row.value.ValueMetaBase in project pentaho-kettle by pentaho.

the class SalesforceUpdateTest method testLogMessageInDetailedModeFotWriteToSalesForce.

@Test
public void testLogMessageInDetailedModeFotWriteToSalesForce() throws KettleException {
    SalesforceUpdate sfInputStep = new SalesforceUpdate(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
    SalesforceUpdateMeta meta = generateSalesforceUpdateMeta(new String[] { ACCOUNT_ID }, new Boolean[] { false });
    SalesforceUpdateData data = generateSalesforceUpdateData();
    sfInputStep.init(meta, data);
    when(sfInputStep.getLogChannel().isDetailed()).thenReturn(true);
    RowMeta rowMeta = new RowMeta();
    ValueMetaBase valueMeta = new ValueMetaString("AccNoExtId");
    rowMeta.addValueMeta(valueMeta);
    smh.initStepDataInterface.inputRowMeta = rowMeta;
    verify(sfInputStep.getLogChannel(), never()).logDetailed(anyString());
    sfInputStep.writeToSalesForce(new Object[] { "001i000001c5Nv9AAE" });
    verify(sfInputStep.getLogChannel()).logDetailed("Called writeToSalesForce with 0 out of 2");
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) Test(org.junit.Test)

Aggregations

ValueMetaBase (org.pentaho.di.core.row.value.ValueMetaBase)31 RowMeta (org.pentaho.di.core.row.RowMeta)26 Test (org.junit.Test)25 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)16 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)13 ArrayList (java.util.ArrayList)7 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)7 Matchers.anyString (org.mockito.Matchers.anyString)3 Strings.nullToEmpty (com.google.common.base.Strings.nullToEmpty)2 XmlObject (com.sforce.ws.bind.XmlObject)2 List (java.util.List)2 SWT (org.eclipse.swt.SWT)2 CTabFolder (org.eclipse.swt.custom.CTabFolder)2 CTabItem (org.eclipse.swt.custom.CTabItem)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 Image (org.eclipse.swt.graphics.Image)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 Button (org.eclipse.swt.widgets.Button)2