Package org.kie.api.builder

Examples of org.kie.api.builder.KieBuilder.buildAll()


        kfs.write( ks.getResources()
                           .newByteArrayResource( drlString.getBytes() )
                           .setSourcePath( "drl1.drl" )
                           .setResourceType( ResourceType.DRL ) );
        KieBuilder kieBuilder = ks.newKieBuilder( kfs );
        kieBuilder.buildAll();

        Results res = kieBuilder.getResults();
        if ( res.hasMessages( Message.Level.ERROR ) ) {
            fail( res.getMessages( Message.Level.ERROR ).toString() );
        }
View Full Code Here


        kfs.write( ks.getResources()
                           .newByteArrayResource( droolsSource.getBytes() )
                           .setSourcePath( "drl1.drl" )
                           .setResourceType( ResourceType.DRL ) );
        KieBuilder kieBuilder = ks.newKieBuilder( kfs );
        kieBuilder.buildAll();

        Results res = kieBuilder.getResults();
        assertTrue( res.hasMessages( Message.Level.ERROR ) );

    }
View Full Code Here

        kfs.write( ResourceFactory.newClassPathResource( source1 ).setResourceType( ResourceType.PMML ) );
        kfs.write( ResourceFactory.newClassPathResource( source2 ).setResourceType( ResourceType.PMML ) );

        KieBuilder kb = ks.newKieBuilder( kfs );
        kb.buildAll();

        KieSession kSession = ks.newKieContainer( ks.getRepository().getDefaultReleaseId() ).newKieSession();
        setKbase( kSession.getKieBase() );

        kSession.fireAllRules();
View Full Code Here

        KieFileSystem kfs = ks.newKieFileSystem();
        KieBuilder kb = ks.newKieBuilder( kfs );

        kfs.generateAndWritePomXML( releaseId1 );
        kfs.write( ResourceFactory.newClassPathResource( source1 ).setResourceType( ResourceType.PMML ) );
        kb.buildAll();

        KieContainer kc = ks.newKieContainer( releaseId1 );
        KieSession kSession = kc.newKieSession();
        setKbase( kSession.getKieBase() );
        kSession.fireAllRules();
View Full Code Here

            }
        }
   
        KieBuilder kieBuilder = config.getKieServicesInstance().newKieBuilder(kfs);
        int buildMsgs = 0;
        for( Message buildMsg : kieBuilder.buildAll().getResults().getMessages() ) {
           System.out.println( buildMsg.getPath() + " : " + buildMsg.getText() );
           ++buildMsgs;
        }
        if( buildMsgs > 0 ) {
            throw new RuntimeException("Unable to build KieModule, see the " + buildMsgs + " messages above.");
View Full Code Here

            kfs.write("src/main/resources/KBase1/rule1.drl", createDRLNotUsingJava(value));
        }
        kfs.write("src/main/java/org/kie/test/Value.java", createJavaSource(value));

        KieBuilder kieBuilder = ks.newKieBuilder(kfs);
        assertTrue("", kieBuilder.buildAll().getResults().getMessages().isEmpty());
        return (InternalKieModule) kieBuilder.getKieModule();
    }

    private String createDRLForJavaSource() {
        return "package org.kie.test\n" +
View Full Code Here

        kfs.writePomXML( getPom( releaseId ) );
        kfs.write( "src/main/java/org/kie/test/Bean.java",
                   createJavaSourceInPackage() );

        KieBuilder kieBuilder1 = ks.newKieBuilder( kfs );
        Assert.assertTrue( kieBuilder1.buildAll().getResults().getMessages().isEmpty() );
        InternalKieModule kieModule = (InternalKieModule) kieBuilder1.getKieModule();

        MavenRepository.getMavenRepository().deployArtifact( releaseId,
                                                             kieModule,
                                                             pomFile );
View Full Code Here

                             KieServices.Factory.get().getResources().newInputStreamResource( is ) );
        kieFileSystem.writeKModuleXML( kproj2.toXML() );
        kieFileSystem.write( "src/main/resources/rule.drl",
                             createDRLWithImport( "rule1" ) );
        KieBuilder kieBuilder = kieServices.newKieBuilder( kieFileSystem );
        kieBuilder.buildAll();
        assertTrue( kieBuilder.getResults().getMessages().isEmpty() );
    }

    private String createJavaSourceInPackage() {
        return "package org.kie.test;\n" +
View Full Code Here

        kfs.writeKModuleXML( kproj.toXML() )
                .writePomXML( generatePomXml( releaseId ) )
                .write( "src/main/java/test/Bean.java", createJavaSource() );

        final KieBuilder kieBuilder = ks.newKieBuilder( kfs );
        final List<Message> messages = kieBuilder.buildAll().getResults().getMessages();
        assertTrue( messages.isEmpty() );

        final KieModule kieModule = kieBuilder.getKieModule();
        final KieModuleMetaData kieModuleMetaData = KieModuleMetaData.Factory.newKieModuleMetaData( kieModule );
View Full Code Here

        final KieFileSystem kfs = ks.newKieFileSystem();
        kfs.write( "src/main/resources/test.drl",
                   "package org.test declare Bean end" );

        final KieBuilder kieBuilder = ks.newKieBuilder( kfs );
        final List<Message> messages = kieBuilder.buildAll().getResults().getMessages();
        assertTrue( messages.isEmpty() );

        final KieModule kieModule = kieBuilder.getKieModule();
        final KieModuleMetaData kieModuleMetaData = KieModuleMetaData.Factory.newKieModuleMetaData( kieModule );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.