Search in sources :

Example 16 with Issue

use of org.drools.verifier.api.reporting.Issue in project kie-wb-common by kiegroup.

the class AnalysisReportScreenTest method testMerge.

private void testMerge(CheckType type) {
    Issue issue1 = new Issue(Severity.WARNING, type, new HashSet<>(Arrays.asList(1)));
    Issue issue2 = new Issue(Severity.WARNING, type, new HashSet<>(Arrays.asList(2)));
    Issue issue3 = new Issue(Severity.WARNING, type, new HashSet<>(Arrays.asList(3)));
    screen.showReport(getAnalysis(issue1, issue2, issue3));
    assertEquals(1, dataProvider.getList().size());
    Issue issue = (Issue) dataProvider.getList().get(0);
    assertEquals(Severity.WARNING, issue.getSeverity());
    assertEquals(type, issue.getCheckType());
    Iterator<Integer> rowNumbers = issue.getRowNumbers().iterator();
    for (Integer rowNumber : Arrays.asList(1, 2, 3)) {
        assertEquals(rowNumber, rowNumbers.next());
    }
    verify(view).showIssue(issue);
}
Also used : Issue(org.drools.verifier.api.reporting.Issue)

Example 17 with Issue

use of org.drools.verifier.api.reporting.Issue in project kie-wb-common by kiegroup.

the class AnalysisReportScreenTest method testShowEverythingOnce.

@Test
public void testShowEverythingOnce() throws Exception {
    Issue issue2 = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, Collections.emptySet());
    Issue issue3 = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, Collections.emptySet());
    Issue issue4 = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, new HashSet<>(Arrays.asList(1, 2, 3)));
    Issue issue5 = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, new HashSet<>(Arrays.asList(1, 2, 3)));
    screen.showReport(getAnalysis(issue2, issue3, issue4, issue5));
    assertEquals(2, dataProvider.getList().size());
}
Also used : Issue(org.drools.verifier.api.reporting.Issue) Test(org.junit.Test)

Example 18 with Issue

use of org.drools.verifier.api.reporting.Issue in project kie-wb-common by kiegroup.

the class IssuePresenterTest method testShow.

@Test
public void testShow() throws Exception {
    Issue issue = new Issue(Severity.WARNING, CheckType.REDUNDANT_ROWS, new HashSet<>(Arrays.asList(3, 2, 1)));
    screen.show(issue);
    verify(view).setIssueTitle("RedundantRows");
    ArgumentCaptor<SafeHtml> safeHtmlArgumentCaptor = ArgumentCaptor.forClass(SafeHtml.class);
    verify(view).setExplanation(safeHtmlArgumentCaptor.capture());
    assertEquals("<p>MissingRangeP1(1)</p>", safeHtmlArgumentCaptor.getValue().asString());
    verify(view).setLines("1, 2, 3");
}
Also used : Issue(org.drools.verifier.api.reporting.Issue) IllegalVerifierStateIssue(org.drools.verifier.api.reporting.IllegalVerifierStateIssue) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Test(org.junit.Test)

Example 19 with Issue

use of org.drools.verifier.api.reporting.Issue in project kie-wb-common by kiegroup.

the class ReceiverTest method webWorkerException.

@Test
public void webWorkerException() {
    returnObject = new WebWorkerException("error");
    messageHandlerArgumentCaptor.getValue().onMessage(mock(MessageEvent.class));
    verify(reporter, never()).sendStatus(any());
    verify(reporter).sendReport(setArgumentCaptor.capture());
    verify(worker).terminate();
    final Set<Issue> issues = setArgumentCaptor.getValue();
    assertEquals(1, issues.size());
    assertTrue(issues.iterator().next() instanceof IllegalVerifierStateIssue);
}
Also used : Issue(org.drools.verifier.api.reporting.Issue) IllegalVerifierStateIssue(org.drools.verifier.api.reporting.IllegalVerifierStateIssue) MessageEvent(com.google.gwt.webworker.client.MessageEvent) WebWorkerException(org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException) IllegalVerifierStateIssue(org.drools.verifier.api.reporting.IllegalVerifierStateIssue) Test(org.junit.Test)

Example 20 with Issue

use of org.drools.verifier.api.reporting.Issue in project kie-wb-common by kiegroup.

the class MarshallingTest method check.

private void check(final Issue original, final Issue secondOne) {
    final String json = ServerMarshalling.toJSON(original);
    final Issue newVersion = (Issue) ServerMarshalling.fromJSON(json);
    assertEquals(original.hashCode(), newVersion.hashCode());
    assertNotEquals(secondOne.hashCode(), newVersion.hashCode());
}
Also used : Issue(org.drools.verifier.api.reporting.Issue) ValueForFactFieldIsSetTwiceIssue(org.drools.verifier.api.reporting.ValueForFactFieldIsSetTwiceIssue) ImpossibleMatchIssue(org.drools.verifier.api.reporting.ImpossibleMatchIssue) RedundantConditionsIssue(org.drools.verifier.api.reporting.RedundantConditionsIssue) MultipleValuesForOneActionIssue(org.drools.verifier.api.reporting.MultipleValuesForOneActionIssue) SingleHitLostIssue(org.drools.verifier.api.reporting.SingleHitLostIssue) ValueForActionIsSetTwiceIssue(org.drools.verifier.api.reporting.ValueForActionIsSetTwiceIssue)

Aggregations

Issue (org.drools.verifier.api.reporting.Issue)26 Test (org.junit.Test)16 Analyzer (org.drools.verifier.core.main.Analyzer)6 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)5 IllegalVerifierStateIssue (org.drools.verifier.api.reporting.IllegalVerifierStateIssue)4 AnalyzerConfigurationMock (org.drools.workbench.services.verifier.plugin.client.testutil.AnalyzerConfigurationMock)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 HashSet (java.util.HashSet)2 WebWorkerException (org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException)2 MessageEvent (com.google.gwt.webworker.client.MessageEvent)1 Comparator (java.util.Comparator)1 EnumSet (java.util.EnumSet)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Collectors (java.util.stream.Collectors)1 Status (org.drools.verifier.api.Status)1 CheckType (org.drools.verifier.api.reporting.CheckType)1 ImpossibleMatchIssue (org.drools.verifier.api.reporting.ImpossibleMatchIssue)1