[jboss-cvs] JBossAS SVN: r105596 - in trunk: component-matrix and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 2 16:42:53 EDT 2010
Author: ALRubinger
Date: 2010-06-02 16:42:51 -0400 (Wed, 02 Jun 2010)
New Revision: 105596
Added:
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/EmbeddedEjbCallingServlet.java
trunk/embedded/src/test/resources/webxml/ejbCallingServlet.xml
Modified:
trunk/build/build.xml
trunk/component-matrix/pom.xml
trunk/depchain/pom.xml
trunk/embedded/pom.xml
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputBean.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java
trunk/testsuite/src/main/org/jboss/test/osgi/simple/SimpleRuntimeTestCase.java
Log:
[JBAS-7964] Merged r104179 to r105595 from branches/TEMP_EJB3_EMBEDDABLE_JBAS-7964 to trunk; bringing in Embedded EJB3 1.0.0-alpha-1 in paravirtualized mode
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/build/build.xml 2010-06-02 20:42:51 UTC (rev 105596)
@@ -708,6 +708,8 @@
<include name="ejb3-timerservice-jboss-beans.xml"/>
<include name="ejb3-connectors-jboss-beans.xml"/>
</fileset>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-impl-as:jar"/>
+ <fileset refid="org.jboss.shrinkwrap:shrinkwrap-extension-vdf:jar" />
<fileset dir="${ejb3.module.output}/resources/META-INF">
<include name="singleton-container-aop.xml"/>
</fileset>
@@ -2071,6 +2073,11 @@
<fileset refid="org.jboss.ejb3.container:jboss-ejb3-container-spi:jar"/>
<fileset refid="org.jboss.ejb3.context:jboss-ejb3-context-base:jar"/>
<fileset refid="org.jboss.ejb3.context:jboss-ejb3-context-naming:jar"/>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-api:jar"/>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-api-shrinkwrap:jar"/>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-impl-base:jar"/>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-impl-shrinkwrap:jar"/>
+ <fileset refid="org.jboss.ejb3.embedded:jboss-ejb3-embedded-spi:jar"/>
<fileset refid="org.jboss.ejb3:jboss-ejb3-core:jar"/>
<fileset refid="org.jboss.ejb3:jboss-ejb3-deployers:jar"/>
<fileset refid="org.jboss.ejb3:jboss-ejb3-endpoint:jar"/>
@@ -2109,6 +2116,7 @@
<fileset refid="org.jboss.shrinkwrap:shrinkwrap-api:jar" />
<fileset refid="org.jboss.shrinkwrap:shrinkwrap-impl-base:jar" />
<fileset refid="org.jboss.shrinkwrap:shrinkwrap-spi:jar" />
+ <fileset refid="org.jboss.shrinkwrap:shrinkwrap-extension-vfs3:jar" />
<fileset refid="org.hibernate:hibernate-core:jar"/>
<fileset refid="org.hibernate:hibernate-commons-annotations:jar"/>
<fileset refid="org.hibernate:hibernate-entitymanager:jar"/>
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/component-matrix/pom.xml 2010-06-02 20:42:51 UTC (rev 105596)
@@ -104,6 +104,8 @@
<version.org.jboss.common.core>2.2.17.GA</version.org.jboss.common.core>
<version.org.jboss.deployers>2.2.0.Alpha5</version.org.jboss.deployers>
<version.org.jboss.ejb3.bom>0.1.2</version.org.jboss.ejb3.bom>
+ <!-- This to move into the EJB3 BOM -->
+ <version.org.jboss.ejb3.embedded>1.0.0-alpha-1</version.org.jboss.ejb3.embedded>
<version.org.jboss.ejb.api>1.0-alpha-1</version.org.jboss.ejb.api>
<version.org.jboss.embedded>1.0.0-alpha-3</version.org.jboss.embedded>
<version.org.jboss.injection>0.1.0-alpha-2</version.org.jboss.injection>
@@ -144,7 +146,7 @@
<version.org.jboss.security>3.0.0.Beta4</version.org.jboss.security>
<version.org.jboss.security.negotiation>2.0.3.SP1</version.org.jboss.security.negotiation>
<version.org.jboss.service.binding>1.1.0.CR1</version.org.jboss.service.binding>
- <version.org.jboss.shrinkwrap>1.0.0-alpha-9</version.org.jboss.shrinkwrap>
+ <version.org.jboss.shrinkwrap>1.0.0-alpha-10</version.org.jboss.shrinkwrap>
<version.org.jboss.slf4j>1.0.2.GA</version.org.jboss.slf4j>
<version.org.jboss.stdio>1.0.0.CR3</version.org.jboss.stdio>
<version.org.jboss.threads>2.0.0.CR4</version.org.jboss.threads>
@@ -2819,8 +2821,41 @@
<type>pom</type>
<scope>import</scope>
</dependency>
-
+
+ <!-- This to move into the EJB3 BOM -->
<dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-api</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-api-shrinkwrap</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-as</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-base</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-shrinkwrap</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-spi</artifactId>
+ <version>${version.org.jboss.ejb3.embedded}</version>
+ </dependency>
+
+
+ <dependency>
<groupId>org.jboss.embedded</groupId>
<artifactId>jboss-embedded-api</artifactId>
<version>${version.org.jboss.embedded}</version>
@@ -3450,8 +3485,17 @@
<artifactId>shrinkwrap-impl-base</artifactId>
<version>${version.org.jboss.shrinkwrap}</version>
</dependency>
-
<dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-extension-vdf</artifactId>
+ <version>${version.org.jboss.shrinkwrap}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-extension-vfs3</artifactId>
+ <version>${version.org.jboss.shrinkwrap}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee6-specs-bom</artifactId>
<version>${version.org.jboss.javaee.specs.bom}</version>
Modified: trunk/depchain/pom.xml
===================================================================
--- trunk/depchain/pom.xml 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/depchain/pom.xml 2010-06-02 20:42:51 UTC (rev 105596)
@@ -582,6 +582,90 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-api-shrinkwrap</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-as</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-base</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-impl-shrinkwrap</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3.embedded</groupId>
+ <artifactId>jboss-ejb3-embedded-spi</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-endpoint-deployer</artifactId>
<exclusions>
@@ -834,13 +918,40 @@
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-spi</artifactId>
- <version>${version.org.jboss.shrinkwrap}</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-impl-base</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-extension-vdf</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-extension-vfs3</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.jboss.slf4j</groupId>
<artifactId>slf4j-jboss-logging</artifactId>
</dependency>
Modified: trunk/embedded/pom.xml
===================================================================
--- trunk/embedded/pom.xml 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/embedded/pom.xml 2010-06-02 20:42:51 UTC (rev 105596)
@@ -3,7 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- Parent -->
- <!-- Do not depend on jboss-as-parent or component-matrix; we cannot inherit depMgt here so we assure the build is working right for consumers outside AS -->
<parent>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-parent</artifactId>
Modified: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java 2010-06-02 20:42:51 UTC (rev 105596)
@@ -56,6 +56,7 @@
import org.apache.http.message.BasicNameValuePair;
import org.jboss.bootstrap.api.lifecycle.LifecycleState;
import org.jboss.bootstrap.api.mc.server.MCBasedServer;
+import org.jboss.ejb3.embedded.api.JBossEJBContainer;
import org.jboss.embedded.api.server.JBossASEmbeddedServer;
import org.jboss.embedded.api.server.JBossASEmbeddedServerFactory;
import org.jboss.jbossas.embedded.testsuite.ejb3.entity.Jbossian;
@@ -65,6 +66,7 @@
import org.jboss.jbossas.embedded.testsuite.ejb3.slsb.OutputBean;
import org.jboss.jbossas.embedded.testsuite.ejb3.slsb.OutputLocalBusiness;
import org.jboss.jbossas.embedded.testsuite.mc.StateReportingBean;
+import org.jboss.jbossas.embedded.testsuite.servlet.EmbeddedEjbCallingServlet;
import org.jboss.jbossas.embedded.testsuite.servlet.JspForwardingServlet;
import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -109,11 +111,18 @@
private static final String PATH_RESOURCE_WEB_XML = "webxml/";
/**
- * Path, relative to the resources base, of a test web.xml
+ * Path, relative to the resources base, of a test web.xml for a Servlet which forwards control to a JSP
*/
- private static final String PATH_ACTUAL_WEB_XML = PATH_RESOURCE_WEB_XML + "servletForwardingToJsp.xml";
+ private static final String PATH_ACTUAL_SERVLET_FORWARDING_TO_JSP_WEB_XML = PATH_RESOURCE_WEB_XML
+ + "servletForwardingToJsp.xml";
/**
+ * Path, relative to the resources base, of a test web.xml for a Servlet which uses the {@link JBossEJBContainer} API
+ */
+ private static final String PATH_ACTUAL_SERVLET_EMBEDDED_EJB_WEB_XML = PATH_RESOURCE_WEB_XML
+ + "ejbCallingServlet.xml";
+
+ /**
* Filename of a test queue *-service.xml
*/
private static final String FILENAME_QUEUE_SERVICE_XML = "hornetq-jms.xml";
@@ -255,21 +264,26 @@
// Make a deployment
final String name = "slsb.jar";
- final JavaArchive archive = ShrinkWrap.create(name, JavaArchive.class).addClasses(OutputBean.class,
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name).addClasses(OutputBean.class,
OutputLocalBusiness.class);
log.info(archive.toString(true));
// Deploy
server.deploy(archive);
// 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);
+ try
+ {
+ final OutputLocalBusiness bean = (OutputLocalBusiness) NAMING_CONTEXT.lookup(OutputLocalBusiness.JNDI_NAME);
+ final String output = bean.getOutput();
+ log.info("Got output: " + output);
- // Undeploy
- server.undeploy(archive);
+ Assert.assertEquals(OutputLocalBusiness.OUTPUT, output);
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(archive);
+ }
}
@@ -292,43 +306,106 @@
final String appName = "testServletJsp";
final String name = appName + ".war";
final Class<?> servletClass = JspForwardingServlet.class;
- final WebArchive archive = ShrinkWrap.create(name, WebArchive.class);
+ final WebArchive archive = ShrinkWrap.create(WebArchive.class, name);
final ArchivePath targetPathWebXml = ArchivePaths.create("web.xml");
- archive.addWebResource(PATH_ACTUAL_WEB_XML, targetPathWebXml).addResource(PATH_JSP).addClass(servletClass);
+ archive.addWebResource(PATH_ACTUAL_SERVLET_FORWARDING_TO_JSP_WEB_XML, targetPathWebXml).addResource(PATH_JSP)
+ .addClass(servletClass);
log.info(archive.toString(true));
// Deploy
server.deploy(archive);
- // Get an HTTP Client
- final HttpClient client = new DefaultHttpClient();
+ try
+ {
+ // 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);
+ // 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)
+ // 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);
+ }
+ finally
{
- TestCase.fail("Request returned no entity");
+ // Undeploy
+ server.undeploy(archive);
}
+ }
- // 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);
+ /**
+ * Tests deployment of a virtual WAR which contains a servlet
+ * that will use the {@link JBossEJBContainer} API to deploy
+ * and invoke upon an EJB.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testServletUsingEmbeddedEJB() throws Exception
+ {
+ // Log
+ log.info("testServletUsingEmbeddedEJB");
- // Undeploy
- server.undeploy(archive);
+ // Make a deployment
+ final String appName = "embeddedEjbCallingServlet";
+ final String name = appName + ".war";
+ final Class<?> servletClass = EmbeddedEjbCallingServlet.class;
+ final WebArchive archive = ShrinkWrap.create(WebArchive.class, name);
+ final ArchivePath targetPathWebXml = ArchivePaths.create("web.xml");
+ archive.addWebResource(PATH_ACTUAL_SERVLET_EMBEDDED_EJB_WEB_XML, targetPathWebXml).addClass(servletClass);
+ log.info(archive.toString(true));
+
+ // Deploy
+ server.deploy(archive);
+
+ try
+ {
+ // Get an HTTP Client
+ final HttpClient client = new DefaultHttpClient();
+
+ // Make an HTTP Request
+ final URI uri = URIUtils.createURI("http", "localhost", 8080, appName + SEPARATOR
+ + servletClass.getSimpleName(), null, 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
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
+ final String line = reader.readLine();
+ log.info("Got response: " + line);
+ Assert.assertEquals(OutputLocalBusiness.OUTPUT, line);
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(archive);
+ }
}
/**
@@ -347,7 +424,7 @@
// Create a virtual archive for the MDB deployment
final String name = "jms-mdb-test.jar";
- final JavaArchive archive = ShrinkWrap.create(name, JavaArchive.class);
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
final ArchivePath queuesTargetPath = ArchivePaths.create(FILENAME_QUEUE_SERVICE_XML);
archive.addClass(MessageStoringMdb.class).addResource(PATH_QUEUE_SERVICE_XML, queuesTargetPath);
@@ -355,38 +432,43 @@
log.info(archive.toString(true));
server.deploy(archive);
- // Define a String message to send
- final String message = "From in-JVM Test Message";
+ try
+ {
+ // Define a String message to send
+ final String message = "From in-JVM Test Message";
- // Send the message
- this.sendTextMessageToQueue(message, MessageStoringMdb.NAME_QUEUE);
+ // Send the message
+ this.sendTextMessageToQueue(message, MessageStoringMdb.NAME_QUEUE);
- // Wait on the MDB to process
- try
- {
- MessageStoringMdb.BARRIER.await(10, TimeUnit.SECONDS);
+ // 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);
}
- catch (final InterruptedException e)
+ finally
{
- // Clear the flag
- Thread.interrupted();
- // Throw up
- throw e;
+ // Undeploy
+ server.undeploy(archive);
}
- 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(archive);
-
}
/**
@@ -407,7 +489,7 @@
final String name = "datasource-entity-test.jar";
final ArchivePath targetDsPath = ArchivePaths.create(FILENAME_EMBEDDED_DS);
final ArchivePath targetPersistencePath = ArchivePaths.create(PATH_DESTINATION_PERSISTENCE_XML);
- final JavaArchive archive = ShrinkWrap.create(name, JavaArchive.class);
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
archive.addClasses(Jbossian.class, JbossianRegistrarLocalBusiness.class, JbossianRegistrarBean.class)
.addResource(PATH_RESOURCE_DS_XML_EMBEDDED, targetDsPath).addManifestResource(
PATH_RESOURCE_PERSISTENCE_XML_EMBEDDED, targetPersistencePath);
@@ -416,35 +498,40 @@
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);
+ try
+ {
+ // 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);
+ // 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);
+ // 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);
+ // Get all
+ final Collection<Jbossian> jbossians = slsb.getAllJbossians();
+ log.info("Got all JBossians: " + jbossians);
- // Test
- Assert.assertEquals(6, jbossians.size());
-
- // Undeploy
- server.undeploy(archive);
+ // Test
+ Assert.assertEquals(6, jbossians.size());
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(archive);
+ }
}
/**
@@ -461,25 +548,29 @@
// Make a deployment
final String appName = "webservice";
final String name = appName + ".war";
- final WebArchive archive = ShrinkWrap.create(name, WebArchive.class);
+ final WebArchive archive = ShrinkWrap.create(WebArchive.class, name);
final String targetPathWebXml = "web.xml";
archive.addWebResource(PATH_ACTUAL_WEB_XML_WS, targetPathWebXml).addClass(
org.jboss.jbossas.embedded.testsuite.ws.EmbeddedWs.class);
// Deploy
log.info(archive.toString(true));
server.deploy(archive);
-
- // consume the webservice
- org.jboss.jbossas.embedded.testsuite.wsclient.Embedded embeddedService = new org.jboss.jbossas.embedded.testsuite.wsclient.Embedded();
- log.info("Create Web Service client...");
- org.jboss.jbossas.embedded.testsuite.wsclient.EmbeddedWs port = embeddedService.getEmbeddedWsPort();
- log.info("Call Web Service Operation...");
- String wsResponse = port.hello("jboss embedded user");
- log.info("Web service response: " + wsResponse);
- Assert.assertEquals(WS_RESPONSE, wsResponse);
-
- // Undeploy
- server.undeploy(archive);
+ try
+ {
+ // consume the webservice
+ org.jboss.jbossas.embedded.testsuite.wsclient.Embedded embeddedService = new org.jboss.jbossas.embedded.testsuite.wsclient.Embedded();
+ log.info("Create Web Service client...");
+ org.jboss.jbossas.embedded.testsuite.wsclient.EmbeddedWs port = embeddedService.getEmbeddedWsPort();
+ log.info("Call Web Service Operation...");
+ String wsResponse = port.hello("jboss embedded user");
+ log.info("Web service response: " + wsResponse);
+ Assert.assertEquals(WS_RESPONSE, wsResponse);
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(archive);
+ }
}
/**
@@ -496,21 +587,28 @@
// Deploy it
server.deploy(url);
- // Lookup the bean
- final String context = MC_NAME_STATEREPORTING_BEAN;
- final StateReportingBean bean = (StateReportingBean) ((MCBasedServer<?, ?>) server).getKernel().getController()
- .getInstalledContext(context).getTarget();
- TestCase.assertNotNull("Bean was not found installed in expected context: " + context, bean);
+ StateReportingBean bean = null;
+ try
+ {
+ // Lookup the bean
+ final String context = MC_NAME_STATEREPORTING_BEAN;
+ bean = (StateReportingBean) ((MCBasedServer<?, ?>) server).getKernel().getController().getInstalledContext(
+ context).getTarget();
+ TestCase.assertNotNull("Bean was not found installed in expected context: " + context, bean);
- // Ensure started
- TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
- .getState());
+ // Ensure started
+ TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
+ .getState());
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(url);
- // Undeploy
- server.undeploy(url);
-
- // Ensure stopped
- TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
+ // Ensure stopped
+ TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean
+ .getState());
+ }
}
/**
@@ -527,21 +625,28 @@
// Deploy it
server.deploy(file);
- // Lookup the bean
- final String context = MC_NAME_STATEREPORTING_BEAN;
- final StateReportingBean bean = (StateReportingBean) ((MCBasedServer<?, ?>) server).getKernel().getController()
- .getInstalledContext(context).getTarget();
- TestCase.assertNotNull("Bean was not found installed in expected context: " + context, bean);
+ StateReportingBean bean = null;
+ try
+ {
+ // Lookup the bean
+ final String context = MC_NAME_STATEREPORTING_BEAN;
+ bean = (StateReportingBean) ((MCBasedServer<?, ?>) server).getKernel().getController().getInstalledContext(
+ context).getTarget();
+ TestCase.assertNotNull("Bean was not found installed in expected context: " + context, bean);
- // Ensure started
- TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
- .getState());
+ // Ensure started
+ TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
+ .getState());
+ }
+ finally
+ {
+ // Undeploy
+ server.undeploy(file);
- // Undeploy
- server.undeploy(file);
-
- // Ensure stopped
- TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
+ // Ensure stopped
+ TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean
+ .getState());
+ }
}
//-------------------------------------------------------------------------------------||
Modified: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputBean.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputBean.java 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputBean.java 2010-06-02 20:42:51 UTC (rev 105596)
@@ -24,10 +24,9 @@
import javax.ejb.Local;
import javax.ejb.Stateless;
+import org.jboss.ejb3.annotation.LocalBinding;
/**
- * OutputBean
- *
* Simple SLSB which will return a contracted output
*
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
@@ -35,16 +34,19 @@
*/
@Stateless
@Local(OutputLocalBusiness.class)
+ at LocalBinding(jndiBinding = OutputLocalBusiness.JNDI_NAME)
public class OutputBean implements OutputLocalBusiness
{
//-------------------------------------------------------------------------------------||
// Required Implementations -----------------------------------------------------------||
//-------------------------------------------------------------------------------------||
+ /**
+ * {@inheritDoc}
+ * @see org.jboss.jbossas.embedded.testsuite.ejb3.slsb.OutputLocalBusiness#getOutput()
+ */
public String getOutput()
{
- String sd="";
- sd.toCharArray();
return OutputLocalBusiness.OUTPUT;
}
}
Modified: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java 2010-06-02 20:42:51 UTC (rev 105596)
@@ -36,14 +36,22 @@
// Constants --------------------------------------------------------------------||
//-------------------------------------------------------------------------------||
+ /**
+ * Contracted output
+ */
String OUTPUT = "Embedded SLSB Local Business Output";
+ /**
+ * Target JNDI name to which we'll be bound
+ */
+ String JNDI_NAME = "OutputBeanLocal";
+
//-------------------------------------------------------------------------------||
// Contracts --------------------------------------------------------------------||
//-------------------------------------------------------------------------------||
/**
- * Returns the contracted output
+ * Returns {@link OutputLocalBusiness#OUTPUT}
*/
String getOutput();
}
Copied: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/EmbeddedEjbCallingServlet.java (from rev 105595, branches/TEMP_EJB3_EMBEDDABLE_JBAS-7964/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/EmbeddedEjbCallingServlet.java)
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/EmbeddedEjbCallingServlet.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/EmbeddedEjbCallingServlet.java 2010-06-02 20:42:51 UTC (rev 105596)
@@ -0,0 +1,132 @@
+/*
+ * 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.jbossas.embedded.testsuite.servlet;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.ejb3.embedded.api.shrinkwrap.ShrinkWrapEJBContainer;
+import org.jboss.ejb3.embedded.impl.shrinkwrap.ShrinkWrapEJBContainerImpl;
+import org.jboss.ejb3.embedded.spi.JBossEJBContainerProvider;
+import org.jboss.jbossas.embedded.testsuite.ejb3.slsb.OutputBean;
+import org.jboss.jbossas.embedded.testsuite.ejb3.slsb.OutputLocalBusiness;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * Servlet which forwards calls upon an EJB
+ * via the {@link EJBContainer} API.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class EmbeddedEjbCallingServlet extends HttpServlet
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(EmbeddedEjbCallingServlet.class.getName());
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Content type to use in forwarding
+ */
+ private static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain";
+
+ //-------------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns the value {@link OutputLocalBusiness#OUTPUT} by invoking via an EJB
+ *
+ * @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);
+
+ // Set the content-type to text
+ response.setContentType(CONTENT_TYPE_TEXT_PLAIN);
+
+ // Create the EJB Container
+ final Map<String, String> ejbContainerProps = new HashMap<String, String>();
+ ejbContainerProps.put(EJBContainer.MODULES, ""); // Deploy no modules and do no scanning by default
+ final JBossEJBContainerProvider ejbContainer = (JBossEJBContainerProvider) EJBContainer
+ .createEJBContainer(ejbContainerProps);
+ final ShrinkWrapEJBContainer shrinkwrapEjbContainer = new ShrinkWrapEJBContainerImpl(ejbContainer);
+
+ // Define the EJB JAR
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "outputSlsb.jar").addClasses(OutputBean.class,
+ OutputLocalBusiness.class);
+
+ // Deploy the JAR
+ shrinkwrapEjbContainer.deploy(archive);
+
+ // Look up the EJB
+ final Context context = ejbContainer.getContext();
+ final OutputLocalBusiness bean;
+ try
+ {
+ bean = (OutputLocalBusiness) context.lookup(OutputLocalBusiness.JNDI_NAME);
+ }
+ catch (final NamingException e)
+ {
+ throw new RuntimeException("Could not find bean proxy at " + OutputLocalBusiness.JNDI_NAME, e);
+ }
+
+ // Invoke
+ final String value = bean.getOutput();
+
+ // Undeploy
+ shrinkwrapEjbContainer.undeploy(archive);
+
+ // Shut down EJBContainer
+ ejbContainer.close();
+
+ // Write out
+ log.info("Got value from EJB: " + value);
+ response.getWriter().write(value);
+ }
+}
Copied: trunk/embedded/src/test/resources/webxml/ejbCallingServlet.xml (from rev 105595, branches/TEMP_EJB3_EMBEDDABLE_JBAS-7964/embedded/src/test/resources/webxml/ejbCallingServlet.xml)
===================================================================
--- trunk/embedded/src/test/resources/webxml/ejbCallingServlet.xml (rev 0)
+++ trunk/embedded/src/test/resources/webxml/ejbCallingServlet.xml 2010-06-02 20:42:51 UTC (rev 105596)
@@ -0,0 +1,13 @@
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <servlet>
+ <servlet-name>EmbeddedEjbCallingServlet</servlet-name>
+ <servlet-class>org.jboss.jbossas.embedded.testsuite.servlet.EmbeddedEjbCallingServlet
+ </servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>EmbeddedEjbCallingServlet</servlet-name>
+ <url-pattern>/EmbeddedEjbCallingServlet</url-pattern>
+ </servlet-mapping>
+</web-app>
Modified: trunk/testsuite/src/main/org/jboss/test/osgi/simple/SimpleRuntimeTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/osgi/simple/SimpleRuntimeTestCase.java 2010-06-02 20:22:29 UTC (rev 105595)
+++ trunk/testsuite/src/main/org/jboss/test/osgi/simple/SimpleRuntimeTestCase.java 2010-06-02 20:42:51 UTC (rev 105596)
@@ -30,7 +30,7 @@
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiRuntimeTest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.Asset;
+import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -47,7 +47,7 @@
public void testSimpleBundle() throws Exception
{
// Build the bundle with shrinkwrap
- final JavaArchive archive = ShrinkWrap.create("example-simple", JavaArchive.class);
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "example-simple");
archive.setManifest(new Asset()
{
public InputStream openStream()
More information about the jboss-cvs-commits
mailing list