Package org.drools.compiler.kie.builder.impl

Examples of org.drools.compiler.kie.builder.impl.InternalKieModule


        KieScanner releaseIdScanner = context.getBean("spring-scanner-releaseId#scanner", KieScanner.class);
        assertNotNull(releaseIdScanner);
    }

    protected void redeployModule(MavenRepository repository, KieServices ks) throws IOException {
        InternalKieModule kJar2 = createKieJarWithClass(ks, releaseId, SECOND_VALUE);
        repository.deployArtifact(releaseId, kJar2, kPom);
    }
View Full Code Here


                                        entry.getKReleaseId(),
                                        entry.getScope(),
                                        entry.getName(),
                                        entry.getInjectionPoints() );
        if ( log.isDebugEnabled() ) {
            InternalKieModule kModule = kProject.getKieModuleForKBase( kBaseQName );
            log.debug( "Added Bean for @KBase({})",
                       kBaseQName,
                       kModule );
        }
        abd.addBean( bean );
View Full Code Here

            }
        }

        if ( KieSessionType.STATELESS.equals( kSessionModel.getType() ) ) {
            if ( log.isDebugEnabled() ) {
                InternalKieModule kModule = kProject.getKieModuleForKBase( ((KieSessionModelImpl) kSessionModel).getKieBaseModel().getName() );
                log.debug( "Added Bean for Stateless @KSession({}) from: {}",
                           kSessionName,
                           kModule );
            }
            abd.addBean( new StatelessKSessionBean( kSessionModel,
                                                    kieContainer,
                                                    entry.getKReleaseId(),
                                                    entry.getScope(),
                                                    entry.getName(),
                                                    entry.getInjectionPoints() ) );
        } else {
            InternalKieModule kModule = kProject.getKieModuleForKBase( ((KieSessionModelImpl) kSessionModel).getKieBaseModel().getName() );
            log.debug( "Added Bean for Stateful @KSession({})  from: {}",
                       kSessionName,
                       kModule );
            abd.addBean( new StatefulKSessionBean( kSessionModel,
                                                   kieContainer,
View Full Code Here

            //Deploy, if no errors
            final POM pom = pomService.load( project.getPomXMLPath() );
            if ( results.getMessages().isEmpty() ) {
                final Builder builder = cache.assertBuilder( project );
                final InternalKieModule kieModule = (InternalKieModule) builder.getKieModule();
                final ByteArrayInputStream input = new ByteArrayInputStream( kieModule.getBytes() );
                m2RepoService.deployJar( input,
                                         pom.getGav() );

                for ( PostBuildHandler handler : handlers ) {
                    try {
View Full Code Here

                "rule R2 when\n" +
                "   $m : Message( message == \"Hello World\" )\n" +
                "then\n" +
                "end\n";

        InternalKieModule kieJar1 = createKieJar( drl1, drl2 );
        InternalKieModule kieJar2 = createKieJar( drl1, drl2 );

        ChangeSetBuilder builder = new ChangeSetBuilder();
        KieJarChangeSet changes = builder.build( kieJar1, kieJar2 );
        System.out.println( builder.toProperties( changes ) );
       
View Full Code Here

                "rule R3 when\n" +
                "   $m : Message( message == \"Good bye World\" )\n" +
                "then\n" +
                "end\n";

        InternalKieModule kieJar1 = createKieJar( drl1, drl2 );
        InternalKieModule kieJar2 = createKieJar( drl1, drl3 );

        KieJarChangeSet changes = new ChangeSetBuilder().build( kieJar1, kieJar2 );
       
        String modifiedFile = (String) kieJar2.getFileNames().toArray()[1];
       
        assertThat( changes.getChanges().size(), is(1));
        ResourceChangeSet cs = changes.getChanges().get( modifiedFile );
        assertThat( cs, not( nullValue() ) );
        assertThat( cs.getChangeType(), is( ChangeType.UPDATED ) );
View Full Code Here

                "rule R2 when\n" +
                "   $m : Message( message == \"Hello World\" )\n" +
                "then\n" +
                "end\n";

        InternalKieModule kieJar1 = createKieJar( drl1, drl2 );
        InternalKieModule kieJar2 = createKieJar( drl1 );

        KieJarChangeSet changes = new ChangeSetBuilder().build( kieJar1, kieJar2 );

        String removedFile = (String) kieJar1.getFileNames().toArray()[1];
       
View Full Code Here

                "rule \"Another dumb rule\" when\n" +
                "   $m : Message( message == \"Good bye World\" )\n" +
                "then\n" +
                "end\n";

        InternalKieModule kieJar1 = createKieJar( drl1, drl2 );
        InternalKieModule kieJar2 = createKieJar( drl1_5, null, drl3 );

        ChangeSetBuilder builder = new ChangeSetBuilder();
        KieJarChangeSet changes = builder.build( kieJar1, kieJar2 );
       
        System.out.println( builder.toProperties( changes ) );

        String modifiedFile = (String) kieJar2.getFileNames().toArray()[0];
        String addedFile = (String) kieJar2.getFileNames().toArray()[1];
        String removedFile = (String) kieJar1.getFileNames().toArray()[1];
       
        assertThat( changes.getChanges().size(), is(3));

        ResourceChangeSet cs = changes.getChanges().get( removedFile );
View Full Code Here

//        assertThat( cs.getChanges().get( 1 ), is( new ResourceChange(ChangeType.REMOVED, Type.RULE, "A removed rule") ) );
//        assertThat( cs.getChanges().get( 2 ), is( new ResourceChange(ChangeType.UPDATED, Type.RULE, "An updated rule") ) );
    }

    private InternalKieModule createKieJar( String... drls) {
        InternalKieModule kieJar = mock( InternalKieModule.class );
        KieServices ks = KieServices.Factory.get();
        ReleaseId releaseId = ks.newReleaseId("org.kie", "hello-world", "1.0-SNAPSHOT");

        List<String> drlFs = new ArrayList<String>();
       
        for( int i=0; i<drls.length; i++ ) {
            if( drls[i] != null ) {
                String fileName = "src/main/resoureces/org/pkg1/drlFile"+i+".drl";
                drlFs.add( fileName );
                when( kieJar.getBytes( fileName ) ).thenReturn( drls[i].getBytes() );
            }
        }
        when( kieJar.getBytes( KieModuleModelImpl.KMODULE_JAR_PATH ) ).thenReturn( createKieProjectWithPackages(ks, releaseId).toXML().getBytes() );
        when( kieJar.getFileNames() ).thenReturn( drlFs );
        return ( InternalKieModule ) kieJar;
    }
View Full Code Here

                                        entry.getKReleaseId(),
                                        entry.getScope(),
                                        entry.getName(),
                                        entry.getInjectionPoints() );
        if ( log.isDebugEnabled() ) {
            InternalKieModule kModule = kProject.getKieModuleForKBase( kBaseQName );
            log.debug( "Added Bean for @KBase({})",
                       kBaseQName,
                       kModule );
        }
        abd.addBean( bean );
View Full Code Here

TOP

Related Classes of org.drools.compiler.kie.builder.impl.InternalKieModule

Copyright © 2018 www.massapicom. 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.