tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject [11/11] tomee git commit: TOMEE-2151 Use correct classloader for creating application resources specified in resources.xml. Added examples and arquillian tests
Date Tue, 28 Nov 2017 20:52:29 GMT
TOMEE-2151 Use correct classloader for creating application resources specified in resources.xml. Added examples and arquillian tests


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d362df28
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d362df28
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d362df28

Branch: refs/heads/tomee-1.7.x
Commit: d362df28d1bb5797f891ed8dabaff3087132699f
Parents: bd89b96
Author: Jonathan Gallimore <jon@jrg.me.uk>
Authored: Tue Nov 28 20:47:46 2017 +0000
Committer: Jonathan Gallimore <jon@jrg.me.uk>
Committed: Tue Nov 28 20:47:46 2017 +0000

----------------------------------------------------------------------
 .../arquillian-tomee-jms-tests/pom.xml          |    9 +
 .../arquillian/tests/jms/BaseMdbBean.java       |   35 +
 .../openejb/arquillian/tests/jms/BlueBean.java  |   31 +
 .../openejb/arquillian/tests/jms/Color.java     |   40 +
 ...nectorWithApplicationResourcesInEarTest.java |  111 +
 ...nectorWithApplicationResourcesInWarTest.java |   71 +
 .../arquillian/tests/jms/JmsEnvEntryTest.java   |  151 +
 .../arquillian/tests/jms/MessageBean.java       |   89 +
 .../tests/jms/NoColorSpecifiedBean.java         |   31 +
 .../openejb/arquillian/tests/jms/RedBean.java   |   32 +
 .../superbiz/application/MessagesReceived.java  |   35 +
 .../java/org/superbiz/application/Receiver.java |   40 +
 .../java/org/superbiz/application/Sender.java   |   69 +
 .../connector/adapter/SampleActivationSpec.java |   54 +
 .../adapter/SampleConnectionFactoryImpl.java    |   69 +
 .../connector/adapter/SampleConnectionImpl.java |   44 +
 .../adapter/SampleManagedConnection.java        |  134 +
 .../adapter/SampleManagedConnectionFactory.java |   99 +
 .../SampleManagedConnectionMetaData.java        |   56 +
 .../adapter/SampleResourceAdapter.java          |   89 +
 .../superbiz/connector/api/InboundListener.java |   24 +
 .../connector/api/SampleConnection.java         |   26 +
 .../connector/api/SampleConnectionFactory.java  |   28 +
 .../src/test/resources/arquillian.xml           |    1 +
 .../src/test/resources/connector/ra.xml         |   58 +
 .../src/test/resources/connector/resources.xml  |   30 +
 .../apache/openejb/assembler/DeployerEjb.java   |   39 +-
 .../openejb/assembler/classic/Assembler.java    |   50 +-
 .../assembler/classic/ContainerInfo.java        |    2 +-
 .../ActivationConfigPropertyOverride.java       |   79 +-
 .../org/apache/openejb/config/AutoConfig.java   |   38 +-
 .../openejb/core/ivm/naming/IvmContext.java     |    6 +-
 .../apache/openejb/config/AutoConfigTest.java   |    4 +-
 .../connector-starter-api/pom.xml               |   50 +
 .../connector/starter/api/InboundListener.java  |   24 +
 .../connector/starter/api/SampleConnection.java |   26 +
 .../starter/api/SampleConnectionFactory.java    |   28 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../connector-starter-impl/pom.xml              |   60 +
 .../starter/adapter/SampleActivationSpec.java   |   54 +
 .../adapter/SampleConnectionFactoryImpl.java    |   69 +
 .../starter/adapter/SampleConnectionImpl.java   |   44 +
 .../adapter/SampleManagedConnection.java        |  139 +
 .../adapter/SampleManagedConnectionFactory.java |  108 +
 .../SampleManagedConnectionMetaData.java        |   58 +
 .../starter/adapter/SampleResourceAdapter.java  |   92 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../connector-starter-rar/pom.xml               |   43 +
 .../src/main/rar/META-INF/LICENSE               |  294 +
 .../src/main/rar/META-INF/NOTICE                |    5 +
 .../src/main/rar/META-INF/ra.xml                |   58 +
 .../connector-starter-sample-war/pom.xml        |  150 +
 .../src/main/java/org/superbiz/Receiver.java    |   35 +
 .../src/main/java/org/superbiz/Sender.java      |   52 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../src/main/resources/META-INF/ejb-jar.xml     |   23 +
 .../org/tomitribe/connector/starter/Runner.java |  104 +
 .../src/test/resources/arquillian.xml           |   30 +
 .../connector-ear-sample/moviefun-ear/pom.xml   |   74 +
 examples/connector-ear-sample/pom.xml           |  205 +
 examples/connector-ear/.gitignore               |   30 +
 .../connector-ear/connector-sample-api/pom.xml  |   43 +
 .../superbiz/connector/api/InboundListener.java |   24 +
 .../connector/api/SampleConnection.java         |   26 +
 .../connector/api/SampleConnectionFactory.java  |   28 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../connector-ear/connector-sample-ear/pom.xml  |   81 +
 .../connector-sample-functional-tests/pom.xml   |  145 +
 .../java/org/superbiz/moviefun/Basedir.java     |   34 +
 .../moviefun/DeployInWebAppsDirectoryTest.java  |   96 +
 .../java/org/superbiz/moviefun/EARTest.java     |  116 +
 .../src/test/resources/arquillian.xml           |   34 +
 .../connector-ear/connector-sample-impl/pom.xml |   54 +
 .../connector/adapter/SampleActivationSpec.java |   54 +
 .../adapter/SampleConnectionFactoryImpl.java    |   69 +
 .../connector/adapter/SampleConnectionImpl.java |   44 +
 .../adapter/SampleManagedConnection.java        |  139 +
 .../adapter/SampleManagedConnectionFactory.java |  108 +
 .../SampleManagedConnectionMetaData.java        |   58 +
 .../adapter/SampleResourceAdapter.java          |   92 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../connector-ear/connector-sample-rar/pom.xml  |   43 +
 .../src/main/rar/META-INF/LICENSE               |  294 +
 .../src/main/rar/META-INF/NOTICE                |    5 +
 .../src/main/rar/META-INF/ra.xml                |   58 +
 .../connector-ear/connector-sample-war/pom.xml  |   70 +
 .../superbiz/application/MessagesReceived.java  |   35 +
 .../java/org/superbiz/application/Receiver.java |   40 +
 .../java/org/superbiz/application/Sender.java   |   76 +
 .../src/main/resources/META-INF/LICENSE         |  202 +
 .../src/main/resources/META-INF/NOTICE          |    7 +
 .../src/main/webapp/WEB-INF/resources.xml       |   30 +
 examples/connector-ear/pom.xml                  |   95 +
 examples/connector-war/README.md                |  340 ++
 examples/connector-war/pom.xml                  |  165 +
 .../connector/adapter/SampleActivationSpec.java |   54 +
 .../adapter/SampleConnectionFactoryImpl.java    |   69 +
 .../connector/adapter/SampleConnectionImpl.java |   44 +
 .../adapter/SampleManagedConnection.java        |  139 +
 .../adapter/SampleManagedConnectionFactory.java |  105 +
 .../SampleManagedConnectionMetaData.java        |   56 +
 .../adapter/SampleResourceAdapter.java          |   93 +
 .../superbiz/connector/api/InboundListener.java |   24 +
 .../connector/api/SampleConnection.java         |   26 +
 .../connector/api/SampleConnectionFactory.java  |   28 +
 .../connector/application/MessagesReceived.java |   35 +
 .../connector/application/Receiver.java         |   41 +
 .../superbiz/connector/application/Sender.java  |   76 +
 .../src/main/webapp/WEB-INF/resources.xml       |   30 +
 .../superbiz/moviefun/ConnectorInWarTest.java   |   59 +
 .../src/test/resources/arquillian.xml           |   34 +
 examples/pom.xml                                |    3 +
 .../simple-ear/moviefun-business-logic/pom.xml  |   85 +
 .../java/org/superbiz/logic/MoviesBean.java     |  120 +
 .../src/main/resources/META-INF/ejb-jar.xml     |    1 +
 .../java/org/superbiz/logic/MoviesTest.java     |   65 +
 .../simple-ear/moviefun-business-model/pom.xml  |   48 +
 .../src/main/java/org/superbiz/model/Movie.java |  104 +
 .../main/java/org/superbiz/model/Movies.java    |   27 +
 .../src/main/resources/META-INF/persistence.xml |   32 +
 examples/simple-ear/moviefun-ear/pom.xml        |   74 +
 .../moviefun-functional-tests/pom.xml           |  138 +
 .../moviefun/DeployInWebAppsDirectoryTest.java  |  130 +
 .../moviefun/MoviesArquillianHtmlUnitTest.java  |   75 +
 .../resources/META-INF/application-client.xml   |    1 +
 .../src/test/resources/arquillian.xml           |   32 +
 examples/simple-ear/moviefun-webapp/pom.xml     |   79 +
 .../org/superbiz/moviefun/ActionServlet.java    |  143 +
 .../src/main/webapp/WEB-INF/moviefun.jsp        |  124 +
 .../src/main/webapp/WEB-INF/web.xml             |   24 +
 .../webapp/assets/css/bootstrap-responsive.css  | 1285 ++++
 .../assets/css/bootstrap-responsive.min.css     | 1196 ++++
 .../src/main/webapp/assets/css/bootstrap.css    | 5774 ++++++++++++++++++
 .../main/webapp/assets/css/bootstrap.min.css    | 5215 ++++++++++++++++
 .../src/main/webapp/assets/css/movie.css        |   24 +
 .../assets/img/glyphicons-halflings-white.png   |  Bin 0 -> 8777 bytes
 .../webapp/assets/img/glyphicons-halflings.png  |  Bin 0 -> 12799 bytes
 .../src/main/webapp/assets/js/bootstrap.js      | 1885 ++++++
 .../src/main/webapp/assets/js/bootstrap.min.js  |  568 ++
 .../moviefun-webapp/src/main/webapp/default.css |  207 +
 .../moviefun-webapp/src/main/webapp/index.jsp   |   70 +
 .../moviefun-webapp/src/main/webapp/setup.jsp   |  111 +
 examples/simple-ear/pom.xml                     |  101 +
 .../tomee/catalina/TomcatWebAppBuilder.java     |    4 +
 149 files changed, 25906 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
index 566d456..6bc712f 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/pom.xml
@@ -30,4 +30,13 @@
   <properties>
     <profile-under-test>plus</profile-under-test>
   </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+      <version>2.6.17</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BaseMdbBean.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BaseMdbBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BaseMdbBean.java
new file mode 100644
index 0000000..1f12422
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BaseMdbBean.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+public class BaseMdbBean {
+
+    public String getColor() {
+        try {
+            return (String) new InitialContext().lookup("java:comp/env/color");
+        } catch (NameNotFoundException e) {
+            return "<not specified>";
+        } catch (NamingException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BlueBean.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BlueBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BlueBean.java
new file mode 100644
index 0000000..7633ee2
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/BlueBean.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import javax.inject.Inject;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+public class BlueBean extends BaseMdbBean implements MessageListener {
+    @Inject
+    private Color color;
+
+    @Override
+    public void onMessage(Message message) {
+        color.add(getColor());
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/Color.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/Color.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/Color.java
new file mode 100644
index 0000000..3a313d3
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/Color.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.util.ArrayList;
+import java.util.List;
+
+@ApplicationScoped
+public class Color {
+
+    private List<String> colors = new ArrayList<String>();
+
+    public List<String> getColors() {
+        return colors;
+    }
+
+    public void add(final String color) {
+        colors.add(color);
+    }
+
+    public void clear() {
+        colors.clear();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInEarTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInEarTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInEarTest.java
new file mode 100644
index 0000000..021ee08
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInEarTest.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.apache.openejb.arquillian.tests.jms;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor;
+import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+@RunAsClient
+public class ConnectorWithApplicationResourcesInEarTest {
+
+    @Deployment
+    public static EnterpriseArchive createDeployment() {
+
+        final JavaArchive apiJar = ShrinkWrap.create(JavaArchive.class, "connector-sample-api.jar");
+        apiJar.addPackage("org.superbiz.connector.api");
+        System.out.println("API JAR:\n" + apiJar.toString(true));
+
+        final JavaArchive implJar = ShrinkWrap.create(JavaArchive.class, "connector-sample-impl.jar");
+        implJar.addPackage("org.superbiz.connector.adapter");
+        System.out.println("IMPL JAR:\n" + implJar.toString(true));
+
+        final ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class,"connector-sample-ra.rar");
+        rar.addAsLibraries(implJar);
+
+        rar.setResourceAdapterXML(ConnectorWithApplicationResourcesInEarTest.class.getResource("/connector/ra.xml"));
+        System.out.println("RAR:\n" + rar.toString(true));
+
+        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "connector-sample-war.war");
+        webArchive.addPackage("org.superbiz.application");
+
+        final WebAppDescriptor webAppDescriptor = Descriptors.create(WebAppDescriptor.class);
+        webAppDescriptor.version("3.0");
+
+        webArchive.addAsWebInfResource(ConnectorWithApplicationResourcesInEarTest.class.getResource("/connector/resources.xml"), "resources.xml");
+        webArchive.setWebXML(new StringAsset(webAppDescriptor.exportAsString()));
+        System.out.println("Webapp:\n" + webArchive.toString(true));
+
+        final EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class, "connector-sample.ear");
+        enterpriseArchive.addAsLibraries(apiJar);
+        enterpriseArchive.addAsModule(rar);
+        enterpriseArchive.addAsModule(webArchive);
+
+        ApplicationDescriptor applicationXml = Descriptors.create(ApplicationDescriptor.class);
+        applicationXml.displayName("connector-sample-ear");
+        applicationXml.createModule()
+                .getOrCreateWeb()
+                    .webUri("connector-sample-war.war")
+                    .contextRoot("/sample")
+                .up().up()
+                .createModule().connector("connector-sample-ra.rar")
+                .up().libraryDirectory("lib");
+
+        enterpriseArchive.setApplicationXML(new StringAsset(applicationXml.exportAsString()));
+        System.out.println(enterpriseArchive.toString(true));
+
+        return enterpriseArchive;
+    }
+
+    @ArquillianResource
+    private URL deploymentUrl;
+
+    @Test
+    public void testShouldMakeSureWebappIsWorking() throws Exception {
+        final String url = "http://" + deploymentUrl.getHost() + ":" + deploymentUrl.getPort() + "/sample/sender";
+
+        final WebClient webClient = WebClient.create(url);
+        final Response response = webClient.type(MediaType.TEXT_PLAIN_TYPE).post("Hello, world");
+
+        assertEquals(200, response.getStatus());
+        final String result = webClient.accept(MediaType.TEXT_PLAIN_TYPE).get(String.class);
+
+        assertEquals("Hello, world", result);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInWarTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInWarTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInWarTest.java
new file mode 100644
index 0000000..f202840
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/ConnectorWithApplicationResourcesInWarTest.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.ziplock.maven.Mvn;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class ConnectorWithApplicationResourcesInWarTest {
+
+    @ArquillianResource
+    private URL webappUrl;
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        final WebAppDescriptor webAppDescriptor = Descriptors.create(WebAppDescriptor.class);
+        webAppDescriptor.version("3.0");
+
+        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "connector-sample-war.war");
+        webArchive.addPackage("org.superbiz.connector.api");
+        webArchive.addPackage("org.superbiz.connector.adapter");
+        webArchive.addPackage("org.superbiz.application");
+        webArchive.addAsWebInfResource(ConnectorWithApplicationResourcesInEarTest.class.getResource("/connector/resources.xml"), "resources.xml");
+        webArchive.setWebXML(new StringAsset(webAppDescriptor.exportAsString()));
+        System.out.println("Webapp:\n" + webArchive.toString(true));
+
+        return webArchive;
+    }
+
+    @Test
+    public void testShouldMakeSureWebappIsWorking() throws Exception {
+        final WebClient webClient = WebClient.create(webappUrl.toURI());
+        final Response response = webClient.path("sender").type(MediaType.TEXT_PLAIN_TYPE).post("Hello, world");
+
+        assertEquals(200, response.getStatus());
+        final String result = webClient.path("").accept(MediaType.TEXT_PLAIN_TYPE).get(String.class);
+
+        assertEquals("Hello, world", result);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/JmsEnvEntryTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/JmsEnvEntryTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/JmsEnvEntryTest.java
new file mode 100644
index 0000000..9a4cced
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/JmsEnvEntryTest.java
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.ejbjar31.EjbJarDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ejb.EJB;
+import java.util.concurrent.Callable;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class JmsEnvEntryTest {
+    @EJB
+    private MessageBean messageBean;
+
+    @Deployment
+    public static JavaArchive getArchive() {
+
+        final EjbJarDescriptor ejbJarDescriptor = Descriptors.create(EjbJarDescriptor.class);
+        ejbJarDescriptor.getOrCreateEnterpriseBeans()
+            .createMessageDriven()
+                .ejbName("RedBean")
+                .ejbClass(RedBean.class.getName())
+                .messagingType("javax.jms.MessageListener")
+                .transactionType("Container")
+                .messageDestinationType("javax.jms.Topic")
+                .getOrCreateActivationConfig()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destinationType")
+                        .activationConfigPropertyValue("javax.jms.Topic").up()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destination")
+                        .activationConfigPropertyValue("red").up().up()
+                .createEnvEntry().envEntryName("color").envEntryType("java.lang.String").envEntryValue("red").up().up()
+            .createMessageDriven()
+                .ejbName("BlueBean")
+                .ejbClass(BlueBean.class.getName())
+                .messagingType("javax.jms.MessageListener")
+                .transactionType("Container")
+                .messageDestinationType("javax.jms.Topic")
+                .getOrCreateActivationConfig()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destinationType")
+                        .activationConfigPropertyValue("javax.jms.Topic").up()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destination")
+                        .activationConfigPropertyValue("blue").up().up()
+                .createEnvEntry().envEntryName("color").envEntryType("java.lang.String").envEntryValue("blue").up().up()
+            .createMessageDriven()
+                .ejbName("NoColorBean")
+                .ejbClass(NoColorSpecifiedBean.class.getName())
+                .messagingType("javax.jms.MessageListener")
+                .transactionType("Container")
+                .messageDestinationType("javax.jms.Topic")
+                .getOrCreateActivationConfig()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destinationType")
+                        .activationConfigPropertyValue("javax.jms.Topic").up()
+                    .createActivationConfigProperty()
+                        .activationConfigPropertyName("destination")
+                        .activationConfigPropertyValue("nocolor").up().up();
+
+        final String ejbJarXml = ejbJarDescriptor.exportAsString();
+
+
+        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "jms-env-entry.jar")
+                .addClasses(BaseMdbBean.class, BlueBean.class, Color.class, NoColorSpecifiedBean.class, RedBean.class, MessageBean.class)
+                .add(new StringAsset("<beans/>"), "META-INF/beans.xml")
+                .add(new StringAsset(ejbJarXml), "META-INF/ejb-jar.xml");
+
+        System.out.println(archive.toString(true));
+
+        return archive;
+    }
+
+    @Test
+    public void test() throws Exception {
+        messageBean.clear();
+
+        messageBean.callRed();
+        assertXMessages(1);
+        assertEquals("red",messageBean.getColors().get(0));
+        messageBean.clear();
+
+        messageBean.callBlue();
+        assertXMessages(1);
+        assertEquals("blue",messageBean.getColors().get(0));
+        messageBean.clear();
+
+        messageBean.callNoColor();
+        assertXMessages(1);
+        assertEquals("<not specified>",messageBean.getColors().get(0));
+        messageBean.clear();
+    }
+
+    public void assertXMessages(final int x) {
+        attempt(5, 100, new Callable<Void>() {
+
+            @Override
+            public Void call() throws Exception {
+                assertEquals(x, messageBean.getColors().size());
+                return null;
+            }
+        });
+    }
+
+
+    public <T> T attempt(int tries, int delay, Callable<T> callable) {
+        for (int i = 0; i < tries; i++) {
+            try {
+                return callable.call();
+            } catch (Throwable t) {
+                if (i == (tries - 1)) {
+                    throw new RuntimeException(t);
+                }
+
+                try {
+                    Thread.sleep(delay);
+                } catch (InterruptedException e) {
+                    // ignore
+                }
+            }
+        }
+
+        throw new IllegalStateException("We shouldn't reach this exception");
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/MessageBean.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/MessageBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/MessageBean.java
new file mode 100644
index 0000000..703d561
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/MessageBean.java
@@ -0,0 +1,89 @@
+package org.apache.openejb.arquillian.tests.jms;
+
+import javax.annotation.Resource;
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import java.lang.IllegalStateException;
+import java.util.List;
+
+@Singleton
+@Lock(LockType.READ)
+public class MessageBean {
+
+    @Resource
+    private ConnectionFactory cf;
+
+    @Resource(name = "red")
+    private Topic red;
+
+    @Resource(name = "blue")
+    private Topic blue;
+
+    @Resource(name = "nocolor")
+    private Topic noColor;
+
+    @Inject
+    private Color color;
+
+    public void callRed() {
+        try {
+            process(cf, red, "red", Session.SESSION_TRANSACTED);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void callBlue() {
+        try {
+            process(cf, blue, "blue", Session.SESSION_TRANSACTED);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void callNoColor() {
+        try {
+            process(cf, noColor, "nocolor", Session.SESSION_TRANSACTED);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void clear() {
+        color.clear();
+    }
+
+    public List<String> getColors() {
+        return color.getColors();
+    }
+
+    protected void process(final ConnectionFactory cf, final Topic topic, final String payload, final int acknowledgeMode) throws JMSException {
+        Connection connection = null;
+        Session session = null;
+
+        try {
+            connection = cf.createConnection();
+            connection.start();
+
+            session = connection.createSession(false, acknowledgeMode);
+            final MessageProducer producer = session.createProducer(null);
+
+            final TextMessage textMessage = session.createTextMessage(payload);
+            producer.send(topic, textMessage);
+        } finally {
+            if (session != null) session.close();
+            if (connection != null) connection.close();
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/NoColorSpecifiedBean.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/NoColorSpecifiedBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/NoColorSpecifiedBean.java
new file mode 100644
index 0000000..a793afa
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/NoColorSpecifiedBean.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import javax.inject.Inject;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+public class NoColorSpecifiedBean extends BaseMdbBean implements MessageListener {
+    @Inject
+    private Color color;
+
+    @Override
+    public void onMessage(Message message) {
+        color.add(getColor());
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/RedBean.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/RedBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/RedBean.java
new file mode 100644
index 0000000..4c6c921
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/apache/openejb/arquillian/tests/jms/RedBean.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.openejb.arquillian.tests.jms;
+
+import javax.inject.Inject;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+public class RedBean extends BaseMdbBean implements MessageListener {
+
+    @Inject
+    private Color color;
+
+    @Override
+    public void onMessage(Message message) {
+        color.add(getColor());
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/MessagesReceived.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/MessagesReceived.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/MessagesReceived.java
new file mode 100644
index 0000000..7e8f98e
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/MessagesReceived.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.application;
+
+import javax.ejb.Singleton;
+import java.util.ArrayList;
+import java.util.List;
+
+@Singleton
+public class MessagesReceived {
+
+    private final List<String> messagesReceived = new ArrayList<String>();
+
+    public List<String> getMessagesReceived() {
+        return messagesReceived;
+    }
+
+    public void messageReceived(final String message) {
+        messagesReceived.add(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Receiver.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Receiver.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Receiver.java
new file mode 100644
index 0000000..5230129
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Receiver.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.application;
+
+
+import org.superbiz.connector.api.InboundListener;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+
+@MessageDriven(name = "Receiver")
+public class Receiver implements InboundListener {
+
+    @EJB
+    private MessagesReceived messagesReceived;
+
+    @Resource
+    private MessageDrivenContext context;
+    
+    @Override
+    public void receiveMessage(String message) {
+        messagesReceived.messageReceived(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Sender.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Sender.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Sender.java
new file mode 100644
index 0000000..06ef490
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/application/Sender.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.application;
+
+import org.apache.openejb.loader.IO;
+import org.superbiz.connector.api.SampleConnection;
+import org.superbiz.connector.api.SampleConnectionFactory;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@WebServlet(name = "Sender", urlPatterns = { "/sender" })
+public class Sender extends HttpServlet{
+
+    @Resource
+    private SampleConnectionFactory cf;
+
+    @EJB
+    private MessagesReceived messagesReceived;
+
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        try {
+            final String payload = IO.slurp(req.getInputStream());
+            final SampleConnection connection = cf.getConnection();
+            connection.sendMessage(payload);
+            connection.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        final StringBuilder sb = new StringBuilder();
+
+        final List<String> messages = this.messagesReceived.getMessagesReceived();
+        for (int i = 0; i < messages.size(); i++) {
+            if (i > 0) {
+                sb.append("\n");
+            }
+
+            sb.append(messages.get(i));
+        }
+
+        resp.getWriter().print(sb.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleActivationSpec.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleActivationSpec.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleActivationSpec.java
new file mode 100644
index 0000000..466f13e
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleActivationSpec.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.InboundListener;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.Activation;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.InvalidPropertyException;
+import javax.resource.spi.ResourceAdapter;
+
+@Activation(messageListeners = InboundListener.class)
+public class SampleActivationSpec implements ActivationSpec {
+
+    private ResourceAdapter resourceAdapter;
+    private Class beanClass;
+
+    public Class getBeanClass() {
+        return beanClass;
+    }
+
+    public void setBeanClass(Class beanClass) {
+        this.beanClass = beanClass;
+    }
+
+    @Override
+    public void validate() throws InvalidPropertyException {
+    }
+
+    @Override
+    public ResourceAdapter getResourceAdapter() {
+        return resourceAdapter;
+    }
+
+    @Override
+    public void setResourceAdapter(ResourceAdapter ra) throws ResourceException {
+        this.resourceAdapter = ra;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionFactoryImpl.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionFactoryImpl.java
new file mode 100755
index 0000000..2263787
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionFactoryImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.SampleConnection;
+import org.superbiz.connector.api.SampleConnectionFactory;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import java.util.logging.Logger;
+
+public class SampleConnectionFactoryImpl implements SampleConnectionFactory {
+    private static final long serialVersionUID = 1L;
+
+    private static Logger log = Logger.getLogger(SampleConnectionFactoryImpl.class.getName());
+
+    private Reference reference;
+
+    private SampleManagedConnectionFactory mcf;
+
+    private ConnectionManager connectionManager;
+
+    public SampleConnectionFactoryImpl() {
+
+    }
+
+    public SampleConnectionFactoryImpl(SampleManagedConnectionFactory mcf, ConnectionManager cxManager) {
+        this.mcf = mcf;
+        this.connectionManager = cxManager;
+    }
+
+    @Override
+    public SampleConnection getConnection() throws ResourceException {
+        log.finest("getConnection()");
+        return (SampleConnection) connectionManager.allocateConnection(mcf, null);
+    }
+
+    @Override
+    public Reference getReference() throws NamingException {
+        log.finest("getReference()");
+        return reference;
+    }
+
+    @Override
+    public void setReference(Reference reference) {
+        log.finest("setReference()");
+        this.reference = reference;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionImpl.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionImpl.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionImpl.java
new file mode 100755
index 0000000..60ef137
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleConnectionImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.SampleConnection;
+
+import java.util.logging.Logger;
+
+public class SampleConnectionImpl implements SampleConnection {
+    private static Logger log = Logger.getLogger(SampleConnectionImpl.class.getName());
+
+    private SampleManagedConnection mc;
+
+    private SampleManagedConnectionFactory mcf;
+
+    public SampleConnectionImpl(SampleManagedConnection mc, SampleManagedConnectionFactory mcf) {
+        this.mc = mc;
+        this.mcf = mcf;
+    }
+
+    public void sendMessage(final String message) {
+        mc.sendMessage(message);
+    }
+
+    public void close() {
+        mc.closeHandle(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnection.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnection.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnection.java
new file mode 100755
index 0000000..63cbe70
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnection.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.SampleConnection;
+
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.spi.*;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Logger;
+
+public class SampleManagedConnection implements ManagedConnection {
+
+    private static Logger log = Logger.getLogger(SampleManagedConnection.class.getName());
+
+    private PrintWriter logwriter;
+
+    private SampleManagedConnectionFactory mcf;
+
+    private List<ConnectionEventListener> listeners;
+
+    private SampleConnectionImpl connection;
+
+    public SampleManagedConnection(SampleManagedConnectionFactory mcf) {
+        this.mcf = mcf;
+        this.logwriter = null;
+        this.listeners = Collections.synchronizedList(new ArrayList<ConnectionEventListener>(1));
+        this.connection = null;
+    }
+
+    public Object getConnection(Subject subject,
+                                ConnectionRequestInfo cxRequestInfo) throws ResourceException {
+        log.finest("getConnection()");
+        connection = new SampleConnectionImpl(this, mcf);
+        return connection;
+    }
+
+    public void associateConnection(Object connection) throws ResourceException {
+        log.finest("associateConnection()");
+
+        if (connection == null)
+            throw new ResourceException("Null connection handle");
+
+        if (!(connection instanceof SampleConnectionImpl))
+            throw new ResourceException("Wrong connection handle");
+
+        this.connection = (SampleConnectionImpl) connection;
+    }
+
+    public void cleanup() throws ResourceException {
+        log.finest("cleanup()");
+    }
+
+    public void destroy() throws ResourceException {
+        log.finest("destroy()");
+    }
+
+    public void addConnectionEventListener(ConnectionEventListener listener) {
+        log.finest("addConnectionEventListener()");
+
+        if (listener == null) {
+            throw new IllegalArgumentException("Listener is null");
+        }
+
+        listeners.add(listener);
+    }
+
+    public void removeConnectionEventListener(ConnectionEventListener listener) {
+        log.finest("removeConnectionEventListener()");
+        if (listener == null)
+            throw new IllegalArgumentException("Listener is null");
+        listeners.remove(listener);
+    }
+
+    void closeHandle(SampleConnection handle) {
+        ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+        event.setConnectionHandle(handle);
+        for (ConnectionEventListener cel : listeners) {
+            cel.connectionClosed(event);
+        }
+    }
+
+    public PrintWriter getLogWriter() throws ResourceException {
+        log.finest("getLogWriter()");
+        return logwriter;
+    }
+
+    public void setLogWriter(PrintWriter out) throws ResourceException {
+        log.finest("setLogWriter()");
+        logwriter = out;
+    }
+
+    public LocalTransaction getLocalTransaction() throws ResourceException {
+        throw new NotSupportedException("getLocalTransaction() not supported");
+    }
+
+    public XAResource getXAResource() throws ResourceException {
+        throw new NotSupportedException("getXAResource() not supported");
+    }
+
+    public ManagedConnectionMetaData getMetaData() throws ResourceException {
+        log.finest("getMetaData()");
+        return new SampleManagedConnectionMetaData();
+    }
+
+    void sendMessage(final String message) {
+        log.finest("sendMessage()");
+
+        final SampleResourceAdapter resourceAdapter = (SampleResourceAdapter) mcf.getResourceAdapter();
+        resourceAdapter.sendMessage(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionFactory.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionFactory.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionFactory.java
new file mode 100755
index 0000000..662b676
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionFactory.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.SampleConnection;
+import org.superbiz.connector.api.SampleConnectionFactory;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.*;
+import javax.security.auth.Subject;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.logging.Logger;
+
+@ConnectionDefinition(connectionFactory = SampleConnectionFactory.class,
+        connectionFactoryImpl = SampleConnectionFactoryImpl.class,
+        connection = SampleConnection.class,
+        connectionImpl = SampleConnectionImpl.class)
+public class SampleManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger log = Logger.getLogger(SampleManagedConnectionFactory.class.getName());
+
+    private ResourceAdapter ra;
+
+    private PrintWriter logwriter;
+
+    public SampleManagedConnectionFactory() {
+
+    }
+
+    public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException {
+        log.finest("createConnectionFactory()");
+        return new SampleConnectionFactoryImpl(this, cxManager);
+    }
+
+    public Object createConnectionFactory() throws ResourceException {
+        throw new ResourceException("This resource adapter doesn't support non-managed environments");
+    }
+
+    public ManagedConnection createManagedConnection(Subject subject,
+                                                     ConnectionRequestInfo cxRequestInfo) throws ResourceException {
+        log.finest("createManagedConnection()");
+        return new SampleManagedConnection(this);
+    }
+
+    public ManagedConnection matchManagedConnections(Set connectionSet,
+                                                     Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException {
+        log.finest("matchManagedConnections()");
+        ManagedConnection result = null;
+        Iterator it = connectionSet.iterator();
+        while (result == null && it.hasNext()) {
+            ManagedConnection mc = (ManagedConnection) it.next();
+            if (mc instanceof SampleManagedConnection) {
+                result = mc;
+            }
+
+        }
+        return result;
+    }
+
+    public PrintWriter getLogWriter() throws ResourceException {
+        log.finest("getLogWriter()");
+        return logwriter;
+    }
+
+    public void setLogWriter(PrintWriter out) throws ResourceException {
+        log.finest("setLogWriter()");
+        logwriter = out;
+    }
+
+    public ResourceAdapter getResourceAdapter() {
+        log.finest("getResourceAdapter()");
+        return ra;
+    }
+
+    public void setResourceAdapter(ResourceAdapter ra) {
+        log.finest("setResourceAdapter()");
+        this.ra = ra;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionMetaData.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionMetaData.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionMetaData.java
new file mode 100755
index 0000000..d7a0fa9
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleManagedConnectionMetaData.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.adapter;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionMetaData;
+import java.util.logging.Logger;
+
+public class SampleManagedConnectionMetaData implements ManagedConnectionMetaData {
+
+    private static Logger log = Logger.getLogger(SampleManagedConnectionMetaData.class.getName());
+
+    public SampleManagedConnectionMetaData() {
+
+    }
+
+    @Override
+    public String getEISProductName() throws ResourceException {
+        log.finest("getEISProductName()");
+        return null; //TODO
+    }
+
+    @Override
+    public String getEISProductVersion() throws ResourceException {
+        log.finest("getEISProductVersion()");
+        return null; //TODO
+    }
+
+    @Override
+    public int getMaxConnections() throws ResourceException {
+        log.finest("getMaxConnections()");
+        return 0; //TODO
+    }
+
+    @Override
+    public String getUserName() throws ResourceException {
+        log.finest("getUserName()");
+        return null; //TODO
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleResourceAdapter.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleResourceAdapter.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleResourceAdapter.java
new file mode 100644
index 0000000..b1075dc
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/adapter/SampleResourceAdapter.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.connector.adapter;
+
+import org.superbiz.connector.api.InboundListener;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.*;
+import javax.resource.spi.endpoint.MessageEndpoint;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.transaction.xa.XAResource;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.lang.IllegalStateException;
+
+@Connector(description = "Sample Resource Adapter", displayName = "Sample Resource Adapter", eisType = "Sample Resource Adapter", version = "1.0")
+public class SampleResourceAdapter implements ResourceAdapter {
+
+    final Map<SampleActivationSpec, EndpointTarget> targets = new ConcurrentHashMap<SampleActivationSpec, EndpointTarget>();
+
+    public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
+    }
+
+    public void stop() {
+    }
+
+    public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec)
+            throws ResourceException
+    {
+        final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec;
+
+        try {
+            final MessageEndpoint messageEndpoint = messageEndpointFactory.createEndpoint(null);
+            final EndpointTarget target = new EndpointTarget(messageEndpoint);
+            targets.put(sampleActivationSpec, target);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) {
+        final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec;
+
+        final EndpointTarget endpointTarget = targets.get(sampleActivationSpec);
+        if (endpointTarget == null) {
+            throw new IllegalStateException("No EndpointTarget to undeploy for ActivationSpec " + activationSpec);
+        }
+
+        endpointTarget.messageEndpoint.release();
+    }
+
+    public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException {
+        return new XAResource[0];
+    }
+
+    public void sendMessage(final String message) {
+        final Collection<EndpointTarget> endpoints = this.targets.values();
+        for (final EndpointTarget endpoint : endpoints) {
+            endpoint.invoke(message);
+        }
+    }
+
+    public static class EndpointTarget {
+        private final MessageEndpoint messageEndpoint;
+
+        public EndpointTarget(final MessageEndpoint messageEndpoint) {
+            this.messageEndpoint = messageEndpoint;
+        }
+
+        public void invoke(final String message) {
+            ((InboundListener)this.messageEndpoint).receiveMessage(message);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/InboundListener.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/InboundListener.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/InboundListener.java
new file mode 100644
index 0000000..1c80ebc
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/InboundListener.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.superbiz.connector.api;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public interface InboundListener {
+    public void receiveMessage(final String message);
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnection.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnection.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnection.java
new file mode 100755
index 0000000..990471f
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnection.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.api;
+
+public interface SampleConnection {
+    public void sendMessage(final String message);
+
+    public void close();
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnectionFactory.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnectionFactory.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnectionFactory.java
new file mode 100755
index 0000000..0ffa4f5
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/java/org/superbiz/connector/api/SampleConnectionFactory.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.superbiz.connector.api;
+
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+import java.io.Serializable;
+
+public interface SampleConnectionFactory extends Serializable, Referenceable {
+    public SampleConnection getConnection() throws ResourceException;
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml
index 29e96a9..e46822e 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/arquillian.xml
@@ -31,6 +31,7 @@
         My\ Unmanaged\ DataSource.JdbcUrl = jdbc:hsqldb:mem:hsqldb
 
         openejb.classloader.forced-load=org.apache.openejb.arquillian.tests.jms
+        openejb.descriptors.output=true
       </property>
     </configuration>
   </container>

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/ra.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/ra.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/ra.xml
new file mode 100644
index 0000000..2428bbc
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/ra.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You 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.
+  -->
+<connector xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/connector_1_7.xsd"
+           version="1.7">
+  <description>Sample Resource Adapter</description>
+  <display-name>Sample Resource Adapter</display-name>
+  <eis-type>Sample Resource Adapter</eis-type>
+  <resourceadapter-version>1.0</resourceadapter-version>
+  <license>
+    <license-required>false</license-required>
+  </license>
+  <resourceadapter>
+    <resourceadapter-class>org.superbiz.connector.adapter.SampleResourceAdapter</resourceadapter-class>
+    <config-property>
+      <config-property-name>interval</config-property-name>
+      <config-property-type>int</config-property-type>
+      <config-property-value>15</config-property-value>
+    </config-property>
+    <outbound-resourceadapter>
+      <connection-definition>
+        <managedconnectionfactory-class>org.superbiz.connector.adapter.SampleManagedConnectionFactory</managedconnectionfactory-class>
+        <connectionfactory-interface>SampleConnectionFactory</connectionfactory-interface>
+        <connectionfactory-impl-class>org.superbiz.connector.adapter.SampleConnectionFactoryImpl</connectionfactory-impl-class>
+        <connection-interface>SampleConnection</connection-interface>
+        <connection-impl-class>org.superbiz.connector.adapter.SampleConnectionImpl</connection-impl-class>
+      </connection-definition>
+      <transaction-support>NoTransaction</transaction-support>
+      <reauthentication-support>false</reauthentication-support>
+    </outbound-resourceadapter>
+    <inbound-resourceadapter>
+      <messageadapter>
+        <messagelistener>
+          <messagelistener-type>org.superbiz.connector.api.InboundListener</messagelistener-type>
+          <activationspec>
+            <activationspec-class>org.superbiz.connector.adapter.SampleActivationSpec</activationspec-class>
+          </activationspec>
+        </messagelistener>
+      </messageadapter>
+    </inbound-resourceadapter>
+  </resourceadapter>
+</connector>

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/resources.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/resources.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/resources.xml
new file mode 100644
index 0000000..9317f23
--- /dev/null
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-jms-tests/src/test/resources/connector/resources.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<resources>
+  <Resource id="SampleResourceAdapter" class-name="org.superbiz.connector.adapter.SampleResourceAdapter">
+  </Resource>
+
+  <Container id="SampleMDBContainer" ctype="MESSAGE">
+    ResourceAdapter=SampleResourceAdapter
+    ActivationSpecClass=org.superbiz.connector.adapter.SampleActivationSpec
+    MessageListenerInterface=org.superbiz.connector.api.InboundListener
+  </Container>
+
+  <Resource id="SampleConnectionFactory" type="org.superbiz.connector.api.SampleConnectionFactory" class-name="org.superbiz.connector.adapter.SampleManagedConnectionFactory">
+    ResourceAdapter=SampleResourceAdapter
+    TransactionSupport=none
+  </Resource>
+</resources>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/d362df28/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
index 939dd23..b328fdc 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
@@ -22,8 +22,7 @@ import org.apache.openejb.NoSuchApplicationException;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.UndeployException;
-import org.apache.openejb.assembler.classic.AppInfo;
-import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.*;
 import org.apache.openejb.config.AppModule;
 import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.config.DeploymentLoader;
@@ -50,11 +49,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigInteger;
 import java.security.SecureRandom;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
+import java.util.*;
 
 import static javax.ejb.TransactionManagementType.BEAN;
 import static org.apache.openejb.config.ConfigurationFactory.ADDITIONAL_DEPLOYMENTS;
@@ -115,13 +110,10 @@ public class DeployerEjb implements Deployer {
 
 
     private final DeploymentLoader deploymentLoader;
-    private final ConfigurationFactory configurationFactory;
     private final Assembler assembler;
 
     public DeployerEjb() {
         deploymentLoader = new DeploymentLoader();
-        final ConfigurationFactory component = SystemInstance.get().getComponent(ConfigurationFactory.class);
-        configurationFactory = component == null ? new ConfigurationFactory() : component;
         assembler = (Assembler) SystemInstance.get().getComponent(org.apache.openejb.spi.Assembler.class);
     }
 
@@ -237,6 +229,11 @@ public class DeployerEjb implements Deployer {
                 }
             }
 
+            final OpenEjbConfiguration configuration = new OpenEjbConfiguration();
+            configuration.containerSystem = new ContainerSystemInfo();
+            configuration.facilities = new FacilitiesInfo();
+
+            final ConfigurationFactory configurationFactory = new ConfigurationFactory(false, configuration);
             appInfo = configurationFactory.configureApplication(appModule);
             appInfo.autoDeploy = autoDeploy;
 
@@ -244,7 +241,27 @@ public class DeployerEjb implements Deployer {
                 appInfo.appId = properties.getProperty(OPENEJB_DEPLOYER_FORCED_APP_ID_PROP);
             }
 
-            assembler.createApplication(appInfo);
+            // create any resources and containers defined in the application itself
+
+            final ClassLoader appClassLoader = assembler.createAppClassLoader(appInfo);
+            final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
+            try {
+                Thread.currentThread().setContextClassLoader(appClassLoader);
+
+                for (final ResourceInfo resource : configuration.facilities.resources) {
+                    assembler.createResource(resource);
+                }
+
+                for (final ContainerInfo container : configuration.containerSystem.containers) {
+                    assembler.createContainer(container);
+                }
+
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
+
+            assembler.createApplication(appInfo, appClassLoader);
 
             saveIfNeeded(properties, file, appInfo);
 


Mime
View raw message