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());
}
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);
}
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"));
}
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"));
}
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\"}]}");
}
Aggregations