Bug 1034250
| Summary: | KIE FileSystem resource type overriding does not work as reported by documentation | ||
|---|---|---|---|
| Product: | [Retired] JBoss BRMS Platform 6 | Reporter: | Mario Fusco <mfusco> |
| Component: | BRE | Assignee: | Mario Fusco <mfusco> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Tomas Schlosser <tschloss> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.0.0 | CC: | etirelli |
| Target Milestone: | ER6 | ||
| Target Release: | 6.0.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-08-06 20:18:46 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Verified in brms 6.0.1-redhat-1 |
When a resource is written into the KieFileSystem using the method write( path, Resource ), the resource type is ignored and it will be resolved from the file extension instead. For instance the following test should work regardless of the file extension. @Test public void testHelloWorldWithResource() throws Exception { String drl = "package org.drools.compiler.integrationtests\n" + "import " + Message.class.getCanonicalName() + "\n" + "rule R1 when\n" + " $m : Message( message == \"Hello World\" )\n" + "then\n" + "end\n"; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = ks.newKieFileSystem().write( ks.getResources() .newReaderResource( new StringReader(drl) ) .setResourceType(ResourceType.DRL) .setSourcePath("src/main/resources/r1.txt") ); ks.newKieBuilder( kfs ).buildAll(); KieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession(); ksession.insert(new Message("Hello World")); int count = ksession.fireAllRules(); assertEquals( 1, count ); }