use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testNoIssues2.
@Test
public void testNoIssues2() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("application", "LoanApplication", "amount", ">").withConditionIntegerColumn("application", "LoanApplication", "amount", "<=").withConditionIntegerColumn("application", "LoanApplication", "lengthYears", "==").withConditionIntegerColumn("application", "LoanApplication", "deposit", "<").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_BOOLEAN).withActionSetField("application", "insuranceCost", DataType.TYPE_NUMERIC_INTEGER).withActionSetField("application", "approvedRate", DataType.TYPE_NUMERIC_INTEGER).withData(new Object[][] { { 1, "description", 131000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 2, "description", 1000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 3, "description", 100001, 130000, 20, 3000, "Job", true, 10, 6 } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertDoesNotContain("ThisRowIsRedundantTo(1)", analyzerProvider.getAnalysisReport());
assertDoesNotContain("ThisRowIsRedundantTo(2)", analyzerProvider.getAnalysisReport());
assertDoesNotContain("ThisRowIsRedundantTo(3)", analyzerProvider.getAnalysisReport());
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRows002.
@Test
public void testRedundantRows002() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withStringColumn("application", "LoanApplication", "amount", ">").withStringColumn("person", "Person", "name", "==").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_STRING).withData(new Object[][] { { 1, "description", "131000", "Toni", "Asset", "true" }, { 2, "description", "131000", "Toni", "Asset", "true" }, { 3, "description", "100001", "Michael", "Job", "true" } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.WARNING, 1, 2);
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class ReceiverTest method testInit.
@Test
public void testInit() throws Exception {
final GuidedDecisionTable52 table1 = analyzerProvider.makeAnalyser().withPersonAgeColumn(">").withPersonApprovedActionSetField().withData(DataBuilderProvider.row(0, true).end()).buildTable();
receiver.received(new Initialize("testUUID", table1, new ModelMetaDataEnhancer(table1).getHeaderMetaData(), analyzerProvider.getFactTypes(), "dd-MMM-yyyy"));
verify(poster).post(issuesArgumentCaptor.capture());
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testLHSConflictsArePickedUpForEachFieldOfAPatternTheFileFromTicket.
@Test
public void testLHSConflictsArePickedUpForEachFieldOfAPatternTheFileFromTicket() throws Exception {
final String xml = loadResource("GUVNOR-3513-second-version.gdst");
final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertResultIsEmpty(analyzerProvider.getAnalysisReport());
}
use of org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithDeletes.
@Test
public void testFileLargeFileGDSTWithDeletes() throws Exception, UpdateException {
final String xml = loadResource("Large file.gdst");
final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
long baseline = System.currentTimeMillis();
for (int iterations = 0; iterations < 10; iterations++) {
analyzer.removeRule(100);
table52.getData().remove(100);
List<Coordinate> canBeUpdated = new ArrayList<>();
canBeUpdated.add(new Coordinate(0, 0));
analyzerProvider.getUpdateManager(table52, analyzer).update(table52, canBeUpdated);
long now = System.currentTimeMillis();
System.out.println("Partial analysis took.. " + (now - baseline) + " ms");
baseline = now;
assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
}
}
Aggregations