[jboss-cvs] JBossAS SVN: r94237 - in projects/embedded/trunk: assembly and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 1 23:49:49 EDT 2009
Author: ALRubinger
Date: 2009-10-01 23:49:49 -0400 (Thu, 01 Oct 2009)
New Revision: 94237
Added:
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerFullDepModeTestCase.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/Jbossian.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputBean.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/servlet/
projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/servlet/JspForwardingServlet.java
Removed:
projects/embedded/trunk/api/
projects/embedded/trunk/core/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerTestCase.java
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ejb3/
projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/servlet/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/datasources/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/jsp/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/persistence/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/queues/
projects/embedded/trunk/testsuite-full-dep/src/test/resources/webxml/
Modified:
projects/embedded/trunk/assembly/embedded-assembly.xml
projects/embedded/trunk/assembly/pom.xml
projects/embedded/trunk/build/pom.xml
projects/embedded/trunk/pom.xml
projects/embedded/trunk/testsuite-full-dep/pom.xml
projects/embedded/trunk/testsuite/pom.xml
projects/embedded/trunk/testsuite/src/test/java/org/jboss/ServerTestCase.java
Log:
[EMB-50] JBOSS_HOME-backed runtime with new assembly
Modified: projects/embedded/trunk/assembly/embedded-assembly.xml
===================================================================
--- projects/embedded/trunk/assembly/embedded-assembly.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/assembly/embedded-assembly.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -10,22 +10,83 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
+ <!--
+
+ This section here was intended to be a *small* assembly used to
+ boot AS. The procedure in mind was: 1) This goes on the ClassPath
+ 2) Make a URLCL pointing to necesary JARs in JBOSS_HOME/lib 3)
+ Upon server start, jboss-cl takes over and all works
+
+ Unfortunately, there are too many Class reference leaks to make
+ this approach practical at the moment. Leave this section
+ commented in place for the time being (chasing these down in order
+ is *very* time-consuming). <dependencySet> <unpack>true</unpack>
+ <includes>
+
+ <include>org.jboss.bootstrap:jboss-bootstrap-api</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-api-as</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-api-embedded</include>
+ <include>org.jboss.tmpdpl:tmpdpl-api</include>
+ <include>org.jboss.tmpdpl:tmpdpl-impl-vdf</include>
+ <include>org.jboss.tmpdpl:tmpdpl-spi-vdf</include>
+
+ <include>org.jboss.deployers:jboss-deployers-core-spi</include>
+ <include>org.jboss.deployers:jboss-deployers-client-spi</include>
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss.logging:jboss-logging-spi</include>
+ <include>org.jboss.man:jboss-managed</include>
+ <include>org.jboss:jboss-reflect</include>
+ <include>org.jboss.man:jboss-metatype</include>
+ <include>org.jboss:jboss-mdr</include>
+ <include>org.jboss.aop:jboss-aop</include>
+ <include>trove:trove</include>
+ <include>javassist:javassist</include>
+ <include>org.jboss:jboss-vfs</include>
+ <include>org.jboss.deployers:jboss-deployers-vfs-spi</include>
+ <include>org.jboss.deployers:jboss-deployers-spi</include>
+ <include>org.jboss.deployers:jboss-deployers-structure-spi</include>
+ <include>org.jboss:jbossxb</include>
+ <include>org.jboss.cl:jboss-classloading</include>
+ <include>org.jboss.cl:jboss-classloader</include>
+ <include>org.jboss.integration:jboss-classloading-spi</include>
+ <include>org.jboss.microcontainer:jboss-dependency</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-spi</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-spi-as</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-spi-mc</include>
+ <include>org.jboss.bootstrap:jboss-bootstrap-api-mc</include>
+ <include>org.jboss.cl:jboss-classloading-vfs</include>
+ <include>org.jboss.deployers:jboss-deployers-vfs</include>
+ <include>org.jboss.deployers:jboss-deployers-client</include>
+ <include>org.jboss.deployers:jboss-deployers-core</include>
+ <include>org.jboss.microcontainer:jboss-kernel</include>
+ <include>org.jboss.microcontainer:jboss-jmx-mc-int</include>
+ <include>org.jboss.deployers:jboss-deployers-impl</include>
+ <include>org.jboss.mx:jboss-j2se</include>
+ <include>org.jboss.microcontainer:jboss-aop-mc-int</include>
+ <include>org.jboss.mx:jboss-jmx</include>
+ <include>org.jboss.jbossas:jboss-as-j2se</include>
+ <include>org.jboss.jbossas:jboss-as-mbeans</include>
+ <include>oswego-concurrent:concurrent</include>
+ <include>dom4j:dom4j</include>
+
+
+ <include>org.jboss.logging:jboss-logging-log4j</include>
+ <include>org.jboss.logmanager:jboss-logmanager</include>
+ <include>org.jboss.logbridge:jboss-logbridge</include>
+ <include>log4j:log4j</include>
+
+ <include>org.jboss.naming:jnp-client</include>
+ <include>org.jboss.naming:jnpserver</include> </includes>
+ </dependencySet>
+ -->
+
+
+ <!-- Bring in *everything* defined via the POM -->
<dependencySet>
<unpack>true</unpack>
- <includes>
- <include>org.jboss.bootstrap:jboss-bootstrap-api-as</include>
- <include>org.jboss.bootstrap:jboss-bootstrap-api</include>
- <include>org.jboss.embedded:jboss-embedded-api</include>
- <include>org.jboss.tmpdpl:tmpdpl-api</include>
- <!--
- TODO:
- Below this line can likely be removed if put into JBOSS_HOME/lib or common/lib or something
- -->
- <include>org.jboss.tmpdpl:tmpdpl-impl-vdf</include>
- <include>org.jboss.tmpdpl:tmpdpl-spi-vdf</include>
- </includes>
</dependencySet>
</dependencySets>
+
<fileSets>
<fileSet>
<directory>target/classes</directory>
Modified: projects/embedded/trunk/assembly/pom.xml
===================================================================
--- projects/embedded/trunk/assembly/pom.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/assembly/pom.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
+ <!--
vi:ts=2:sw=2:expandtab:
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<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">
-
+
<!-- Parent -->
<parent>
<groupId>org.jboss.embedded</groupId>
@@ -26,18 +25,25 @@
<!-- Properties -->
<properties>
-
+
<!-- Versioning -->
- <version.org.jboss.embedded_jboss.embedded.core>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.core>
- <version.org.jboss.tmpdpl_tmpdpl.impl.vdf>0.1.0-SNAPSHOT</version.org.jboss.tmpdpl_tmpdpl.impl.vdf>
+ <!--
+ TODO: Properties below this line should be ultimately removed as
+ these dependencies should be provided as part of the AS dependency
+ chain
+ -->
+ <version.jboss.web>2.1.3.GA</version.jboss.web>
+ <version.jboss.messaging>1.4.3.GA</version.jboss.messaging>
+ <version.org.slf4j_slf4j.jboss.logging>1.0.2.GA</version.org.slf4j_slf4j.jboss.logging>
+
</properties>
<!-- Build -->
<build>
-
+
<plugins>
- <!-- Assembly Plugin -->
+ <!-- Assembly Plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
@@ -62,18 +68,56 @@
<!-- Dependencies -->
<dependencies>
-
- <!-- org.jboss.embedded:jboss-embedded-core -->
+
+ <!-- org.jboss.jbossas:jboss-as-build -->
<!--
- Don't export this dependency; mark as optional
+ We get dependencies transitively through here
-->
<dependency>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-core</artifactId>
- <optional>true</optional>
- <version>${version.org.jboss.embedded_jboss.embedded.core}</version>
- </dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-build</artifactId>
+ <type>pom</type>
+ </dependency>
+ <!--
+ Deps in the runtime of AS but *not* part of the AS dependency tree
+
+ TODO: Get these represented by the AS build dependency chain
+ JBAS-7267
+ -->
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-management</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <classifier>jsr77</classifier>
+ </dependency>
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>${version.jboss.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>el-api</artifactId>
+ <version>${version.jboss.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.web</groupId>
+ <artifactId>jasper-jdt</artifactId>
+ <version>${version.jboss.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.messaging</groupId>
+ <artifactId>jboss-messaging</artifactId>
+ <version>${version.jboss.messaging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.slf4j</groupId>
+ <artifactId>slf4j-jboss-logging</artifactId>
+ <version>${version.org.slf4j_slf4j.jboss.logging}</version>
+ </dependency>
+
</dependencies>
</project>
Modified: projects/embedded/trunk/build/pom.xml
===================================================================
--- projects/embedded/trunk/build/pom.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/build/pom.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -30,7 +30,6 @@
<version.junit_junit>4.6</version.junit_junit>
<version.org.jboss.jbossas>5.2.0-SNAPSHOT</version.org.jboss.jbossas>
<version.org.jboss.shrinkwrap_shrinkwrap.impl.base>0.1.0-SNAPSHOT</version.org.jboss.shrinkwrap_shrinkwrap.impl.base>
- <version.org.jboss.tmpdpl_tmpdpl.impl.vdf>0.1.0-SNAPSHOT</version.org.jboss.tmpdpl_tmpdpl.impl.vdf>
</properties>
@@ -146,13 +145,6 @@
<scope>test</scope>
</dependency>
- <!-- Deployable Containers (groupId and artifactId will change) -->
- <dependency>
- <groupId>org.jboss.tmpdpl</groupId>
- <artifactId>tmpdpl-impl-vdf</artifactId>
- <version>${version.org.jboss.tmpdpl_tmpdpl.impl.vdf}</version>
- </dependency>
-
<!-- ShrinkWrap (Declarative Archives) -->
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
@@ -168,20 +160,13 @@
<type>pom</type>
</dependency>
- <!-- JBossAS Client assembly
-
- This one is for runtime. We really want just compile-time.
-
- Plus it leaks in A LOT.
-
- <dependency>
+ <!--
+ JBossAS Client assembly This one is for runtime. We really want
+ just compile-time. Plus it leaks in A LOT. <dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>${version.org.jboss.jbossas}</version>
- <scope>test</scope>
- <type>pom</type>
- </dependency>
-
+ <scope>test</scope> <type>pom</type> </dependency>
-->
<!--
Modified: projects/embedded/trunk/pom.xml
===================================================================
--- projects/embedded/trunk/pom.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/pom.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -31,12 +31,10 @@
<!-- Aggregate Modules -->
<modules>
- <module>api</module>
<module>assembly</module>
<module>build</module>
- <module>core</module>
- <!-- <module>testsuite</module>
- <module>testsuite-fulldep Leave these out for the time being -->
+ <module>testsuite</module>
+ <module>testsuite-full-dep</module>
</modules>
</project>
Modified: projects/embedded/trunk/testsuite/pom.xml
===================================================================
--- projects/embedded/trunk/testsuite/pom.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/testsuite/pom.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -19,7 +19,6 @@
<name>JBossAS Embedded TestSuite</name>
<description>JBoss Application Server Embedded TestSuite</description>
-
<!-- Properties -->
<properties>
@@ -28,9 +27,31 @@
<version.org.apache.httpcomponents_httpclient>4.0-beta2</version.org.apache.httpcomponents_httpclient>
<version.org.jboss.javaee_jboss.jms.api>1.1.0.GA</version.org.jboss.javaee_jboss.jms.api>
<version.org.jboss.javaee_jboss.persistence.api>3.0.0.CR1</version.org.jboss.javaee_jboss.persistence.api>
+ <version.org.jboss.javaee_jboss.servlet.api>2.5.0.GA</version.org.jboss.javaee_jboss.servlet.api>
+ <version.org.jboss.javaee_jboss.ejb.api>3.0.0.GA</version.org.jboss.javaee_jboss.ejb.api>
</properties>
+ <!-- Build Configuration -->
+ <build>
+
+ <!-- Make a Test JAR (used by testsuite-fulldep component) -->
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
<!-- Dependencies -->
<dependencies>
@@ -43,13 +64,6 @@
</dependency>
<dependency>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-testsuite-fulldep</artifactId>
- <classifier>tests</classifier>
- <version>0.1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-impl-base</artifactId>
<scope>test</scope>
@@ -60,19 +74,25 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${version.org.apache.httpcomponents_httpclient}</version>
- <scope>test</scope>
</dependency>
+ <!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+ <!--
+ Dependencies below this line are for APIs used in the tests
+ themselves
+ -->
+
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jms-api</artifactId>
<version>${version.org.jboss.javaee_jboss.jms.api}</version>
<scope>test</scope>
+ <optional>true</optional>
</dependency>
<dependency>
@@ -80,8 +100,25 @@
<artifactId>jboss-persistence-api</artifactId>
<version>${version.org.jboss.javaee_jboss.persistence.api}</version>
<scope>test</scope>
+ <optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-servlet-api</artifactId>
+ <version>${version.org.jboss.javaee_jboss.servlet.api}</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ <version>${version.org.jboss.javaee_jboss.ejb.api}</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+
</dependencies>
</project>
Modified: projects/embedded/trunk/testsuite/src/test/java/org/jboss/ServerTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/ServerTestCase.java 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/ServerTestCase.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -23,16 +23,11 @@
package org.jboss;
import java.io.BufferedReader;
-import java.io.File;
import java.io.InputStreamReader;
import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
@@ -58,16 +53,16 @@
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
+import org.jboss.bootstrap.api.embedded.server.JBossASEmbeddedServer;
+import org.jboss.bootstrap.api.embedded.server.JBossASEmbeddedServerFactory;
import org.jboss.bootstrap.api.lifecycle.LifecycleState;
-import org.jboss.embedded.api.server.JBossASEmbeddedServer;
-import org.jboss.embedded.api.server.JBossASEmbeddedServerFactory;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.Jbossian;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarBean;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarLocalBusiness;
-import org.jboss.embedded.testsuite.fulldep.ejb3.mdb.MessageStoringMdb;
-import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputBean;
-import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputLocalBusiness;
-import org.jboss.embedded.testsuite.fulldep.servlet.JspForwardingServlet;
+import org.jboss.embedded.testsuite.ejb3.entity.Jbossian;
+import org.jboss.embedded.testsuite.ejb3.entity.JbossianRegistrarBean;
+import org.jboss.embedded.testsuite.ejb3.entity.JbossianRegistrarLocalBusiness;
+import org.jboss.embedded.testsuite.ejb3.mdb.MessageStoringMdb;
+import org.jboss.embedded.testsuite.ejb3.slsb.OutputBean;
+import org.jboss.embedded.testsuite.ejb3.slsb.OutputLocalBusiness;
+import org.jboss.embedded.testsuite.servlet.JspForwardingServlet;
import org.jboss.shrinkwrap.api.JavaArchiveFactory;
import org.jboss.shrinkwrap.api.Path;
import org.jboss.shrinkwrap.api.WebArchiveFactory;
@@ -81,14 +76,12 @@
/**
* ServerTestCase
*
- * The beginnings of the prototype for an end-user view
- * of the Embedded Server. Tests here should include lifecycle
+ * End-user view of the Embedded Server. Tests here should include lifecycle
* to start/stop the server, and checks to ensure that
* subsystems are working as expected.
*
- * This is the initial prototype for Embedded AS to run
- * with a full AS Dependency Set upon the Application
- * ClassLoader. The deps are defined by pom.xml and its parents.
+ * This is a high-level integration test for the Application
+ * Server running in Embedded mode
*
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
@@ -187,58 +180,17 @@
@BeforeClass
public static void startEmbedddedASAndSetNamingContext() throws Exception
{
-
- final Set<URL> urls = new HashSet<URL>();
- final String jbossHome = System.getenv("JBOSS_HOME");
- if (jbossHome == null || jbossHome.length() == 0)
- {
- throw new IllegalStateException("JBOSS_HOME is not set");
- }
- log.info("JBOSS_HOME: " + jbossHome);
- final File jbossHomeFile = new File(jbossHome);
- final URL jbossHomeUrl = jbossHomeFile.toURI().toURL();
- final URL jbossLib = new URL(jbossHomeUrl, "lib/");
- log.info("JBOSS Lib: " + jbossLib);
-
- final File libDir = new File(jbossLib.toURI());
- final File[] libs = libDir.listFiles();
- for (final File lib : libs)
- {
- urls.add(lib.toURI().toURL());
- }
-
- final URL[] urlarray = urls.toArray(new URL[]
- {});
-
- final ClassLoader oldCl = SecurityActions.getThreadContextClassLoader();
- final URLClassLoader urlcl = new URLClassLoader(urls.toArray(new URL[]
- {}), oldCl);
- log.info("URLs: " + urls);
- log.info("Number of URLs: " + urlarray.length);
-
- // Set TCCL to the URLCL
-
- SecurityActions.setThreadContextClassLoader(urlcl);
-
// Make Server (will pull JBOSS_HOME from env var or sys prop)
server = JBossASEmbeddedServerFactory.createServer();
+ log.info("Created: " + server);
- try
- {
- log.info("Created: " + server);
+ // Start
+ log.info("Starting Server: " + server);
+ server.start();
+ log.info("...started.");
- // Start
- log.info("Starting Server: " + server);
- server.start();
- log.info("...started.");
-
- // Set Naming Context
- NAMING_CONTEXT = new InitialContext();
- }
- finally
- {
- SecurityActions.setThreadContextClassLoader(oldCl);
- }
+ // Set Naming Context
+ NAMING_CONTEXT = new InitialContext();
}
/**
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/Jbossian.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/Jbossian.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/Jbossian.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.entity;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * JBossian
+ *
+ * Test entity bean to represent a hacker
+ * of JBoss projects
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Entity
+public class Jbossian implements Serializable
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Primary key
+ */
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long id;
+
+ /**
+ * Name
+ */
+ private String name;
+
+ /**
+ * Position / title
+ */
+ private String role;
+
+ /**
+ * Age
+ */
+ private int age;
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Default, no-arg constructor
+ */
+ public Jbossian()
+ {
+
+ }
+
+ /**
+ * Constructor to set all properties
+ */
+ public Jbossian(final String name, final String role, final int age)
+ {
+ // Set properties
+ this.setName(name);
+ this.setRole(role);
+ this.setAge(age);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Accessors / Mutators ---------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the role
+ */
+ public String getRole()
+ {
+ return role;
+ }
+
+ /**
+ * @param role the role to set
+ */
+ public void setRole(String role)
+ {
+ this.role = role;
+ }
+
+ /**
+ * @return the age
+ */
+ public int getAge()
+ {
+ return age;
+ }
+
+ /**
+ * @param age the age to set
+ */
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return this.getClass().getSimpleName() + " [name=" + name + ", role=" + role + ", age=" + age + "]";
+ }
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.entity;
+
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+/**
+ * JbossianRegistrarBean
+ *
+ * EJB3 SLSB to register/manage JBossians
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(JbossianRegistrarLocalBusiness.class)
+public class JbossianRegistrarBean implements JbossianRegistrarLocalBusiness
+{
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(JbossianRegistrarBean.class.getName());
+
+ private static final String EJBQL_ALL_JBOSSIANS = "SELECT o FROM " + Jbossian.class.getSimpleName() + " o";
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * JPA integration
+ */
+ @PersistenceContext
+ private EntityManager em;
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarLocalBusiness#add(org.jboss.embedded.testsuite.fulldep.ejb3.entity.Jbossian)
+ */
+ @Override
+ public void add(final Jbossian jbossian) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (jbossian == null)
+ {
+ throw new IllegalArgumentException("jbossian must be specified");
+ }
+
+ // Persist
+ log.info("Persisting: " + jbossian);
+ em.persist(jbossian);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarLocalBusiness#getAllJbossians()
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Collection<Jbossian> getAllJbossians()
+ {
+ // Get all
+ final Collection<Jbossian> list;
+ try
+ {
+ list = em.createQuery(EJBQL_ALL_JBOSSIANS).getResultList();
+ }
+ catch (final ClassCastException cce)
+ {
+ throw new RuntimeException(
+ "Error in setup, only objects of type " + Jbossian.class.getName() + " are allowed", cce);
+ }
+ log.info("Returning " + list.size() + " " + Jbossian.class.getSimpleName() + "(s)");
+ return list;
+ }
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.entity;
+
+import java.util.Collection;
+
+/**
+ * JBossianRegistrar
+ *
+ * Interface of a business object to add and list JBossians
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JbossianRegistrarLocalBusiness
+{
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns all JBossians registered in the system
+ * @return
+ */
+ Collection<Jbossian> getAllJbossians();
+
+ /**
+ * Adds the specified JBossian to the system
+ *
+ * @param jbossian
+ * @throws IllegalArgumentException If no JBossian was specified
+ */
+ void add(Jbossian jbossian) throws IllegalArgumentException;
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.mdb;
+
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Logger;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+/**
+ * MessageStoringMdb
+ *
+ * A message-driven bean which stores the contents of a text
+ * message into a publicly-available static field.
+ *
+ * Here we control the test environment
+ * so we'll permit this clash of design paradigms. Don't
+ * try this at home, kids.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at MessageDriven(activationConfig =
+{@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = MessageStoringMdb.NAME_QUEUE)})
+public class MessageStoringMdb implements MessageListener
+{
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(MessageStoringMdb.class.getName());
+
+ /**
+ * Exposed contents of the last message received, volatile
+ * so the thread visibility from the test will always get the
+ * right value
+ */
+ public volatile static String LAST_MESSAGE_CONTENTS = null;
+
+ /**
+ * Shared barrier, so tests can wait until the MDB is processed
+ */
+ public static CyclicBarrier BARRIER = new CyclicBarrier(2);
+
+ /**
+ * Name of the queue upon which we'll listen
+ */
+ public static final String NAME_QUEUE = "queue/EmbeddedQueue";
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
+ */
+ @Override
+ public void onMessage(final Message message)
+ {
+ // Log
+ log.info("Received: " + message);
+
+ // Cast
+ final TextMessage notSms = (TextMessage) message;
+
+ // Obtain contents
+ final String contents;
+ try
+ {
+ contents = notSms.getText();
+ }
+ catch (final JMSException jmse)
+ {
+ throw new RuntimeException("Could not obtain contents of message: " + notSms, jmse);
+ }
+
+ // Store contents
+ LAST_MESSAGE_CONTENTS = contents;
+
+ // Announce to the barrier we're here, and block on the test
+ // (so that the test can block as well and know when we're done;
+ // we should really be the second ones here)
+ try
+ {
+ BARRIER.await(2, TimeUnit.SECONDS);
+ }
+ catch (final InterruptedException e)
+ {
+ // Clear the flag
+ Thread.interrupted();
+ // Throw up
+ throw new RuntimeException("Unexpected interruption", e);
+ }
+ catch (final BrokenBarrierException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (final TimeoutException e)
+ {
+ throw new RuntimeException("The test did not call upon the barrier in the allotted time", e);
+ }
+ }
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputBean.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputBean.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputBean.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.slsb;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+
+/**
+ * OutputBean
+ *
+ * Simple SLSB which will return a contracted output
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(OutputLocalBusiness.class)
+public class OutputBean implements OutputLocalBusiness
+{
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ public String getOutput()
+ {
+ String sd="";
+ sd.toCharArray();
+ return OutputLocalBusiness.OUTPUT;
+ }
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.ejb3.slsb;
+
+/**
+ * OutputLocalBusiness
+ *
+ * Local business interface to an SLSB which will
+ * return a contracted String output
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface OutputLocalBusiness
+{
+ //-------------------------------------------------------------------------------||
+ // Constants --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ String OUTPUT = "Embedded SLSB Local Business Output";
+
+ //-------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Returns the contracted output
+ */
+ String getOutput();
+}
Added: projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/servlet/JspForwardingServlet.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/servlet/JspForwardingServlet.java (rev 0)
+++ projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/servlet/JspForwardingServlet.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.embedded.testsuite.servlet;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * JspForwardingServlet
+ *
+ * Servlet which forwards to a JSP as requested
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JspForwardingServlet extends HttpServlet
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(JspForwardingServlet.class.getName());
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Name of the request parameter denoting which JSP to forward
+ */
+ public static final String REQ_PARAM_JSP = "jsp";
+
+ /**
+ * Context root
+ */
+ private static final char ROOT = '/';
+
+ /**
+ * Content type to use in forwarding
+ */
+ private static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain";
+
+ //-------------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Forwards the request to a JSP denoted by the request parameter "jsp",
+ * returning a status of 400/Bad Request if not specified
+ *
+ * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
+ IOException
+ {
+ // Log
+ log.info("Request: " + request);
+
+ // Get the target JSP page
+ final String jsp = request.getParameter(REQ_PARAM_JSP);
+
+ // Handle unspecified
+ if (jsp == null)
+ {
+ // HTTP 400 and return
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+
+ // Set the content-type to text
+ response.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+
+ // Forward
+ final String resolvedLocation = ROOT + jsp;
+ log.info("Forwarding to: " + resolvedLocation);
+ final RequestDispatcher dispatcher = request.getRequestDispatcher(resolvedLocation);
+ dispatcher.forward(request, response);
+ }
+
+}
Modified: projects/embedded/trunk/testsuite-full-dep/pom.xml
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/pom.xml 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/testsuite-full-dep/pom.xml 2009-10-02 03:49:49 UTC (rev 94237)
@@ -25,117 +25,54 @@
<properties>
<!-- Versioning -->
- <version.org.jboss.embedded_jboss.embedded.core>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.core>
- <version.org.apache.httpcomponents_httpclient>4.0-beta2</version.org.apache.httpcomponents_httpclient>
+ <version.org.jboss.embedded_jboss.embedded.assembly>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.assembly>
+ <version.org.jboss.embedded_jboss.embedded.testsuite>0.1.0-SNAPSHOT</version.org.jboss.embedded_jboss.embedded.testsuite>
- <!--
- TODO: Properties below this line should be ultimately removed as
- these dependencies should be provided as part of the AS dependency
- chain
- -->
-
- <version.jboss.web>2.1.3.GA</version.jboss.web>
- <version.jboss.messaging>1.4.3.GA</version.jboss.messaging>
- <version.org.slf4j_slf4j.jboss.logging>1.0.2.GA</version.org.slf4j_slf4j.jboss.logging>
-
</properties>
+ <!-- Build Configuration -->
<build>
- <!-- Make a Test JAR (temporary, used by testsuite component) -->
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
</build>
<!-- Dependencies -->
<dependencies>
- <!-- JBossAS Embedded Core -->
- <dependency>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-core</artifactId>
- <version>${version.org.jboss.embedded_jboss.embedded.core}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- ShrinkWrap -->
- <dependency>
- <groupId>org.jboss.shrinkwrap</groupId>
- <artifactId>shrinkwrap-impl-base</artifactId>
- <scope>test</scope>
- </dependency>
-
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
- <!-- Apache HttpClient -->
+ <!--
+ AS modules and 3rdparty deps, all brought in transitively via the
+ assembly This will test the run mode where Maven launches the
+ suite with all transitive dependencies individually upon the
+ ClassPath
+ -->
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${version.org.apache.httpcomponents_httpclient}</version>
+ <groupId>org.jboss.embedded</groupId>
+ <artifactId>jboss-embedded-assembly</artifactId>
+ <type>pom</type>
+ <version>${version.org.jboss.embedded_jboss.embedded.assembly}</version>
<scope>test</scope>
</dependency>
- <!-- AS modules and 3rdparty deps -->
+ <!-- We inherit from the "testsuite" tests -->
<dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-build</artifactId>
- <type>pom</type>
+ <groupId>org.jboss.embedded</groupId>
+ <artifactId>jboss-embedded-testsuite</artifactId>
+ <classifier>tests</classifier>
+ <version>${version.org.jboss.embedded_jboss.embedded.testsuite}</version>
+ <scope>test</scope>
</dependency>
- <!--
- Deps in the runtime of AS but *not* part of the AS dependency tree
-
- TODO: Get these represented by the AS build dependency chain
- JBAS-7267
- -->
-
+ <!-- ShrinkWrap -->
<dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-management</artifactId>
- <version>${version.org.jboss.jbossas}</version>
- <classifier>jsr77</classifier>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-impl-base</artifactId>
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>jboss.web</groupId>
- <artifactId>jsp-api</artifactId>
- <version>${version.jboss.web}</version>
- </dependency>
- <dependency>
- <groupId>jboss.web</groupId>
- <artifactId>el-api</artifactId>
- <version>${version.jboss.web}</version>
- </dependency>
- <dependency>
- <groupId>jboss.web</groupId>
- <artifactId>jasper-jdt</artifactId>
- <version>${version.jboss.web}</version>
- </dependency>
- <dependency>
- <groupId>jboss.messaging</groupId>
- <artifactId>jboss-messaging</artifactId>
- <version>${version.jboss.messaging}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.slf4j</groupId>
- <artifactId>slf4j-jboss-logging</artifactId>
- <version>${version.org.slf4j_slf4j.jboss.logging}</version>
- </dependency>
</dependencies>
Copied: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerFullDepModeTestCase.java (from rev 94231, projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerTestCase.java)
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerFullDepModeTestCase.java (rev 0)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerFullDepModeTestCase.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.
+ */
+//FIXME We have to be in org.jboss due to JMX getPackage in AS
+package org.jboss.embedded.testsuite.fulldep;
+
+import org.jboss.ServerTestCase;
+
+/**
+ * ServerMavenRunModeTestCase
+ *
+ * Runs exactly the same suite as defined by
+ * {@link ServerTestCase}, but with the individual
+ * dependencies brought onto the classpath
+ * transitively via Maven
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ServerFullDepModeTestCase extends ServerTestCase
+{
+
+}
Deleted: projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerTestCase.java
===================================================================
--- projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerTestCase.java 2009-10-02 03:48:49 UTC (rev 94236)
+++ projects/embedded/trunk/testsuite-full-dep/src/test/java/org/jboss/embedded/testsuite/fulldep/ServerTestCase.java 2009-10-02 03:49:49 UTC (rev 94237)
@@ -1,476 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.
- */
-//FIXME We have to be in org.jboss due to JMX getPackage in AS
-package org.jboss.embedded.testsuite.fulldep;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.utils.URIUtils;
-import org.apache.http.client.utils.URLEncodedUtils;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.message.BasicNameValuePair;
-import org.jboss.bootstrap.api.lifecycle.LifecycleState;
-import org.jboss.embedded.api.server.JBossASEmbeddedServer;
-import org.jboss.embedded.core.server.JBossASEmbeddedServerImpl;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.Jbossian;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarBean;
-import org.jboss.embedded.testsuite.fulldep.ejb3.entity.JbossianRegistrarLocalBusiness;
-import org.jboss.embedded.testsuite.fulldep.ejb3.mdb.MessageStoringMdb;
-import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputBean;
-import org.jboss.embedded.testsuite.fulldep.ejb3.slsb.OutputLocalBusiness;
-import org.jboss.embedded.testsuite.fulldep.servlet.JspForwardingServlet;
-import org.jboss.logging.Logger;
-import org.jboss.shrinkwrap.api.JavaArchiveFactory;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.WebArchiveFactory;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.jboss.tmpdpl.api.deployable.Deployable;
-import org.jboss.tmpdpl.api.deployable.VfsVdfDeployableFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * ServerTestCase
- *
- * The beginnings of the prototype for an end-user view
- * of the Embedded Server. Tests here should include lifecycle
- * to start/stop the server, and checks to ensure that
- * subsystems are working as expected.
- *
- * This is the initial prototype for Embedded AS to run
- * with a full AS Dependency Set upon the Application
- * ClassLoader. The deps are defined by pom.xml and its parents.
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class ServerTestCase
-{
-
- //-------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Logger
- */
- private static final Logger log = Logger.getLogger(ServerTestCase.class);
-
- /**
- * The server instance
- */
- private static JBossASEmbeddedServer server;
-
- /**
- * Path, relative to the resources base, of a test web.xml
- */
- private static final String PATH_ACTUAL_WEB_XML = "webxml/servletForwardingToJsp.xml";
-
- /**
- * Filename of a test queue *-service.xml
- */
- private static final String FILENAME_QUEUE_SERVICE_XML = "mdb-queue-service.xml";
-
- /**
- * Path, relative to the resources base, of a test queue *-service.xml
- */
- private static final String PATH_QUEUE_SERVICE_XML = "queues/" + FILENAME_QUEUE_SERVICE_XML;
-
- /**
- * Path, relative to the resources base, of a test JSP
- */
- private static final String PATH_JSP = "jsp/requestParamEcho.jsp";
-
- /**
- * Path, relative to the resources base, of a persistence.xml file for Embedded DataSource
- */
- private static final String PATH_RESOURCE_PERSISTENCE_XML_EMBEDDED = "persistence/persistenceEmbedded.xml";
-
- /**
- * Path, relative to the deployment root, of a persistence.xml file
- */
- private static final String PATH_DESTINATION_PERSISTENCE_XML = "persistence.xml";
-
- /**
- * Path, relative to the resources base, of the directory containing DataSource resources
- */
- private static final String PATH_RESOURCE_DS_XMLs = "datasources/";
-
- /**
- * Filename of the Embedded DataSource deployment XML
- */
- private static final String FILENAME_EMBEDDED_DS = "embedded-ds.xml";
-
- /**
- * Path, relative to the resources base, of the directory containing DataSource resources
- */
- private static final String PATH_RESOURCE_DS_XML_EMBEDDED = PATH_RESOURCE_DS_XMLs + FILENAME_EMBEDDED_DS;
-
- /**
- * Separator character within archives
- */
- private static final char SEPARATOR = '/';
-
- /**
- * The JNDI Context
- */
- private static Context NAMING_CONTEXT;
-
- /**
- * Name of the Queue Connection Factory in JNDI
- */
- private static final String JNDI_NAME_CONNECTION_FACTORY = "ConnectionFactory";
-
- /**
- * JNDI name suffix appended to local business EJB3 views
- */
- private static final String JNDI_SUFFIX_LOCAL_BUSINESS = "/local";
-
- //-------------------------------------------------------------------------------||
- // Lifecycle --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Starts up the Application Server. Relies upon either Environment
- * Variable "JBOSS_HOME" or System Property "jboss.home" being set, with
- * precedence to the system property
- */
- @BeforeClass
- public static void startEmbedddedASAndSetNamingContext() throws Exception
- {
- // Make Server (will pull JBOSS_HOME from env var or sys prop)
- server = new JBossASEmbeddedServerImpl();
- log.info("Created: " + server);
-
- // Start
- log.info("Starting Server: " + server);
- server.start();
- log.info("...started.");
-
- // Set Naming Context
- NAMING_CONTEXT = new InitialContext();
- }
-
- /**
- * Shuts down the Application Server after the suite ends
- */
- @AfterClass
- public static void stopEmbeddedAS() throws Exception
- {
- // If exists and started
- if (server != null && server.getState().equals(LifecycleState.STARTED))
- {
- // Shutdown
- log.info("Shutting down server: " + server);
- server.shutdown();
- }
-
- }
-
- //-------------------------------------------------------------------------------||
- // Tests ------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Tests EJB3 Stateless Session Beans via a virtual archive
- * deployment
- */
- @Test
- public void testSlsb() throws Exception
- {
- // Log
- log.info("testSlsb");
-
- // Make a deployment
- final String name = "slsb.jar";
- final JavaArchive archive = JavaArchiveFactory.create(name).addClasses(OutputBean.class,
- OutputLocalBusiness.class);
- log.info(archive.toString(true));
- final Deployable deployable = VfsVdfDeployableFactory.createDeployable(archive);
-
- // Deploy
- server.deploy(deployable);
-
- // Test
- final OutputLocalBusiness bean = (OutputLocalBusiness) NAMING_CONTEXT.lookup(OutputBean.class.getSimpleName()
- + JNDI_SUFFIX_LOCAL_BUSINESS);;
- final String output = bean.getOutput();
- log.info("Got output: " + output);
- Assert.assertEquals(OutputLocalBusiness.OUTPUT, output);
-
- // Undeploy
- server.undeploy(deployable);
-
- }
-
- /**
- * Tests deployment of a virtual WAR containing a servlet
- * and JSP.
- *
- * The Servlet will forward to the JSP path denoted by request param
- * "jsp". The JSP will echo the value of request param "echo".
- *
- * @throws Exception
- */
- @Test
- public void testWarServletJsp() throws Exception
- {
- // Log
- log.info("testWarServletJsp");
-
- // Make a deployment
- final String appName = "testServletJsp";
- final String name = appName + ".war";
- final Class<?> servletClass = JspForwardingServlet.class;
- final WebArchive archive = WebArchiveFactory.create(name);
- final Path targetPathWebXml = new BasicPath("web.xml");
- archive.addWebResource(targetPathWebXml, PATH_ACTUAL_WEB_XML).addResource(PATH_JSP).addClass(servletClass);
- log.info(archive.toString(true));
-
- // Deploy
- server.deploy(archive);
-
- // Get an HTTP Client
- final HttpClient client = new DefaultHttpClient();
-
- // Make an HTTP Request
- final String echoValue = "EmbeddedBiatch";
- final List<NameValuePair> params = new ArrayList<NameValuePair>();
- params.add(new BasicNameValuePair("jsp", PATH_JSP));
- params.add(new BasicNameValuePair("echo", echoValue));
- final URI uri = URIUtils.createURI("http", "localhost", 8080, appName + SEPARATOR + servletClass.getSimpleName(),
- URLEncodedUtils.format(params, "UTF-8"), null);
- final HttpGet request = new HttpGet(uri);
-
- // Execute the request
- log.info("Executing request to: " + request.getURI());
- final HttpResponse response = client.execute(request);
- final HttpEntity entity = response.getEntity();
- if (entity == null)
- {
- TestCase.fail("Request returned no entity");
- }
-
- // Read the result, ensure it's what we're expecting (should be the value of request param "echo")
- final BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
- final String line = reader.readLine();
- log.info("Got response: " + line);
- Assert.assertEquals(echoValue, line);
-
- // Undeploy
- server.undeploy(archive);
- }
-
- /**
- * Tests deployment of a JMS Queue with EJB3 MDB Listener
- *
- * The MDB will simply store the text of the message in a publicly-accessible
- * static field
- *
- * @throws Exception
- */
- @Test
- public void testJmsAndMdb() throws Exception
- {
- // Log
- log.info("testJmsAndMdb");
-
- // Create a virtual archive for the MDB deployment
- final String name = "jms-mdb-test.jar";
- final JavaArchive archive = JavaArchiveFactory.create(name);
- final Path queuesTargetPath = new BasicPath(FILENAME_QUEUE_SERVICE_XML);
- archive.addClass(MessageStoringMdb.class).addResource(queuesTargetPath, PATH_QUEUE_SERVICE_XML);
-
- // Deploy
- log.info(archive.toString(true));
- final Deployable deployable = VfsVdfDeployableFactory.createDeployable(archive);
- server.deploy(archive);
-
- // Define a String message to send
- final String message = "From in-JVM Test Message";
-
- // Send the message
- this.sendTextMessageToQueue(message, MessageStoringMdb.NAME_QUEUE);
-
- // Wait on the MDB to process
- try
- {
- MessageStoringMdb.BARRIER.await(10, TimeUnit.SECONDS);
- }
- catch (final InterruptedException e)
- {
- // Clear the flag
- Thread.interrupted();
- // Throw up
- throw e;
- }
- catch (final TimeoutException e)
- {
- TestCase.fail("The MDB did not process the message in the allotted time");
- }
-
- // Get the contents of the String from the MDB
- final String received = MessageStoringMdb.LAST_MESSAGE_CONTENTS;
-
- // Ensure equal
- Assert.assertEquals("The test message received was not as expected", message, received);
-
- // Undeploy
- server.undeploy(deployable);
-
- }
-
- /**
- * Tests deployment of a JCA DataSource and EJB3 Entity Bean (JPA)
- *
- * A test SLSB will also be used to create a few rows in the DB,
- * then obtain all.
- *
- * @throws Exception
- */
- @Test
- public void testDataSourceAndEntity() throws Exception
- {
- // Log
- log.info("testDataSourceAndEntity");
-
- // Create a virtual archive for DS, persistence.xml, Entity, and SLSB
- final String name = "datasource-entity-test.jar";
- final Path targetDsPath = new BasicPath(FILENAME_EMBEDDED_DS); //TODO Use factory when available
- final Path targetPersistencePath = new BasicPath(PATH_DESTINATION_PERSISTENCE_XML); //TODO Use factory when available
- final JavaArchive archive = JavaArchiveFactory.create(name);
- archive.addClasses(Jbossian.class, JbossianRegistrarLocalBusiness.class, JbossianRegistrarBean.class)
- .addResource(targetDsPath, PATH_RESOURCE_DS_XML_EMBEDDED).addManifestResource(targetPersistencePath,
- PATH_RESOURCE_PERSISTENCE_XML_EMBEDDED);
-
- // Deploy
- log.info(archive.toString(true));
- server.deploy(archive);
-
- // Make some JBossians
- final Jbossian jgreene = new Jbossian("Jason T. Greene", "AS Hole", 12);
- final Jbossian jpederse = new Jbossian("Jesper Pedersen", "Professional Tattletale", 21);
- final Jbossian dmlloyd = new Jbossian("David M. Lloyd", "???????", 15);
- final Jbossian wolfc = new Jbossian("Carlo de Wolf", "Superlead", 13);
- final Jbossian alr = new Jbossian("Andew Lee Rubinger", "The New Fluery", 58);
- final Jbossian asaldhan = new Jbossian("Anil Saldhana", "Karma Police", 23);
-
- // Get an SLSB to interact w/ the DB
- final JbossianRegistrarLocalBusiness slsb = (JbossianRegistrarLocalBusiness) NAMING_CONTEXT
- .lookup(JbossianRegistrarBean.class.getSimpleName() + JNDI_SUFFIX_LOCAL_BUSINESS);
-
- // Add the JBossians
- slsb.add(jgreene);
- slsb.add(jpederse);
- slsb.add(dmlloyd);
- slsb.add(wolfc);
- slsb.add(alr);
- slsb.add(asaldhan);
-
- // Get all
- final Collection<Jbossian> jbossians = slsb.getAllJbossians();
- log.info("Got all JBossians: " + jbossians);
-
- // Test
- Assert.assertEquals(6, jbossians.size());
-
- // Undeploy
- server.undeploy(archive);
- }
-
- //-------------------------------------------------------------------------------------||
- // Internal Helper Methods ------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Sends a JMS {@link TextMessage} containing the specified contents to the
- * queue of the specified name
- *
- * @param contents
- * @param queueName
- * @throws Exception
- * @throws IllegalArgumentException If either argument is not provided
- */
- private void sendTextMessageToQueue(final String contents, final String queueName) throws Exception,
- IllegalArgumentException
- {
- // Precondition check
- if (contents == null || contents.length() == 0)
- {
- throw new IllegalArgumentException("contents must be provided");
- }
- if (queueName == null || queueName.length() == 0)
- {
- throw new IllegalArgumentException("queueName must be provided");
- }
-
- // Get the queue from JNDI
- final Queue queue = (Queue) NAMING_CONTEXT.lookup(queueName);
-
- // Get the ConnectionFactory from JNDI
- final QueueConnectionFactory factory = (QueueConnectionFactory) NAMING_CONTEXT
- .lookup(JNDI_NAME_CONNECTION_FACTORY);
-
- // Make a Connection
- final QueueConnection connection = factory.createQueueConnection();
- final QueueSession sendSession = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
-
- // Make the message
- final TextMessage message = sendSession.createTextMessage(contents);
-
- // Send the message
- final QueueSender sender = sendSession.createSender(queue);
- sender.send(message);
- log.info("Sent message " + message + " with contents: " + contents);
-
- // Clean up
- sendSession.close();
- connection.close();
- }
-}
More information about the jboss-cvs-commits
mailing list