Author: dan.j.allen
Date: 2009-05-12 03:11:03 -0400 (Tue, 12 May 2009)
New Revision: 10898
Added:
modules/trunk/webbeans-bridge/src/test/
modules/trunk/webbeans-bridge/src/test/java/
modules/trunk/webbeans-bridge/src/test/java/org/
modules/trunk/webbeans-bridge/src/test/java/org/jboss/
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/webbeans/
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/webbeans/WebBeansManagerBridgeTest.java
modules/trunk/webbeans-bridge/src/test/resources/
modules/trunk/webbeans-bridge/src/test/resources/org/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/packaging/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
modules/trunk/webbeans-bridge/src/test/resources/test-suite.xml
Modified:
modules/trunk/webbeans-bridge/pom.xml
Log:
add tests to verify the WebBeansManagerProvider is loaded properly
Modified: modules/trunk/webbeans-bridge/pom.xml
===================================================================
--- modules/trunk/webbeans-bridge/pom.xml 2009-05-12 07:00:44 UTC (rev 10897)
+++ modules/trunk/webbeans-bridge/pom.xml 2009-05-12 07:11:03 UTC (rev 10898)
@@ -15,29 +15,12 @@
<name>Seam Web Beans Bridge</name>
<description>An implementation of the Seam Bridge SPI to obtain a Web Beans
Manager.</description>
- <build>
- <plugins>
-
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <suiteXmlFiles>
-
<suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
- </suiteXmlFiles>
- </configuration>
- </plugin>
- -->
-
- </plugins>
- </build>
-
<dependencies>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -59,4 +42,20 @@
</dependencies>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+
<suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
</project>
Added:
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/webbeans/WebBeansManagerBridgeTest.java
===================================================================
---
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/webbeans/WebBeansManagerBridgeTest.java
(rev 0)
+++
modules/trunk/webbeans-bridge/src/test/java/org/jboss/seam/bridge/webbeans/WebBeansManagerBridgeTest.java 2009-05-12
07:11:03 UTC (rev 10898)
@@ -0,0 +1,47 @@
+package org.jboss.seam.bridge.webbeans;
+
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+
+import javax.context.RequestScoped;
+import javax.inject.manager.Manager;
+
+import org.jboss.seam.bridge.ManagerBridge;
+import org.jboss.seam.bridge.spi.ManagerProvider;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.el.WebBeansELResolver;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * This test method bootstraps the WebBeans Manager with the ManagerBridge registered to
+ * verify that the ServiceLoader properly detects the correct ManagerProvider
+ * from META-INF/services/org.jboss.seam.bridge.spi.ManagerProvider. There
+ * should only be one method in this test class.
+ *
+ * @author Dan Allen
+ */
+public
+@Artifact
+(a)Classes(ManagerBridge.class)
+class WebBeansManagerBridgeTest extends AbstractWebBeansTest
+{
+ /**
+ * Check that when Web Beans booted, the ManagerBridge was instantiated
+ * and that the ServiceLoader detected and instantiated the ManagerProvider
+ * instance.
+ */
+ @Test
+ public void testLoadValidManagerProvider()
+ {
+ ManagerProvider provider = ManagerBridge.getProvider();
+ assertTrue(provider instanceof WebBeansManagerProvider);
+ assertSame(provider.getRootManager(), getCurrentManager());
+ assertSame(provider.getCurrentManager(), getCurrentManager());
+ Manager currentManager = getCurrentManager().setCurrent(RequestScoped.class);
+ assertSame(provider.getCurrentManager(), currentManager);
+ assertTrue(provider.getELResolver() instanceof WebBeansELResolver);
+ }
+
+}
Added:
modules/trunk/webbeans-bridge/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
===================================================================
Added: modules/trunk/webbeans-bridge/src/test/resources/test-suite.xml
===================================================================
--- modules/trunk/webbeans-bridge/src/test/resources/test-suite.xml
(rev 0)
+++ modules/trunk/webbeans-bridge/src/test/resources/test-suite.xml 2009-05-12 07:11:03
UTC (rev 10898)
@@ -0,0 +1,8 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="Seam - Web Beans Bridge Module Test Suite"
verbose="1">
+ <test name="Seam - Web Beans Bridge Module - Unit Tests">
+ <packages>
+ <package name="org.jboss.seam.bridge.webbeans"/>
+ </packages>
+ </test>
+</suite>
Show replies by date