Search in sources :

Example 6 with QualityControlRule

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);
}
Also used : QualityControlRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule) MissingTypeRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.MissingTypeRule) QualityCategory(au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent.QualityCategory) IdentifierInconsistentWithTypeRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.IdentifierInconsistentWithTypeRule) UnknownTypeRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.UnknownTypeRule) Test(org.testng.annotations.Test)

Example 7 with QualityControlRule

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);
}
Also used : QualityControlRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule) QualityControlEvent(au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent) ArrayList(java.util.ArrayList) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) Test(org.testng.annotations.Test)

Example 8 with QualityControlRule

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);
}
Also used : QualityControlRule(au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule) QualityControlEvent(au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent) ArrayList(java.util.ArrayList) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) WritableGraph(au.gov.asd.tac.constellation.graph.WritableGraph) Test(org.testng.annotations.Test)

Aggregations

QualityControlRule (au.gov.asd.tac.constellation.views.qualitycontrol.rules.QualityControlRule)8 ArrayList (java.util.ArrayList)5 QualityControlEvent (au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent)4 Test (org.testng.annotations.Test)4 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)3 DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)3 QualityCategory (au.gov.asd.tac.constellation.views.qualitycontrol.QualityControlEvent.QualityCategory)2 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)1 Schema (au.gov.asd.tac.constellation.graph.schema.Schema)1 SchemaVertexType (au.gov.asd.tac.constellation.graph.schema.type.SchemaVertexType)1 IdentifierInconsistentWithTypeRule (au.gov.asd.tac.constellation.views.qualitycontrol.rules.IdentifierInconsistentWithTypeRule)1 MissingTypeRule (au.gov.asd.tac.constellation.views.qualitycontrol.rules.MissingTypeRule)1 UnknownTypeRule (au.gov.asd.tac.constellation.views.qualitycontrol.rules.UnknownTypeRule)1 Insets (javafx.geometry.Insets)1 Alert (javafx.scene.control.Alert)1 Button (javafx.scene.control.Button)1 Label (javafx.scene.control.Label)1 RadioButton (javafx.scene.control.RadioButton)1 ScrollPane (javafx.scene.control.ScrollPane)1 ToggleGroup (javafx.scene.control.ToggleGroup)1