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