Package org.drools.io.impl

Examples of org.drools.io.impl.ChangeSetImpl


        KnowledgeAgent kagent = createKAgent( kbase, false, true );

        ByteArrayResource bres = (ByteArrayResource) ResourceFactory.newByteArrayResource( s1.getBytes() );
        bres.setResourceType( ResourceType.DRL );

        ChangeSetImpl cs = new ChangeSetImpl();
        cs.setResourcesAdded( Arrays.<Resource> asList( bres ) );
        kagent.applyChangeSet( cs );

        KnowledgePackage pack = kagent.getKnowledgeBase().getKnowledgePackage( "org.drools.test.pack1" );
        assertNotNull( pack );
        assertEquals( 0, pack.getRules().size() );
        assertEquals( 1, pack.getFactTypes().size() );


        ByteArrayResource bres2 = (ByteArrayResource) ResourceFactory.newByteArrayResource( s2.getBytes() );
        bres2.setResourceType( ResourceType.DRL );
        ChangeSetImpl cs2 = new ChangeSetImpl();
        cs2.setResourcesAdded( Arrays.<Resource> asList( bres2 ) );
        kagent.applyChangeSet( cs2 );

        pack = kagent.getKnowledgeBase().getKnowledgePackage( "org.drools.test.pack1" );
        assertNotNull( pack );
        assertEquals( 0, pack.getRules().size() );
View Full Code Here


        kagent.setSystemEventListener( new PrintStreamSystemEventListener() );

        ByteArrayResource bres = (ByteArrayResource) ResourceFactory.newByteArrayResource( s1.getBytes() );
        bres.setResourceType( ResourceType.DRL );

        ChangeSetImpl cs = new ChangeSetImpl();
        cs.setResourcesAdded(Arrays.<Resource>asList(bres));
        kagent.applyChangeSet(cs);


        ByteArrayResource bres2 = (ByteArrayResource) ResourceFactory.newByteArrayResource( s2.getBytes() );
        bres2.setResourceType( ResourceType.DRL );

        ChangeSetImpl cs2 = new ChangeSetImpl();
        cs2.setResourcesAdded( Arrays.<Resource> asList( bres2 ) );
        kagent.applyChangeSet( cs2 );


        StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
View Full Code Here

        kagent.setSystemEventListener( new PrintStreamSystemEventListener() );

        ByteArrayResource bres = (ByteArrayResource) ResourceFactory.newByteArrayResource( drl.getBytes() );
        bres.setResourceType( ResourceType.DRL );

        ChangeSetImpl cs = new ChangeSetImpl();
        cs.setResourcesAdded(Arrays.<Resource>asList(bres));
        try {
            kagent.applyChangeSet(cs);
        } catch ( Throwable t ) {
            fail( t.getMessage() );
        }
View Full Code Here

                           assertEquals(1,defs.size());



           String rule4 = this.createDefaultRule( "rule4", "org.drools.test4" );
           ChangeSetImpl cs = new ChangeSetImpl();
               ByteArrayResource res = new ByteArrayResource( rule4.getBytes( ));
                   res.setResourceType(ResourceType.DRL);
                   cs.setResourcesAdded(Arrays.asList(new Resource[] {res}));
               kagent.applyChangeSet(cs);


           assertEquals(1,ksession.getKnowledgeBase().getKnowledgePackage("org.drools.test3").getRules().size());
           assertEquals(1,ksession.getKnowledgeBase().getKnowledgePackage("org.drools.test4").getRules().size());
View Full Code Here

TOP

Related Classes of org.drools.io.impl.ChangeSetImpl

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.