Package org.kie.api.definition

Examples of org.kie.api.definition.KiePackage


        ReleaseId releaseId1 = ks.newReleaseId( "org.kie", "test-upgrade", "1.0.0" );
        KieModule km = createAndDeployJar( ks, releaseId1, drl1 + drl2 + drl3 );

        // Create a session and fire rules
        KieContainer kc = ks.newKieContainer( km.getReleaseId() );
        KiePackage kpkg = ( (KieContainerImpl) kc ).getKieBase().getKiePackage( "org.drools.compiler" );
        assertEquals( 3, kpkg.getRules().size() );
        Map<String, Rule> rules = rulestoMap( kpkg.getRules() );

        assertNotNull(((org.drools.core.definitions.rule.impl.RuleImpl) rules.get("R1")));
        assertNotNull(((org.drools.core.definitions.rule.impl.RuleImpl) rules.get("R2")));
        assertNotNull(((org.drools.core.definitions.rule.impl.RuleImpl) rules.get("R3")));
        RuleTerminalNode rtn1_1  = (RuleTerminalNode) ((KnowledgeBaseImpl)kc.getKieBase()).getReteooBuilder().getTerminalNodes( "R1" )[0];
        RuleTerminalNode rtn2_1  = (RuleTerminalNode) ((KnowledgeBaseImpl)kc.getKieBase()).getReteooBuilder().getTerminalNodes( "R2" )[0];
        RuleTerminalNode rtn3_1  = (RuleTerminalNode) ((KnowledgeBaseImpl)kc.getKieBase()).getReteooBuilder().getTerminalNodes( "R3" )[0];
        // Create a new jar for version 1.1.0
        ReleaseId releaseId2 = ks.newReleaseId( "org.kie", "test-upgrade", "1.1.0" );
        km = createAndDeployJar( ks, releaseId2, drl1 + drl3 );

        // try to update the container to version 1.1.0
        kc.updateToVersion(releaseId2);

        KnowledgeBaseImpl rb_2 = ((KnowledgeBaseImpl) kc.getKieBase());
        RuleTerminalNode rtn1_2  = (RuleTerminalNode) rb_2.getReteooBuilder().getTerminalNodes( "R1" )[0];
        RuleTerminalNode rtn3_2  = (RuleTerminalNode) rb_2.getReteooBuilder().getTerminalNodes( "R3" )[0];
        assertNull( rb_2.getReteooBuilder().getTerminalNodes( "R2" ) );

        assertSame( rtn3_1, rtn3_2 );
        assertSame( rtn1_1, rtn1_2 );

        kpkg = ( (KieContainerImpl) kc ).getKieBase().getKiePackage( "org.drools.compiler" );
        assertEquals( 2, kpkg.getRules().size() );
        rules = rulestoMap( kpkg.getRules() );

        assertNotNull( ( (org.drools.core.definitions.rule.impl.RuleImpl) rules.get( "R1" ) ) );
        assertNull( ( (org.drools.core.definitions.rule.impl.RuleImpl) rules.get( "R2" ) ) );
        assertNotNull( ( (org.drools.core.definitions.rule.impl.RuleImpl) rules.get( "R3" ) ) );
    }
View Full Code Here


        assertTrue(appl);



        KieSession ksession = getSession( theory );
        KiePackage pack = ksession.getKieBase().getKiePackage( "org.drools.pmml.pmml_4_1.test" );
        assertNotNull(pack);

        ksession.dispose();
    }
View Full Code Here

        assertTrue(appl);



        KieSession ksession = getSession( theory );
        KiePackage pack = ksession.getKieBase().getKiePackage( "org.drools.pmml.pmml_4_1.test" );
        assertNotNull(pack);

        ksession.dispose();
    }
View Full Code Here

TOP

Related Classes of org.kie.api.definition.KiePackage

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.