Author: dan.j.allen
Date: 2009-05-05 01:33:08 -0400 (Tue, 05 May 2009)
New Revision: 2650
Added:
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java
extensions/trunk/servlet/tests/src/test/resources/META-INF/
extensions/trunk/servlet/tests/src/test/resources/META-INF/beans.xml
Modified:
extensions/trunk/servlet/tests/pom.xml
Log:
WBX-38 add test to verify that the scanner properly locates META-INF/beans.xml files
Modified: extensions/trunk/servlet/tests/pom.xml
===================================================================
--- extensions/trunk/servlet/tests/pom.xml 2009-05-05 05:32:13 UTC (rev 2649)
+++ extensions/trunk/servlet/tests/pom.xml 2009-05-05 05:33:08 UTC (rev 2650)
@@ -32,11 +32,32 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jbossws</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-transaction-api</artifactId>
+ <groupId>org.jboss.javaee</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core-test</artifactId>
<scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version> <!-- waiting on >=
1.0.0.PREVIEW2 -->
</dependency>
<dependency>
@@ -61,6 +82,13 @@
<artifactId>webbeans-spi</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>webbeans-servlet-int</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-SNAPSHOT</version> <!-- waiting on >= 1.0.0.CR2
-->
+ </dependency>
<dependency>
<groupId>javax.el</groupId>
Added:
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java
===================================================================
---
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java
(rev 0)
+++
extensions/trunk/servlet/tests/src/test/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscoveryTest.java 2009-05-05
05:33:08 UTC (rev 2650)
@@ -0,0 +1,41 @@
+package org.jboss.webbeans.environment.servlet.discovery;
+
+import java.net.URL;
+import java.util.Set;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.mock.MockServletContext;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+/**
+ * A set of tests to verify the discovery of JSR-299 resources in a servlet environment.
+ *
+ * @author Dan Allen
+ */
+@Artifact
+// for now we are just going to look for the one in test-classes/META-INF/beans.xml using
standalone mode
+//@Resources(
+// @Resource(source = "beans.xml", destination =
"WEB-INF/classes/META-INF/beans.xml")
+//)
+public class ServletWebBeanDiscoveryTest extends AbstractWebBeansTest
+{
+ /**
+ * Verify that the scanner properly locates any META-INF/beans.xml. To prevent a
brittle test,
+ * assume that there is at least one found and that the path ends with
META-INF/beans.xml. Technically,
+ * META-INF would need to be the root of the classpath.
+ */
+ @Test
+ public void testDiscoverMetaInfBeansXml()
+ {
+ ServletWebBeanDiscovery discovery = new ServletWebBeanDiscovery(new
MockServletContext("."))
+ {
+ };
+
+ Set<URL> beansXmls = discovery.getWbUrls();
+ assert beansXmls.size() >= 1 : "Expecting to find at least one
META-INF/beans.xml resource on the test classpath";
+ for (URL beansXml : beansXmls)
+ {
+ assert beansXml.getPath().endsWith("META-INF/beans.xml") :
beansXml.getPath() + " does not end with META-INF/beans.xml as expected";
+ }
+ }
+}
Added: extensions/trunk/servlet/tests/src/test/resources/META-INF/beans.xml
===================================================================
Show replies by date