use of org.pentaho.metaverse.api.model.IOperation 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.IOperation 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"));
}
use of org.pentaho.metaverse.api.model.IOperation 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);
}
use of org.pentaho.metaverse.api.model.IOperation in project pentaho-metaverse by pentaho.
the class NumberRangeStepAnalyzerTest method testGetChangeRecords.
@Test
public void testGetChangeRecords() throws Exception {
Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords(meta);
assertEquals(1, changeRecords.size());
ComponentDerivationRecord changeRecord = changeRecords.iterator().next();
assertEquals("inField", changeRecord.getOriginalEntityName());
assertEquals("outField", changeRecord.getChangedEntityName());
Operations operations = changeRecord.getOperations();
// Only data operations
assertEquals(1, operations.size());
List<IOperation> dataOperations = operations.get(ChangeType.DATA);
assertEquals(2, dataOperations.size());
}
use of org.pentaho.metaverse.api.model.IOperation 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());
}
Aggregations