use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testMapChange.
@Test
public void testMapChange() throws Exception {
doReturn(outputs).when(analyzer).getOutputs();
doReturn(inputs).when(analyzer).getInputs();
Operation operation = new Operation("testOperation", "testOperation");
StepField original = new StepField("previousStep", "address");
StepField changed = new StepField("nextStep", "address");
ComponentDerivationRecord cdr = new ComponentDerivationRecord(original, changed);
cdr.addOperation(operation);
ComponentDerivationRecord spyCdr = spy(cdr);
analyzer.mapChange(spyCdr);
// get operations to verify it is not null, then agains to toString it
verify(spyCdr, times(1)).getOperations();
verify(analyzer).linkChangeNodes(any(IMetaverseNode.class), any(IMetaverseNode.class));
}
use of org.pentaho.metaverse.api.model.Operation 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.Operation in project pentaho-metaverse by pentaho.
the class ComponentDerivationRecordTest method testGetOperations.
@Test
public void testGetOperations() throws Exception {
Operations operations = record.getOperations();
assertNotNull(operations);
assertTrue(operations.isEmpty());
String operands = "testOperand1, testOperand2";
record.addOperation(new Operation("testOperation", operands));
assertNull(record.getOperations(ChangeType.DATA));
assertNotNull(record.getOperations(ChangeType.METADATA));
}
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"));
}
use of org.pentaho.metaverse.api.model.Operation in project pentaho-metaverse by pentaho.
the class ComponentDerivationRecordTest method testPutOperationNullOperation.
@Test
public void testPutOperationNullOperation() throws Exception {
Operations operations = record.getOperations();
assertNotNull(operations);
assertTrue(operations.isEmpty());
record.addOperation(null);
String operands = "testOperand1, testOperand2";
record.addOperation(new Operation(null, operands));
operations = record.getOperations();
assertNotNull(operations);
List<IOperation> checkOperands = operations.get("testOperation");
assertNull(checkOperands);
}
Aggregations