Seam SVN: r12371 - in branches/community/Seam_2_2: examples/restbay/src/org/jboss/seam/example/restbay/test and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-02 04:49:51 -0400 (Fri, 02 Apr 2010)
New Revision: 12371
Modified:
branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Webservices.xml
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
Log:
JBSEAM-4039 Seam components can now be JAX-RS subresources
Modified: branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Webservices.xml
===================================================================
--- branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Webservices.xml 2010-04-02 08:31:08 UTC (rev 12370)
+++ branches/community/Seam_2_2/doc/Seam_Reference_Guide/en-US/Webservices.xml 2010-04-02 08:49:51 UTC (rev 12371)
@@ -493,17 +493,25 @@
EJB Seam components are supported as REST resources. Always annotate the local business interface, not
the EJB implementation class, with JAX-RS annotations. The EJB has to be <literal>STATELESS</literal>.
</para>
+
+ <para>
+ Sub-resources as defined in the JAX RS specification, section 3.4.1, can also be Seam component instances:
+ </para>
+
+<programlisting role="JAVA"><![CDATA[@Path("/garage")
+@Name("garage")
+public class GarageService
+{
+ ...
+
+ @Path("/vehicles")
+ public VehicleService getVehicles() {
+ return (VehicleService) Component.getInstance(VehicleService.class);
+ }
+}]]></programlisting>
<note>
<para>
- Sub-resources as defined in the JAX RS specification, section 3.4.1, can not be Seam component instances
- at this time. Only root resource classes can be registered as Seam components. In other words, do not
- return a Seam component instance from a root resource method.
- </para>
- </note>
-
- <note>
- <para>
Provider classes can currently not be Seam components. Although you can configure an
<literal>@Provider</literal> annotated class as a Seam component, it will at runtime be managed
by RESTEasy as a singleton with no Seam interception, bijection, etc. The instance will not be
Modified: branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
===================================================================
--- branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2010-04-02 08:31:08 UTC (rev 12370)
+++ branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2010-04-02 08:49:51 UTC (rev 12371)
@@ -36,13 +36,11 @@
</classes>
</test>
- <!-- JBSEAM-4039
<test name="RestBay Subresources">
<classes>
<class name="org.jboss.seam.example.restbay.test.SubresourceTest"/>
</classes>
</test>
- -->
<test name="RestBay DBUnit Integration">
14 years, 9 months
Seam SVN: r12370 - branches/community/Seam_2_2/build.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-02 04:31:08 -0400 (Fri, 02 Apr 2010)
New Revision: 12370
Modified:
branches/community/Seam_2_2/build/root.pom.xml
Log:
JBSEAM-4627 Upgrade to RESTEasy 2.0-beta-2
Modified: branches/community/Seam_2_2/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/root.pom.xml 2010-04-02 08:20:44 UTC (rev 12369)
+++ branches/community/Seam_2_2/build/root.pom.xml 2010-04-02 08:31:08 UTC (rev 12370)
@@ -42,7 +42,7 @@
<version.wicket>1.3.5.jboss1</version.wicket>
<version.drools>5.0.1</version.drools>
<version.testng>5.10</version.testng>
- <version.resteasy>1.2.1.GA</version.resteasy>
+ <version.resteasy>2.0-beta-2</version.resteasy>
</properties>
<dependencyManagement>
14 years, 9 months
Seam SVN: r12369 - branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-02 04:20:44 -0400 (Fri, 02 Apr 2010)
New Revision: 12369
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
Log:
JBPAPP-4036 Workaround for Selenium tests on IE
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-04-02 08:00:56 UTC (rev 12368)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-04-02 08:20:44 UTC (rev 12369)
@@ -26,6 +26,7 @@
import java.io.OutputStreamWriter;
import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.SeleniumException;
import com.thoughtworks.selenium.Wait;
/**
@@ -41,6 +42,8 @@
private boolean icefacesDetection = false;
private long icefacesWaitTime = 1000;
private long windowMaximizeWaitTime = 5000L;
+ private boolean suppressSeleniumTimeoutException = true;
+
private final String ICEFACES_CONNECTION_STATUS = "xpath=//div[@class='iceOutConStat connectionStatus']";
private final String ICEFACES_IDLE_VISIBLE = "xpath=//div[@class='iceOutConStatInactv connectionStatusInactv'][@style='visibility: visible;']";
@@ -107,6 +110,26 @@
{
waitForIcefaces(icefacesWaitTime, Long.valueOf(timeout));
}
+ else if (suppressSeleniumTimeoutException)
+ {
+ try
+ {
+ super.waitForPageToLoad(timeout);
+ }
+ catch (SeleniumException e)
+ {
+ if (isTimeoutException(e))
+ {
+ // NOOP
+ // THIS IS A WORKAROUND FOR IE BEHAVIOR
+ // SEE JBPAPP-4036
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
else
{
super.waitForPageToLoad(timeout);
@@ -274,4 +297,48 @@
}
}.wait("Timeout while waiting for document body after icefaces click.", timeout);
}
+
+ @Override
+ public void open(String url)
+ {
+ if (suppressSeleniumTimeoutException)
+ {
+ try
+ {
+ super.open(url);
+ }
+ catch (SeleniumException e)
+ {
+ if (isTimeoutException(e))
+ {
+ // NOOP
+ // THIS IS A WORKAROUND FOR IE BEHAVIOR
+ // SEE JBPAPP-4036
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+ else
+ {
+ super.open(url);
+ }
+ }
+
+ private boolean isTimeoutException(SeleniumException e)
+ {
+ return e.getMessage().contains("Timed out");
+ }
+
+ public boolean isSuppressSeleniumTimeoutException()
+ {
+ return suppressSeleniumTimeoutException;
+ }
+
+ public void setSuppressSeleniumTimeoutException(boolean suppressSeleniumTimeoutException)
+ {
+ this.suppressSeleniumTimeoutException = suppressSeleniumTimeoutException;
+ }
}
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java 2010-04-02 08:00:56 UTC (rev 12368)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java 2010-04-02 08:20:44 UTC (rev 12369)
@@ -96,6 +96,11 @@
newBrowser.allowNativeXpath("false");
newBrowser.setSpeed(SPEED);
newBrowser.setTimeout(TIMEOUT);
+ if (BROWSER.contains("iexplore"))
+ {
+ // Turn on the workaround for JBPAPP-4036
+ newBrowser.setSuppressSeleniumTimeoutException(true);
+ }
return newBrowser;
}
14 years, 9 months
Seam SVN: r12368 - branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/web.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-02 04:00:56 -0400 (Fri, 02 Apr 2010)
New Revision: 12368
Modified:
branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/web/IdentityRequestWrapperTest.java
Log:
Fixed test ordering issue revealed by TestNG upgrade.
Modified: branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/web/IdentityRequestWrapperTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/web/IdentityRequestWrapperTest.java 2010-04-01 23:30:31 UTC (rev 12367)
+++ branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/web/IdentityRequestWrapperTest.java 2010-04-02 08:00:56 UTC (rev 12368)
@@ -29,6 +29,10 @@
public void testWithSeamSecurityEnabled()
{
HttpServletRequest request = initializeWrappedRequest();
+ if (!Identity.isSecurityEnabled())
+ {
+ Identity.setSecurityEnabled(true);
+ }
assert request.getUserPrincipal() != null && request.getUserPrincipal().getName().equals(SEAM_USER);
assert request.getRemoteUser() != null && request.getRemoteUser().equals(SEAM_USER);
assert request.isUserInRole(SEAM_ROLE);
14 years, 9 months
Seam SVN: r12367 - in modules/drools/trunk/core/src/test: resources and 1 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-01 19:30:31 -0400 (Thu, 01 Apr 2010)
New Revision: 12367
Added:
modules/drools/trunk/core/src/test/resources/META-INF/
modules/drools/trunk/core/src/test/resources/META-INF/beans.xml
Modified:
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
Log:
fix test
use beans.xml from /META-INF/beans.xml
Modified: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 23:30:04 UTC (rev 12366)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 23:30:31 UTC (rev 12367)
@@ -1,15 +1,13 @@
package org.jboss.seam.drools.kbase;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
import static org.junit.Assert.assertNotNull;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
+import junit.framework.Assert;
-import org.drools.KnowledgeBase;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
@@ -27,49 +25,38 @@
@Deployment
public static JavaArchive createTestArchive()
{
+ String pkgPath = KBaseTest.class.getPackage().getName().replaceAll("\\.", "/");
return Archives.create("test.jar", JavaArchive.class)
.addPackages(true, KnowledgeBaseProducer.class.getPackage())
- .addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbasetest.drl")
- .addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbuilderconfig.properties")
- .addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbaseconfig.properties")
- .addManifestResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/KBaseTest-beans.xml",
- ArchivePaths.create("beans.xml"));
+ .addResource(pkgPath + "/kbasetest.drl")
+ .addResource(pkgPath + "/kbuilderconfig.properties")
+ .addResource(pkgPath + "/kbaseconfig.properties")
+ .addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
+ // the XML bean config module doesn't pick up the beans.xml unless it's located at src/test/resources/META-INF/beans.xml
+ //.addManifestResource(pkgPath + "/KBaseTest-beans.xml", ArchivePaths.create("beans.xml"));
}
-
- @Inject BeanManager manager;
+
+ @Inject @Any Instance<KnowledgeBaseConfig> kbaseConfigResolver;
+ @Inject @KBaseConfig(name = "kbaseconfig1") KnowledgeBaseConfig config;
@Test
- public void testManager() {
- assertNotNull(manager);
- }
-
- @Test
public void testKBaseConfig() {
- Bean<KnowledgeBaseConfig> knowledgeBaseConfigBean = (Bean<KnowledgeBaseConfig>)
- manager.getBeans(KnowledgeBaseConfig.class, new KBaseConfigBinding("kbaseconfig1")).iterator().next();
-
- KnowledgeBaseConfig kbaseConfig = (KnowledgeBaseConfig) manager.getReference(knowledgeBaseConfigBean, KnowledgeBaseConfig.class, manager.createCreationalContext(knowledgeBaseConfigBean));
-
+ Assert.assertFalse(kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).isUnsatisfied());
+ KnowledgeBaseConfig kbaseConfig = kbaseConfigResolver.select(new KBaseConfigBinding("kbaseconfig1")).get();
assertNotNull(kbaseConfig);
System.out.println("**** " + kbaseConfig.getEventListeners());
}
- //@Test
- public void testKBase() {
- //assertNotNull(kbasebean.getKbase());
- //System.out.println("********* KBASE: " + kbasebean.getKbase());
- }
-
static class KBaseConfigBinding extends AnnotationLiteral<KBaseConfig> implements KBaseConfig
{
- private String value = null;
- public KBaseConfigBinding(String value)
+ private String name = null;
+ public KBaseConfigBinding(String name)
{
- this.value = value;
+ this.name = name;
}
public String name() {
- return value;
+ return name;
}
}
}
Added: modules/drools/trunk/core/src/test/resources/META-INF/beans.xml
===================================================================
--- modules/drools/trunk/core/src/test/resources/META-INF/beans.xml (rev 0)
+++ modules/drools/trunk/core/src/test/resources/META-INF/beans.xml 2010-04-01 23:30:31 UTC (rev 12367)
@@ -0,0 +1,35 @@
+<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:drools="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+ xmlns:drools-qualifier="urn:java:org.jboss.seam.drools.qualifier"
+ xmlns:drools-test="urn:java:org.jboss.seam.drools.kbase">
+
+ <drools:KnowledgeBaseConfig>
+ <s:overrides/>
+ <drools-qualifier:KBaseConfig name="kbaseconfig1" />
+ <drools:knowledgeBuilderConfig>kbuilderconfig.properties</drools:knowledgeBuilderConfig>
+ <drools:knowledgeBaseConfig>kbaseconfig.properties</drools:knowledgeBaseConfig>
+ <drools:ruleResources>
+ <s:value>classpath:kbasetest.drl:DRL</s:value>
+ </drools:ruleResources>
+ <drools:eventListeners>
+ <s:value>org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener
+ </s:value>
+ </drools:eventListeners>
+ </drools:KnowledgeBaseConfig>
+
+ <drools:KnowledgeBaseProducer>
+ <s:specializes />
+ <drools:produceKBase>
+ <drools-qualifier:KBase name="kbase1" />
+ <s:parameters>
+ <drools:KnowledgeBaseConfig>
+ <s:Inject />
+ <drools-qualifier:KBaseConfig name="kbaseconfig1" />
+ </drools:KnowledgeBaseConfig>
+ </s:parameters>
+ </drools:produceKBase>
+ </drools:KnowledgeBaseProducer>
+
+</beans>
\ No newline at end of file
14 years, 9 months
Seam SVN: r12366 - modules/drools/trunk/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-01 19:30:04 -0400 (Thu, 01 Apr 2010)
New Revision: 12366
Modified:
modules/drools/trunk/core/
Log:
ignore target
Property changes on: modules/drools/trunk/core
___________________________________________________________________
Name: svn:ignore
+ target
14 years, 9 months
Seam SVN: r12365 - modules/drools/trunk/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-01 19:28:02 -0400 (Thu, 01 Apr 2010)
New Revision: 12365
Modified:
modules/drools/trunk/core/pom.xml
Log:
add Seam XML bean config module to test classpath
Modified: modules/drools/trunk/core/pom.xml
===================================================================
--- modules/drools/trunk/core/pom.xml 2010-04-01 22:20:43 UTC (rev 12364)
+++ modules/drools/trunk/core/pom.xml 2010-04-01 23:28:02 UTC (rev 12365)
@@ -82,6 +82,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.seam.xml</groupId>
+ <artifactId>seam-xml-bean-config</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<scope>test</scope>
14 years, 9 months
Seam SVN: r12364 - modules/drools/trunk/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-04-01 18:20:43 -0400 (Thu, 01 Apr 2010)
New Revision: 12364
Modified:
modules/drools/trunk/core/pom.xml
Log:
pull in require repositories
Modified: modules/drools/trunk/core/pom.xml
===================================================================
--- modules/drools/trunk/core/pom.xml 2010-04-01 21:39:26 UTC (rev 12363)
+++ modules/drools/trunk/core/pom.xml 2010-04-01 22:20:43 UTC (rev 12364)
@@ -14,6 +14,26 @@
<packaging>jar</packaging>
<name>Seam Drools Core</name>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>apache.org-snapshots</id>
+ <name>Apache Snapshots Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
<groupId>javax.el</groupId>
14 years, 9 months
Seam SVN: r12363 - in modules/drools/trunk/core/src/test: resources/org/jboss/seam/drools/kbase and 1 other directory.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 17:39:26 -0400 (Thu, 01 Apr 2010)
New Revision: 12363
Removed:
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java
Modified:
modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml
Log:
removed kbasebean
Deleted: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java 2010-04-01 21:37:35 UTC (rev 12362)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java 2010-04-01 21:39:26 UTC (rev 12363)
@@ -1,28 +0,0 @@
-package org.jboss.seam.drools.kbase;
-
-import org.drools.KnowledgeBase;
-import org.jboss.seam.drools.config.KnowledgeBaseConfig;
-
-public class KBaseBean
-{
- private KnowledgeBaseConfig kbaseconfig;
- private KnowledgeBase kbase;
- public KnowledgeBaseConfig getKbaseconfig()
- {
- return kbaseconfig;
- }
- public void setKbaseconfig(KnowledgeBaseConfig kbaseconfig)
- {
- this.kbaseconfig = kbaseconfig;
- }
- public KnowledgeBase getKbase()
- {
- return kbase;
- }
- public void setKbase(KnowledgeBase kbase)
- {
- this.kbase = kbase;
- }
-
-
-}
Modified: modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml
===================================================================
--- modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml 2010-04-01 21:37:35 UTC (rev 12362)
+++ modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml 2010-04-01 21:39:26 UTC (rev 12363)
@@ -6,6 +6,7 @@
xmlns:drools-test="urn:java:org.jboss.seam.drools.kbase">
<drools:KnowledgeBaseConfig>
+ <s:overrides/>
<drools-qualifier:KBaseConfig name="kbaseconfig1" />
<drools:knowledgeBuilderConfig>kbuilderconfig.properties</drools:knowledgeBuilderConfig>
<drools:knowledgeBaseConfig>kbaseconfig.properties</drools:knowledgeBaseConfig>
@@ -30,16 +31,5 @@
</s:parameters>
</drools:produceKBase>
</drools:KnowledgeBaseProducer>
-
- <drools-test:KBaseBean>
- <drools-test:kbaseconfig>
- <drools-qualifier:KBaseConfig name="kbaseconfig1" />
- <s:Inject/>
- </drools-test:kbaseconfig>
- <drools-test:kbase>
- <drools-qualifier:KBase name="kbase1" />
- <s:Inject/>
- </drools-test:kbase>
- </drools-test:KBaseBean>
</beans>
\ No newline at end of file
14 years, 9 months
Seam SVN: r12362 - modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 17:37:35 -0400 (Thu, 01 Apr 2010)
New Revision: 12362
Modified:
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
Log:
added bean manager
Modified: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 20:03:51 UTC (rev 12361)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 21:37:35 UTC (rev 12362)
@@ -4,6 +4,9 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
import org.drools.KnowledgeBase;
@@ -11,6 +14,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
import org.jboss.seam.drools.config.KnowledgeBaseConfig;
+import org.jboss.seam.drools.qualifier.KBaseConfig;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -25,7 +29,6 @@
{
return Archives.create("test.jar", JavaArchive.class)
.addPackages(true, KnowledgeBaseProducer.class.getPackage())
- .addClass(KBaseBean.class)
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbasetest.drl")
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbuilderconfig.properties")
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbaseconfig.properties")
@@ -33,22 +36,41 @@
ArchivePaths.create("beans.xml"));
}
- @Inject KBaseBean kbasebean;
+ @Inject BeanManager manager;
- @Test
- public void testKBaseBean() {
- assertNotNull(kbasebean);
+ @Test
+ public void testManager() {
+ assertNotNull(manager);
}
@Test
public void testKBaseConfig() {
- assertNotNull(kbasebean.getKbaseconfig());
+ Bean<KnowledgeBaseConfig> knowledgeBaseConfigBean = (Bean<KnowledgeBaseConfig>)
+ manager.getBeans(KnowledgeBaseConfig.class, new KBaseConfigBinding("kbaseconfig1")).iterator().next();
+
+ KnowledgeBaseConfig kbaseConfig = (KnowledgeBaseConfig) manager.getReference(knowledgeBaseConfigBean, KnowledgeBaseConfig.class, manager.createCreationalContext(knowledgeBaseConfigBean));
+
+ assertNotNull(kbaseConfig);
+ System.out.println("**** " + kbaseConfig.getEventListeners());
}
//@Test
public void testKBase() {
- assertNotNull(kbasebean.getKbase());
- System.out.println("********* KBASE: " + kbasebean.getKbase());
+ //assertNotNull(kbasebean.getKbase());
+ //System.out.println("********* KBASE: " + kbasebean.getKbase());
}
+
+ static class KBaseConfigBinding extends AnnotationLiteral<KBaseConfig> implements KBaseConfig
+ {
+ private String value = null;
+ public KBaseConfigBinding(String value)
+ {
+ this.value = value;
+ }
+
+ public String name() {
+ return value;
+ }
+ }
}
14 years, 9 months