Search in sources :

Example 21 with Operations

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

the class MetaverseUtilTest method testConvertOperationsStringToMap.

@Test
public void testConvertOperationsStringToMap() {
    // Test null string
    assertNull(MetaverseUtil.convertOperationsStringToMap(null));
    assertNull(MetaverseUtil.convertOperationsStringToMap(""));
    assertNull(MetaverseUtil.convertOperationsStringToMap("{"));
    assertNotNull(MetaverseUtil.convertOperationsStringToMap("{}"));
    Operations ops = MetaverseUtil.convertOperationsStringToMap("{\"metadataOperations\":[{\"category\":\"changeMetadata\",\"class\":" + "\"Operation\",\"description\":\"name\"," + "\"name\":\"modified\",\"type\":\"METADATA\"}]}");
    assertNotNull(ops);
    assertNull(ops.get(ChangeType.DATA));
    List<IOperation> metadataOps = ops.get(ChangeType.METADATA);
    assertNotNull(metadataOps);
    assertEquals(1, metadataOps.size());
    IOperation op = metadataOps.get(0);
    assertEquals(Operation.METADATA_CATEGORY, op.getCategory());
    assertEquals(DictionaryConst.PROPERTY_MODIFIED, op.getName());
    assertEquals("name", op.getDescription());
}
Also used : IOperation(org.pentaho.metaverse.api.model.IOperation) Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 22 with Operations

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

the class StepFieldOperationsTest method testGetSetOperations.

@Test
public void testGetSetOperations() throws Exception {
    stepFieldOperations = new StepFieldOperations("testStep", "testField", null);
    assertNull(stepFieldOperations.getOperations());
    Operations operations = new Operations();
    stepFieldOperations.setOperations(operations);
    assertEquals(operations, stepFieldOperations.getOperations());
}
Also used : Operations(org.pentaho.metaverse.api.model.Operations) Test(org.junit.Test)

Example 23 with Operations

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

the class ComponentDerivationRecordTest method testHasDelta.

@Test
public void testHasDelta() throws Exception {
    Operations operations = record.getOperations();
    assertNotNull(operations);
    assertTrue(operations.isEmpty());
    assertFalse("This record should not say it has been changed!", record.hasDelta());
    record.addOperation(new Operation("testOperation", "testOperand"));
    assertTrue("This record should say it has been changed!", record.hasDelta());
}
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 24 with Operations

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

the class ComponentDerivationRecordTest method testPutOperationNullOperands.

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

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