[seam-commits] Seam SVN: r12479 - in modules/drools/trunk: impl/src/main/java/org/jboss/seam/drools and 7 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 13 15:24:36 EDT 2010


Author: tsurdilovic
Date: 2010-04-13 15:24:35 -0400 (Tue, 13 Apr 2010)
New Revision: 12479

Added:
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestQualifier.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/
   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/KSessionTestQualifier.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyDummyWorkItemHandler.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyKnowledgeSessionEventListener.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MySecondKnowledgeBaseEventListener.java
   modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/
   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/kbaseconfig.properties
   modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/kbuilderconfig.properties
   modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/ksessiontest.drl
Removed:
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyDummyWorkItemHandler.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyKnowledgeSessionEventListener.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyOtherDummyWorkItemHandler.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MySecondKnowledgeBaseEventListener.java
Modified:
   modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/TemplateData.java
   modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/WIHandler.java
   modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java
   modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/bootstrap/DroolsExtension.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
   modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/SimpleTemplateDataProvider.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/kbase/kbasetest.drl
   modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties
Log:
added ksession test (need to check in to look at possible arquillian issue with aslak)

Modified: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/TemplateData.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/TemplateData.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/TemplateData.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -21,5 +21,5 @@
 @Retention(RUNTIME)
 @Inherited
 public @interface TemplateData {
-	@Nonbinding String name();
+	@Nonbinding String value();
 }

Modified: modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/WIHandler.java
===================================================================
--- modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/WIHandler.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/WIHandler.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -24,5 +24,5 @@
 @Retention(RUNTIME)
 @Inherited
 public @interface WIHandler {
-	@Nonbinding String name();
+	@Nonbinding String value();
 }

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-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeSessionProducer.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -45,9 +45,9 @@
 
    @Produces
    @KBaseConfigured
-   public StatefulKnowledgeSession produceStatefulSession(@KBaseConfigured KnowledgeBase kbase, Instance<DroolsConfiguration> ksessionConfigInstance) throws Exception
+   public StatefulKnowledgeSession produceStatefulSession(@KBaseConfigured KnowledgeBase kbase, @Any DroolsConfiguration ksessionConfig) throws Exception
    {
-      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getConfig(ksessionConfigInstance.get().getKnowledgeSessionConfigPath()), null);
+      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getConfig(ksessionConfig.getKnowledgeSessionConfigPath()), null);
       addEventListeners(ksession);
       addWorkItemHandlers(ksession);
 
@@ -56,9 +56,9 @@
 
    @Produces
    @KAgentConfigured
-   StatefulKnowledgeSession produceStatefulSessionFromKAgent(@KAgentConfigured KnowledgeBase kbase, Instance<DroolsConfiguration> ksessionConfigInstance) throws Exception
+   StatefulKnowledgeSession produceStatefulSessionFromKAgent(@KAgentConfigured KnowledgeBase kbase, @Any DroolsConfiguration ksessionConfig) throws Exception
    {
-      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getConfig(ksessionConfigInstance.get().getKnowledgeSessionConfigPath()), null);
+      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getConfig(ksessionConfig.getKnowledgeSessionConfigPath()), null);
       addEventListeners(ksession);
       addWorkItemHandlers(ksession);
 
@@ -67,9 +67,9 @@
 
    @Produces
    @KAgentConfigured
-   StatelessKnowledgeSession produceStatelessSessionFromKAgent(@KAgentConfigured KnowledgeBase kbase, Instance<DroolsConfiguration> ksessionConfigInstance) throws Exception
+   StatelessKnowledgeSession produceStatelessSessionFromKAgent(@KAgentConfigured KnowledgeBase kbase, @Any DroolsConfiguration ksessionConfig) throws Exception
    {
-      StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getConfig(ksessionConfigInstance.get().getKnowledgeSessionConfigPath()));
+      StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getConfig(ksessionConfig.getKnowledgeSessionConfigPath()));
       addEventListeners(ksession);
 
       return ksession;
@@ -77,9 +77,9 @@
 
    @Produces
    @KBaseConfigured
-   public StatelessKnowledgeSession produceStatelessSession(@KBaseConfigured KnowledgeBase kbase, Instance<DroolsConfiguration> ksessionConfigInstance) throws Exception
+   public StatelessKnowledgeSession produceStatelessSession(@KBaseConfigured KnowledgeBase kbase, @Any DroolsConfiguration ksessionConfig) throws Exception
    {
-      StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getConfig(ksessionConfigInstance.get().getKnowledgeSessionConfigPath()));
+      StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getConfig(ksessionConfig.getKnowledgeSessionConfigPath()));
       addEventListeners(ksession);
 
       return ksession;

Modified: modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/bootstrap/DroolsExtension.java
===================================================================
--- modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/bootstrap/DroolsExtension.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/bootstrap/DroolsExtension.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -71,7 +71,7 @@
          {
             Bean<?> handler = iter.next();
             WIHandler handlerAnnotation = handler.getBeanClass().getAnnotation(WIHandler.class);
-            String handlerName = handlerAnnotation.name();
+            String handlerName = handlerAnnotation.value();
             if(handlerName.length() > 0) {
                CreationalContext<?> context = bm.createCreationalContext(handler);
                WorkItemHandler handlerInstance = (WorkItemHandler) bm.getReference(handler, WorkItemHandler.class, context);
@@ -92,7 +92,7 @@
          {
             Bean<?> templateDataProvider = iter.next();
             TemplateData teamplateDataAnnotation = templateDataProvider.getBeanClass().getAnnotation(TemplateData.class);
-            String templateDataName = teamplateDataAnnotation.name();
+            String templateDataName = teamplateDataAnnotation.value();
             if(templateDataName.length() > 0) {
                CreationalContext<?> context = bm.createCreationalContext(templateDataProvider);
                TemplateDataProvider templateDataProviderInstance = (TemplateDataProvider) bm.getReference(templateDataProvider, TemplateDataProvider.class, context);

Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,25 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
- at Qualifier
- at Target( { TYPE, METHOD, FIELD, PARAMETER })
- at Documented
- at Retention(RUNTIME)
- at Inherited
-public @interface ForKBaseTest
-{
-
-}

Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTest.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,6 +1,7 @@
 package org.jboss.seam.drools.test.kbase;
 
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import javax.inject.Inject;
 
@@ -10,7 +11,6 @@
 import org.jboss.seam.drools.KnowledgeBaseProducer;
 import org.jboss.seam.drools.config.DroolsConfiguration;
 import org.jboss.seam.drools.qualifiers.KBaseConfigured;
-import org.jboss.seam.drools.qualifiers.config.DroolsConfig;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.formatter.Formatters;
@@ -29,7 +29,7 @@
       JavaArchive archive = Archives.create("test.jar", JavaArchive.class)
       .addPackages(true, KnowledgeBaseProducer.class.getPackage())
       .addPackages(true, ResourceProvider.class.getPackage())
-      .addClass(ForKBaseTest.class)
+      .addClass(KBaseTestQualifier.class)
       .addClass(MyKnowledgeBaseEventListener.class)
       .addResource(pkgPath + "/kbasetest.drl", ArchivePaths.create("kbasetest.drl"))
       .addResource(pkgPath + "/kbuilderconfig.properties", ArchivePaths.create("kbuilderconfig.properties"))
@@ -40,11 +40,11 @@
    }
 
    @Inject
-   @ForKBaseTest
+   @KBaseTestQualifier
    DroolsConfiguration config;
    
    @Inject
-   @ForKBaseTest
+   @KBaseTestQualifier
    @KBaseConfigured
    KnowledgeBase kbase;
 
@@ -63,7 +63,7 @@
    public void testKBase()
    {
       assertNotNull(kbase);
-      System.out.println("KBASE: " + kbase.toString());
+      assertTrue(kbase.getKnowledgePackage("org.jboss.seam.drools.test.kbase").getRules().size() == 3);
    }
 
    // static class KBaseConfigBinding extends AnnotationLiteral<ForKBaseTest>

Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestQualifier.java (from rev 12427, modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/ForKBaseTest.java)
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestQualifier.java	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/KBaseTestQualifier.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,25 @@
+package org.jboss.seam.drools.test.kbase;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { TYPE, METHOD, FIELD, PARAMETER })
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KBaseTestQualifier
+{
+
+}

Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyDummyWorkItemHandler.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyDummyWorkItemHandler.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyDummyWorkItemHandler.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,24 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import org.drools.runtime.process.WorkItem;
-import org.drools.runtime.process.WorkItemHandler;
-import org.drools.runtime.process.WorkItemManager;
-import org.jboss.seam.drools.qualifiers.WIHandler;
-
- at WIHandler(name="dummy1")
-public class MyDummyWorkItemHandler implements WorkItemHandler
-{
-
-   public void abortWorkItem(WorkItem arg0, WorkItemManager arg1)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void executeWorkItem(WorkItem arg0, WorkItemManager arg1)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-}

Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyKnowledgeSessionEventListener.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyKnowledgeSessionEventListener.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyKnowledgeSessionEventListener.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,62 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import org.drools.event.process.ProcessCompletedEvent;
-import org.drools.event.process.ProcessEventListener;
-import org.drools.event.process.ProcessNodeLeftEvent;
-import org.drools.event.process.ProcessNodeTriggeredEvent;
-import org.drools.event.process.ProcessStartedEvent;
-import org.jboss.seam.drools.qualifiers.KSessionEventListener;
-
- at KSessionEventListener
-public class MyKnowledgeSessionEventListener implements ProcessEventListener
-{
-
-   public void afterNodeLeft(ProcessNodeLeftEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void afterProcessCompleted(ProcessCompletedEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void afterProcessStarted(ProcessStartedEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void beforeNodeLeft(ProcessNodeLeftEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void beforeNodeTriggered(ProcessNodeTriggeredEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void beforeProcessCompleted(ProcessCompletedEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void beforeProcessStarted(ProcessStartedEvent arg0)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-   
-}

Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyOtherDummyWorkItemHandler.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyOtherDummyWorkItemHandler.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyOtherDummyWorkItemHandler.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,24 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import org.drools.runtime.process.WorkItem;
-import org.drools.runtime.process.WorkItemHandler;
-import org.drools.runtime.process.WorkItemManager;
-import org.jboss.seam.drools.qualifiers.WIHandler;
-
- at WIHandler(name="dummy2")
-public class MyOtherDummyWorkItemHandler implements WorkItemHandler
-{
-
-   public void abortWorkItem(WorkItem arg0, WorkItemManager arg1)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-
-   public void executeWorkItem(WorkItem arg0, WorkItemManager arg1)
-   {
-      // TODO Auto-generated method stub
-      
-   }
-   
-}

Deleted: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MySecondKnowledgeBaseEventListener.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MySecondKnowledgeBaseEventListener.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MySecondKnowledgeBaseEventListener.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,13 +0,0 @@
-package org.jboss.seam.drools.test.kbase;
-
-import org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener;
-import org.drools.event.knowledgebase.KnowledgeBaseEventListener;
-import org.jboss.seam.drools.qualifiers.KBaseEventListener;
-
- at KBaseEventListener
-public class MySecondKnowledgeBaseEventListener extends DefaultKnowledgeBaseEventListener implements KnowledgeBaseEventListener
-{
-   public MySecondKnowledgeBaseEventListener() {
-      super();
-   }
-}
\ No newline at end of file

Modified: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/SimpleTemplateDataProvider.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/SimpleTemplateDataProvider.java	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/SimpleTemplateDataProvider.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -8,7 +8,7 @@
 import org.jboss.seam.drools.TemplateDataProvider;
 import org.jboss.seam.drools.qualifiers.TemplateData;
 
- at TemplateData(name="forkbasetest")
+ at TemplateData("forkbasetest")
 public class SimpleTemplateDataProvider implements TemplateDataProvider
 {
    private static Collection<Map<String, Object>> templateData = new ArrayList<Map<String,Object>>();

Added: 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	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,50 @@
+package org.jboss.seam.drools.test.ksession;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.inject.Inject;
+
+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.KBaseConfigured;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.formatter.Formatters;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.extensions.resources.ResourceProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class KSessionTest
+{
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      String pkgPath = KSessionTest.class.getPackage().getName().replaceAll("\\.", "/");
+      JavaArchive archive = Archives.create("test.jar", JavaArchive.class)
+      .addPackages(true, KnowledgeBaseProducer.class.getPackage())
+      .addPackages(true, ResourceProvider.class.getPackage())
+      .addClass(KSessionTestQualifier.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"))
+      .addManifestResource(pkgPath + "/KSessionTest-beans.xml", ArchivePaths.create("beans.xml"));
+      System.out.println(archive.toString(Formatters.VERBOSE));
+      return archive;
+   }
+   
+   @Inject 
+   @KSessionTestQualifier 
+   @KBaseConfigured 
+   StatefulKnowledgeSession ksession;
+   
+   @Test
+   public void testKSession()
+   {
+      assertNotNull(ksession);
+   }
+}

Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestQualifier.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestQualifier.java	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTestQualifier.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,24 @@
+package org.jboss.seam.drools.test.ksession;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { TYPE, METHOD, FIELD, PARAMETER })
+ at Documented
+ at Retention(RUNTIME)
+ at Inherited
+public @interface KSessionTestQualifier
+{
+
+}

Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyDummyWorkItemHandler.java (from rev 12440, modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyDummyWorkItemHandler.java)
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyDummyWorkItemHandler.java	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyDummyWorkItemHandler.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,24 @@
+package org.jboss.seam.drools.test.ksession;
+
+import org.drools.runtime.process.WorkItem;
+import org.drools.runtime.process.WorkItemHandler;
+import org.drools.runtime.process.WorkItemManager;
+import org.jboss.seam.drools.qualifiers.WIHandler;
+
+ at WIHandler("dummy1")
+public class MyDummyWorkItemHandler implements WorkItemHandler
+{
+
+   public void abortWorkItem(WorkItem arg0, WorkItemManager arg1)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void executeWorkItem(WorkItem arg0, WorkItemManager arg1)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+}

Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyKnowledgeSessionEventListener.java (from rev 12440, modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MyKnowledgeSessionEventListener.java)
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyKnowledgeSessionEventListener.java	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MyKnowledgeSessionEventListener.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,62 @@
+package org.jboss.seam.drools.test.ksession;
+
+import org.drools.event.process.ProcessCompletedEvent;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.process.ProcessNodeLeftEvent;
+import org.drools.event.process.ProcessNodeTriggeredEvent;
+import org.drools.event.process.ProcessStartedEvent;
+import org.jboss.seam.drools.qualifiers.KSessionEventListener;
+
+ at KSessionEventListener
+public class MyKnowledgeSessionEventListener implements ProcessEventListener
+{
+
+   public void afterNodeLeft(ProcessNodeLeftEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void afterProcessCompleted(ProcessCompletedEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void afterProcessStarted(ProcessStartedEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void beforeNodeLeft(ProcessNodeLeftEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void beforeNodeTriggered(ProcessNodeTriggeredEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void beforeProcessCompleted(ProcessCompletedEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+   public void beforeProcessStarted(ProcessStartedEvent arg0)
+   {
+      // TODO Auto-generated method stub
+      
+   }
+   
+}

Copied: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MySecondKnowledgeBaseEventListener.java (from rev 12440, modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kbase/MySecondKnowledgeBaseEventListener.java)
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MySecondKnowledgeBaseEventListener.java	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/MySecondKnowledgeBaseEventListener.java	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,13 @@
+package org.jboss.seam.drools.test.ksession;
+
+import org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener;
+import org.drools.event.knowledgebase.KnowledgeBaseEventListener;
+import org.jboss.seam.drools.qualifiers.KBaseEventListener;
+
+ at KBaseEventListener
+public class MySecondKnowledgeBaseEventListener extends DefaultKnowledgeBaseEventListener implements KnowledgeBaseEventListener
+{
+   public MySecondKnowledgeBaseEventListener() {
+      super();
+   }
+}
\ No newline at end of file

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-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/KBaseTest-beans.xml	2010-04-13 19:24:35 UTC (rev 12479)
@@ -6,7 +6,7 @@
 
    <drools:DroolsConfiguration>
       <s:overrides/>
-      <test:ForKBaseTest/>
+      <test:KBaseTestQualifier/>
       <drools:knowledgeBuilderConfigPath>kbuilderconfig.properties</drools:knowledgeBuilderConfigPath>
       <drools:knowledgeBaseConfigPath>kbaseconfig.properties</drools:knowledgeBaseConfigPath>
       <drools:ruleResources>
@@ -17,11 +17,11 @@
    <drools:KnowledgeBaseProducer>
       <s:specializes/>
       <drools:produceKBase>
-         <test:ForKBaseTest/>
+         <test:KBaseTestQualifier/>
          <s:parameters>
             <drools:DroolsConfiguration>
                <s:Inject/>
-               <test:ForKBaseTest/>
+               <test:KBaseTestQualifier/>
             </drools:DroolsConfiguration>
          </s:parameters>
       </drools:produceKBase>
@@ -32,11 +32,11 @@
    <drools:KnowledgeBaseProducer>
       <s:specializes/>
       <drools:produceKBase>
-         <test:ForKBaseTest/>
+         <test:KBaseTestQualifier/>
          <s:parameters>
             <s:Instance>
 				<s:Inject/>
-				<test:ForKBaseTest/>
+				<test:KBaseTestQualifier/>
 			</s:Instance>
          </s:parameters>
       </drools:produceKBase>

Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbasetest.drl	2010-04-13 19:24:35 UTC (rev 12479)
@@ -1,7 +1,7 @@
 template header
 name
 
-package org.jboss.seam.drools.kbase
+package org.jboss.seam.drools.test.kbase
 
 template "kbasetesttemplate"
 rule "say hello to @{name}"

Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties	2010-04-13 17:55:46 UTC (rev 12478)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kbase/kbuilderconfig.properties	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1 @@
+drools.dialect.java.lngLevel=1.5

Added: 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	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/KSessionTest-beans.xml	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1,47 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" 
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns:s="urn:java:seam:core"
+   xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+   xmlns:drools="urn:java:org.drools:org.drools.runtime"
+   xmlns:test="urn:java:org.jboss.seam.drools.test.ksession">
+
+   <d:DroolsConfiguration>
+      <s:overrides/>
+      <test:KSessionTestQualifier/>
+      <d:knowledgeBuilderConfigPath>kbuilderconfig.properties</d:knowledgeBuilderConfigPath>
+      <d:knowledgeBaseConfigPath>kbaseconfig.properties</d:knowledgeBaseConfigPath>
+      <d:ruleResources>
+         <s:value>classpath;ksessiontest.drl;DRL</s:value>
+      </d:ruleResources>
+   </d:DroolsConfiguration>
+
+   <d:KnowledgeBaseProducer>
+      <s:specializes/>
+      <d:produceKBase>
+         <test:KSessionTestQualifier/>
+         <s:parameters>
+            <d:DroolsConfiguration>
+               <s:Inject/>
+               <test:KSessionTestQualifier/>
+            </d:DroolsConfiguration>
+         </s:parameters>
+      </d:produceKBase>
+   </d:KnowledgeBaseProducer>
+   
+   <d:KnowledgeSessionProducer>
+   	<s:specializes/>
+   	<d:produceStatefulSession>
+   		<test:KSessionTestQualifier/>
+   		<s:parameters>
+   			<drools:KnowledgeBase>
+   				<s:Inject/>
+   				<test:KSessionTestQualifier/>
+   			</drools:KnowledgeBase>
+   			<d:DroolsConfiguration>
+   				<s:Inject/>
+   				<test:KSessionTestQualifier/>
+   			</d:DroolsConfiguration>
+   		</s:parameters>
+   	</d:produceStatefulSession>
+   </d:KnowledgeSessionProducer>
+</beans>       

Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/kbaseconfig.properties
===================================================================

Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/kbuilderconfig.properties
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/kbuilderconfig.properties	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/kbuilderconfig.properties	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1 @@
+drools.dialect.java.lngLevel=1.5

Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/ksessiontest.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/ksessiontest.drl	                        (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/ksession/ksessiontest.drl	2010-04-13 19:24:35 UTC (rev 12479)
@@ -0,0 +1 @@
+package org.jboss.seam.drools.test.ksession



More information about the seam-commits mailing list