use of au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule in project constellation by constellation-app.
the class QualityControlViewPaneNGTest method testGetPriorities.
/**
* Test of getPriorities method, of class QualityControlViewPane.
*/
@Test
public void testGetPriorities() {
System.out.println("getPriorities");
final Map<QualityControlRule, QualityCategory> result = QualityControlViewPane.getPriorities();
assertEquals(result.size(), rules.size());
for (final QualityControlRule rule : result.keySet()) {
rule.clearResults();
}
final IdentifierInconsistentWithTypeRule iiRule = new IdentifierInconsistentWithTypeRule();
final MissingTypeRule mRule = new MissingTypeRule();
final UnknownTypeRule uRule = new UnknownTypeRule();
assertEquals(result.get(iiRule), QualityCategory.MEDIUM);
assertEquals(result.get(mRule), QualityCategory.SEVERE);
assertEquals(result.get(uRule), QualityCategory.MINOR);
}
use of au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule in project constellation by constellation-app.
the class QualityControlStateUpdaterNGTest method testReadNoNodesNoAttributes.
@Test
public void testReadNoNodesNoAttributes() throws Exception {
System.out.println("read No Nodes");
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
WritableGraph wg = graph.getWritableGraph("Add Elements", true);
try {
// Add X,Y,Z vertex attributes
attrX = VisualConcept.VertexAttribute.X.ensure(wg);
attrY = VisualConcept.VertexAttribute.Y.ensure(wg);
attrZ = VisualConcept.VertexAttribute.Z.ensure(wg);
} finally {
wg.commit();
}
// Expected rules and events
final List<QualityControlEvent> expectedQualityControlEvents = new ArrayList<>();
final List<QualityControlRule> expectedRegisteredRules = new ArrayList<>();
final List<QualityControlRule> uExpectedRegisteredRules = Collections.unmodifiableList(expectedRegisteredRules);
// Call update state to trigger checking of rules
PluginExecution.withPlugin(new QualityControlStateUpdater()).executeNow(graph);
// get the state and events
final QualityControlState state = QualityControlAutoVetter.getInstance().getQualityControlState();
final List<QualityControlEvent> qualityControlEvents = state.getQualityControlEvents();
final List<QualityControlRule> registeredRules = state.getRegisteredRules();
// check equality of the events and rules
assertEquals(qualityControlEvents, expectedQualityControlEvents);
assertEquals(registeredRules, uExpectedRegisteredRules);
}
use of au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule in project constellation by constellation-app.
the class QualityControlStateUpdaterNGTest method testReadNoNodes.
@Test
public void testReadNoNodes() throws Exception {
System.out.println("read No Nodes");
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
WritableGraph wg = graph.getWritableGraph("Add Elements", true);
try {
// Add X,Y,Z vertex attributes
attrX = VisualConcept.VertexAttribute.X.ensure(wg);
attrY = VisualConcept.VertexAttribute.Y.ensure(wg);
attrZ = VisualConcept.VertexAttribute.Z.ensure(wg);
// Add vertex and transaction SELECTED attributes
vSelectedAttrId = VisualConcept.VertexAttribute.SELECTED.ensure(wg);
tSelectedAttrId = VisualConcept.TransactionAttribute.SELECTED.ensure(wg);
// Add vertex IDENTIFIER attribute and label each vertice.
vxIdentifierAttrId = VisualConcept.VertexAttribute.IDENTIFIER.ensure(wg);
// Add vertex TYPE attribute and set each type to unknown
typeAttrId = AnalyticConcept.VertexAttribute.TYPE.ensure(wg);
} finally {
wg.commit();
}
// Expected rules and events
final List<QualityControlEvent> expectedQualityControlEvents = new ArrayList<>();
final List<QualityControlRule> expectedRegisteredRules = new ArrayList<>();
final List<QualityControlRule> uExpectedRegisteredRules = Collections.unmodifiableList(expectedRegisteredRules);
// Call update state to trigger checking of rules
PluginExecution.withPlugin(new QualityControlStateUpdater()).executeNow(graph);
// get the state and events
final QualityControlState state = QualityControlAutoVetter.getInstance().getQualityControlState();
final List<QualityControlEvent> qualityControlEvents = state.getQualityControlEvents();
final List<QualityControlRule> registeredRules = state.getRegisteredRules();
// check equality of the events and rules
assertEquals(qualityControlEvents, expectedQualityControlEvents);
assertEquals(registeredRules, uExpectedRegisteredRules);
}
Aggregations