Search in sources :

Example 6 with Operation

use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.

the class ComponentDerivationRecordTest method testAddOperand.

@Test
public void testAddOperand() throws Exception {
    record.operations = null;
    record.addOperation(new Operation("testOperation", "testOperand"));
    Operations operations = record.getOperations();
    assertNotNull(operations);
    List<IOperation> checkOperations = operations.get(ChangeType.METADATA);
    assertNotNull(checkOperations);
    assertEquals(1, checkOperations.size());
    IOperation checkOperation = checkOperations.get(0);
    assertTrue("testOperand not in operands!", checkOperation.getDescription().contains("testOperand"));
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) IOperation(org.pentaho.metaverse.api.model.IOperation) Operation(org.pentaho.metaverse.api.model.Operation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 7 with Operation

use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.

the class ComponentDerivationRecordTest method testEquals.

@Test
public void testEquals() {
    assertTrue(record.equals(record));
    assertFalse(record.equals(new Object()));
    ComponentDerivationRecord record2 = new ComponentDerivationRecord("myRecord");
    assertTrue(record.equals(record2));
    ComponentDerivationRecord record3 = new ComponentDerivationRecord("originalRecord", "myRecord");
    assertFalse(record.equals(record3));
    record2.setChangeType(ChangeType.DATA);
    assertFalse(record.equals(record2));
    record2 = new ComponentDerivationRecord("myRecord");
    record2.setChangedEntityName("Some other name");
    assertFalse(record.equals(record2));
    record2 = new ComponentDerivationRecord("myRecord");
    record.addOperation(new Operation("testOperation", "testOperand"));
    assertFalse(record.equals(record2));
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) Operation(org.pentaho.metaverse.api.model.Operation) Test(org.junit.Test)

Example 8 with Operation

use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.

the class ComponentDerivationRecordTest method testAddOperationNull.

@Test
public void testAddOperationNull() throws Exception {
    record.operations = null;
    String operands = "testOperand1, testOperand2";
    record.addOperation(new Operation("testOperation", operands));
    Operations operations = record.getOperations();
    assertNotNull(operations);
    List<IOperation> checkOperations = operations.get(ChangeType.METADATA);
    assertNotNull(checkOperations);
    assertEquals(1, checkOperations.size());
    IOperation checkOperation = checkOperations.get(0);
    assertTrue("testOperand1 not in operands!", checkOperation.getDescription().contains("testOperand1"));
    assertTrue("testOperand2 not in operands!", checkOperation.getDescription().contains("testOperand2"));
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) IOperation(org.pentaho.metaverse.api.model.IOperation) Operation(org.pentaho.metaverse.api.model.Operation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 9 with Operation

use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.

the class ComponentDerivationRecordTest method testToString.

@Test
public void testToString() throws Exception {
    Operations operations = record.getOperations();
    assertNotNull(operations);
    assertTrue(operations.isEmpty());
    assertEquals(record.toString(), "{}");
    record.addOperation(new Operation("testOperation", "testOperand"));
    assertEquals(record.toString(), "{\"metadataOperations\":[{\"category\":\"changeMetadata\",\"class\":" + "\"org.pentaho.metaverse.api.model.Operation\",\"description\":" + "\"testOperand\",\"name\":\"testOperation\",\"type\":\"METADATA\"}]}");
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) Operation(org.pentaho.metaverse.api.model.Operation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 10 with Operation

use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.

the class ComponentDerivationRecordTest method testAddOperation.

@Test
public void testAddOperation() throws Exception {
    Operations operations = record.getOperations();
    assertNotNull(operations);
    assertTrue(operations.isEmpty());
    String operands = "testOperand1, testOperand2";
    record.addOperation(new Operation("testOperation", operands));
    operations = record.getOperations();
    assertNotNull(operations);
    List<IOperation> checkOperations = operations.get(ChangeType.METADATA);
    assertNotNull(checkOperations);
    assertEquals(1, checkOperations.size());
    IOperation checkOperation = checkOperations.get(0);
    assertTrue("testOperand1 not in operands!", checkOperation.getDescription().contains("testOperand1"));
    assertTrue("testOperand2 not in operands!", checkOperation.getDescription().contains("testOperand2"));
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) IOperation(org.pentaho.metaverse.api.model.IOperation) Operation(org.pentaho.metaverse.api.model.Operation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Aggregations

Operation (org.pentaho.metaverse.api.model.Operation)22 Test (org.junit.Test)12 ComponentDerivationRecord (org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord)11 IOperation (org.pentaho.metaverse.api.model.IOperation)10 Operations (org.pentaho.metaverse.api.model.Operations)10 HashSet (java.util.HashSet)7 ArrayList (java.util.ArrayList)1 Condition (org.pentaho.di.core.Condition)1 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)1 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)1 NumberRangeRule (org.pentaho.di.trans.steps.numberrange.NumberRangeRule)1 SelectMetadataChange (org.pentaho.di.trans.steps.selectvalues.SelectMetadataChange)1 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)1 StepField (org.pentaho.metaverse.api.StepField)1