[jboss-cvs] JBossAS SVN: r103715 - in trunk: embedded and 20 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 8 15:16:02 EDT 2010
Author: ALRubinger
Date: 2010-04-08 15:16:01 -0400 (Thu, 08 Apr 2010)
New Revision: 103715
Added:
trunk/embedded/
trunk/embedded/pom.xml
trunk/embedded/src/
trunk/embedded/src/test/
trunk/embedded/src/test/java/
trunk/embedded/src/test/java/org/
trunk/embedded/src/test/java/org/jboss/jbossas/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/SecurityActions.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/Jbossian.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/mdb/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/
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/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/mc/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/mc/StateReportingBean.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/JspForwardingServlet.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ws/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ws/EmbeddedWs.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Embedded.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/EmbeddedWs.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Hello.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/HelloResponse.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/ObjectFactory.java
trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/package-info.java
trunk/embedded/src/test/resources/
Removed:
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/SecurityActions.java
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ServerIntegrationTest.java
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ejb3/entity/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ejb3/mdb/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ejb3/slsb/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/mc/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/servlet/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ws/
trunk/embedded/src/test/java/org/jboss/embedded/testsuite/wsclient/
trunk/embedded/src/test/resources/log4j.xml
Modified:
trunk/embedded/src/test/resources/mc/statereporter-jboss-beans.xml
trunk/embedded/src/test/resources/webxml/servletForwardingToJsp.xml
trunk/embedded/src/test/resources/webxml/webservice-web.xml
trunk/pom.xml
Log:
[JBAS-7916] Bring the EmbeddedAS testsuite into AS (run it using profile "embedded")
Property changes on: trunk/embedded
___________________________________________________________________
Name: svn:ignore
+ .git
.metadata
target
bin
*.ipr
*.iws
*.iml
.idea
*.patch
.settings
.classpath
.project
build.log
local.properties
Copied: trunk/embedded/pom.xml (from rev 103713, projects/embedded/trunk/testsuite/pom.xml)
===================================================================
--- trunk/embedded/pom.xml (rev 0)
+++ trunk/embedded/pom.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 -->
+ <!-- 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</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>5-beta-5</version>
+ </parent>
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Configuration -->
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-embedded</artifactId>
+ <name>JBoss Application Server EmbeddedAS TestSuite</name>
+ <description>JBoss Application Server Embedded TestSuite</description>
+
+ <!-- Properties -->
+ <properties>
+
+ <!-- JBOSS_HOME (We'll unpack into here -->
+ <version.org.jboss.jbossas>6.0.0-SNAPSHOT</version.org.jboss.jbossas>
+ <JBOSS_HOME>${project.build.directory}/jboss-${version.org.jboss.jbossas}</JBOSS_HOME>
+
+ <!-- Versioning -->
+ <version.org.apache.httpcomponents_httpclient>4.0-beta2</version.org.apache.httpcomponents_httpclient>
+ <version.junit_junit>4.7</version.junit_junit>
+
+ </properties>
+
+ <!-- Build Configuration -->
+ <build>
+
+
+ <plugins>
+
+ <!-- Compiler -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ <compilerVersion>1.6</compilerVersion>
+ <fork>true</fork>
+ <argLine>-Xmx512M</argLine>
+ <executable>${JAVA_HOME}/bin/javac</executable>
+ </configuration>
+ </plugin>
+
+ <!-- Surefire -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <trimStackTrace>false</trimStackTrace>
+ <printSummary>true</printSummary>
+ <includes>
+ <include>**/*UnitTest.java</include>
+ </includes>
+ <forkMode>always</forkMode>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <!-- All AS runtime dependencies -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-depchain</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ <!-- The AS distribution (ZIP) -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-distribution</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ <type>zip</type>
+ </dependency>
+
+ <!-- JUnit -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit_junit}</version>
+ </dependency>
+
+ <!--
+ Dependencies below this line are for APIs used in the tests
+ themselves
+ -->
+
+ <!-- Apache HttpClient -->
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${version.org.apache.httpcomponents_httpclient}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- These should come in throgh the depchain once added -->
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-impl-base</artifactId>
+ <scope>test</scope>
+ <version>1.0.0-alpha-7</version> <!-- Remove -->
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.embedded</groupId>
+ <artifactId>jboss-embedded-core</artifactId>
+ <version>1.0.0-SNAPSHOT</version> <!-- Remove -->
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- We need to inherit the exclusions as well, so this is required -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-depchain</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <profiles>
+ <profile>
+ <id>embedded</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${JBOSS_HOME}/client/jbossws-native-client.jar</additionalClasspathElement>
+ <!--
+ Because jbossweb.sar contains shared web.xml,
+ which must be visible from same CL as
+ TomcatDeployer.class.getClassLoader
+ -->
+ <additionalClasspathElement>${JBOSS_HOME}/server/default/deploy/jbossweb.sar</additionalClasspathElement>
+ </additionalClasspathElements>
+
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <trimStackTrace>false</trimStackTrace>
+ <printSummary>true</printSummary>
+ <includes>
+ <include>**/*IntegrationTest.java</include>
+ </includes>
+ <forkMode>always</forkMode>
+
+ <!--
+ MaxPermSize Required to bump the space for relective
+ data like classes, methods, etc. EMB-41. Endorsed
+ required for things like WS support (EMB-61)
+ -->
+ <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed -Djboss.home=${JBOSS_HOME}</argLine>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Get AS and put into "target" -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>pre-integration-test</phase> <!-- So run before testing -->
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-distribution</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <type>zip</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Copied: trunk/embedded/src/test/java/org (from rev 103641, projects/embedded/trunk/testsuite/src/test/java/org)
Deleted: trunk/embedded/src/test/java/org/jboss/embedded/testsuite/SecurityActions.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/SecurityActions.java 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/java/org/jboss/embedded/testsuite/SecurityActions.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -1,140 +0,0 @@
-/*
- * 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;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-class SecurityActions
-{
-
- //-------------------------------------------------------------------------------||
- // Constructor ------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * No external instanciation
- */
- private SecurityActions()
- {
-
- }
-
- //-------------------------------------------------------------------------------||
- // Utility Methods --------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Sets the specified property with key and value
- */
- static void setSystemProperty(final String key, final String value)
- {
- AccessController.doPrivileged(new PrivilegedAction<Void>()
- {
- public Void run()
- {
- System.setProperty(key, value);
- return null;
- }
- });
- }
-
- /**
- * Obtains the system property with the specified key
- *
- * @param key
- * @return
- * @throws IllegalArgumentException If the key is null
- */
- static String getSystemProperty(final String key) throws IllegalArgumentException
- {
- // Precondition check
- if (key == null)
- {
- throw new IllegalArgumentException("key was null");
- }
-
- // Get sysprop
- return AccessController.doPrivileged(new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(key);
- }
- });
- }
-
- /**
- * Obtains the Thread Context ClassLoader
- */
- static ClassLoader getThreadContextClassLoader()
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-
- /**
- * Sets the specified CL upon the current Thread's Context
- *
- * @param cl
- * @throws IllegalArgumentException If the CL was null
- */
- static void setThreadContextClassLoader(final ClassLoader cl) throws IllegalArgumentException
- {
- if (cl == null)
- {
- throw new IllegalArgumentException("ClassLoader was null");
- }
-
- AccessController.doPrivileged(new PrivilegedAction<Void>()
- {
- public Void run()
- {
- Thread.currentThread().setContextClassLoader(cl);
- return null;
- };
- });
- }
-
- /**
- * Adds the specified shutdown hook
- *
- * @param shutdownHook
- */
- static void addShutdownHook(final Thread shutdownHook)
- {
- AccessController.doPrivileged(new PrivilegedAction<Void>()
- {
- public Void run()
- {
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- return null;
- }
- });
-
- }
-}
Deleted: trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ServerIntegrationTest.java
===================================================================
--- projects/embedded/trunk/testsuite/src/test/java/org/jboss/embedded/testsuite/ServerIntegrationTest.java 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/java/org/jboss/embedded/testsuite/ServerIntegrationTest.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -1,605 +0,0 @@
-/*
- * 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;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
-
-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.bootstrap.api.mc.server.MCBasedServer;
-import org.jboss.embedded.api.server.JBossASEmbeddedServer;
-import org.jboss.embedded.api.server.JBossASEmbeddedServerFactory;
-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.mc.StateReportingBean;
-import org.jboss.embedded.testsuite.servlet.JspForwardingServlet;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * 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 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: $
- */
-public class ServerIntegrationTest
-{
-
- //-------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Logger
- */
- private static final Logger log = Logger.getLogger(ServerIntegrationTest.class.getName());
-
- /**
- * The server instance
- */
- private static JBossASEmbeddedServer server;
-
- /**
- * Path, relative to the resources base, of the directory containing web.xml descriptor for tests
- */
- private static final String PATH_RESOURCE_WEB_XML = "webxml/";
-
- /**
- * Path, relative to the resources base, of a test web.xml
- */
- private static final String PATH_ACTUAL_WEB_XML = PATH_RESOURCE_WEB_XML + "servletForwardingToJsp.xml";
-
- /**
- * Filename of a test queue *-service.xml
- */
- private static final String FILENAME_QUEUE_SERVICE_XML = "hornetq-jms.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";
-
- /**
- * Name of the server configuration to use
- */
- private static final String NAME_SERVER_CONFIG = "all";
-
- /**
- * Path, relative to test resources of web.xml used to deploy a werservice war
- */
- private static final String PATH_ACTUAL_WEB_XML_WS = PATH_RESOURCE_WEB_XML + "webservice-web.xml";
-
- private static final String WS_REQUEST_PARAMETER = "jboss embedded user";
-
- private static final String WS_RESPONSE = "hello " + WS_REQUEST_PARAMETER;
-
- /**
- * Relative path to the MC Descriptor for the State Reporting Bean
- */
- private static final String PATH_STATEREPORTING_BEAN = "mc/statereporter-jboss-beans.xml";
-
- /**
- * MC Name (Context) of the State Reporting Bean
- */
- private static final String MC_NAME_STATEREPORTING_BEAN = "org.jboss.embedded.test.StateReporter";
-
- //-------------------------------------------------------------------------------||
- // 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 = JBossASEmbeddedServerFactory.createServer();
- log.info("Created: " + server);
-
- // Start
- log.info("Starting Server: " + server);
- server.getConfiguration().serverName(NAME_SERVER_CONFIG);
- 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 = Archives.create(name, JavaArchive.class).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);
-
- // Undeploy
- server.undeploy(archive);
-
- }
-
- /**
- * 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 = Archives.create(name, WebArchive.class);
- final ArchivePath targetPathWebXml = ArchivePaths.create("web.xml");
- archive.addWebResource(PATH_ACTUAL_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();
-
- // 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 = Archives.create(name, JavaArchive.class);
- final ArchivePath queuesTargetPath = ArchivePaths.create(FILENAME_QUEUE_SERVICE_XML);
- archive.addClass(MessageStoringMdb.class).addResource(PATH_QUEUE_SERVICE_XML, queuesTargetPath);
-
- // Deploy
- log.info(archive.toString(true));
- 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(archive);
-
- }
-
- /**
- * 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 ArchivePath targetDsPath = ArchivePaths.create(FILENAME_EMBEDDED_DS);
- final ArchivePath targetPersistencePath = ArchivePaths.create(PATH_DESTINATION_PERSISTENCE_XML);
- final JavaArchive archive = Archives.create(name, JavaArchive.class);
- archive.addClasses(Jbossian.class, JbossianRegistrarLocalBusiness.class, JbossianRegistrarBean.class)
- .addResource(PATH_RESOURCE_DS_XML_EMBEDDED, targetDsPath).addManifestResource(
- PATH_RESOURCE_PERSISTENCE_XML_EMBEDDED, targetPersistencePath);
-
- // 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);
- }
-
- /**
- * Ensures WS is working as expected
- *
- * EMB-61
- *
- * @throws Exception
- */
- @Test
- public void testWs() throws Exception
- {
-
- // Make a deployment
- final String appName = "webservice";
- final String name = appName + ".war";
- final WebArchive archive = Archives.create(name, WebArchive.class);
- final String targetPathWebXml = "web.xml";
- archive.addWebResource(PATH_ACTUAL_WEB_XML_WS, targetPathWebXml).addClass(
- org.jboss.embedded.testsuite.ws.EmbeddedWs.class);
- // Deploy
- log.info(archive.toString(true));
- server.deploy(archive);
-
- // consume the webservice
- org.jboss.embedded.testsuite.wsclient.Embedded embeddedService = new org.jboss.embedded.testsuite.wsclient.Embedded();
- log.info("Create Web Service client...");
- org.jboss.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);
- }
-
- /**
- * Ensures that a URL may be deployed and undeployed
- *
- * @throws Exception
- */
- @Test
- public void testUrlDeployment() throws Exception
- {
- // Get a URL
- final URL url = this.getMcBeanDescriptor();
-
- // 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);
-
- // Ensure started
- TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
- .getState());
-
- // Undeploy
- server.undeploy(url);
-
- // Ensure stopped
- TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
- }
-
- /**
- * Ensures that a File may be deployed and undeployed
- *
- * @throws Exception
- */
- @Test
- public void testFileDeployment() throws Exception
- {
- // Get a File
- final File file = new File(this.getMcBeanDescriptor().toURI());
-
- // 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);
-
- // Ensure started
- TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
- .getState());
-
- // Undeploy
- server.undeploy(file);
-
- // Ensure stopped
- TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
- }
-
- //-------------------------------------------------------------------------------------||
- // Internal Helper Methods ------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Obtains the URL of the MC Bean Descriptor for
- * the State Reporting Bean
- */
- private URL getMcBeanDescriptor()
- {
- return this.getClass().getClassLoader().getResource(PATH_STATEREPORTING_BEAN);
- }
-
- /**
- * 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();
- }
-}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/SecurityActions.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/SecurityActions.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/SecurityActions.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,140 @@
+/*
+ * 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;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * No external instanciation
+ */
+ private SecurityActions()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Sets the specified property with key and value
+ */
+ static void setSystemProperty(final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Obtains the system property with the specified key
+ *
+ * @param key
+ * @return
+ * @throws IllegalArgumentException If the key is null
+ */
+ static String getSystemProperty(final String key) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key was null");
+ }
+
+ // Get sysprop
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(key);
+ }
+ });
+ }
+
+ /**
+ * Obtains the Thread Context ClassLoader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ /**
+ * Sets the specified CL upon the current Thread's Context
+ *
+ * @param cl
+ * @throws IllegalArgumentException If the CL was null
+ */
+ static void setThreadContextClassLoader(final ClassLoader cl) throws IllegalArgumentException
+ {
+ if (cl == null)
+ {
+ throw new IllegalArgumentException("ClassLoader was null");
+ }
+
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ };
+ });
+ }
+
+ /**
+ * Adds the specified shutdown hook
+ *
+ * @param shutdownHook
+ */
+ static void addShutdownHook(final Thread shutdownHook)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
+ return null;
+ }
+ });
+
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ServerIntegrationTest.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,605 @@
+/*
+ * 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;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Logger;
+
+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.bootstrap.api.mc.server.MCBasedServer;
+import org.jboss.embedded.api.server.JBossASEmbeddedServer;
+import org.jboss.embedded.api.server.JBossASEmbeddedServerFactory;
+import org.jboss.jbossas.embedded.testsuite.ejb3.entity.Jbossian;
+import org.jboss.jbossas.embedded.testsuite.ejb3.entity.JbossianRegistrarBean;
+import org.jboss.jbossas.embedded.testsuite.ejb3.entity.JbossianRegistrarLocalBusiness;
+import org.jboss.jbossas.embedded.testsuite.ejb3.mdb.MessageStoringMdb;
+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.JspForwardingServlet;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 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 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: $
+ */
+public class ServerIntegrationTest
+{
+
+ //-------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(ServerIntegrationTest.class.getName());
+
+ /**
+ * The server instance
+ */
+ private static JBossASEmbeddedServer server;
+
+ /**
+ * Path, relative to the resources base, of the directory containing web.xml descriptor for tests
+ */
+ private static final String PATH_RESOURCE_WEB_XML = "webxml/";
+
+ /**
+ * Path, relative to the resources base, of a test web.xml
+ */
+ private static final String PATH_ACTUAL_WEB_XML = PATH_RESOURCE_WEB_XML + "servletForwardingToJsp.xml";
+
+ /**
+ * Filename of a test queue *-service.xml
+ */
+ private static final String FILENAME_QUEUE_SERVICE_XML = "hornetq-jms.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";
+
+ /**
+ * Name of the server configuration to use
+ */
+ private static final String NAME_SERVER_CONFIG = "all";
+
+ /**
+ * Path, relative to test resources of web.xml used to deploy a werservice war
+ */
+ private static final String PATH_ACTUAL_WEB_XML_WS = PATH_RESOURCE_WEB_XML + "webservice-web.xml";
+
+ private static final String WS_REQUEST_PARAMETER = "jboss embedded user";
+
+ private static final String WS_RESPONSE = "hello " + WS_REQUEST_PARAMETER;
+
+ /**
+ * Relative path to the MC Descriptor for the State Reporting Bean
+ */
+ private static final String PATH_STATEREPORTING_BEAN = "mc/statereporter-jboss-beans.xml";
+
+ /**
+ * MC Name (Context) of the State Reporting Bean
+ */
+ private static final String MC_NAME_STATEREPORTING_BEAN = "org.jboss.jbossas.embedded.test.StateReporter";
+
+ //-------------------------------------------------------------------------------||
+ // 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 = JBossASEmbeddedServerFactory.createServer();
+ log.info("Created: " + server);
+
+ // Start
+ log.info("Starting Server: " + server);
+ server.getConfiguration().serverName(NAME_SERVER_CONFIG);
+ 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 = Archives.create(name, JavaArchive.class).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);
+
+ // Undeploy
+ server.undeploy(archive);
+
+ }
+
+ /**
+ * 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 = Archives.create(name, WebArchive.class);
+ final ArchivePath targetPathWebXml = ArchivePaths.create("web.xml");
+ archive.addWebResource(PATH_ACTUAL_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();
+
+ // 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 = Archives.create(name, JavaArchive.class);
+ final ArchivePath queuesTargetPath = ArchivePaths.create(FILENAME_QUEUE_SERVICE_XML);
+ archive.addClass(MessageStoringMdb.class).addResource(PATH_QUEUE_SERVICE_XML, queuesTargetPath);
+
+ // Deploy
+ log.info(archive.toString(true));
+ 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(archive);
+
+ }
+
+ /**
+ * 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 ArchivePath targetDsPath = ArchivePaths.create(FILENAME_EMBEDDED_DS);
+ final ArchivePath targetPersistencePath = ArchivePaths.create(PATH_DESTINATION_PERSISTENCE_XML);
+ final JavaArchive archive = Archives.create(name, JavaArchive.class);
+ archive.addClasses(Jbossian.class, JbossianRegistrarLocalBusiness.class, JbossianRegistrarBean.class)
+ .addResource(PATH_RESOURCE_DS_XML_EMBEDDED, targetDsPath).addManifestResource(
+ PATH_RESOURCE_PERSISTENCE_XML_EMBEDDED, targetPersistencePath);
+
+ // 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);
+ }
+
+ /**
+ * Ensures WS is working as expected
+ *
+ * EMB-61
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testWs() throws Exception
+ {
+
+ // Make a deployment
+ final String appName = "webservice";
+ final String name = appName + ".war";
+ final WebArchive archive = Archives.create(name, WebArchive.class);
+ 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);
+ }
+
+ /**
+ * Ensures that a URL may be deployed and undeployed
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUrlDeployment() throws Exception
+ {
+ // Get a URL
+ final URL url = this.getMcBeanDescriptor();
+
+ // 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);
+
+ // Ensure started
+ TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
+ .getState());
+
+ // Undeploy
+ server.undeploy(url);
+
+ // Ensure stopped
+ TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
+ }
+
+ /**
+ * Ensures that a File may be deployed and undeployed
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testFileDeployment() throws Exception
+ {
+ // Get a File
+ final File file = new File(this.getMcBeanDescriptor().toURI());
+
+ // 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);
+
+ // Ensure started
+ TestCase.assertEquals("Bean should be started after installation", StateReportingBean.State.STARTED, bean
+ .getState());
+
+ // Undeploy
+ server.undeploy(file);
+
+ // Ensure stopped
+ TestCase.assertEquals("Bean should be stopped after undeploy", StateReportingBean.State.STOPPED, bean.getState());
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the URL of the MC Bean Descriptor for
+ * the State Reporting Bean
+ */
+ private URL getMcBeanDescriptor()
+ {
+ return this.getClass().getClassLoader().getResource(PATH_STATEREPORTING_BEAN);
+ }
+
+ /**
+ * 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();
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/Jbossian.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/Jbossian.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/Jbossian.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarBean.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/entity/JbossianRegistrarLocalBusiness.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/mdb/MessageStoringMdb.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: 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 (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputBean.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: 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 (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ejb3/slsb/OutputLocalBusiness.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/mc/StateReportingBean.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/mc/StateReportingBean.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/mc/StateReportingBean.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jbossas.embedded.testsuite.mc;
+
+import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.beans.metadata.api.annotations.Stop;
+import org.jboss.embedded.api.server.JBossASEmbeddedServer;
+
+/**
+ * Simple MC Bean to test URL and File deployment
+ * into the {@link JBossASEmbeddedServer}. Reports
+ * its current state.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StateReportingBean
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Possible states
+ *
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ public enum State {
+ STARTED, STOPPED
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Current state of this bean
+ */
+ private State state = State.STOPPED;
+
+ //-------------------------------------------------------------------------------------||
+ // Lifecycle Methods ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Reports that the bean has been started
+ */
+ @Start
+ public void setStateStarted()
+ {
+ state = State.STARTED;
+ }
+
+ /**
+ * Reports that the bean has been stopped
+ */
+ @Stop
+ public void setStateStopped()
+ {
+ state = State.STOPPED;
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Functional Methods -----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * @return the state
+ */
+ public State getState()
+ {
+ return state;
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/JspForwardingServlet.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/JspForwardingServlet.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/servlet/JspForwardingServlet.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -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.jbossas.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);
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ws/EmbeddedWs.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ws/EmbeddedWs.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/ws/EmbeddedWs.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,36 @@
+/*
+ * 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.ws;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+ at WebService(serviceName = "embedded")
+public class EmbeddedWs
+{
+ @WebMethod
+ public String hello(String name)
+ {
+ return "hello " + name;
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Embedded.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Embedded.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Embedded.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,68 @@
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.3-b02-
+ * Generated source version: 2.0
+ *
+ */
+ at WebServiceClient(name = "embedded", targetNamespace = Embedded.TARGET_NAMESPACE, wsdlLocation = "http://localhost:8080/testws/embedded?wsdl")
+public class Embedded extends Service
+{
+
+ private final static URL EMBEDDED_WSDL_LOCATION;
+
+ public static final String TARGET_NAMESPACE = "http://ws.testsuite.embedded.jbossas.jboss.org/";
+
+ private final static Logger logger = Logger
+ .getLogger(org.jboss.jbossas.embedded.testsuite.wsclient.Embedded.class.getName());
+
+ static
+ {
+ URL url = null;
+ try
+ {
+ URL baseUrl;
+ baseUrl = org.jboss.jbossas.embedded.testsuite.wsclient.Embedded.class.getResource(".");
+ url = new URL(baseUrl, "http://localhost:8080/webservice/embedded?wsdl");
+ }
+ catch (MalformedURLException e)
+ {
+ logger
+ .warning("Failed to create URL for the wsdl Location: 'http://localhost:8080/testws/embedded?wsdl', retrying as a local file");
+ logger.warning(e.getMessage());
+ }
+ EMBEDDED_WSDL_LOCATION = url;
+ }
+
+ public Embedded(URL wsdlLocation, QName serviceName)
+ {
+ super(wsdlLocation, serviceName);
+ }
+
+ public Embedded()
+ {
+ super(EMBEDDED_WSDL_LOCATION, new QName(TARGET_NAMESPACE, "embedded"));
+ }
+
+ /**
+ *
+ * @return
+ * returns EmbeddedWs
+ */
+ @WebEndpoint(name = "EmbeddedWsPort")
+ public EmbeddedWs getEmbeddedWsPort()
+ {
+ return super.getPort(new QName(TARGET_NAMESPACE, "EmbeddedWsPort"), EmbeddedWs.class);
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/EmbeddedWs.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/EmbeddedWs.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/EmbeddedWs.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,32 @@
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.3-b02-
+ * Generated source version: 2.0
+ *
+ */
+ at WebService(name = "EmbeddedWs", targetNamespace = "http://ws.testsuite.embedded.jbossas.jboss.org/")
+public interface EmbeddedWs
+{
+
+ /**
+ *
+ * @param arg0
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod
+ @WebResult(targetNamespace = "")
+ @RequestWrapper(localName = "hello", targetNamespace = "http://ws.testsuite.embedded.jbossas.jboss.org/", className = "org.jboss.jbossas.embedded.testsuite.wsclient.Hello")
+ @ResponseWrapper(localName = "helloResponse", targetNamespace = "http://ws.testsuite.embedded.jbossas.jboss.org/", className = "org.jboss.jbossas.embedded.testsuite.wsclient.HelloResponse")
+ public String hello(@WebParam(name = "arg0", targetNamespace = "") String arg0);
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Hello.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Hello.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/Hello.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,60 @@
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for hello complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="hello">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "hello", propOrder =
+{"arg0"})
+public class Hello
+{
+
+ protected String arg0;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getArg0()
+ {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setArg0(String value)
+ {
+ this.arg0 = value;
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/HelloResponse.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/HelloResponse.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/HelloResponse.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,62 @@
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>Java class for helloResponse complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="helloResponse">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "helloResponse", propOrder =
+{"_return"})
+public class HelloResponse
+{
+
+ @XmlElement(name = "return")
+ protected String _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReturn()
+ {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReturn(String value)
+ {
+ this._return = value;
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/ObjectFactory.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/ObjectFactory.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/ObjectFactory.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,77 @@
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.embedded.testsuite.wsclient package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+ at XmlRegistry
+public class ObjectFactory
+{
+
+ private final static QName _HelloResponse_QNAME = new QName("http://ws.testsuite.embedded.jboss.org/",
+ "helloResponse");
+
+ private final static QName _Hello_QNAME = new QName("http://ws.testsuite.embedded.jboss.org/", "hello");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.embedded.testsuite.wsclient
+ *
+ */
+ public ObjectFactory()
+ {
+ }
+
+ /**
+ * Create an instance of {@link HelloResponse }
+ *
+ */
+ public HelloResponse createHelloResponse()
+ {
+ return new HelloResponse();
+ }
+
+ /**
+ * Create an instance of {@link Hello }
+ *
+ */
+ public Hello createHello()
+ {
+ return new Hello();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link HelloResponse }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://ws.testsuite.embedded.jboss.org/", name = "helloResponse")
+ public JAXBElement<HelloResponse> createHelloResponse(HelloResponse value)
+ {
+ return new JAXBElement<HelloResponse>(_HelloResponse_QNAME, HelloResponse.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Hello }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://ws.testsuite.embedded.jboss.org/", name = "hello")
+ public JAXBElement<Hello> createHello(Hello value)
+ {
+ return new JAXBElement<Hello>(_Hello_QNAME, Hello.class, null, value);
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/package-info.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/package-info.java (rev 0)
+++ trunk/embedded/src/test/java/org/jboss/jbossas/embedded/testsuite/wsclient/package-info.java 2010-04-08 19:16:01 UTC (rev 103715)
@@ -0,0 +1,3 @@
+ at javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.testsuite.embedded.jboss.org/")
+package org.jboss.jbossas.embedded.testsuite.wsclient;
+
Copied: trunk/embedded/src/test/resources (from rev 103641, projects/embedded/trunk/testsuite/src/test/resources)
Deleted: trunk/embedded/src/test/resources/log4j.xml
===================================================================
--- projects/embedded/trunk/testsuite/src/test/resources/log4j.xml 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/resources/log4j.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Log4j Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
-
-<!--
- | For more configuration infromation and examples see the Jakarta Log4j
- | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
- <param name="File" value="target/test.log"/>
- <param name="Threshold" value="INFO"/>
- <param name="Append" value="false"/>
-
- <!-- Rollover at midnight each day -->
- <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-
- <!-- Rollover at the top of each hour
- <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
- -->
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
-
- <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
- <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
- -->
- </layout>
- </appender>
-
- <!-- ============================== -->
- <!-- Append messages to the console -->
- <!-- ============================== -->
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
- </layout>
- </appender>
-
-
- <!-- ================ -->
- <!-- Limit categories -->
- <!-- ================ -->
-
- <category name="org.jboss">
- <priority value="INFO"/>
- </category>
-
- <category name="org.jnp">
- <priority value="INFO"/>
- </category>
-
- <category name="org.jboss.embedded">
- <priority value="ALL"/>
- </category>
-
- <category name="org.jboss.bootstrap">
- <priority value="ALL"/>
- </category>
-
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <appender-ref ref="CONSOLE"/>
- <appender-ref ref="FILE"/>
- </root>
-
-</log4j:configuration>
Modified: trunk/embedded/src/test/resources/mc/statereporter-jboss-beans.xml
===================================================================
--- projects/embedded/trunk/testsuite/src/test/resources/mc/statereporter-jboss-beans.xml 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/resources/mc/statereporter-jboss-beans.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -8,6 +8,6 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="org.jboss.embedded.test.StateReporter" class="org.jboss.embedded.testsuite.mc.StateReportingBean" />
+ <bean name="org.jboss.jbossas.embedded.test.StateReporter" class="org.jboss.jbossas.embedded.testsuite.mc.StateReportingBean" />
</deployment>
\ No newline at end of file
Modified: trunk/embedded/src/test/resources/webxml/servletForwardingToJsp.xml
===================================================================
--- projects/embedded/trunk/testsuite/src/test/resources/webxml/servletForwardingToJsp.xml 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/resources/webxml/servletForwardingToJsp.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -3,7 +3,7 @@
version="2.5">
<servlet>
<servlet-name>JspForwardingServlet</servlet-name>
- <servlet-class>org.jboss.embedded.testsuite.servlet.JspForwardingServlet
+ <servlet-class>org.jboss.jbossas.embedded.testsuite.servlet.JspForwardingServlet
</servlet-class>
</servlet>
<servlet-mapping>
Modified: trunk/embedded/src/test/resources/webxml/webservice-web.xml
===================================================================
--- projects/embedded/trunk/testsuite/src/test/resources/webxml/webservice-web.xml 2010-04-07 16:43:21 UTC (rev 103641)
+++ trunk/embedded/src/test/resources/webxml/webservice-web.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -3,7 +3,7 @@
version="2.5">
<servlet>
<servlet-name>embedded</servlet-name>
- <servlet-class>org.jboss.embedded.testsuite.ws.EmbeddedWs
+ <servlet-class>org.jboss.jbossas.embedded.testsuite.ws.EmbeddedWs
</servlet-class>
</servlet>
<servlet-mapping>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-08 19:02:44 UTC (rev 103714)
+++ trunk/pom.xml 2010-04-08 19:16:01 UTC (rev 103715)
@@ -556,6 +556,7 @@
<module>depchain</module>
<module>deployment</module>
<module>ejb3</module>
+ <module>embedded</module>
<module>hibernate-int</module>
<module>hornetq-int</module>
<module>iiop</module>
More information about the jboss-cvs-commits
mailing list