Examples of KieSession


Examples of org.kie.api.runtime.KieSession

    private static final String packageName = "org.drools.pmml.pmml_4_2.test";


    @Test
    public void testCleanupANN() {
        KieSession kSession = getModelSession( source1 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "Neuiris" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_Neuiris" ).insert( Boolean.FALSE );
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );
        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession



    @Test
    public void testCleanupDT() {
        KieSession kSession = getModelSession( source2 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "TreeTest" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_TreeTest" ).insert(Boolean.FALSE);
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

        kSession.dispose();
    }

    @Test
    public void testCleanupRegression() {
        KieSession kSession = getModelSession( source3 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "LinReg" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_LinReg" ).insert(Boolean.FALSE);
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

        kSession.dispose();
    }

    @Test
    public void testCleanupClustering() {
        KieSession kSession = getModelSession( source4 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "CenterClustering" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_CenterClustering" ).insert(Boolean.FALSE);
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

        kSession.dispose();
    }

    @Test
    public void testCleanupSVM() {
        KieSession kSession = getModelSession( source5 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "SVMXORModel" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_SVMXORModel" ).insert(Boolean.FALSE);
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

        kSession.dispose();
    }

    @Test
    public void testCleanupScorecard() {
        KieSession kSession = getModelSession( source6 );
        kSession.fireAllRules();
        assertTrue( kSession.getObjects().size() > 0 );

        Collection qres = getModelMarker( kSession, "SampleScore" );
        assertEquals( 1, qres.size() );

        kSession.getEntryPoint( "enable_SampleScore" ).insert(Boolean.FALSE);
        kSession.fireAllRules();

        assertEquals( 1, kSession.getObjects().size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

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

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

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

        kSession.fireAllRules();

        assertEquals( 2, kSession.getObjects( new ClassObjectFilter( ModelMarker.class ) ).size() );
        assertEquals( 11, kSession.getObjects( new ClassObjectFilter( kSession.getKieBase().getFactType( packageName, "Synapse" ).getFactClass() ) ).size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

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

        KieContainer kc = ks.newKieContainer( releaseId1 );
        KieSession kSession = kc.newKieSession();
        kSession.fireAllRules();


        kfs.write( ResourceFactory.newClassPathResource( source2 ).setResourceType( ResourceType.PMML ) );
        IncrementalResults results = (( InternalKieBuilder ) kb ).incrementalBuild();
        kc.updateToVersion( releaseId1 );

        kSession.fireAllRules();

        assertEquals( 2, kSession.getObjects( new ClassObjectFilter( ModelMarker.class ) ).size() );
        assertEquals( 11, kSession.getObjects( new ClassObjectFilter( kSession.getKieBase().getFactType( packageName, "Synapse" ).getFactClass() ) ).size() );

        kSession.dispose();
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

    @Test
    public void testSimpleTree() throws Exception {
        setKSession( getModelSession( source1, VERBOSE ) );
        setKbase( getKSession().getKieBase() );
        KieSession kSession = getKSession();

//        kSession.addEventListener( new org.drools.event.rule.DebugAgendaEventListener() );

        kSession.fireAllRules()//init model

        FactType tgt = kSession.getKieBase().getFactType( packageName, "Fld5" );
       
        kSession.getEntryPoint( "in_Fld1" ).insert( 30.0 );
        kSession.getEntryPoint( "in_Fld2" ).insert( 60.0 );
        kSession.getEntryPoint( "in_Fld3" ).insert( "false" );
        kSession.getEntryPoint( "in_Fld4" ).insert( "optA" );

        kSession.fireAllRules();

        checkFirstDataFieldOfTypeStatus( tgt, true, false, "Missing", "tgtY" );
    }
View Full Code Here

Examples of org.kie.api.runtime.KieSession

    @Test
    public void testMissingTree() throws Exception {
        setKSession( getModelSession( source2, VERBOSE ) );
        setKbase( getKSession().getKieBase() );
        KieSession kSession = getKSession();

        kSession.fireAllRules()//init model

        FactType tgt = kSession.getKieBase().getFactType( packageName, "Fld9" );
        FactType tok = kSession.getKieBase().getFactType( PMML4Helper.pmmlDefaultPackageName(), "TreeToken" );

        kSession.getEntryPoint( "in_Fld1" ).insert( 45.0 );
        kSession.getEntryPoint( "in_Fld2" ).insert( 60.0 );
        kSession.getEntryPoint( "in_Fld3" ).insert( "optA" );

        kSession.fireAllRules();

        Object token = getToken( kSession );
        assertEquals( 0.6, tok.get( token, "confidence" ) );
        assertEquals( "null", tok.get( token, "current" ) );
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.