hi,
I'm having trouble with scanning changed knowledge from Guvnor. I found out
that compiled processes from Guvnor are missing after resource change
scanner scan for changes first time (event there is no changes).
I wrote a simple test to reproduce this.
public class KnowledgeAgentTest {
@Test
public void should_load_processes() throws Exception {
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
// Scan change every 2 seconds
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("agent");
// Changeset points to a PKG contains 12 processes on Guvnor
kagent.applyChangeSet(ResourceFactory.newClassPathResource("test/drools-changeset.xml"));
// Everything is still ok now
System.out.println("Processes before scan: " +
kagent.getKnowledgeBase().getProcesses().size());
Assert.assertFalse(kagent.getKnowledgeBase().getProcesses().isEmpty());
// Scan change every 2 seconds
sconf.setProperty("drools.resource.scanner.interval", "2");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
// Wait long enough
Thread.sleep(5000);
// Processes are gone somehow
System.out.println("Processes after scan: " +
kagent.getKnowledgeBase().getProcesses().size());
Assert.assertFalse(kagent.getKnowledgeBase().getProcesses().isEmpty());
}
}
Here is what I'm getting when run the test.
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running test.KnowledgeAgentTest
Processes before scan: 12
Processes after scan: 0
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.802 sec
<<< FAILURE!
Results :
Failed tests: should_load_processes(test.KnowledgeAgentTest)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Thanks,
Jiang
--
View this message in context:
http://drools.46999.n3.nabble.com/compiled-processes-in-PKG-removed-by-kn...
Sent from the Drools: User forum mailing list archive at
Nabble.com.