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 testEquals.
@Test
public void testEquals() {
assertTrue(record.equals(record));
assertFalse(record.equals(new Object()));
ComponentDerivationRecord record2 = new ComponentDerivationRecord("myRecord");
assertTrue(record.equals(record2));
ComponentDerivationRecord record3 = new ComponentDerivationRecord("originalRecord", "myRecord");
assertFalse(record.equals(record3));
record2.setChangeType(ChangeType.DATA);
assertFalse(record.equals(record2));
record2 = new ComponentDerivationRecord("myRecord");
record2.setChangedEntityName("Some other name");
assertFalse(record.equals(record2));
record2 = new ComponentDerivationRecord("myRecord");
record.addOperation(new Operation("testOperation", "testOperand"));
assertFalse(record.equals(record2));
}
use of org.pentaho.metaverse.api.model.Operation 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.Operation 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\"}]}");
}
use of org.pentaho.metaverse.api.model.Operation 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"));
}
Aggregations