Search in sources :

Example 11 with StepField

use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.

the class CalculatorStepAnalyzerTest method testGetUsedFields.

@Test
public void testGetUsedFields() throws Exception {
    StepNodes inputNodes = new StepNodes();
    inputNodes.addNode("input", "height", node);
    inputNodes.addNode("input", "width", node);
    inputNodes.addNode("input", "radius", node);
    inputNodes.addNode("input", "pi", node);
    inputNodes.addNode("input", "two", node);
    inputNodes.addNode("input", "NOT USED", node);
    when(analyzer.getInputs()).thenReturn(inputNodes);
    Set<StepField> usedFields = analyzer.getUsedFields(calculatorMeta);
    assertEquals(5, usedFields.size());
}
Also used : StepField(org.pentaho.metaverse.api.StepField) StepNodes(org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes) Test(org.junit.Test)

Example 12 with StepField

use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.

the class ExcelInputStepAnalyzerTest method testGetUsedFields_fileNameFromField.

@Test
public void testGetUsedFields_fileNameFromField() throws Exception {
    when(meta.isAcceptingFilenames()).thenReturn(true);
    when(meta.getAcceptingField()).thenReturn("filename");
    when(meta.getAcceptingStepName()).thenReturn("previousStep");
    Set<StepField> usedFields = analyzer.getUsedFields(meta);
    assertNotNull(usedFields);
    assertEquals(1, usedFields.size());
    StepField used = usedFields.iterator().next();
    assertEquals("previousStep", used.getStepName());
    assertEquals("filename", used.getFieldName());
}
Also used : StepField(org.pentaho.metaverse.api.StepField) Test(org.junit.Test)

Example 13 with StepField

use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.

the class MergeJoinStepAnalyzerTest method testIsPassthrough_leftSideField.

@Test
public void testIsPassthrough_leftSideField() throws Exception {
    StepField passthroughField = new StepField("leftStep", "value");
    assertTrue(analyzer.isPassthrough(passthroughField));
}
Also used : StepField(org.pentaho.metaverse.api.StepField) Test(org.junit.Test)

Example 14 with StepField

use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.

the class MergeJoinStepAnalyzerTest method testIsPassthrough_rightSideField.

@Test
public void testIsPassthrough_rightSideField() throws Exception {
    StepField passthroughField = new StepField("rightStep", "ST");
    assertTrue(analyzer.isPassthrough(passthroughField));
}
Also used : StepField(org.pentaho.metaverse.api.StepField) Test(org.junit.Test)

Example 15 with StepField

use of org.pentaho.metaverse.api.StepField in project pentaho-metaverse by pentaho.

the class MergeJoinStepAnalyzerTest method testIsPassthrough_rightSideFieldRenamed.

@Test
public void testIsPassthrough_rightSideFieldRenamed() throws Exception {
    // the right side value field gets renamed to value_1, so this one is not a passthrough
    StepField passthroughField = new StepField("rightStep", "value");
    assertFalse(analyzer.isPassthrough(passthroughField));
}
Also used : StepField(org.pentaho.metaverse.api.StepField) Test(org.junit.Test)

Aggregations

StepField (org.pentaho.metaverse.api.StepField)53 Test (org.junit.Test)33 HashSet (java.util.HashSet)23 StepNodes (org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes)11 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)10 ComponentDerivationRecord (org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord)10 Matchers.anyString (org.mockito.Matchers.anyString)6 Before (org.junit.Before)4 SelectMetadataChange (org.pentaho.di.trans.steps.selectvalues.SelectMetadataChange)4 Set (java.util.Set)3 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)3 MetaverseObjectFactory (org.pentaho.metaverse.api.MetaverseObjectFactory)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 IAnalysisContext (org.pentaho.metaverse.api.IAnalysisContext)2 IExternalResourceInfo (org.pentaho.metaverse.api.model.IExternalResourceInfo)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Graph (com.tinkerpop.blueprints.Graph)1 Vertex (com.tinkerpop.blueprints.Vertex)1