Package org.drools.agent.impl

Examples of org.drools.agent.impl.FailureDetectingSystemEventListener


        assertEquals(3, kbase.getKnowledgePackages().iterator().next().getRules().size());
    }

    @Test
    public void testCSVByKnowledgeAgentWithFileReader() throws IOException {
        FailureDetectingSystemEventListener systemEventListener = new FailureDetectingSystemEventListener();
        SystemEventListenerFactory.setSystemEventListener(systemEventListener);

        try {
            File targetTestFilesDir = new File("target/testFiles");
            targetTestFilesDir.mkdirs();
            File changeSetFile = new File(targetTestFilesDir, "changeSetTestCSV.xml");
            FileUtils.copyURLToFile(getClass().getResource("changeSetTestCSV.xml"), changeSetFile);

            KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("csv agent");
            kagent.setSystemEventListener(systemEventListener);
            kagent.applyChangeSet(ResourceFactory.newFileResource(changeSetFile));
            KnowledgeBase kbase = kagent.getKnowledgeBase();

            assertEquals(1, kbase.getKnowledgePackages().size());
            assertEquals(3, kbase.getKnowledgePackages().iterator().next().getRules().size());

            if (!systemEventListener.isSuccessful()) {
                for (Throwable throwable : systemEventListener.getExceptionList()) {
                    throwable.printStackTrace();
                }
                fail("The scanner ran into exceptions");
            }
        } catch(Throwable t) {
View Full Code Here


        assertEquals(3, kbase.getKnowledgePackages().iterator().next().getRules().size());
    }

    @Test
    public void testCSVByKnowledgeAgentWithFileReader() throws IOException {
        FailureDetectingSystemEventListener systemEventListener = new FailureDetectingSystemEventListener();
        SystemEventListenerFactory.setSystemEventListener(systemEventListener);

        try {
            File targetTestFilesDir = new File("target/testFiles");
            targetTestFilesDir.mkdirs();
            File changeSetFile = new File(targetTestFilesDir, "changeSetTestCSV.xml");
            FileUtils.copyURLToFile(getClass().getResource("changeSetTestCSV.xml"), changeSetFile);

            KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("csv agent");
            kagent.setSystemEventListener(systemEventListener);
            kagent.applyChangeSet(ResourceFactory.newFileResource(changeSetFile));
            KnowledgeBase kbase = kagent.getKnowledgeBase();

            assertEquals(1, kbase.getKnowledgePackages().size());
            assertEquals(3, kbase.getKnowledgePackages().iterator().next().getRules().size());

            if (!systemEventListener.isSuccessful()) {
                for (Throwable throwable : systemEventListener.getExceptionList()) {
                    throwable.printStackTrace();
                }
                fail("The scanner ran into exceptions");
            }
        } catch(Throwable t) {
View Full Code Here

TOP

Related Classes of org.drools.agent.impl.FailureDetectingSystemEventListener

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.