Search in sources :

Example 1 with WebWorkerException

use of org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException in project drools-wb by kiegroup.

the class Receiver method init.

private void init(final DrlInitialize initialize) {
    try {
        final AnalyzerBuilder analyzerBuilder = new AnalyzerBuilder().with(initialize).with(checkRunner).with(new Reporter() {

            @Override
            public void sendReport(final Set<Issue> issues) {
                latestReport = new Issues(initialize.getUuid(), issues);
                poster.post(latestReport);
            }

            @Override
            public void sendStatus(final Status status) {
                poster.post(status);
            }
        });
        analyzer = analyzerBuilder.buildAnalyzer();
        index = analyzerBuilder.getIndex();
        configuration = analyzerBuilder.getConfiguration();
        analyzer.resetChecks();
        analyzer.analyze();
    } catch (final Exception e) {
        poster.post(new WebWorkerException("Initialization failed: " + e.getMessage()));
    }
}
Also used : RequestStatus(org.kie.workbench.common.services.verifier.api.client.api.RequestStatus) Status(org.drools.verifier.api.Status) Issue(org.drools.verifier.api.reporting.Issue) Issues(org.drools.verifier.api.reporting.Issues) Reporter(org.drools.verifier.core.main.Reporter) WebWorkerException(org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException) WebWorkerException(org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException) BuildException(org.drools.workbench.services.verifier.plugin.client.builders.BuildException)

Example 2 with WebWorkerException

use of org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException 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)

Aggregations

Issue (org.drools.verifier.api.reporting.Issue)2 WebWorkerException (org.kie.workbench.common.services.verifier.api.client.api.WebWorkerException)2 MessageEvent (com.google.gwt.webworker.client.MessageEvent)1 Status (org.drools.verifier.api.Status)1 IllegalVerifierStateIssue (org.drools.verifier.api.reporting.IllegalVerifierStateIssue)1 Issues (org.drools.verifier.api.reporting.Issues)1 Reporter (org.drools.verifier.core.main.Reporter)1 BuildException (org.drools.workbench.services.verifier.plugin.client.builders.BuildException)1 Test (org.junit.Test)1 RequestStatus (org.kie.workbench.common.services.verifier.api.client.api.RequestStatus)1