You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2011/05/21 22:27:32 UTC
svn commit: r1125800 [3/3] - in /openejb/trunk/sandbox/arquillian-tomee: ./
arquillian-tomee-container/ arquillian-tomee-container/src/
arquillian-tomee-container/src/main/
arquillian-tomee-container/src/main/java/
arquillian-tomee-container/src/main/j...
Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestServlet.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestServlet.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestServlet.java Sat May 21 20:27:31 2011
@@ -0,0 +1,43 @@
+/**
+ * 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;
+
+import java.io.IOException;
+
+import javax.ejb.EJB;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class TestServlet extends HttpServlet {
+
+ @EJB
+ private TestEjb myEjb;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ String name = req.getParameter("name");
+ if (name == null || name.length() == 0) {
+ name = "OpenEJB";
+ }
+
+ resp.getOutputStream().print(myEjb.greet(name));
+ }
+
+
+}
Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TomEEContainerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TomEEContainerTest.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TomEEContainerTest.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TomEEContainerTest.java Sat May 21 20:27:31 2011
@@ -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.apache.openejb.arquillian;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+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.spec.servlet.web.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class TomEEContainerTest {
+
+ @Deployment(testable=false)
+ public static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addClass(TestServlet.class)
+ .addClass(TestEjb.class)
+ .setWebXML(new StringAsset(
+ Descriptors.create(WebAppDescriptor.class)
+ .version("3.0")
+ .servlet(TestServlet.class, "/Test")
+ .exportAsString()
+ ));
+ }
+
+ @Test
+ public void testShouldBeAbleToAccessServletAndEjb() throws Exception {
+ InputStream is = new URL("http://localhost:9080/test/Test").openStream();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ int bytesRead = -1;
+ byte[] buffer = new byte[8192];
+ while ((bytesRead = is.read(buffer)) > -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+
+ is.close();
+ os.close();
+
+ String output = new String(os.toByteArray(), "UTF-8");
+ Assert.assertTrue(output.contains("Hello, OpenEJB"));
+ }
+
+}
Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/arquillian.xml?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/arquillian.xml (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/arquillian.xml Sat May 21 20:27:31 2011
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ 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.
+-->
+<arquillian
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <container qualifier="tomee" default="true">
+ <configuration>
+ <property name="dir">/tmp/arquillian-apache-tomee</property>
+ <property name="httpPort">9080</property>
+ <property name="stopPort">9005</property>
+ </configuration>
+ </container>
+</arquillian>
\ No newline at end of file
Added: openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/pom.xml?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/pom.xml (added)
+++ openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/pom.xml Sat May 21 20:27:31 2011
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>arquillian-tomee</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-webapp-wrapper</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>openejb-webapp-wrapper</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-tomcat-webapp</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <type>war</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-tomcat-webapp</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+</project>
Added: openejb/trunk/sandbox/arquillian-tomee/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/pom.xml?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/pom.xml (added)
+++ openejb/trunk/sandbox/arquillian-tomee/pom.xml Sat May 21 20:27:31 2011
@@ -0,0 +1,37 @@
+<?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.
+-->
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>arquillian-tomee</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>arquillian-tomee</name>
+ <url>http://openejb.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <modules>
+ <module>openejb-webapp-wrapper</module>
+ <module>arquillian-tomee-container</module>
+ </modules>
+</project>
\ No newline at end of file