Search in sources :

Example 11 with Operations

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

the class StepFieldOperationsTest method testToString.

@Test
public void testToString() {
    stepFieldOperations = new StepFieldOperations("testStep", "testField", null);
    assertEquals("{ step:testStep, field:testField, operations: { none } }", stepFieldOperations.toString());
    Operations operations = new Operations();
    operations.addOperation(ChangeType.METADATA, Operation.getRenameOperation());
    operations.addOperation(ChangeType.DATA, new Operation(Operation.CALC_CATEGORY, ChangeType.DATA, "dataOp", "calcStuff"));
    stepFieldOperations.setOperations(operations);
    assertEquals("{ step:testStep, field:testField, operations: " + "{metadataOperations=[modified: name], dataOperations=[dataOp: calcStuff]} }", stepFieldOperations.toString());
}
Also used : Operation(org.pentaho.metaverse.api.model.Operation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 12 with Operations

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

the class ComponentDerivationRecordTest method testAddOperandNullOperand.

@Test
public void testAddOperandNullOperand() throws Exception {
    Operations operations = record.getOperations();
    assertNotNull(operations);
    assertTrue(operations.isEmpty());
    record.addOperation(new Operation("testOperation", null));
    List<IOperation> checkOperands = record.getOperations().get("testOperation");
    assertNull(checkOperands);
}
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 13 with Operations

use of org.pentaho.metaverse.api.model.Operations 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 14 with Operations

use of org.pentaho.metaverse.api.model.Operations 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 15 with Operations

use of org.pentaho.metaverse.api.model.Operations 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)

Aggregations

Operations (org.pentaho.metaverse.api.model.Operations)24 Test (org.junit.Test)22 IOperation (org.pentaho.metaverse.api.model.IOperation)19 Operation (org.pentaho.metaverse.api.model.Operation)11 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)6 List (java.util.List)3 ComponentDerivationRecord (org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord)3 TransformationStepNode (org.pentaho.metaverse.frames.TransformationStepNode)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ValueMapperMeta (org.pentaho.di.trans.steps.valuemapper.ValueMapperMeta)2 MetaverseException (org.pentaho.metaverse.api.MetaverseException)2 StepFieldOperations (org.pentaho.metaverse.api.StepFieldOperations)2 FieldNode (org.pentaho.metaverse.frames.FieldNode)2 Graph (com.tinkerpop.blueprints.Graph)1 Vertex (com.tinkerpop.blueprints.Vertex)1 GremlinPipeline (com.tinkerpop.gremlin.java.GremlinPipeline)1 JSONDeserializer (flexjson.JSONDeserializer)1 HashMap (java.util.HashMap)1