Author: tsurdilovic
Date: 2010-09-14 10:04:53 -0400 (Tue, 14 Sep 2010)
New Revision: 13752
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/KSessionTest-beans.xml
Log:
ksession test further try to get it running
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
===================================================================
---
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-09-14
14:04:53 UTC (rev 13752)
@@ -29,6 +29,7 @@
import java.util.Map.Entry;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.New;
@@ -68,7 +69,7 @@
*
* @author Tihomir Surdilovic
*/
-@ApplicationScoped
+@Dependent
@Generic(DroolsConfig.class)
public class KnowledgeBaseProducer implements Serializable
{
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
===================================================================
---
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java 2010-09-14
14:04:53 UTC (rev 13752)
@@ -25,6 +25,7 @@
import java.util.Iterator;
import java.util.Map.Entry;
+import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
@@ -54,7 +55,7 @@
*
* @author Tihomir Surdilovic
*/
-@SessionScoped
+@Dependent
@Generic(DroolsConfig.class)
public class KnowledgeSessionProducer implements Serializable
{
@@ -154,12 +155,12 @@
return ksession;
}
- public void disposeStatefulSession( @Disposes StatefulKnowledgeSession session)
+ public void disposeStatefulSession( /** @Disposes @Default **/
StatefulKnowledgeSession session)
{
session.dispose();
}
- public void disposeScannedStatefulSession( @Disposes @Scanned StatefulKnowledgeSession
session)
+ public void disposeScannedStatefulSession( /** @Disposes @Scanned **/
StatefulKnowledgeSession session)
{
session.dispose();
}
Modified:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java
===================================================================
---
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java 2010-09-14
14:04:53 UTC (rev 13752)
@@ -21,13 +21,20 @@
*/
package org.jboss.seam.drools.test.ksession;
+import javax.enterprise.inject.Default;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.drools.runtime.StatefulKnowledgeSession;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
+import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
import org.jboss.seam.drools.test.DroolsModuleFilter;
-import org.jboss.seam.drools.test.kbase.KBaseTestProducer;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.formatter.Formatters;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,7 +49,7 @@
JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class)
.addPackages(true, new DroolsModuleFilter("ksession"),
KnowledgeBaseProducer.class.getPackage())
.addClass(KSessionTestRules.class)
- .addClass(KBaseTestProducer.class)
+ .addClass(KSessionTestProducer.class)
.addResource(pkgPath + "/ksessiontest.drl",
ArchivePaths.create("ksessiontest.drl"))
.addResource(pkgPath + "/kbuilderconfig.properties",
ArchivePaths.create("kbuilderconfig.properties"))
.addResource(pkgPath + "/kbaseconfig.properties",
ArchivePaths.create("kbaseconfig.properties"))
@@ -52,23 +59,10 @@
return archive;
}
- /**
@Test
- public void testKSession(@Default @DefaultConfig StatefulKnowledgeSession ksession,
- @Default @MVELDialectConfig StatefulKnowledgeSession mvelksession,
- @Default @MVELDialectConfig StatefulKnowledgeSession mvelksession2)
+ public void testKSession(@DefaultConfig @Default StatefulKnowledgeSession ksession)
{
assertNotNull(ksession);
assertTrue(ksession.getId() >= 0);
-
- assertNotNull(mvelksession);
- assertTrue(mvelksession.getId() >= 0);
-
- assertNotSame(ksession, mvelksession);
- assertSame(mvelksession, mvelksession2);
- }**/
- @Test
- public void nothingToTest() {
-
}
}
Modified:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java
===================================================================
---
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestProducer.java 2010-09-14
14:04:53 UTC (rev 13752)
@@ -2,22 +2,15 @@
import javax.enterprise.inject.Produces;
-import org.jboss.seam.drools.KnowledgeBaseProducer;
import org.jboss.seam.drools.KnowledgeSessionProducer;
import org.jboss.seam.drools.config.DroolsConfig;
import org.jboss.seam.drools.config.RuleResource;
import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
-import org.jboss.seam.drools.qualifiers.config.MVELDialectConfig;
public class KSessionTestProducer
{
@DroolsConfig(knowledgeBuilderConfigProperties =
"kbuilderconfig.properties", knowledgeBaseConfigProperties =
"kbaseconfig.properties", ruleResources = {
@RuleResource("classpath;ksessiontest.drl;DRL") })
@Produces
@DefaultConfig
- KnowledgeSessionProducer defaultProducer;
-
- //@DroolsConfig(knowledgeBuilderConfigProperties =
"kbuilderconfig.properties", knowledgeBaseConfigProperties =
"kbaseconfig.properties", ruleResources = {
@RuleResource("classpath;ksessiontest2.drl;DRL") })
- //@Produces
- //@MVELDialectConfig
- //KnowledgeBaseProducer mvelDialectProducer;
+ KnowledgeSessionProducer producer;
}
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml 2010-09-14
14:04:53 UTC (rev 13752)
@@ -24,11 +24,11 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.kbase">
- <!-- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
<s:value>classpath;kbasetest.drl;DRL;forkbasetest</s:value>
</d:resources>
- </d:DefaultRuleResources> -->
-</beans>
+ </d:DefaultRuleResources>
+--></beans>
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/KSessionTest-beans.xml
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/KSessionTest-beans.xml 2010-09-14
13:59:59 UTC (rev 13751)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/KSessionTest-beans.xml 2010-09-14
14:04:53 UTC (rev 13752)
@@ -24,19 +24,11 @@
xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
- <!-- <d:DefaultRuleResources>
+ <!--<d:DefaultRuleResources>
<s:modifies/>
<s:Exact>org.jboss.seam.drools.config.DefaultRuleResources</s:Exact>
<d:resources>
<s:value>classpath;ksessiontest.drl;DRL</s:value>
</d:resources>
- </d:DefaultRuleResources>
-
- <d:MVELDialectRuleResources>
- <s:modifies/>
- <s:Exact>org.jboss.seam.drools.config.MVELDialectRuleResources</s:Exact>
- <d:resources>
- <s:value>classpath;ksessiontest.drl;DRL</s:value>
- </d:resources>
- </d:MVELDialectRuleResources> -->
-</beans>
+ </d:DefaultRuleResources>
+--></beans>
Show replies by date