Search in sources :

Example 16 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DTableUpdateManagerTest method testFillNullAction.

@Test
public void testFillNullAction() throws Exception, UpdateException {
    ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
    Coordinate coordinate = new Coordinate(1, 3);
    coordinates.add(coordinate);
    table52.getData().get(1).get(3).setBooleanValue(false);
    updateManager.update(table52, coordinates);
    verify(analyzer).update(anySet());
}
Also used : Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 17 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DTableUpdateManagerTest method testSetConditionToNull.

@Test
public void testSetConditionToNull() throws Exception, UpdateException {
    ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
    Coordinate coordinate = new Coordinate(0, 2);
    coordinates.add(coordinate);
    table52.getData().get(0).get(2).setNumericValue((Integer) null);
    updateManager.update(table52, coordinates);
    verify(analyzer).update(anySet());
}
Also used : Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 18 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DTableUpdateManagerTest method testFillNullConditionWithNull.

@Test
public void testFillNullConditionWithNull() throws Exception, UpdateException {
    ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
    Coordinate coordinate = new Coordinate(1, 2);
    coordinates.add(coordinate);
    table52.getData().get(1).get(2).setNumericValue((Integer) null);
    updateManager.update(table52, coordinates);
    verify(analyzer, never()).update(anySet());
}
Also used : Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 19 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testUpdateNotNullColumn.

@Test
public void testUpdateNotNullColumn() throws Exception, UpdateException {
    final String xml = loadResource("Is Null Table.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    // First run
    analyzer.resetChecks();
    analyzer.analyze();
    assertContains(analyzerProvider.getAnalysisReport(), RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, Severity.NOTE);
    // Update
    table52.getData().get(0).get(2).setBooleanValue(true);
    final List<Coordinate> updates = new ArrayList<>();
    updates.add(new Coordinate(0, 2));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates);
    // Update
    table52.getData().get(1).get(2).setBooleanValue(true);
    final List<Coordinate> updates2 = new ArrayList<>();
    updates2.add(new Coordinate(1, 2));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates2);
    assertDoesNotContain(RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, analyzerProvider.getAnalysisReport());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 20 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithUpdate.

@Test
public void testFileLargeFileGDSTWithUpdate() throws Exception, UpdateException {
    long baseline = System.currentTimeMillis();
    final String xml = loadResource("Large file.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    long now = System.currentTimeMillis();
    System.out.println("Loading of model took.. " + (now - baseline) + " ms");
    baseline = now;
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    now = System.currentTimeMillis();
    System.out.println("Indexing took.. " + (now - baseline) + " ms");
    analyzer.resetChecks();
    analyzer.analyze();
    assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
    now = System.currentTimeMillis();
    System.out.println("Initial analysis took.. " + (now - baseline) + " ms");
    baseline = now;
    table52.getData().get(2).get(6).clearValues();
    final List<Coordinate> updates = new ArrayList<>();
    updates.add(new Coordinate(2, 6));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates);
    assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
    now = System.currentTimeMillis();
    System.out.println("Partial analysis took.. " + (now - baseline) + " ms");
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Aggregations

Coordinate (org.drools.workbench.services.verifier.plugin.client.Coordinate)22 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)19 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)3 Analyzer (org.drools.workbench.services.verifier.core.main.Analyzer)3 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Mockito.anySet (org.mockito.Mockito.anySet)1