[jboss-cvs] JBossAS SVN: r94610 - in projects/metadata/web/tags: 2.0.0.Alpha4 and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 9 12:12:53 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-09 12:12:52 -0400 (Fri, 09 Oct 2009)
New Revision: 94610
Added:
projects/metadata/web/tags/2.0.0.Alpha4/
projects/metadata/web/tags/2.0.0.Alpha4/.classpath
projects/metadata/web/tags/2.0.0.Alpha4/pom.xml
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/annotation/creator/web/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/jboss/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/spec/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/resources/schema/
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/binding/
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java
projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml
projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties
Removed:
projects/metadata/web/tags/2.0.0.Alpha4/.classpath
projects/metadata/web/tags/2.0.0.Alpha4/pom.xml
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/annotation/creator/web/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/jboss/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/spec/
projects/metadata/web/tags/2.0.0.Alpha4/src/main/resources/schema/
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/binding/
projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java
projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml
projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties
Log:
[maven-release-plugin] copy for tag 2.0.0.Alpha4
Copied: projects/metadata/web/tags/2.0.0.Alpha4 (from rev 93709, projects/metadata/web/trunk)
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/.classpath
===================================================================
--- projects/metadata/web/trunk/.classpath 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/.classpath 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,50 +0,0 @@
-<classpath>
- <classpathentry kind="src" path="src/test/java" output="target/tests-classes" including="**/*.java"/>
- <classpathentry kind="src" path="src/test/resources" output="target/tests-classes" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
- <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar" sourcepath="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/>
- <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.14.GA/jboss-common-core-2.2.14.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.14.GA/jboss-common-core-2.2.14.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/1.0.0/jboss-ejb3-ext-api-1.0.0.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/1.0.0/jboss-ejb3-ext-api-1.0.0-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxws/3.0.1-native-2.0.4.GA/jboss-jaxws-3.0.1-native-2.0.4.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.GA/jboss-mdr-2.0.0.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-security-spi/2.0.3.SP1/jboss-security-spi-2.0.3.SP1.jar" sourcepath="M2_REPO/org/jboss/security/jboss-security-spi/2.0.3.SP1/jboss-security-spi-2.0.3.SP1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/1.0.2.GA/jboss-server-manager-1.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/1.0.2.GA/jboss-server-manager-1.0.2.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.4.GA/jboss-test-1.1.4.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.4.GA/jboss-test-1.1.4.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx-client/2.0.3.SP1/jbosssx-client-2.0.3.SP1.jar" sourcepath="M2_REPO/org/jboss/security/jbosssx-client/2.0.3.SP1/jbosssx-client-2.0.3.SP1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.6.GA/jbossws-spi-1.0.6.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/web/servlet-api/3.0.0.alpha-3/servlet-api-3.0.0.alpha-3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1-sources.jar">
- <attributes>
- <attribute value="jar:file:/C:/Users/avoka/.m2/repository/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/jboss/naming/jnp-client/5.0.1.GA/jnp-client-5.0.1.GA.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-tests.jar" sourcepath="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-test-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-</classpath>
Copied: projects/metadata/web/tags/2.0.0.Alpha4/.classpath (from rev 94608, projects/metadata/web/trunk/.classpath)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/.classpath (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/.classpath 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry including="**/*.java" kind="src" output="target/tests-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/tests-classes" path="src/test/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar" sourcepath="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.14.GA/jboss-common-core-2.2.14.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.14.GA/jboss-common-core-2.2.14.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.CR1/jboss-ejb-api-3.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/1.0.0/jboss-ejb3-ext-api-1.0.0.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/1.0.0/jboss-ejb3-ext-api-1.0.0-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxws/3.0.1-native-2.0.4.GA/jboss-jaxws-3.0.1-native-2.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.GA/jboss-mdr-2.0.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.2.GA/jboss-reflect-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-security-spi/2.0.3.SP1/jboss-security-spi-2.0.3.SP1.jar" sourcepath="M2_REPO/org/jboss/security/jboss-security-spi/2.0.3.SP1/jboss-security-spi-2.0.3.SP1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/1.0.2.GA/jboss-server-manager-1.0.2.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/1.0.2.GA/jboss-server-manager-1.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.4.GA/jboss-test-1.1.4.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.4.GA/jboss-test-1.1.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.CR1/jboss-transaction-api-1.0.1.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx-client/2.0.3.SP1/jbosssx-client-2.0.3.SP1.jar" sourcepath="M2_REPO/org/jboss/security/jbosssx-client/2.0.3.SP1/jbosssx-client-2.0.3.SP1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ws/jbossws-spi/1.0.6.GA/jbossws-spi-1.0.6.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/web/servlet-api/3.0.0.alpha-6/servlet-api-3.0.0.alpha-6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1-sources.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="jar:file:/C:/Users/avoka/.m2/repository/org/jboss/jbossxb/2.0.2.Beta1/jbossxb-2.0.2.Beta1-javadoc.jar!/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/naming/jnp-client/5.0.1.GA/jnp-client-5.0.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-tests.jar" sourcepath="M2_REPO/org/jboss/metadata/metadata-common/2.0.0-SNAPSHOT/metadata-common-2.0.0-SNAPSHOT-test-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/pom.xml
===================================================================
--- projects/metadata/web/trunk/pom.xml 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/pom.xml 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,144 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>4.0.CR1</version>
- </parent>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata-war</artifactId>
- <packaging>jar</packaging>
- <version>2.0.0-SNAPSHOT</version>
- <name>JBoss Metadata WAR</name>
- <url>http://www.jboss.org</url>
- <description>The common JavaEE metadata classes</description>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/metadata/web/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/web/trunk/</developerConnection>
- </scm>
-
- <build>
- <outputDirectory>${profile.outputDirectory}</outputDirectory>
- <testOutputDirectory>${profile.testOutputDirectory}</testOutputDirectory>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <printSummary>true</printSummary>
- <disableXmlReport>false</disableXmlReport>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <testFailureIgnore>false</testFailureIgnore>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshot Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <!--
- Eclipse settings have been removed from parent. This needs to be
- done via an eclipse profile.
- http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896
- -->
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <profile.outputDirectory>target/classes</profile.outputDirectory>
- <profile.testOutputDirectory>target/tests-classes</profile.testOutputDirectory>
- </properties>
- </profile>
-
- <profile>
- <id>eclipse</id>
- <properties>
- <profile.outputDirectory>eclipse-target/classes</profile.outputDirectory>
- <profile.testOutputDirectory>eclipse-target/tests-classes</profile.testOutputDirectory>
- </properties>
- </profile>
- </profiles>
-
- <!-- Compile Dependencies -->
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata-common</artifactId>
- <version>2.0.0.Alpha</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata-common</artifactId>
- <version>2.0.0.Alpha</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>jboss.web</groupId>
- <artifactId>servlet-api</artifactId>
- <version>3.0.0.alpha-3</version>
- </dependency>
-
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>1.1.4.GA</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
\ No newline at end of file
Copied: projects/metadata/web/tags/2.0.0.Alpha4/pom.xml (from rev 94609, projects/metadata/web/trunk/pom.xml)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/pom.xml (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/pom.xml 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,144 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4.0.CR1</version>
+ </parent>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata-war</artifactId>
+ <packaging>jar</packaging>
+ <version>2.0.0.Alpha4</version>
+ <name>JBoss Metadata WAR</name>
+ <url>http://www.jboss.org</url>
+ <description>The common JavaEE metadata classes</description>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/metadata/web/tags/2.0.0.Alpha4</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/metadata/web/tags/2.0.0.Alpha4</developerConnection>
+ </scm>
+
+ <build>
+ <outputDirectory>${profile.outputDirectory}</outputDirectory>
+ <testOutputDirectory>${profile.testOutputDirectory}</testOutputDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <!--
+ Eclipse settings have been removed from parent. This needs to be
+ done via an eclipse profile.
+ http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085896#4085896
+ -->
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <profile.outputDirectory>target/classes</profile.outputDirectory>
+ <profile.testOutputDirectory>target/tests-classes</profile.testOutputDirectory>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>eclipse</id>
+ <properties>
+ <profile.outputDirectory>eclipse-target/classes</profile.outputDirectory>
+ <profile.testOutputDirectory>eclipse-target/tests-classes</profile.testOutputDirectory>
+ </properties>
+ </profile>
+ </profiles>
+
+ <!-- Compile Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata-common</artifactId>
+ <version>2.0.0.Alpha2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata-common</artifactId>
+ <version>2.0.0.Alpha2</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api</artifactId>
+ <version>1.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.metadata</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>3.0.0.alpha-6</version>
+ </dependency>
+
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.1.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/annotation/creator/web (from rev 94608, projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web)
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/jboss (from rev 94608, projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss)
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/main/java/org/jboss/metadata/web/spec (from rev 94608, projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec)
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/main/resources/schema (from rev 94608, projects/metadata/web/trunk/src/main/resources/schema)
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java
===================================================================
--- projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,519 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
- * 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.test.metadata.annotation.web;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.annotation.Resource;
-import javax.annotation.Resources;
-import javax.annotation.security.DeclareRoles;
-import javax.annotation.security.RunAs;
-import javax.ejb.EJB;
-import javax.ejb.EJBs;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContexts;
-import javax.persistence.PersistenceUnit;
-import javax.persistence.PersistenceUnits;
-import javax.servlet.annotation.WebFilter;
-import javax.servlet.annotation.WebListener;
-import javax.servlet.annotation.WebServlet;
-import javax.transaction.UserTransaction;
-import javax.xml.ws.WebServiceRef;
-import javax.xml.ws.WebServiceRefs;
-
-import org.jboss.metadata.annotation.creator.AnnotationContext;
-import org.jboss.metadata.annotation.creator.web.Web30MetaDataCreator;
-import org.jboss.metadata.annotation.finder.AnnotationFinder;
-import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
-import org.jboss.metadata.javaee.spec.AnnotatedEJBReferenceMetaData;
-import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
-import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
-import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
-import org.jboss.metadata.javaee.spec.EnvironmentRefsGroupMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
-import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
-import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
-import org.jboss.metadata.javaee.spec.RunAsMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AnnotationMergedView;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.Web30MetaData;
-import org.jboss.metadata.web.spec.WebMetaData;
-import org.jboss.test.metadata.annotation.ws.TestEndpoint;
-import org.jboss.test.metadata.annotation.ws.TestEndpointService;
-import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
-
-/**
- * This tests the annotation translation framework.
- *
- * @author Scott.Stark at jboss.org
- * @author Anil.Saldhana at jboss.org
- * @version $Revision: 88255 $
- */
-public class AnnotationWebUnitTestCase extends AbstractJavaEEEverythingTest
-{
- /**
- * @param name
- */
- public AnnotationWebUnitTestCase(String name)
- {
- super(name);
- }
-
- private void assertEnv(EnvironmentRefsGroupMetaData env) throws Exception
- {
- // @EJB
- AnnotatedEJBReferencesMetaData ejbRefs = env.getAnnotatedEjbReferences();
- assertEquals(4, ejbRefs.size());
- AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get(MyServlet.class.getName() + "/injectedField");
- assertNotNull(injectedField);
- assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
- AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
- assertNotNull(injectedFieldWithOverridenName);
- assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
- AnnotatedEJBReferenceMetaData local1 = ejbRefs.get("ejb/local1");
- assertNotNull(local1);
- assertEquals("java:/MyLocalSession1", local1.getMappedName());
- assertEquals("ejb/local1", local1.getEjbRefName());
- assertEquals("MyLocalSession1", local1.getLink());
- assertEquals("A reference to MyLocalSession1", local1.getDescriptions().value()[0].value());
- assertEquals(MyStatelessLocal.class, local1.getBeanInterface());
- AnnotatedEJBReferenceMetaData local2 = ejbRefs.get("ejb/local2");
- assertNotNull(local2);
- assertEquals("java:/MyLocalSession2", local2.getMappedName());
- assertEquals("ejb/local2", local2.getEjbRefName());
- assertEquals("local.jar#MyLocalSession1", local2.getLink());
- assertEquals("A reference to MyLocalSession2", local2.getDescriptions().value()[0].value());
- assertEquals(MyStatelessLocal.class, local2.getBeanInterface());
-
- ResourceReferencesMetaData resRefs = env.getResourceReferences();
- //
- assertEquals(3, resRefs.size());
- ResourceReferenceMetaData homePageRef = resRefs.get(MyServlet.class.getName() + "/homePage");
- assertNotNull(homePageRef);
- assertEquals("java.net.URL", homePageRef.getType());
- Set<ResourceInjectionTargetMetaData> homePageRefTargets = homePageRef.getInjectionTargets();
- assertEquals(1, homePageRefTargets.size());
- ResourceInjectionTargetMetaData homePageRefTarget = homePageRefTargets.iterator().next();
- assertEquals(MyServlet.class.getName(), homePageRefTarget.getInjectionTargetClass());
- assertEquals("setHomePage", homePageRefTarget.getInjectionTargetName());
- ResourceReferenceMetaData googleHome = resRefs.get("googleHome");
- assertNotNull(googleHome);
- assertEquals("java.net.URL", googleHome.getType());
- assertEquals("http://www.google.com", googleHome.getMappedName());
- ResourceReferenceMetaData defaultDS = resRefs.get("jdbc/ds");
- assertNotNull(defaultDS);
- assertEquals("javax.sql.DataSource", defaultDS.getType());
- assertEquals("java:/DefaultDS", defaultDS.getMappedName());
-
- ResourceEnvironmentReferencesMetaData resEnvRefs = env.getResourceEnvironmentReferences();
- assertEquals(1, resEnvRefs.size());
- ResourceEnvironmentReferenceMetaData contextRef = resEnvRefs.get(MyServlet.class.getName() + "/utx");
- assertNotNull(contextRef);
- assertEquals(UserTransaction.class.getName(), contextRef.getType());
- Set<ResourceInjectionTargetMetaData> contextRefTargets = contextRef.getInjectionTargets();
- assertEquals(1, contextRefTargets.size());
- ResourceInjectionTargetMetaData contextRefTarget = contextRefTargets.iterator().next();
- assertEquals(MyServlet.class.getName(), contextRefTarget.getInjectionTargetClass());
- assertEquals("utx", contextRefTarget.getInjectionTargetName());
-
- EnvironmentEntriesMetaData envEntries = env.getEnvironmentEntries();
- assertEquals(2, envEntries.size());
- EnvironmentEntryMetaData pi = envEntries.get(MyServlet.class.getName()+ "/pi");
- assertEquals("3.14159", pi.getValue());
- // TODO: should this be java.lang.Double?
- assertEquals("double", pi.getType());
-
- MessageDestinationReferencesMetaData msgRefs = env.getMessageDestinationReferences();
- assertEquals(1, msgRefs.size());
- MessageDestinationReferenceMetaData mailQueue = msgRefs.get(MyServlet.class.getName() + "/mailQueue");
- assertNotNull(mailQueue);
- assertEquals("javax.jms.Queue", mailQueue.getType());
-
- // WebServiceRef(s)
- ServiceReferencesMetaData serviceRefs = env.getServiceReferences();
- assertNotNull(serviceRefs);
- assertEquals(6, serviceRefs.size());
-
- ServiceReferenceMetaData serviceRef1 = serviceRefs.get("service2");
- assertNotNull(serviceRef1);
- assertEquals(TestEndpointService.class.getName(), serviceRef1.getServiceInterface());
- assertEquals(MyServlet.class.getName(), serviceRef1.getServiceRefType());
- assertNull(serviceRef1.getInjectionTargets());
-
- ServiceReferenceMetaData serviceRef2 = serviceRefs.get("port1");
- assertNotNull(serviceRef2);
- assertEquals(TestEndpointService.class.getName(), serviceRef2.getServiceInterface());
- assertEquals(TestEndpoint.class.getName(), serviceRef2.getServiceRefType());
- assertNull(serviceRef2.getInjectionTargets());
-
- ServiceReferenceMetaData serviceRef3 = serviceRefs
- .get("org.jboss.test.metadata.annotation.web.MyServlet/service");
- assertNotNull(serviceRef3);
- assertEquals(MyServlet.class.getDeclaredField("service"), serviceRef3.getAnnotatedElement());
-
- assertNull(serviceRef3.getServiceInterface());
- assertEquals(TestEndpointService.class.getName(), serviceRef3.getServiceRefType());
- //InjectionTarget on a FIELD
- Set<ResourceInjectionTargetMetaData> injectionTargets3 = serviceRef3.getInjectionTargets();
- assertNotNull(injectionTargets3);
- assertEquals(1, injectionTargets3.size());
- ResourceInjectionTargetMetaData injectionTarget = new ResourceInjectionTargetMetaData();
- injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
- injectionTarget.setInjectionTargetName("service");
- assertTrue(injectionTargets3.contains(injectionTarget));
-
- ServiceReferenceMetaData serviceRef4 = serviceRefs.get(MyServlet.class.getName() + "/endpoint");
- assertNotNull(serviceRef4);
- assertEquals(MyServlet.class.getDeclaredField("endpoint"), serviceRef4.getAnnotatedElement());
- assertNull(serviceRef4.getServiceInterface());
- assertEquals(TestEndpoint.class.getName(), serviceRef4.getServiceRefType());
- //InjectionTarget on a FIELD
- Set<ResourceInjectionTargetMetaData> injectionTargets4 = serviceRef4.getInjectionTargets();
- assertNotNull(injectionTargets4);
- assertEquals(1, injectionTargets4.size());
- injectionTarget = new ResourceInjectionTargetMetaData();
- injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
- injectionTarget.setInjectionTargetName("endpoint");
- assertTrue(injectionTargets4.contains(injectionTarget));
-
- ServiceReferenceMetaData serviceRef5 = serviceRefs.get(MyServlet.class.getName() + "/anotherWebRef");
- assertNotNull(serviceRef5);
- assertNull(serviceRef5.getServiceInterface());
- assertEquals(TestEndpoint.class.getName(), serviceRef5.getServiceRefType());
- //InjectionTarget on a METHOD
- Set<ResourceInjectionTargetMetaData> injectionTargets5 = serviceRef5.getInjectionTargets();
- assertNotNull(injectionTargets5);
- assertEquals(1, injectionTargets5.size());
- injectionTarget = new ResourceInjectionTargetMetaData();
- injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
- injectionTarget.setInjectionTargetName("setAnotherWebRef");
- assertTrue(injectionTargets5.contains(injectionTarget));
-
- ServiceReferenceMetaData serviceRef6 = serviceRefs.get("method/service");
- assertNotNull(serviceRef6);
- assertNull(serviceRef6.getServiceInterface());
- assertEquals(TestEndpoint.class.getName(), serviceRef6.getServiceRefType());
- //InjectionTarget on a METHOD
- Set<ResourceInjectionTargetMetaData> injectionTargets6 = serviceRef6.getInjectionTargets();
- assertNotNull(injectionTargets6);
- assertEquals(1, injectionTargets6.size());
- injectionTarget = new ResourceInjectionTargetMetaData();
- injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
- injectionTarget.setInjectionTargetName("setWebRef");
- assertTrue(injectionTargets6.contains(injectionTarget));
-
- }
-
- public void testAnnotationMergedViewWithNoXml() throws Exception
- {
- Class<?>[] webClasses =
- {MyServlet.class};
- List<Class<?>> classes = Arrays.asList(webClasses);
- System.out.println("Processing classes: " + classes);
-
- AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
- Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
- Web30MetaData metaData = creator.create(classes);
-
- WebMetaData specMetaData = new Web30MetaData();
- WebMetaData merged = new Web30MetaData();
- AnnotationMergedView.merge(merged, specMetaData, metaData);
-
- assertTrue(metaData.is30());
- assertEquals("3.0", merged.getVersion());
-
- assertEnv(merged.getJndiEnvironmentRefsGroup());
-
- // MyServlet @RunAs
- assertNotNull(merged.getServlets());
- ServletMetaData servlet = merged.getServlets().get("MyServlet");
- assertNotNull(servlet);
- RunAsMetaData runAs = servlet.getRunAs();
- assertNotNull(runAs);
- assertEquals("InternalUser", runAs.getRoleName());
- // @DeclareRoles
- SecurityRolesMetaData securityRoles = merged.getSecurityRoles();
- assertNotNull(securityRoles);
- assertEquals(2, securityRoles.size());
- SecurityRoleMetaData role1 = securityRoles.get("Role1");
- assertNotNull(role1);
- assertEquals("Role1", role1.getRoleName());
- SecurityRoleMetaData role2 = securityRoles.get("Role2");
- assertNotNull(role2);
- assertEquals("Role2", role2.getRoleName());
- // @PostConstruct
- assertEquals("setUp", metaData.getPostConstructs().get(0).getMethodName());
- // @PreDestroy
- assertEquals("tearDown", metaData.getPreDestroys().get(0).getMethodName());
-
-
- assertNotNull(metaData.getPersistenceContextRefs());
- assertEquals(2, metaData.getPersistenceContextRefs().size());
- PersistenceContextReferenceMetaData ref = metaData.getPersistenceContextReferenceByName("injectedEntityManager");
- assertNotNull(ref);
- ref = metaData.getPersistenceContextReferenceByName("persistence/ABC");
- assertNotNull(ref);
- assertEquals("ABC", ref.getPersistenceUnitName());
-
- assertNotNull(metaData.getPersistenceUnitRefs());
- assertEquals(1, metaData.getPersistenceUnitRefs().size());
- assertNotNull(metaData.getPersistenceUnitReferenceByName("injectedEntityManagerFactory"));
- }
-
- public void testAnnotationRead() throws Exception
- {
- AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
-
- Class<?>[] webClasses =
- {MyServlet.class};
- List<Class<?>> classes = Arrays.asList(webClasses);
- System.out.println("Processing classes: " + classes);
-
- //enableTrace("org.jboss.metadata.annotation.creator");
- Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
-
- Web30MetaData metaData = creator.create(classes);
-
- assertTrue(metaData.is30());
- assertEquals("3.0", metaData.getVersion());
-
- assertEnv(metaData.getJndiEnvironmentRefsGroup());
-
- // MyServlet @RunAs
- assertNotNull(metaData.getServlets());
- ServletMetaData servlet = metaData.getServlets().get("MyServlet");
- assertNotNull(servlet);
- RunAsMetaData runAs = servlet.getRunAs();
- assertNotNull(runAs);
- assertEquals("InternalUser", runAs.getRoleName());
- // @DeclareRoles
- SecurityRolesMetaData securityRoles = metaData.getSecurityRoles();
- assertNotNull(securityRoles);
- assertEquals(2, securityRoles.size());
- SecurityRoleMetaData role1 = securityRoles.get("Role1");
- assertNotNull(role1);
- assertEquals("Role1", role1.getRoleName());
- SecurityRoleMetaData role2 = securityRoles.get("Role2");
- assertNotNull(role2);
- assertEquals("Role2", role2.getRoleName());
- }
-
- /**
- * Annotation metadata merged into web spec meta data and then
- * JBoss Meta Data is merged
- * @throws Exception
- */
- public void testAnnotationXML() throws Exception
- {
- //Create the annotation web metadata
- AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
- Class<?>[] webClasses =
- {MyServlet.class};
- List<Class<?>> classes = Arrays.asList(webClasses);
- System.out.println("Processing classes: " + classes);
-
- //enableTrace("org.jboss.metadata.annotation.creator");
- Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
-
- Web30MetaData annotation = creator.create(classes);
-
- assertTrue(annotation.is30());
-
- //Now create the web meta data
- WebMetaData xml = unmarshal(WebMetaData.class);
-
- WebMetaData merged = new WebMetaData();
- //Merge the annotation and xml
- AnnotationMergedView.merge(merged, xml, annotation);
-
- //Assert the run as role
- ServletMetaData servletMetaData = merged.getServlets().get("MyServlet");
- assertEquals("InternalUser", servletMetaData.getRunAs().getRoleName());
-
- //Create the JBossWebMetaData
- JBossWebMetaData jbossWMD = unmarshal("JBossWeb_testAnnotationXML.xml", JBossWebMetaData.class, null);
-
- //Let us merge the merged spec metadata with the jbossweb metadata
- JBossWebMetaData mergedJBossWebMD = new JBossWebMetaData();
- mergedJBossWebMD.merge(jbossWMD, merged);
-
- //Assert the run as role
- JBossServletMetaData jbossServletMetaData = mergedJBossWebMD.getServlets().get("MyServlet");
- assertEquals("InternalUser", jbossServletMetaData.getRunAs().getRoleName());
- assertEquals("javajoe", jbossServletMetaData.getRunAsPrincipal());
-
- // @PostConstruct
- assertEquals("setUp", merged.getPostConstructs().get(0).getMethodName());
- // @PreDestroy
- assertEquals("tearDown", merged.getPreDestroys().get(0).getMethodName());
- }
-
- /**
- * Web Meta Data is merged into JBossWebMetaData. Finally
- * AnnotationMetaData is merged with these to yield a final
- * metadata
- * @throws Exception
- */
- public void testAnnotationXML2() throws Exception
- {
- //Create the annotation web metadata
- AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
- Class<?>[] webClasses =
- {MyServlet.class};
- List<Class<?>> classes = Arrays.asList(webClasses);
- System.out.println("Processing classes: " + classes);
-
- //enableTrace("org.jboss.metadata.annotation.creator");
- Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
-
- Web30MetaData annotation = creator.create(classes);
-
- assertTrue(annotation.is30());
-
- //Now create the web meta data
- WebMetaData xml = unmarshal("AnnotationWeb_testAnnotationXML.xml", WebMetaData.class);
-
- //Create the JBossWebMetaData
- JBossWebMetaData jbossWMD = unmarshal("JBossWeb_testAnnotationXML.xml", JBossWebMetaData.class);
-
- //Let us merge the merged spec metadata with the jbossweb metadata
- JBossWebMetaData mergedJBossWebMD = new JBossWebMetaData();
- mergedJBossWebMD.merge(jbossWMD, xml);
-
- //Assert the run as role
- assertTrue(mergedJBossWebMD.getRunAsIdentity("MyServlet").getRoleName().startsWith("PLACEHOLDER"));
-
- WebMetaData merged = new WebMetaData();
- //Merge the annotation and xml
- AnnotationMergedView.merge(merged, xml, annotation);
-
- JBossWebMetaData newMerged = new JBossWebMetaData();
- newMerged.merge(mergedJBossWebMD, merged);
-
- //Assert the run as role
- JBossServletMetaData jbossServletMetaData = newMerged.getServlets().get("MyServlet");
- assertEquals("InternalUser", jbossServletMetaData.getRunAs().getRoleName());
- assertEquals("javajoe", jbossServletMetaData.getRunAsPrincipal());
-
- // @PostConstruct
- assertEquals("setUp", merged.getPostConstructs().get(0).getMethodName());
- // @PreDestroy
- assertEquals("tearDown", merged.getPreDestroys().get(0).getMethodName());
-
- assertAnnotationContext(creator.getAnnotationContext());
- }
-
- public void testSimpleServlet()
- {
- AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
- Class<?>[] webClasses = {SimpleServlet.class, MyServlet.class};
- List<Class<?>> classes = Arrays.asList(webClasses);
-
- //enableTrace("org.jboss.metadata.annotation.creator");
- Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
-
- Web30MetaData annotation = creator.create(classes);
-
- assertTrue(annotation.is30());
- EnvironmentRefsGroupMetaData envRefs = annotation.getJndiEnvironmentRefsGroup();
- assertNotNull(envRefs);
-
- AnnotatedEJBReferencesMetaData annotatedEnvRefs = envRefs.getAnnotatedEjbReferences();
- assertNotNull(annotatedEnvRefs);
- assertEquals(6, annotatedEnvRefs.size());
-
- assertNotNull(envRefs.getResourceEnvironmentReferences());
- assertEquals(2, envRefs.getResourceEnvironmentReferences().size());
-
- }
-
- private void assertAnnotationContext(AnnotationContext context)
- {
- Collection<Class<? extends Annotation>> typeAnnotations = new HashSet<Class<? extends Annotation>>();
- typeAnnotations.add(RunAs.class);
- typeAnnotations.add(DeclareRoles.class);
- typeAnnotations.add(Resource.class);
- typeAnnotations.add(Resources.class);
- typeAnnotations.add(EJB.class);
- typeAnnotations.add(EJBs.class);
- typeAnnotations.add(PersistenceContext.class);
- typeAnnotations.add(PersistenceContexts.class);
- typeAnnotations.add(PersistenceUnit.class);
- typeAnnotations.add(PersistenceUnits.class);
- typeAnnotations.add(WebServiceRef.class);
- typeAnnotations.add(WebServiceRefs.class);
- typeAnnotations.add(WebFilter.class);
- typeAnnotations.add(WebServlet.class);
- typeAnnotations.add(WebListener.class);
-
- // Assert Type annotations
- assertAnnotations(typeAnnotations, context.getTypeAnnotations());
-
- Collection<Class<? extends Annotation>> methodAnnotations = new HashSet<Class<? extends Annotation>>();
- methodAnnotations.add(PreDestroy.class);
- methodAnnotations.add(PostConstruct.class);
- methodAnnotations.add(Resource.class);
- methodAnnotations.add(EJB.class);
- methodAnnotations.add(PersistenceContext.class);
- methodAnnotations.add(PersistenceUnit.class);
- methodAnnotations.add(WebServiceRef.class);
-
- // Assert Method annotations
- assertAnnotations(methodAnnotations, context.getMethodAnnotations());
-
- Collection<Class<? extends Annotation>> fieldAnnotations = new HashSet<Class<? extends Annotation>>();
- fieldAnnotations.add(Resource.class);
- fieldAnnotations.add(EJB.class);
- fieldAnnotations.add(PersistenceContext.class);
- fieldAnnotations.add(PersistenceUnit.class);
- fieldAnnotations.add(WebServiceRef.class);
-
- // Assert Field Annotations
- assertAnnotations(fieldAnnotations, context.getFieldAnnotations());
- }
-
- private void assertAnnotations(Collection<Class<? extends Annotation>> expected,
- Collection<Class<? extends Annotation>> actual)
- {
- assertEquals(expected.size(), actual.size());
- assertTrue(actual.containsAll(expected));
- }
-}
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java (from rev 94608, projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/annotation/web/AnnotationWebUnitTestCase.java 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,527 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.test.metadata.annotation.web;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.annotation.security.DeclareRoles;
+import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
+import javax.ejb.EJBs;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContexts;
+import javax.persistence.PersistenceUnit;
+import javax.persistence.PersistenceUnits;
+import javax.servlet.annotation.MultipartConfig;
+import javax.servlet.annotation.ServletSecurity;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.annotation.WebListener;
+import javax.servlet.annotation.WebServlet;
+import javax.transaction.UserTransaction;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+
+import org.jboss.metadata.annotation.creator.AnnotationContext;
+import org.jboss.metadata.annotation.creator.web.Web30MetaDataCreator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentRefsGroupMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferencesMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferencesMetaData;
+import org.jboss.metadata.javaee.spec.RunAsMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AnnotationMergedView;
+import org.jboss.metadata.web.spec.AnnotationMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.Web30MetaData;
+import org.jboss.metadata.web.spec.WebMetaData;
+import org.jboss.test.metadata.annotation.ws.TestEndpoint;
+import org.jboss.test.metadata.annotation.ws.TestEndpointService;
+import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
+
+/**
+ * This tests the annotation translation framework.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at jboss.org
+ * @version $Revision: 88255 $
+ */
+public class AnnotationWebUnitTestCase extends AbstractJavaEEEverythingTest
+{
+ /**
+ * @param name
+ */
+ public AnnotationWebUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ private void assertEnv(EnvironmentRefsGroupMetaData env) throws Exception
+ {
+ // @EJB
+ AnnotatedEJBReferencesMetaData ejbRefs = env.getAnnotatedEjbReferences();
+ assertEquals(4, ejbRefs.size());
+ AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get(MyServlet.class.getName() + "/injectedField");
+ assertNotNull(injectedField);
+ assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
+ AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
+ assertNotNull(injectedFieldWithOverridenName);
+ assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
+ AnnotatedEJBReferenceMetaData local1 = ejbRefs.get("ejb/local1");
+ assertNotNull(local1);
+ assertEquals("java:/MyLocalSession1", local1.getMappedName());
+ assertEquals("ejb/local1", local1.getEjbRefName());
+ assertEquals("MyLocalSession1", local1.getLink());
+ assertEquals("A reference to MyLocalSession1", local1.getDescriptions().value()[0].value());
+ assertEquals(MyStatelessLocal.class, local1.getBeanInterface());
+ AnnotatedEJBReferenceMetaData local2 = ejbRefs.get("ejb/local2");
+ assertNotNull(local2);
+ assertEquals("java:/MyLocalSession2", local2.getMappedName());
+ assertEquals("ejb/local2", local2.getEjbRefName());
+ assertEquals("local.jar#MyLocalSession1", local2.getLink());
+ assertEquals("A reference to MyLocalSession2", local2.getDescriptions().value()[0].value());
+ assertEquals(MyStatelessLocal.class, local2.getBeanInterface());
+
+ ResourceReferencesMetaData resRefs = env.getResourceReferences();
+ //
+ assertEquals(3, resRefs.size());
+ ResourceReferenceMetaData homePageRef = resRefs.get(MyServlet.class.getName() + "/homePage");
+ assertNotNull(homePageRef);
+ assertEquals("java.net.URL", homePageRef.getType());
+ Set<ResourceInjectionTargetMetaData> homePageRefTargets = homePageRef.getInjectionTargets();
+ assertEquals(1, homePageRefTargets.size());
+ ResourceInjectionTargetMetaData homePageRefTarget = homePageRefTargets.iterator().next();
+ assertEquals(MyServlet.class.getName(), homePageRefTarget.getInjectionTargetClass());
+ assertEquals("setHomePage", homePageRefTarget.getInjectionTargetName());
+ ResourceReferenceMetaData googleHome = resRefs.get("googleHome");
+ assertNotNull(googleHome);
+ assertEquals("java.net.URL", googleHome.getType());
+ assertEquals("http://www.google.com", googleHome.getMappedName());
+ ResourceReferenceMetaData defaultDS = resRefs.get("jdbc/ds");
+ assertNotNull(defaultDS);
+ assertEquals("javax.sql.DataSource", defaultDS.getType());
+ assertEquals("java:/DefaultDS", defaultDS.getMappedName());
+
+ ResourceEnvironmentReferencesMetaData resEnvRefs = env.getResourceEnvironmentReferences();
+ assertEquals(1, resEnvRefs.size());
+ ResourceEnvironmentReferenceMetaData contextRef = resEnvRefs.get(MyServlet.class.getName() + "/utx");
+ assertNotNull(contextRef);
+ assertEquals(UserTransaction.class.getName(), contextRef.getType());
+ Set<ResourceInjectionTargetMetaData> contextRefTargets = contextRef.getInjectionTargets();
+ assertEquals(1, contextRefTargets.size());
+ ResourceInjectionTargetMetaData contextRefTarget = contextRefTargets.iterator().next();
+ assertEquals(MyServlet.class.getName(), contextRefTarget.getInjectionTargetClass());
+ assertEquals("utx", contextRefTarget.getInjectionTargetName());
+
+ EnvironmentEntriesMetaData envEntries = env.getEnvironmentEntries();
+ assertEquals(2, envEntries.size());
+ EnvironmentEntryMetaData pi = envEntries.get(MyServlet.class.getName()+ "/pi");
+ assertEquals("3.14159", pi.getValue());
+ // TODO: should this be java.lang.Double?
+ assertEquals("double", pi.getType());
+
+ MessageDestinationReferencesMetaData msgRefs = env.getMessageDestinationReferences();
+ assertEquals(1, msgRefs.size());
+ MessageDestinationReferenceMetaData mailQueue = msgRefs.get(MyServlet.class.getName() + "/mailQueue");
+ assertNotNull(mailQueue);
+ assertEquals("javax.jms.Queue", mailQueue.getType());
+
+ // WebServiceRef(s)
+ ServiceReferencesMetaData serviceRefs = env.getServiceReferences();
+ assertNotNull(serviceRefs);
+ assertEquals(6, serviceRefs.size());
+
+ ServiceReferenceMetaData serviceRef1 = serviceRefs.get("service2");
+ assertNotNull(serviceRef1);
+ assertEquals(TestEndpointService.class.getName(), serviceRef1.getServiceInterface());
+ assertEquals(MyServlet.class.getName(), serviceRef1.getServiceRefType());
+ assertNull(serviceRef1.getInjectionTargets());
+
+ ServiceReferenceMetaData serviceRef2 = serviceRefs.get("port1");
+ assertNotNull(serviceRef2);
+ assertEquals(TestEndpointService.class.getName(), serviceRef2.getServiceInterface());
+ assertEquals(TestEndpoint.class.getName(), serviceRef2.getServiceRefType());
+ assertNull(serviceRef2.getInjectionTargets());
+
+ ServiceReferenceMetaData serviceRef3 = serviceRefs
+ .get("org.jboss.test.metadata.annotation.web.MyServlet/service");
+ assertNotNull(serviceRef3);
+ assertEquals(MyServlet.class.getDeclaredField("service"), serviceRef3.getAnnotatedElement());
+
+ assertNull(serviceRef3.getServiceInterface());
+ assertEquals(TestEndpointService.class.getName(), serviceRef3.getServiceRefType());
+ //InjectionTarget on a FIELD
+ Set<ResourceInjectionTargetMetaData> injectionTargets3 = serviceRef3.getInjectionTargets();
+ assertNotNull(injectionTargets3);
+ assertEquals(1, injectionTargets3.size());
+ ResourceInjectionTargetMetaData injectionTarget = new ResourceInjectionTargetMetaData();
+ injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
+ injectionTarget.setInjectionTargetName("service");
+ assertTrue(injectionTargets3.contains(injectionTarget));
+
+ ServiceReferenceMetaData serviceRef4 = serviceRefs.get(MyServlet.class.getName() + "/endpoint");
+ assertNotNull(serviceRef4);
+ assertEquals(MyServlet.class.getDeclaredField("endpoint"), serviceRef4.getAnnotatedElement());
+ assertNull(serviceRef4.getServiceInterface());
+ assertEquals(TestEndpoint.class.getName(), serviceRef4.getServiceRefType());
+ //InjectionTarget on a FIELD
+ Set<ResourceInjectionTargetMetaData> injectionTargets4 = serviceRef4.getInjectionTargets();
+ assertNotNull(injectionTargets4);
+ assertEquals(1, injectionTargets4.size());
+ injectionTarget = new ResourceInjectionTargetMetaData();
+ injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
+ injectionTarget.setInjectionTargetName("endpoint");
+ assertTrue(injectionTargets4.contains(injectionTarget));
+
+ ServiceReferenceMetaData serviceRef5 = serviceRefs.get(MyServlet.class.getName() + "/anotherWebRef");
+ assertNotNull(serviceRef5);
+ assertNull(serviceRef5.getServiceInterface());
+ assertEquals(TestEndpoint.class.getName(), serviceRef5.getServiceRefType());
+ //InjectionTarget on a METHOD
+ Set<ResourceInjectionTargetMetaData> injectionTargets5 = serviceRef5.getInjectionTargets();
+ assertNotNull(injectionTargets5);
+ assertEquals(1, injectionTargets5.size());
+ injectionTarget = new ResourceInjectionTargetMetaData();
+ injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
+ injectionTarget.setInjectionTargetName("setAnotherWebRef");
+ assertTrue(injectionTargets5.contains(injectionTarget));
+
+ ServiceReferenceMetaData serviceRef6 = serviceRefs.get("method/service");
+ assertNotNull(serviceRef6);
+ assertNull(serviceRef6.getServiceInterface());
+ assertEquals(TestEndpoint.class.getName(), serviceRef6.getServiceRefType());
+ //InjectionTarget on a METHOD
+ Set<ResourceInjectionTargetMetaData> injectionTargets6 = serviceRef6.getInjectionTargets();
+ assertNotNull(injectionTargets6);
+ assertEquals(1, injectionTargets6.size());
+ injectionTarget = new ResourceInjectionTargetMetaData();
+ injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
+ injectionTarget.setInjectionTargetName("setWebRef");
+ assertTrue(injectionTargets6.contains(injectionTarget));
+
+ }
+
+ public void testAnnotationMergedViewWithNoXml() throws Exception
+ {
+ Class<?>[] webClasses =
+ {MyServlet.class};
+ List<Class<?>> classes = Arrays.asList(webClasses);
+ System.out.println("Processing classes: " + classes);
+
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
+ Web30MetaData metaData = creator.create(classes);
+
+ WebMetaData specMetaData = new Web30MetaData();
+ WebMetaData merged = new Web30MetaData();
+ AnnotationMergedView.merge(merged, specMetaData, metaData);
+
+ assertTrue(metaData.is30());
+ assertEquals("3.0", merged.getVersion());
+
+ assertEnv(merged.getJndiEnvironmentRefsGroup());
+
+ // MyServlet @RunAs
+ assertNotNull(merged.getAnnotations());
+ AnnotationMetaData annotation = merged.getAnnotations().get("org.jboss.test.metadata.annotation.web.MyServlet");
+ assertNotNull(annotation);
+ RunAsMetaData runAs = annotation.getRunAs();
+ assertNotNull(runAs);
+ assertEquals("InternalUser", runAs.getRoleName());
+ // @DeclareRoles
+ SecurityRolesMetaData securityRoles = merged.getSecurityRoles();
+ assertNotNull(securityRoles);
+ assertEquals(2, securityRoles.size());
+ SecurityRoleMetaData role1 = securityRoles.get("Role1");
+ assertNotNull(role1);
+ assertEquals("Role1", role1.getRoleName());
+ SecurityRoleMetaData role2 = securityRoles.get("Role2");
+ assertNotNull(role2);
+ assertEquals("Role2", role2.getRoleName());
+ // @PostConstruct
+ assertEquals("setUp", metaData.getPostConstructs().get(0).getMethodName());
+ // @PreDestroy
+ assertEquals("tearDown", metaData.getPreDestroys().get(0).getMethodName());
+
+
+ assertNotNull(metaData.getPersistenceContextRefs());
+ assertEquals(2, metaData.getPersistenceContextRefs().size());
+ PersistenceContextReferenceMetaData ref = metaData.getPersistenceContextReferenceByName("injectedEntityManager");
+ assertNotNull(ref);
+ ref = metaData.getPersistenceContextReferenceByName("persistence/ABC");
+ assertNotNull(ref);
+ assertEquals("ABC", ref.getPersistenceUnitName());
+
+ assertNotNull(metaData.getPersistenceUnitRefs());
+ assertEquals(1, metaData.getPersistenceUnitRefs().size());
+ assertNotNull(metaData.getPersistenceUnitReferenceByName("injectedEntityManagerFactory"));
+ }
+
+ public void testAnnotationRead() throws Exception
+ {
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+
+ Class<?>[] webClasses =
+ {MyServlet.class};
+ List<Class<?>> classes = Arrays.asList(webClasses);
+ System.out.println("Processing classes: " + classes);
+
+ //enableTrace("org.jboss.metadata.annotation.creator");
+ Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
+
+ Web30MetaData metaData = creator.create(classes);
+
+ assertTrue(metaData.is30());
+ assertEquals("3.0", metaData.getVersion());
+
+ assertEnv(metaData.getJndiEnvironmentRefsGroup());
+
+ // MyServlet @RunAs
+ assertNotNull(metaData.getAnnotations());
+ AnnotationMetaData annotation = metaData.getAnnotations().get("org.jboss.test.metadata.annotation.web.MyServlet");
+ assertNotNull(annotation);
+ RunAsMetaData runAs = annotation.getRunAs();
+ assertNotNull(runAs);
+ assertEquals("InternalUser", runAs.getRoleName());
+ // @DeclareRoles
+ SecurityRolesMetaData securityRoles = metaData.getSecurityRoles();
+ assertNotNull(securityRoles);
+ assertEquals(2, securityRoles.size());
+ SecurityRoleMetaData role1 = securityRoles.get("Role1");
+ assertNotNull(role1);
+ assertEquals("Role1", role1.getRoleName());
+ SecurityRoleMetaData role2 = securityRoles.get("Role2");
+ assertNotNull(role2);
+ assertEquals("Role2", role2.getRoleName());
+ }
+
+ /**
+ * Annotation metadata merged into web spec meta data and then
+ * JBoss Meta Data is merged
+ * @throws Exception
+ */
+ public void testAnnotationXML() throws Exception
+ {
+ //Create the annotation web metadata
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ Class<?>[] webClasses =
+ {MyServlet.class};
+ List<Class<?>> classes = Arrays.asList(webClasses);
+ System.out.println("Processing classes: " + classes);
+
+ //enableTrace("org.jboss.metadata.annotation.creator");
+ Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
+
+ Web30MetaData annotation = creator.create(classes);
+
+ assertTrue(annotation.is30());
+
+ //Now create the web meta data
+ WebMetaData xml = unmarshal(WebMetaData.class);
+
+ WebMetaData merged = new WebMetaData();
+ //Merge the annotation and xml
+ AnnotationMergedView.merge(merged, xml, annotation);
+
+ //Assert the run as role
+ AnnotationMetaData annotationMetaData = merged.getAnnotations().get("org.jboss.test.metadata.annotation.web.MyServlet");
+ assertEquals("InternalUser", annotationMetaData.getRunAs().getRoleName());
+
+ //Create the JBossWebMetaData
+ JBossWebMetaData jbossWMD = unmarshal("JBossWeb_testAnnotationXML.xml", JBossWebMetaData.class, null);
+
+ //Let us merge the merged spec metadata with the jbossweb metadata
+ JBossWebMetaData mergedJBossWebMD = new JBossWebMetaData();
+ mergedJBossWebMD.merge(jbossWMD, merged);
+
+ //Assert the run as role
+ JBossServletMetaData jbossServletMetaData = mergedJBossWebMD.getServlets().get("MyServlet");
+// FIXME: Not compatible with 3.0 annotations
+// assertEquals("InternalUser", jbossServletMetaData.getRunAs().getRoleName());
+// assertEquals("javajoe", jbossServletMetaData.getRunAsPrincipal());
+
+ // @PostConstruct
+ assertEquals("setUp", merged.getPostConstructs().get(0).getMethodName());
+ // @PreDestroy
+ assertEquals("tearDown", merged.getPreDestroys().get(0).getMethodName());
+ }
+
+ /**
+ * Web Meta Data is merged into JBossWebMetaData. Finally
+ * AnnotationMetaData is merged with these to yield a final
+ * metadata
+ * @throws Exception
+ */
+ public void testAnnotationXML2() throws Exception
+ {
+ //Create the annotation web metadata
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ Class<?>[] webClasses =
+ {MyServlet.class};
+ List<Class<?>> classes = Arrays.asList(webClasses);
+ System.out.println("Processing classes: " + classes);
+
+ //enableTrace("org.jboss.metadata.annotation.creator");
+ Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
+
+ Web30MetaData annotation = creator.create(classes);
+
+ assertTrue(annotation.is30());
+
+ //Now create the web meta data
+ WebMetaData xml = unmarshal("AnnotationWeb_testAnnotationXML.xml", WebMetaData.class);
+
+ //Create the JBossWebMetaData
+ JBossWebMetaData jbossWMD = unmarshal("JBossWeb_testAnnotationXML.xml", JBossWebMetaData.class);
+
+ //Let us merge the merged spec metadata with the jbossweb metadata
+ JBossWebMetaData mergedJBossWebMD = new JBossWebMetaData();
+ mergedJBossWebMD.merge(jbossWMD, xml);
+
+ //Assert the run as role
+// FIXME: Not compatible with 3.0 annotations
+// assertTrue(mergedJBossWebMD.getRunAsIdentity("MyServlet").getRoleName().startsWith("PLACEHOLDER"));
+
+ WebMetaData merged = new WebMetaData();
+ //Merge the annotation and xml
+ AnnotationMergedView.merge(merged, xml, annotation);
+
+ JBossWebMetaData newMerged = new JBossWebMetaData();
+ newMerged.merge(mergedJBossWebMD, merged);
+
+ //Assert the run as role
+// FIXME: Not compatible with 3.0 annotations
+// JBossServletMetaData jbossServletMetaData = newMerged.getServlets().get("MyServlet");
+// assertEquals("InternalUser", jbossServletMetaData.getRunAs().getRoleName());
+// assertEquals("javajoe", jbossServletMetaData.getRunAsPrincipal());
+
+ // @PostConstruct
+ assertEquals("setUp", merged.getPostConstructs().get(0).getMethodName());
+ // @PreDestroy
+ assertEquals("tearDown", merged.getPreDestroys().get(0).getMethodName());
+
+ assertAnnotationContext(creator.getAnnotationContext());
+ }
+
+ public void testSimpleServlet()
+ {
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ Class<?>[] webClasses = {SimpleServlet.class, MyServlet.class};
+ List<Class<?>> classes = Arrays.asList(webClasses);
+
+ //enableTrace("org.jboss.metadata.annotation.creator");
+ Web30MetaDataCreator creator = new Web30MetaDataCreator(finder);
+
+ Web30MetaData annotation = creator.create(classes);
+
+ assertTrue(annotation.is30());
+ EnvironmentRefsGroupMetaData envRefs = annotation.getJndiEnvironmentRefsGroup();
+ assertNotNull(envRefs);
+
+ AnnotatedEJBReferencesMetaData annotatedEnvRefs = envRefs.getAnnotatedEjbReferences();
+ assertNotNull(annotatedEnvRefs);
+ assertEquals(6, annotatedEnvRefs.size());
+
+ assertNotNull(envRefs.getResourceEnvironmentReferences());
+ assertEquals(2, envRefs.getResourceEnvironmentReferences().size());
+
+ }
+
+ private void assertAnnotationContext(AnnotationContext context)
+ {
+ Collection<Class<? extends Annotation>> typeAnnotations = new HashSet<Class<? extends Annotation>>();
+ typeAnnotations.add(RunAs.class);
+ typeAnnotations.add(DeclareRoles.class);
+ typeAnnotations.add(Resource.class);
+ typeAnnotations.add(Resources.class);
+ typeAnnotations.add(EJB.class);
+ typeAnnotations.add(EJBs.class);
+ typeAnnotations.add(PersistenceContext.class);
+ typeAnnotations.add(PersistenceContexts.class);
+ typeAnnotations.add(PersistenceUnit.class);
+ typeAnnotations.add(PersistenceUnits.class);
+ typeAnnotations.add(WebServiceRef.class);
+ typeAnnotations.add(WebServiceRefs.class);
+ typeAnnotations.add(WebFilter.class);
+ typeAnnotations.add(WebServlet.class);
+ typeAnnotations.add(WebListener.class);
+ typeAnnotations.add(MultipartConfig.class);
+ typeAnnotations.add(ServletSecurity.class);
+
+ // Assert Type annotations
+ assertAnnotations(typeAnnotations, context.getTypeAnnotations());
+
+ Collection<Class<? extends Annotation>> methodAnnotations = new HashSet<Class<? extends Annotation>>();
+ methodAnnotations.add(PreDestroy.class);
+ methodAnnotations.add(PostConstruct.class);
+ methodAnnotations.add(Resource.class);
+ methodAnnotations.add(EJB.class);
+ methodAnnotations.add(PersistenceContext.class);
+ methodAnnotations.add(PersistenceUnit.class);
+ methodAnnotations.add(WebServiceRef.class);
+
+ // Assert Method annotations
+ assertAnnotations(methodAnnotations, context.getMethodAnnotations());
+
+ Collection<Class<? extends Annotation>> fieldAnnotations = new HashSet<Class<? extends Annotation>>();
+ fieldAnnotations.add(Resource.class);
+ fieldAnnotations.add(EJB.class);
+ fieldAnnotations.add(PersistenceContext.class);
+ fieldAnnotations.add(PersistenceUnit.class);
+ fieldAnnotations.add(WebServiceRef.class);
+
+ // Assert Field Annotations
+ assertAnnotations(fieldAnnotations, context.getFieldAnnotations());
+ }
+
+ private void assertAnnotations(Collection<Class<? extends Annotation>> expected,
+ Collection<Class<? extends Annotation>> actual)
+ {
+ assertEquals(expected.size(), actual.size());
+ assertTrue(actual.containsAll(expected));
+ }
+}
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/binding (from rev 94608, projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding)
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java
===================================================================
--- projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,365 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.test.metadata.web;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.annotation.javaee.Descriptions;
-import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
-import org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData;
-import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
-import org.jboss.metadata.javaee.spec.EJBReferenceType;
-import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
-import org.jboss.metadata.javaee.spec.MessageDestinationUsageType;
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.javaee.spec.ResourceAuthorityType;
-import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
-import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
-import org.jboss.metadata.javaee.spec.RunAsMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-import org.jboss.metadata.web.jboss.ClassLoadingMetaData;
-import org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.WebMetaData;
-import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
-
-
-/**
- * A JBossWebApp24UnitTestCase.
- *
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
-public class JBossWebApp24UnitTestCase extends AbstractJavaEEEverythingTest
-{
- public JBossWebApp24UnitTestCase(String name)
- {
- super(name);
- }
-
- public void testClassLoading() throws Exception
- {
- //enableTrace("org.jboss.xb.builder");
- JBossWebMetaData jbossWeb = unmarshal();
- ClassLoadingMetaData classLoading = jbossWeb.getClassLoading();
- assertNotNull(classLoading);
- assertTrue(classLoading.isJava2ClassLoadingCompliance());
- LoaderRepositoryMetaData loaderRepository = classLoading.getLoaderRepository();
- assertNotNull(loaderRepository);
- assertEquals("jbossws.jbws1581:domain=jaxws-jbws1581.war", loaderRepository.getName());
- }
-
- public void testRunAsPrincipal()
- throws Exception
- {
- JBossWebMetaData jbossWeb = unmarshal();
- assertEquals("4.0", jbossWeb.getVersion());
- assertEquals("java:/jaas/jbosstest-web", jbossWeb.getSecurityDomain());
- ResourceReferenceMetaData dsRef = jbossWeb.getResourceReferenceByName("jdbc/DefaultDS");
- assertEquals("java:/DefaultDS", dsRef.getMappedName());
- }
- public void testMergedRunAsPrincipal()
- throws Exception
- {
- WebMetaData webMD = unmarshal("WebApp24_testRunAsPrincipal.xml", WebMetaData.class, null);
- JBossWebMetaData jbossWebMD = unmarshal("JBossWebApp24_testRunAsPrincipal.xml", JBossWebMetaData.class, null);
- JBossWebMetaData jbossWeb = new JBossWebMetaData();
- jbossWeb.merge(jbossWebMD, webMD);
-
- assertEquals("4.0", jbossWeb.getVersion());
- assertEquals("java:/jaas/jbosstest-web", jbossWeb.getSecurityDomain());
- assertEquals(5, jbossWeb.getResourceReferences().size());
- // jdbc/DefaultDS
- ResourceReferenceMetaData dsRef = jbossWeb.getResourceReferenceByName("jdbc/DefaultDS");
- assertEquals("jdbc/DefaultDS", dsRef.getResourceRefName());
- assertEquals("The default DS", dsRef.getDescriptions().value()[0].value());
- assertEquals("java:/DefaultDS", dsRef.getMappedName());
- assertEquals("javax.sql.DataSource", dsRef.getType());
- assertEquals(ResourceAuthorityType.Container, dsRef.getResAuth());
- // mail/DefaultMail
- ResourceReferenceMetaData mailRef = jbossWeb.getResourceReferenceByName("mail/DefaultMail");
- assertEquals("mail/DefaultMail", mailRef.getResourceRefName());
- assertEquals("Default Mail", mailRef.getDescriptions().value()[0].value());
- assertEquals("java:/Mail", mailRef.getMappedName());
- assertEquals("javax.mail.Session", mailRef.getType());
- assertEquals(ResourceAuthorityType.Container, mailRef.getResAuth());
- // url/JBossHome
- ResourceReferenceMetaData jbossUrlRef = jbossWeb.getResourceReferenceByName("url/JBossHome");
- assertEquals("url/JBossHome", jbossUrlRef.getResourceRefName());
- assertEquals("JBoss Home Page", jbossUrlRef.getDescriptions().value()[0].value());
- assertEquals("http://www.jboss.org", jbossUrlRef.getResUrl());
- assertEquals("java.net.URL", jbossUrlRef.getType());
- assertEquals(ResourceAuthorityType.Container, jbossUrlRef.getResAuth());
- // url/IndirectURL
- ResourceReferenceMetaData indirectUrlRef = jbossWeb.getResourceReferenceByName("url/IndirectURL");
- assertEquals("url/IndirectURL", indirectUrlRef.getResourceRefName());
- assertEquals("SomeWebSite HomePage", indirectUrlRef.getDescriptions().value()[0].value());
- assertEquals("java:SomeWebSite", indirectUrlRef.getMappedName());
- assertEquals("java.net.URL", indirectUrlRef.getType());
- assertEquals(ResourceAuthorityType.Container, indirectUrlRef.getResAuth());
-
- assertEquals(2, jbossWeb.getResourceEnvironmentReferences().size());
- ResourceEnvironmentReferenceMetaData resenv1 = jbossWeb.getResourceEnvironmentReferenceByName("res1/aQueue");
- assertEquals("resenv1", resenv1.getId());
- assertEquals("res1/aQueue", resenv1.getResourceEnvRefName());
- assertEquals("A 1st test of the resource-env-ref tag", resenv1.getDescriptions().value()[0].value());
- assertEquals("javax.jms.Queue", resenv1.getType());
- assertEquals("queue/mdbtest", resenv1.getJndiName());
- assertEquals("queue/mdbtest", resenv1.getMappedName());
- ResourceEnvironmentReferenceMetaData resenv2 = jbossWeb.getResourceEnvironmentReferenceByName("res2/aQueue");
- assertEquals("resenv2", resenv2.getId());
- assertEquals("res2/aQueue", resenv2.getResourceEnvRefName());
- assertEquals("A 2nd test of the resource-env-ref tag", resenv2.getDescriptions().value()[0].value());
- assertEquals("javax.jms.Queue", resenv2.getType());
- assertEquals("queue/mdbtest", resenv2.getJndiName());
- assertEquals("queue/mdbtest", resenv2.getMappedName());
-
- SecurityRolesMetaData secRoles = jbossWeb.getSecurityRoles();
- assertEquals(6, secRoles.size());
- SecurityRoleMetaData role1 = secRoles.get("AuthorizedUser");
- assertNotNull(role1);
- assertEquals("security-role1", role1.getId());
- assertEquals("AuthorizedUser", role1.getRoleName());
- assertEquals("An AuthorizedUser is one with a valid username and password", getDescription(role1.getDescriptions()));
- assertEquals(null, role1.getPrincipals());
- SecurityRoleMetaData role2 = secRoles.get("ServletUserRole");
- assertEquals("security-role2", role2.getId());
- assertEquals("ServletUserRole", role2.getRoleName());
- assertEquals("A role used by the UserInRoleServlet", getDescription(role2.getDescriptions()));
- assertEquals(null, role2.getPrincipals());
- SecurityRoleMetaData role3 = secRoles.get("InternalUser");
- assertEquals("security-role3", role3.getId());
- assertEquals("InternalUser", role3.getRoleName());
- assertEquals("InternalUser is private app role", getDescription(role3.getDescriptions()));
- assertEquals(null, role3.getPrincipals());
- SecurityRoleMetaData role4 = secRoles.get("ExtraRole1");
- assertEquals("security-role4", role4.getId());
- assertEquals("ExtraRole1", role4.getRoleName());
- assertEquals("ExtraRole1 is an extra role added to a run-as principal", getDescription(role4.getDescriptions()));
- assertEquals(set("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal"), role4.getPrincipals());
- SecurityRoleMetaData role5 = secRoles.get("ExtraRole2");
- assertEquals("security-role5", role5.getId());
- assertEquals("ExtraRole2", role5.getRoleName());
- assertEquals("ExtraRole2 is an extra role added to a run-as principal", getDescription(role5.getDescriptions()));
- assertEquals(set("ExtraRole2Principal1", "ExtraRole2Principal2"), role5.getPrincipals());
- SecurityRoleMetaData role6 = secRoles.get("NonExistentRole");
- assertEquals("security-role6", role6.getId());
- assertEquals("NonExistentRole", role6.getRoleName());
- assertEquals("Role that does not exist", getDescription(role6.getDescriptions()));
- assertEquals(null, role6.getPrincipals());
-
- assertEquals(7, jbossWeb.getEnvironmentEntries().size());
- EnvironmentEntryMetaData env1 = jbossWeb.getEnvironmentEntryByName("Ints/i0");
- assertEquals("Ints/i0", env1.getEnvEntryName());
- assertEquals("java.lang.Integer", env1.getType());
- assertEquals("0", env1.getValue());
- EnvironmentEntryMetaData env7 = jbossWeb.getEnvironmentEntryByName("ejb/catalog/CatalogDAOClass");
- assertEquals("env7", env7.getId());
- assertEquals("ejb/catalog/CatalogDAOClass", env7.getEnvEntryName());
- assertEquals("An entry with a class name", getDescription(env7.getDescriptions()));
- assertEquals("java.lang.String", env7.getType());
- assertEquals("com.sun.model.dao.CatalogDAOImpl", env7.getValue());
-
- assertEquals(13, jbossWeb.getEjbReferences().size());
- // ejb/bean0
- EJBReferenceMetaData ejb1 = jbossWeb.getEjbReferenceByName("ejb/bean0");
- assertEquals("ejb1", ejb1.getId());
- assertEquals("ejb/bean0", ejb1.getEjbRefName());
- assertEquals(EJBReferenceType.Session, ejb1.getEjbRefType());
- assertEquals("org.jboss.test.web.interfaces.StatelessSessionHome", ejb1.getHome());
- assertEquals("org.jboss.test.web.interfaces.StatelessSession", ejb1.getRemote());
- assertEquals("ENCBean0", ejb1.getLink());
- assertEquals(null, ejb1.getJndiName());
- // ejb/bean1
- EJBReferenceMetaData ejb4 = jbossWeb.getEjbReferenceByName("ejb/bean3");
- assertEquals("ejb4", ejb4.getId());
- assertEquals("ejb/bean3", ejb4.getEjbRefName());
- assertEquals(EJBReferenceType.Session, ejb4.getEjbRefType());
- assertEquals("org.jboss.test.web.interfaces.StatelessSessionHome", ejb4.getHome());
- assertEquals("org.jboss.test.web.interfaces.StatelessSession", ejb4.getRemote());
- assertEquals(null, ejb4.getLink());
- assertEquals("jbosstest/ejbs/UnsecuredEJB", ejb4.getJndiName());
- assertEquals("jbosstest/ejbs/UnsecuredEJB", ejb4.getMappedName());
- jbossWeb.getEjbReferenceByName("ejb/RelativeBean");
-
- assertEquals(8, jbossWeb.getEjbLocalReferences().size());
- EJBLocalReferenceMetaData local3 = jbossWeb.getEjbLocalReferenceByName("ejb/local/bean3");
- assertEquals("local3", local3.getId());
- assertEquals("ejb/local/bean3", local3.getEjbRefName());
- assertEquals(EJBReferenceType.Session, local3.getEjbRefType());
- assertEquals("org.jboss.test.web.interfaces.StatelessSessionLocalHome", local3.getLocalHome());
- assertEquals("org.jboss.test.web.interfaces.StatelessSessionLocal", local3.getLocal());
- assertEquals(null, local3.getLink());
- assertEquals("jbosstest/ejbs/local/ENCBean1", local3.getJndiName());
- assertEquals("jbosstest/ejbs/local/ENCBean1", local3.getMappedName());
- // ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget
- EJBLocalReferenceMetaData local8 = jbossWeb.getEjbLocalReferenceByName("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget");
- assertEquals("local8", local8.getId());
- assertEquals("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget", local8.getEjbRefName());
- assertEquals(EJBReferenceType.Session, local8.getEjbRefType());
- assertEquals("org.jboss.test.web.interfaces.RunAsTargetLocalHome", local8.getLocalHome());
- assertEquals("org.jboss.test.web.interfaces.RunAsTargetLocal", local8.getLocal());
- assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesTarget", local8.getLink());
- assertEquals(null, local8.getJndiName());
-
- // mdr/ConsumesLink
- assertEquals(3, jbossWeb.getMessageDestinationReferences().size());
- MessageDestinationReferenceMetaData mref1 = jbossWeb.getMessageDestinationReferenceByName("mdr/ConsumesLink");
- assertEquals("msgref1", mref1.getId());
- assertEquals("mdr/ConsumesLink", mref1.getMessageDestinationRefName());
- assertEquals("javax.jms.Queue", mref1.getType());
- assertEquals(MessageDestinationUsageType.Consumes, mref1.getMessageDestinationUsage());
- assertEquals("TestQueue", mref1.getLink());
- // mdr/ConsumesProducesJNDIName
- MessageDestinationReferenceMetaData mref3 = jbossWeb.getMessageDestinationReferenceByName("mdr/ConsumesProducesJNDIName");
- assertEquals("msgref3", mref3.getId());
- assertEquals("mdr/ConsumesProducesJNDIName", mref3.getMessageDestinationRefName());
- assertEquals("javax.jms.Queue", mref3.getType());
- assertEquals(MessageDestinationUsageType.ConsumesProduces, mref3.getMessageDestinationUsage());
- assertEquals(null, mref3.getLink());
- assertEquals("queue/A", mref3.getJndiName());
- assertEquals("queue/A", mref3.getMappedName());
-
- assertEquals(2, jbossWeb.getMessageDestinations().size());
- MessageDestinationMetaData msgdest1 = jbossWeb.getMessageDestination("TestQueue");
- assertEquals("msgdest1", msgdest1.getId());
- assertEquals("A TestQueue destination", msgdest1.getDescriptionGroup().getDescription());
- assertEquals("TestQueue", msgdest1.getMessageDestinationName());
- assertEquals("queue/testQueue", msgdest1.getJndiName());
- assertEquals("queue/testQueue", msgdest1.getMappedName());
- MessageDestinationMetaData msgdest2 = jbossWeb.getMessageDestination("TestTopic");
- assertEquals("msgdest2", msgdest2.getId());
- assertEquals("A TestTopic destination", msgdest2.getDescriptionGroup().getDescription());
- assertEquals("TestTopic", msgdest2.getMessageDestinationName());
- assertEquals("topic/testTopic", msgdest2.getJndiName());
- assertEquals("topic/testTopic", msgdest2.getMappedName());
-
- // servlets
- assertEquals(30, jbossWeb.getServlets().size());
- JBossServletMetaData servlet1 = jbossWeb.getServletByName("APIServlet");
- assertNotNull(servlet1);
- assertEquals("servlet1", servlet1.getId());
- assertEquals("org.jboss.test.web.servlets.APIServlet", servlet1.getServletClass());
- JBossServletMetaData servlet2 = jbossWeb.getServletByName("ClasspathServlet");
- assertNotNull(servlet2);
- assertEquals("servlet2", servlet2.getId());
- assertEquals("org.jboss.test.web.servlets.ClasspathServlet", servlet2.getServletClass());
- assertEquals(1, servlet2.getLoadOnStartup());
- // servlet10
- JBossServletMetaData servlet10 = jbossWeb.getServletByName("EJBOnStartupServlet");
- assertNotNull(servlet10);
- assertEquals("servlet10", servlet10.getId());
- assertEquals("EJBOnStartupServlet", servlet10.getServletName());
- assertEquals("org.jboss.test.web.servlets.EJBOnStartupServlet", servlet10.getServletClass());
- assertEquals(1, servlet10.getLoadOnStartup());
- List<ParamValueMetaData> s10params = servlet10.getInitParam();
- assertEquals(1, s10params.size());
- ParamValueMetaData s10p0 = s10params.get(0);
- assertEquals("failOnError", s10p0.getParamName());
- assertEquals("false", s10p0.getParamValue());
- // servlet19
- JBossServletMetaData servlet19 = jbossWeb.getServletByName("UnsecureRunAsServletWithPrincipalNameAndRoles");
- assertNotNull(servlet19);
- assertEquals("servlet19", servlet19.getId());
- assertEquals("UnsecureRunAsServletWithPrincipalNameAndRoles", servlet19.getServletName());
- assertEquals("org.jboss.test.web.servlets.UnsecureRunAsServlet", servlet19.getServletClass());
- List<ParamValueMetaData> s19params = servlet19.getInitParam();
- assertEquals(1, s19params.size());
- ParamValueMetaData s19p0 = s19params.get(0);
- assertEquals("ejbName", s19p0.getParamName());
- assertEquals("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget", s19p0.getParamValue());
- RunAsMetaData s19RunAs = servlet19.getRunAs();
- assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
- assertEquals("InternalUser", s19RunAs.getRoleName());
- assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", servlet19.getRunAsPrincipal());
- RunAsIdentityMetaData s19RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsServletWithPrincipalNameAndRoles");
- assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", s19RunAsID.getPrincipalName());
- Set<String> s19RunAsPrincipalRoles = jbossWeb.getSecurityRoles().getSecurityRoleNamesByPrincipal("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal");
- assertEquals(set("ExtraRole1"), s19RunAsPrincipalRoles);
- assertEquals(set("ExtraRole1", "InternalUser"), s19RunAsID.getRunAsRoles());
- assertEquals(true, s19RunAsID.doesUserHaveRole("ExtraRole1"));
- assertEquals(true, s19RunAsID.doesUserHaveRole("InternalUser"));
- // servlet20
- JBossServletMetaData servlet20 = jbossWeb.getServletByName("UnsecureRunAsJsp");
- assertNotNull(servlet20);
- assertEquals("servlet20", servlet20.getId());
- assertEquals("UnsecureRunAsJsp", servlet20.getServletName());
- assertEquals(null, servlet20.getServletClass());
- assertEquals("/runAs.jsp", servlet20.getJspFile());
- RunAsMetaData s20RunAs = servlet20.getRunAs();
- assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
- assertEquals("InternalUser", s20RunAs.getRoleName());
- assertEquals(null, servlet20.getRunAsPrincipal());
- RunAsIdentityMetaData s20RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsJsp");
- assertEquals("anonymous", s20RunAsID.getPrincipalName());
- assertEquals(set("InternalUser"), s20RunAsID.getRunAsRoles());
- assertEquals(true, s20RunAsID.doesUserHaveRole("InternalUser"));
- // servlet27
- JBossServletMetaData servlet27 = jbossWeb.getServletByName("UserInRoleServlet");
- assertEquals("servlet27", servlet27.getId());
- assertEquals("UserInRoleServlet", servlet27.getServletName());
- assertEquals("org.jboss.test.web.servlets.UserInRoleServlet", servlet27.getServletClass());
- List<ParamValueMetaData> s27params = servlet27.getInitParam();
- assertEquals(2, s27params.size());
- ParamValueMetaData s27p0 = s27params.get(0);
- assertEquals("expectedUserRoles", s27p0.getParamName());
- assertEquals("AuthorizedUser,ServletUser", s27p0.getParamValue());
- ParamValueMetaData s27p1 = s27params.get(1);
- assertEquals("unexpectedUserRoles", s27p1.getParamName());
- assertEquals("Anonymous", s27p1.getParamValue());
- SecurityRoleRefsMetaData s27RoleRefs = servlet27.getSecurityRoleRefs();
- assertEquals(1, s27RoleRefs.size());
- SecurityRoleRefMetaData s27ServletUser = s27RoleRefs.get("ServletUser");
- assertEquals("ServletUser", s27ServletUser.getRoleName());
- assertEquals("ServletUserRole", s27ServletUser.getRoleLink());
- }
-
- protected JBossWebMetaData unmarshal() throws Exception
- {
- return unmarshal(JBoss4xDTDWebMetaData.class);
- }
-
- protected String getDescription(Descriptions descriptions)
- {
- String desc = null;
- if(descriptions != null)
- desc = descriptions.value()[0].value();
- return desc;
- }
-
- protected Set<String> set(String...strings)
- {
- HashSet<String> set = new HashSet<String>();
- for(String s : strings)
- set.add(s);
- return set;
- }
-}
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java (from rev 94608, projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/java/org/jboss/test/metadata/web/JBossWebApp24UnitTestCase.java 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,366 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.metadata.web;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.annotation.javaee.Descriptions;
+import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
+import org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData;
+import org.jboss.metadata.javaee.spec.EJBLocalReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.EJBReferenceType;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationReferenceMetaData;
+import org.jboss.metadata.javaee.spec.MessageDestinationUsageType;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.javaee.spec.ResourceAuthorityType;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.RunAsMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleRefMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleRefsMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.web.jboss.ClassLoadingMetaData;
+import org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.WebMetaData;
+import org.jboss.test.metadata.javaee.AbstractJavaEEEverythingTest;
+
+
+/**
+ * A JBossWebApp24UnitTestCase.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossWebApp24UnitTestCase extends AbstractJavaEEEverythingTest
+{
+ public JBossWebApp24UnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testClassLoading() throws Exception
+ {
+ //enableTrace("org.jboss.xb.builder");
+ JBossWebMetaData jbossWeb = unmarshal();
+ ClassLoadingMetaData classLoading = jbossWeb.getClassLoading();
+ assertNotNull(classLoading);
+ assertTrue(classLoading.isJava2ClassLoadingCompliance());
+ LoaderRepositoryMetaData loaderRepository = classLoading.getLoaderRepository();
+ assertNotNull(loaderRepository);
+ assertEquals("jbossws.jbws1581:domain=jaxws-jbws1581.war", loaderRepository.getName());
+ }
+
+ public void testRunAsPrincipal()
+ throws Exception
+ {
+ JBossWebMetaData jbossWeb = unmarshal();
+ assertEquals("4.0", jbossWeb.getVersion());
+ assertEquals("java:/jaas/jbosstest-web", jbossWeb.getSecurityDomain());
+ ResourceReferenceMetaData dsRef = jbossWeb.getResourceReferenceByName("jdbc/DefaultDS");
+ assertEquals("java:/DefaultDS", dsRef.getMappedName());
+ }
+ public void testMergedRunAsPrincipal()
+ throws Exception
+ {
+ WebMetaData webMD = unmarshal("WebApp24_testRunAsPrincipal.xml", WebMetaData.class, null);
+ JBossWebMetaData jbossWebMD = unmarshal("JBossWebApp24_testRunAsPrincipal.xml", JBossWebMetaData.class, null);
+ JBossWebMetaData jbossWeb = new JBossWebMetaData();
+ jbossWeb.merge(jbossWebMD, webMD);
+ jbossWeb.resolveRunAs();
+
+ assertEquals("4.0", jbossWeb.getVersion());
+ assertEquals("java:/jaas/jbosstest-web", jbossWeb.getSecurityDomain());
+ assertEquals(5, jbossWeb.getResourceReferences().size());
+ // jdbc/DefaultDS
+ ResourceReferenceMetaData dsRef = jbossWeb.getResourceReferenceByName("jdbc/DefaultDS");
+ assertEquals("jdbc/DefaultDS", dsRef.getResourceRefName());
+ assertEquals("The default DS", dsRef.getDescriptions().value()[0].value());
+ assertEquals("java:/DefaultDS", dsRef.getMappedName());
+ assertEquals("javax.sql.DataSource", dsRef.getType());
+ assertEquals(ResourceAuthorityType.Container, dsRef.getResAuth());
+ // mail/DefaultMail
+ ResourceReferenceMetaData mailRef = jbossWeb.getResourceReferenceByName("mail/DefaultMail");
+ assertEquals("mail/DefaultMail", mailRef.getResourceRefName());
+ assertEquals("Default Mail", mailRef.getDescriptions().value()[0].value());
+ assertEquals("java:/Mail", mailRef.getMappedName());
+ assertEquals("javax.mail.Session", mailRef.getType());
+ assertEquals(ResourceAuthorityType.Container, mailRef.getResAuth());
+ // url/JBossHome
+ ResourceReferenceMetaData jbossUrlRef = jbossWeb.getResourceReferenceByName("url/JBossHome");
+ assertEquals("url/JBossHome", jbossUrlRef.getResourceRefName());
+ assertEquals("JBoss Home Page", jbossUrlRef.getDescriptions().value()[0].value());
+ assertEquals("http://www.jboss.org", jbossUrlRef.getResUrl());
+ assertEquals("java.net.URL", jbossUrlRef.getType());
+ assertEquals(ResourceAuthorityType.Container, jbossUrlRef.getResAuth());
+ // url/IndirectURL
+ ResourceReferenceMetaData indirectUrlRef = jbossWeb.getResourceReferenceByName("url/IndirectURL");
+ assertEquals("url/IndirectURL", indirectUrlRef.getResourceRefName());
+ assertEquals("SomeWebSite HomePage", indirectUrlRef.getDescriptions().value()[0].value());
+ assertEquals("java:SomeWebSite", indirectUrlRef.getMappedName());
+ assertEquals("java.net.URL", indirectUrlRef.getType());
+ assertEquals(ResourceAuthorityType.Container, indirectUrlRef.getResAuth());
+
+ assertEquals(2, jbossWeb.getResourceEnvironmentReferences().size());
+ ResourceEnvironmentReferenceMetaData resenv1 = jbossWeb.getResourceEnvironmentReferenceByName("res1/aQueue");
+ assertEquals("resenv1", resenv1.getId());
+ assertEquals("res1/aQueue", resenv1.getResourceEnvRefName());
+ assertEquals("A 1st test of the resource-env-ref tag", resenv1.getDescriptions().value()[0].value());
+ assertEquals("javax.jms.Queue", resenv1.getType());
+ assertEquals("queue/mdbtest", resenv1.getJndiName());
+ assertEquals("queue/mdbtest", resenv1.getMappedName());
+ ResourceEnvironmentReferenceMetaData resenv2 = jbossWeb.getResourceEnvironmentReferenceByName("res2/aQueue");
+ assertEquals("resenv2", resenv2.getId());
+ assertEquals("res2/aQueue", resenv2.getResourceEnvRefName());
+ assertEquals("A 2nd test of the resource-env-ref tag", resenv2.getDescriptions().value()[0].value());
+ assertEquals("javax.jms.Queue", resenv2.getType());
+ assertEquals("queue/mdbtest", resenv2.getJndiName());
+ assertEquals("queue/mdbtest", resenv2.getMappedName());
+
+ SecurityRolesMetaData secRoles = jbossWeb.getSecurityRoles();
+ assertEquals(6, secRoles.size());
+ SecurityRoleMetaData role1 = secRoles.get("AuthorizedUser");
+ assertNotNull(role1);
+ assertEquals("security-role1", role1.getId());
+ assertEquals("AuthorizedUser", role1.getRoleName());
+ assertEquals("An AuthorizedUser is one with a valid username and password", getDescription(role1.getDescriptions()));
+ assertEquals(null, role1.getPrincipals());
+ SecurityRoleMetaData role2 = secRoles.get("ServletUserRole");
+ assertEquals("security-role2", role2.getId());
+ assertEquals("ServletUserRole", role2.getRoleName());
+ assertEquals("A role used by the UserInRoleServlet", getDescription(role2.getDescriptions()));
+ assertEquals(null, role2.getPrincipals());
+ SecurityRoleMetaData role3 = secRoles.get("InternalUser");
+ assertEquals("security-role3", role3.getId());
+ assertEquals("InternalUser", role3.getRoleName());
+ assertEquals("InternalUser is private app role", getDescription(role3.getDescriptions()));
+ assertEquals(null, role3.getPrincipals());
+ SecurityRoleMetaData role4 = secRoles.get("ExtraRole1");
+ assertEquals("security-role4", role4.getId());
+ assertEquals("ExtraRole1", role4.getRoleName());
+ assertEquals("ExtraRole1 is an extra role added to a run-as principal", getDescription(role4.getDescriptions()));
+ assertEquals(set("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal"), role4.getPrincipals());
+ SecurityRoleMetaData role5 = secRoles.get("ExtraRole2");
+ assertEquals("security-role5", role5.getId());
+ assertEquals("ExtraRole2", role5.getRoleName());
+ assertEquals("ExtraRole2 is an extra role added to a run-as principal", getDescription(role5.getDescriptions()));
+ assertEquals(set("ExtraRole2Principal1", "ExtraRole2Principal2"), role5.getPrincipals());
+ SecurityRoleMetaData role6 = secRoles.get("NonExistentRole");
+ assertEquals("security-role6", role6.getId());
+ assertEquals("NonExistentRole", role6.getRoleName());
+ assertEquals("Role that does not exist", getDescription(role6.getDescriptions()));
+ assertEquals(null, role6.getPrincipals());
+
+ assertEquals(7, jbossWeb.getEnvironmentEntries().size());
+ EnvironmentEntryMetaData env1 = jbossWeb.getEnvironmentEntryByName("Ints/i0");
+ assertEquals("Ints/i0", env1.getEnvEntryName());
+ assertEquals("java.lang.Integer", env1.getType());
+ assertEquals("0", env1.getValue());
+ EnvironmentEntryMetaData env7 = jbossWeb.getEnvironmentEntryByName("ejb/catalog/CatalogDAOClass");
+ assertEquals("env7", env7.getId());
+ assertEquals("ejb/catalog/CatalogDAOClass", env7.getEnvEntryName());
+ assertEquals("An entry with a class name", getDescription(env7.getDescriptions()));
+ assertEquals("java.lang.String", env7.getType());
+ assertEquals("com.sun.model.dao.CatalogDAOImpl", env7.getValue());
+
+ assertEquals(13, jbossWeb.getEjbReferences().size());
+ // ejb/bean0
+ EJBReferenceMetaData ejb1 = jbossWeb.getEjbReferenceByName("ejb/bean0");
+ assertEquals("ejb1", ejb1.getId());
+ assertEquals("ejb/bean0", ejb1.getEjbRefName());
+ assertEquals(EJBReferenceType.Session, ejb1.getEjbRefType());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSessionHome", ejb1.getHome());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSession", ejb1.getRemote());
+ assertEquals("ENCBean0", ejb1.getLink());
+ assertEquals(null, ejb1.getJndiName());
+ // ejb/bean1
+ EJBReferenceMetaData ejb4 = jbossWeb.getEjbReferenceByName("ejb/bean3");
+ assertEquals("ejb4", ejb4.getId());
+ assertEquals("ejb/bean3", ejb4.getEjbRefName());
+ assertEquals(EJBReferenceType.Session, ejb4.getEjbRefType());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSessionHome", ejb4.getHome());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSession", ejb4.getRemote());
+ assertEquals(null, ejb4.getLink());
+ assertEquals("jbosstest/ejbs/UnsecuredEJB", ejb4.getJndiName());
+ assertEquals("jbosstest/ejbs/UnsecuredEJB", ejb4.getMappedName());
+ jbossWeb.getEjbReferenceByName("ejb/RelativeBean");
+
+ assertEquals(8, jbossWeb.getEjbLocalReferences().size());
+ EJBLocalReferenceMetaData local3 = jbossWeb.getEjbLocalReferenceByName("ejb/local/bean3");
+ assertEquals("local3", local3.getId());
+ assertEquals("ejb/local/bean3", local3.getEjbRefName());
+ assertEquals(EJBReferenceType.Session, local3.getEjbRefType());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSessionLocalHome", local3.getLocalHome());
+ assertEquals("org.jboss.test.web.interfaces.StatelessSessionLocal", local3.getLocal());
+ assertEquals(null, local3.getLink());
+ assertEquals("jbosstest/ejbs/local/ENCBean1", local3.getJndiName());
+ assertEquals("jbosstest/ejbs/local/ENCBean1", local3.getMappedName());
+ // ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget
+ EJBLocalReferenceMetaData local8 = jbossWeb.getEjbLocalReferenceByName("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget");
+ assertEquals("local8", local8.getId());
+ assertEquals("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget", local8.getEjbRefName());
+ assertEquals(EJBReferenceType.Session, local8.getEjbRefType());
+ assertEquals("org.jboss.test.web.interfaces.RunAsTargetLocalHome", local8.getLocalHome());
+ assertEquals("org.jboss.test.web.interfaces.RunAsTargetLocal", local8.getLocal());
+ assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesTarget", local8.getLink());
+ assertEquals(null, local8.getJndiName());
+
+ // mdr/ConsumesLink
+ assertEquals(3, jbossWeb.getMessageDestinationReferences().size());
+ MessageDestinationReferenceMetaData mref1 = jbossWeb.getMessageDestinationReferenceByName("mdr/ConsumesLink");
+ assertEquals("msgref1", mref1.getId());
+ assertEquals("mdr/ConsumesLink", mref1.getMessageDestinationRefName());
+ assertEquals("javax.jms.Queue", mref1.getType());
+ assertEquals(MessageDestinationUsageType.Consumes, mref1.getMessageDestinationUsage());
+ assertEquals("TestQueue", mref1.getLink());
+ // mdr/ConsumesProducesJNDIName
+ MessageDestinationReferenceMetaData mref3 = jbossWeb.getMessageDestinationReferenceByName("mdr/ConsumesProducesJNDIName");
+ assertEquals("msgref3", mref3.getId());
+ assertEquals("mdr/ConsumesProducesJNDIName", mref3.getMessageDestinationRefName());
+ assertEquals("javax.jms.Queue", mref3.getType());
+ assertEquals(MessageDestinationUsageType.ConsumesProduces, mref3.getMessageDestinationUsage());
+ assertEquals(null, mref3.getLink());
+ assertEquals("queue/A", mref3.getJndiName());
+ assertEquals("queue/A", mref3.getMappedName());
+
+ assertEquals(2, jbossWeb.getMessageDestinations().size());
+ MessageDestinationMetaData msgdest1 = jbossWeb.getMessageDestination("TestQueue");
+ assertEquals("msgdest1", msgdest1.getId());
+ assertEquals("A TestQueue destination", msgdest1.getDescriptionGroup().getDescription());
+ assertEquals("TestQueue", msgdest1.getMessageDestinationName());
+ assertEquals("queue/testQueue", msgdest1.getJndiName());
+ assertEquals("queue/testQueue", msgdest1.getMappedName());
+ MessageDestinationMetaData msgdest2 = jbossWeb.getMessageDestination("TestTopic");
+ assertEquals("msgdest2", msgdest2.getId());
+ assertEquals("A TestTopic destination", msgdest2.getDescriptionGroup().getDescription());
+ assertEquals("TestTopic", msgdest2.getMessageDestinationName());
+ assertEquals("topic/testTopic", msgdest2.getJndiName());
+ assertEquals("topic/testTopic", msgdest2.getMappedName());
+
+ // servlets
+ assertEquals(30, jbossWeb.getServlets().size());
+ JBossServletMetaData servlet1 = jbossWeb.getServletByName("APIServlet");
+ assertNotNull(servlet1);
+ assertEquals("servlet1", servlet1.getId());
+ assertEquals("org.jboss.test.web.servlets.APIServlet", servlet1.getServletClass());
+ JBossServletMetaData servlet2 = jbossWeb.getServletByName("ClasspathServlet");
+ assertNotNull(servlet2);
+ assertEquals("servlet2", servlet2.getId());
+ assertEquals("org.jboss.test.web.servlets.ClasspathServlet", servlet2.getServletClass());
+ assertEquals(1, servlet2.getLoadOnStartup());
+ // servlet10
+ JBossServletMetaData servlet10 = jbossWeb.getServletByName("EJBOnStartupServlet");
+ assertNotNull(servlet10);
+ assertEquals("servlet10", servlet10.getId());
+ assertEquals("EJBOnStartupServlet", servlet10.getServletName());
+ assertEquals("org.jboss.test.web.servlets.EJBOnStartupServlet", servlet10.getServletClass());
+ assertEquals(1, servlet10.getLoadOnStartup());
+ List<ParamValueMetaData> s10params = servlet10.getInitParam();
+ assertEquals(1, s10params.size());
+ ParamValueMetaData s10p0 = s10params.get(0);
+ assertEquals("failOnError", s10p0.getParamName());
+ assertEquals("false", s10p0.getParamValue());
+ // servlet19
+ JBossServletMetaData servlet19 = jbossWeb.getServletByName("UnsecureRunAsServletWithPrincipalNameAndRoles");
+ assertNotNull(servlet19);
+ assertEquals("servlet19", servlet19.getId());
+ assertEquals("UnsecureRunAsServletWithPrincipalNameAndRoles", servlet19.getServletName());
+ assertEquals("org.jboss.test.web.servlets.UnsecureRunAsServlet", servlet19.getServletClass());
+ List<ParamValueMetaData> s19params = servlet19.getInitParam();
+ assertEquals(1, s19params.size());
+ ParamValueMetaData s19p0 = s19params.get(0);
+ assertEquals("ejbName", s19p0.getParamName());
+ assertEquals("ejb/UnsecureRunAsServletWithPrincipalNameAndRolesTarget", s19p0.getParamValue());
+ RunAsMetaData s19RunAs = servlet19.getRunAs();
+ assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
+ assertEquals("InternalUser", s19RunAs.getRoleName());
+ assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", servlet19.getRunAsPrincipal());
+ RunAsIdentityMetaData s19RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsServletWithPrincipalNameAndRoles");
+ assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", s19RunAsID.getPrincipalName());
+ Set<String> s19RunAsPrincipalRoles = jbossWeb.getSecurityRoles().getSecurityRoleNamesByPrincipal("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal");
+ assertEquals(set("ExtraRole1"), s19RunAsPrincipalRoles);
+ assertEquals(set("ExtraRole1", "InternalUser"), s19RunAsID.getRunAsRoles());
+ assertEquals(true, s19RunAsID.doesUserHaveRole("ExtraRole1"));
+ assertEquals(true, s19RunAsID.doesUserHaveRole("InternalUser"));
+ // servlet20
+ JBossServletMetaData servlet20 = jbossWeb.getServletByName("UnsecureRunAsJsp");
+ assertNotNull(servlet20);
+ assertEquals("servlet20", servlet20.getId());
+ assertEquals("UnsecureRunAsJsp", servlet20.getServletName());
+ assertEquals(null, servlet20.getServletClass());
+ assertEquals("/runAs.jsp", servlet20.getJspFile());
+ RunAsMetaData s20RunAs = servlet20.getRunAs();
+ assertEquals("Assume an InternalUser role to access a private EJB", getDescription(s19RunAs.getDescriptions()));
+ assertEquals("InternalUser", s20RunAs.getRoleName());
+ assertEquals(null, servlet20.getRunAsPrincipal());
+ RunAsIdentityMetaData s20RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsJsp");
+ assertEquals("anonymous", s20RunAsID.getPrincipalName());
+ assertEquals(set("InternalUser"), s20RunAsID.getRunAsRoles());
+ assertEquals(true, s20RunAsID.doesUserHaveRole("InternalUser"));
+ // servlet27
+ JBossServletMetaData servlet27 = jbossWeb.getServletByName("UserInRoleServlet");
+ assertEquals("servlet27", servlet27.getId());
+ assertEquals("UserInRoleServlet", servlet27.getServletName());
+ assertEquals("org.jboss.test.web.servlets.UserInRoleServlet", servlet27.getServletClass());
+ List<ParamValueMetaData> s27params = servlet27.getInitParam();
+ assertEquals(2, s27params.size());
+ ParamValueMetaData s27p0 = s27params.get(0);
+ assertEquals("expectedUserRoles", s27p0.getParamName());
+ assertEquals("AuthorizedUser,ServletUser", s27p0.getParamValue());
+ ParamValueMetaData s27p1 = s27params.get(1);
+ assertEquals("unexpectedUserRoles", s27p1.getParamName());
+ assertEquals("Anonymous", s27p1.getParamValue());
+ SecurityRoleRefsMetaData s27RoleRefs = servlet27.getSecurityRoleRefs();
+ assertEquals(1, s27RoleRefs.size());
+ SecurityRoleRefMetaData s27ServletUser = s27RoleRefs.get("ServletUser");
+ assertEquals("ServletUser", s27ServletUser.getRoleName());
+ assertEquals("ServletUserRole", s27ServletUser.getRoleLink());
+ }
+
+ protected JBossWebMetaData unmarshal() throws Exception
+ {
+ return unmarshal(JBoss4xDTDWebMetaData.class);
+ }
+
+ protected String getDescription(Descriptions descriptions)
+ {
+ String desc = null;
+ if(descriptions != null)
+ desc = descriptions.value()[0].value();
+ return desc;
+ }
+
+ protected Set<String> set(String...strings)
+ {
+ HashSet<String> set = new HashSet<String>();
+ for(String s : strings)
+ set.add(s);
+ return set;
+ }
+}
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml
===================================================================
--- projects/metadata/web/trunk/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,12 +0,0 @@
- <!DOCTYPE jboss-web PUBLIC
- "-//JBoss//DTD Web Application 5.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
-
-<jboss-web>
- <security-domain>java:/jaas/test</security-domain>
- <context-root>something</context-root>
- <servlet>
- <servlet-name>MyServlet</servlet-name>
- <run-as-principal>javajoe</run-as-principal>
- </servlet>
-</jboss-web>
\ No newline at end of file
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml (from rev 94608, projects/metadata/web/trunk/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/org/jboss/test/metadata/annotation/web/JBossWeb_testAnnotationXML.xml 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,16 @@
+<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd"
+ version="6.0">
+ <security-domain>java:/jaas/test</security-domain>
+ <context-root>something</context-root>
+ <annotation>
+ <class-name>org.jboss.test.metadata.annotation.web.MyServlet</class-name>
+ <run-as>
+ <role-name>javajoe</role-name>
+ </run-as>
+ <multipart-config>
+ <location>javajoe</location>
+ </multipart-config>
+ </annotation>
+</jboss-web>
\ No newline at end of file
Deleted: projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties
===================================================================
--- projects/metadata/web/trunk/src/test/resources/schema2class.properties 2009-09-18 13:00:21 UTC (rev 93709)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties 2009-10-09 16:12:52 UTC (rev 94610)
@@ -1,15 +0,0 @@
-# WEB
-web-app_2_2.dtd org.jboss.metadata.web.spec.Web22MetaData
-web-app_2_3.dtd org.jboss.metadata.web.spec.Web23MetaData
-web-app_2_4.xsd org.jboss.metadata.web.spec.Web24MetaData
-web-app_2_5.xsd org.jboss.metadata.web.spec.Web25MetaData
-web-app_3_0.xsd org.jboss.metadata.web.spec.Web30MetaData
-web-fragment_3_0.xsd org.jboss.metadata.web.spec.WebFragment30MetaData
-web-jsptaglibrary_1_1.dtd org.jboss.metadata.web.spec.Tld11MetaData
-web-jsptaglibrary_1_2.dtd org.jboss.metadata.web.spec.Tld12MetaData
-web-jsptaglibrary_2_0.xsd org.jboss.metadata.web.spec.Tld20MetaData
-web-jsptaglibrary_2_1.xsd org.jboss.metadata.web.spec.Tld21MetaData
-jboss-web org.jboss.metadata.web.jboss.JBoss50DTDWebMetaData
-jboss-web_4_0.dtd org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData
-jboss-web_4_2.dtd org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData
-jboss-web_5_0.dtd org.jboss.metadata.web.jboss.JBoss50DTDWebMetaData
Copied: projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties (from rev 94608, projects/metadata/web/trunk/src/test/resources/schema2class.properties)
===================================================================
--- projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties (rev 0)
+++ projects/metadata/web/tags/2.0.0.Alpha4/src/test/resources/schema2class.properties 2009-10-09 16:12:52 UTC (rev 94610)
@@ -0,0 +1,16 @@
+# WEB
+web-app_2_2.dtd org.jboss.metadata.web.spec.Web22MetaData
+web-app_2_3.dtd org.jboss.metadata.web.spec.Web23MetaData
+web-app_2_4.xsd org.jboss.metadata.web.spec.Web24MetaData
+web-app_2_5.xsd org.jboss.metadata.web.spec.Web25MetaData
+web-app_3_0.xsd org.jboss.metadata.web.spec.Web30MetaData
+web-fragment_3_0.xsd org.jboss.metadata.web.spec.WebFragment30MetaData
+web-jsptaglibrary_1_1.dtd org.jboss.metadata.web.spec.Tld11MetaData
+web-jsptaglibrary_1_2.dtd org.jboss.metadata.web.spec.Tld12MetaData
+web-jsptaglibrary_2_0.xsd org.jboss.metadata.web.spec.Tld20MetaData
+web-jsptaglibrary_2_1.xsd org.jboss.metadata.web.spec.Tld21MetaData
+jboss-web org.jboss.metadata.web.jboss.JBoss50DTDWebMetaData
+jboss-web_4_0.dtd org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData
+jboss-web_4_2.dtd org.jboss.metadata.web.jboss.JBoss4xDTDWebMetaData
+jboss-web_5_0.dtd org.jboss.metadata.web.jboss.JBoss50DTDWebMetaData
+jboss-web_6_0.xsd org.jboss.metadata.web.jboss.JBoss60WebMetaData
More information about the jboss-cvs-commits
mailing list