Search in sources :

Example 1 with PackageBuilderErrors

use of org.drools.compiler.compiler.PackageBuilderErrors in project drools by kiegroup.

the class KieBaseUpdater method rebuildAll.

private void rebuildAll(KnowledgeBuilderImpl kbuilder, CompositeKnowledgeBuilder ckbuilder) {
    ckbuilder.build();
    PackageBuilderErrors errors = kbuilder.getErrors();
    if (!errors.isEmpty()) {
        for (KnowledgeBuilderError error : errors.getErrors()) {
            ctx.results.addMessage(error).setKieBaseName(ctx.newKieBaseModel.getName());
        }
        log.error("Unable to update KieBase: " + ctx.newKieBaseModel.getName() + " to release " + ctx.newReleaseId + "\n" + errors.toString());
    }
    if (ctx.modifyingUsedClass) {
        kbuilder.rewireAllClassObjectTypes();
    }
}
Also used : KnowledgeBuilderError(org.kie.internal.builder.KnowledgeBuilderError) PackageBuilderErrors(org.drools.compiler.compiler.PackageBuilderErrors)

Example 2 with PackageBuilderErrors

use of org.drools.compiler.compiler.PackageBuilderErrors in project jbpm by kiegroup.

the class ProcessExceptionHandlerTest method testFaultWithoutHandler.

@Test
public void testFaultWithoutHandler() {
    Reader source = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + "         xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" + "         type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" + "\n" + "  <header>\n" + "  </header>\n" + "\n" + "  <nodes>\n" + "    <start id=\"1\" name=\"Start\" />\n" + "    <fault id=\"2\" name=\"Fault\" faultName=\"myFault\" />\n" + "  </nodes>\n" + "\n" + "  <connections>\n" + "    <connection from=\"1\" to=\"2\" />\n" + "  </connections>\n" + "\n" + "</process>");
    builder.addRuleFlow(source);
    PackageBuilderErrors errors = builder.getErrors();
    if (errors != null && !errors.isEmpty()) {
        for (DroolsError error : errors.getErrors()) {
            logger.error(error.toString());
        }
        fail("Package could not be compiled");
    }
    KieSession session = createKieSession(builder.getPackages());
    ProcessInstance processInstance = (ProcessInstance) session.startProcess("org.drools.exception");
    assertEquals(ProcessInstance.STATE_ABORTED, processInstance.getState());
}
Also used : DroolsError(org.drools.compiler.compiler.DroolsError) StringReader(java.io.StringReader) Reader(java.io.Reader) StringReader(java.io.StringReader) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.jbpm.process.instance.ProcessInstance) PackageBuilderErrors(org.drools.compiler.compiler.PackageBuilderErrors) Test(org.junit.Test) AbstractBaseTest(org.jbpm.test.util.AbstractBaseTest)

Example 3 with PackageBuilderErrors

use of org.drools.compiler.compiler.PackageBuilderErrors in project drools by kiegroup.

the class KieBaseUpdaterImpl method rebuildAll.

private void rebuildAll(InternalKnowledgeBuilder kbuilder, CompositeKnowledgeBuilder ckbuilder) {
    ckbuilder.build();
    PackageBuilderErrors errors = (PackageBuilderErrors) kbuilder.getErrors();
    if (!errors.isEmpty()) {
        for (KnowledgeBuilderError error : errors.getErrors()) {
            ctx.results.addMessage(error).setKieBaseName(ctx.newKieBaseModel.getName());
        }
        log.error("Unable to update KieBase: " + ctx.newKieBaseModel.getName() + " to release " + ctx.newReleaseId + "\n" + errors.toString());
    }
    if (ctx.modifyingUsedClass) {
        kbuilder.rewireAllClassObjectTypes();
    }
}
Also used : KnowledgeBuilderError(org.kie.internal.builder.KnowledgeBuilderError) PackageBuilderErrors(org.drools.compiler.compiler.PackageBuilderErrors)

Aggregations

PackageBuilderErrors (org.drools.compiler.compiler.PackageBuilderErrors)3 KnowledgeBuilderError (org.kie.internal.builder.KnowledgeBuilderError)2 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 DroolsError (org.drools.compiler.compiler.DroolsError)1 ProcessInstance (org.jbpm.process.instance.ProcessInstance)1 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)1 Test (org.junit.Test)1 KieSession (org.kie.api.runtime.KieSession)1