[seam-commits] Seam SVN: r12549 - in modules/drools/trunk/impl/src/test: java/org/jboss/seam/drools/test/interceptors and 5 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Apr 21 15:35:10 EDT 2010
Author: tsurdilovic
Date: 2010-04-21 15:35:09 -0400 (Wed, 21 Apr 2010)
New Revision: 12549
Added:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestFilter.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/Person.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstest.drl
Modified:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml
Log:
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTest.java 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.interceptors;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
+
+import javax.inject.Inject;
+import javax.validation.constraints.AssertTrue;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.drools.KnowledgeBaseProducer;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+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 InterceptorsTest
+{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ String pkgPath = InterceptorsTest.class.getPackage().getName().replaceAll("\\.", "/");
+ JavaArchive archive = Archives.create("test.jar", JavaArchive.class)
+ .addPackages(true, new InterceptorsTestFilter(), KnowledgeBaseProducer.class.getPackage())
+ .addPackages(true, ResourceProvider.class.getPackage())
+ .addClass(Person.class)
+ .addClass(InterceptorsTestBean.class)
+ .addResource(pkgPath + "/interceptorstest.drl", ArchivePaths.create("interceptorstest.drl"))
+ .addManifestResource(pkgPath + "/InterceptorsTest-beans.xml", ArchivePaths.create("beans.xml"));
+ //System.out.println(archive.toString(Formatters.VERBOSE));
+ return archive;
+ }
+
+ @Inject InterceptorsTestBean ibean;
+
+ @Test
+ public void testInterceptors() {
+ assertNotNull(ibean);
+
+ ibean.getPerson();
+ assertTrue(true);
+ }
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestBean.java 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.interceptors;
+
+import javax.enterprise.inject.Default;
+
+import org.jboss.seam.drools.annotations.InsertFact;
+import org.jboss.seam.drools.qualifiers.config.DefaultConfig;
+
+public class InterceptorsTestBean
+{
+ @InsertFact(fire=true) @Default @DefaultConfig
+ public Person getPerson() {
+ System.out.println("*********** \n\nIN GETPERSON\n\n**************");
+ return new Person();
+ }
+}
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestFilter.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestFilter.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/InterceptorsTestFilter.java 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.interceptors;
+
+import org.jboss.shrinkwrap.api.Filter;
+
+public class InterceptorsTestFilter implements Filter<Class<?>>
+{
+
+ public boolean include(Class<?> clazz)
+ {
+ // exclude classes in all other test packages except your own
+ if(clazz.getPackage().getName().startsWith("org.jboss.seam.drools.test")
+ && !clazz.getPackage().getName().equals(InterceptorsTestFilter.class.getPackage().getName())) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+}
\ No newline at end of file
Added: modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/Person.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/Person.java (rev 0)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/interceptors/Person.java 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.interceptors;
+
+public class Person
+{
+ private String name;
+ private String telephoneNumber;
+ private int age;
+ private boolean eligible;
+
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+ public String getTelephoneNumber()
+ {
+ return telephoneNumber;
+ }
+ public void setTelephoneNumber(String telephoneNumber)
+ {
+ this.telephoneNumber = telephoneNumber;
+ }
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public boolean isEligible()
+ {
+ return eligible;
+ }
+
+ public void setEligible(boolean eligible)
+ {
+ this.eligible = eligible;
+ }
+
+
+
+}
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-04-21 18:32:06 UTC (rev 12548)
+++ modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/ksession/KSessionTest.java 2010-04-21 19:35:09 UTC (rev 12549)
@@ -77,11 +77,5 @@
assertNotSame(ksession, mvelksession);
assertSame(mvelksession, mvelksession2);
- doSomething();
}
-
- @InsertFact @Default @DefaultConfig
- public void doSomething() {
-
- }
-}
+ }
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml 2010-04-21 18:32:06 UTC (rev 12548)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/cep/CEPTest-beans.xml 2010-04-21 19:35:09 UTC (rev 12549)
@@ -22,7 +22,7 @@
<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:test="urn:java:org.jboss.seam.drools.test.ksession">
+ xmlns:test="urn:java:org.jboss.seam.drools.test.cep">
<d:CEPPseudoClockRuleResources>
<s:specializes/>
Modified: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml 2010-04-21 18:32:06 UTC (rev 12548)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/flow/FlowTest-beans.xml 2010-04-21 19:35:09 UTC (rev 12549)
@@ -22,7 +22,7 @@
<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:test="urn:java:org.jboss.seam.drools.test.ksession">
+ xmlns:test="urn:java:org.jboss.seam.drools.test.flow">
<d:DefaultRuleResources>
<s:specializes/>
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/InterceptorsTest-beans.xml 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,38 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc., and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<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:test="urn:java:org.jboss.seam.drools.test.interceptors">
+
+ <d:DefaultRuleResources>
+ <s:specializes/>
+ <d:resources>
+ <s:value>classpath;interceptorstest.drl;DRL</s:value>
+ </d:resources>
+ </d:DefaultRuleResources>
+
+ <test:InterceptorsTestBean>
+ <s:overrides/>
+ </test:InterceptorsTestBean>
+
+</beans>
Added: modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstest.drl
===================================================================
--- modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstest.drl (rev 0)
+++ modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstest.drl 2010-04-21 19:35:09 UTC (rev 12549)
@@ -0,0 +1,14 @@
+package org.jboss.seam.drools.test.interceptors
+
+import org.jboss.seam.drools.test.interceptors.Person;
+
+rule "is person eligible for buss pass"
+lock-on-active
+when
+ $p : Person( age >=18 )
+then
+ modify($p) {
+ setEligible(true);
+ }
+end
+
More information about the seam-commits
mailing list