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/09/28 23:14:00 UTC
svn commit: r1177065 - in /openejb/trunk/sandbox/arquillian-tomee:
arquillian-tomee-remote/ common/ common/src/ common/src/main/
common/src/main/java/ common/src/main/java/org/
common/src/main/java/org/apache/ common/src/main/java/org/apache/openejb/
c...
Author: jgallimore
Date: Wed Sep 28 21:13:59 2011
New Revision: 1177065
URL: http://svn.apache.org/viewvc?rev=1177065&view=rev
Log:
OPENEJB-1687 Classes that are common to all the adapters
Added:
openejb/trunk/sandbox/arquillian-tomee/common/src/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/SimpleMavenBuilderImpl.java
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEArchiveAppender.java
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
Modified:
openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-remote/pom.xml
openejb/trunk/sandbox/arquillian-tomee/common/pom.xml
Modified: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-remote/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-remote/pom.xml?rev=1177065&r1=1177064&r2=1177065&view=diff
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-remote/pom.xml (original)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-remote/pom.xml Wed Sep 28 21:13:59 2011
@@ -118,31 +118,12 @@
</dependency>
<dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>3.5.1</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.6.4</version>
- <type>jar</type>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>commons-lang</artifactId>
- <groupId>commons-lang</groupId>
- </exclusion>
- </exclusions>
- </dependency>
+
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
@@ -150,6 +131,7 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
+
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-client</artifactId>
@@ -163,6 +145,7 @@
</exclusion>
</exclusions>
</dependency>
+
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
Modified: openejb/trunk/sandbox/arquillian-tomee/common/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/pom.xml?rev=1177065&r1=1177064&r2=1177065&view=diff
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/pom.xml (original)
+++ openejb/trunk/sandbox/arquillian-tomee/common/pom.xml Wed Sep 28 21:13:59 2011
@@ -33,9 +33,10 @@
<url>http://maven.apache.org</url>
<properties>
- <version.org.apache.tomcat>7.0.21</version.org.apache.tomcat>
- <version.cdi-api>1.0</version.cdi-api>
- <version.arquillian>1.0.0.Alpha5</version.arquillian>
+ <version.org.apache.tomcat>7.0.21</version.org.apache.tomcat>
+ <version.cdi-api>1.0</version.cdi-api>
+ <version.arquillian>1.0.0.Alpha5</version.arquillian>
+ <version.org.apache.openejb>4.0.0-beta-1-SNAPSHOT</version.org.apache.openejb>
</properties>
<repositories>
@@ -53,134 +54,274 @@
<dependencies>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>tomee-embedded</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-spi</artifactId>
- <version>${version.arquillian}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <version>${version.arquillian}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testenricher</groupId>
- <artifactId>arquillian-testenricher-cdi</artifactId>
- <version>${version.arquillian}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testenricher</groupId>
- <artifactId>arquillian-testenricher-resource</artifactId>
- <version>${version.arquillian}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testenricher</groupId>
- <artifactId>arquillian-testenricher-ejb</artifactId>
- <version>${version.arquillian}</version>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-spi</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testenricher</groupId>
+ <artifactId>arquillian-testenricher-cdi</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testenricher</groupId>
+ <artifactId>arquillian-testenricher-resource</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testenricher</groupId>
+ <artifactId>arquillian-testenricher-ejb</artifactId>
+ <version>${version.arquillian}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${version.arquillian}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>xbean-reflect</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>${version.cdi-api}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
+ <version>1.1</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-catalina</artifactId>
- <version>${version.org.apache.tomcat}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-coyote</artifactId>
- <version>${version.org.apache.tomcat}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jasper</artifactId>
- <version>${version.org.apache.tomcat}</version>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-junit</artifactId>
- <version>${version.arquillian}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <version>${version.cdi-api}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-client</artifactId>
+ <version>${version.org.apache.openejb}</version>
+ <type>jar</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>javaee-api-embedded</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>${version.org.apache.openejb}</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>mbean-annotation-api</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-lang</artifactId>
+ <groupId>commons-lang</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>javaee-api-embedded</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openejb-api</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openejb-loader</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openejb-javaagent</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openejb-jee</artifactId>
+ <groupId>org.apache.openejb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-cli</artifactId>
+ <groupId>commons-cli</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>activemq-ra</artifactId>
+ <groupId>org.apache.activemq</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>activemq-core</artifactId>
+ <groupId>org.apache.activemq</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-connector</artifactId>
+ <groupId>org.apache.geronimo.components</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-transaction</artifactId>
+ <groupId>org.apache.geronimo.components</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>howl</artifactId>
+ <groupId>org.objectweb.howl</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>geronimo-javamail_1.4_mail</artifactId>
+ <groupId>org.apache.geronimo.javamail</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xbean-asm-shaded</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xbean-finder-shaded</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xbean-reflect</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xbean-naming</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xbean-bundleutils</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>hsqldb</artifactId>
+ <groupId>hsqldb</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>bval-core</artifactId>
+ <groupId>org.apache.bval</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>bval-jsr303</artifactId>
+ <groupId>org.apache.bval</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openjpa</artifactId>
+ <groupId>org.apache.openjpa</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-web</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-dbcp</artifactId>
+ <groupId>commons-dbcp</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-pool</artifactId>
+ <groupId>commons-pool</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>swizzle-stream</artifactId>
+ <groupId>org.codehaus.swizzle</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>wsdl4j</artifactId>
+ <groupId>wsdl4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>quartz</artifactId>
+ <groupId>org.quartz-scheduler</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-impl</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-api</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-spi</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>openwebbeans-ee</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.sonatype.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>1.8</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+ <version>1.0.0-alpha-12</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
- <dependency>
- <groupId>org.eclipse.jdt.core.compiler</groupId>
- <artifactId>ecj</artifactId>
- <version>3.5.1</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>javaee-api</artifactId>
- <version>6.0-1</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.6.4</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
- <version>1.1</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-client</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-tomcat-catalina</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-core</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ <version>1.0.0-alpha-12</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
Added: openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java?rev=1177065&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java Wed Sep 28 21:13:59 2011
@@ -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.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev: 1157006 $ $Date: 2011-08-12 01:23:04 -0700 (Fri, 12 Aug 2011) $
+ */
+public class FileUtils {
+
+ public static File createTempDir() throws IOException {
+ File tempDir = File.createTempFile("tomee", ".conf");
+ tempDir.delete();
+ tempDir.mkdirs();
+ deleteOnExit(tempDir);
+ return tempDir;
+ }
+
+ private FileUtils() {
+ }
+
+ // Shutdown hook for recurssive delete on tmp directories
+ static final List<String> delete = new ArrayList<String>();
+
+ static {
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ delete();
+ }
+ });
+ }
+
+ private static void deleteOnExit(File file) {
+ delete.add(file.getAbsolutePath());
+ }
+
+ private static void delete() {
+ for (String path : delete) {
+ delete(new File(path));
+ }
+ }
+
+ private static void delete(File file) {
+ if (file.isDirectory()) {
+ for (File f : file.listFiles()) {
+ delete(f);
+ }
+ }
+
+ file.delete();
+ }
+}
Added: openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/SimpleMavenBuilderImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/SimpleMavenBuilderImpl.java?rev=1177065&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/SimpleMavenBuilderImpl.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/SimpleMavenBuilderImpl.java Wed Sep 28 21:13:59 2011
@@ -0,0 +1,56 @@
+package org.apache.openejb.arquillian.common;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.shrinkwrap.resolver.api.ResolutionException;
+import org.jboss.shrinkwrap.resolver.api.maven.MavenResolutionFilter;
+import org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl;
+import org.jboss.shrinkwrap.resolver.impl.maven.MavenConverter;
+import org.jboss.shrinkwrap.resolver.impl.maven.MavenRepositorySettings;
+import org.jboss.shrinkwrap.resolver.impl.maven.MavenRepositorySystem;
+import org.jboss.shrinkwrap.resolver.impl.maven.Validate;
+import org.sonatype.aether.RepositorySystemSession;
+import org.sonatype.aether.artifact.Artifact;
+import org.sonatype.aether.graph.Dependency;
+import org.sonatype.aether.resolution.ArtifactRequest;
+import org.sonatype.aether.resolution.ArtifactResult;
+
+public class SimpleMavenBuilderImpl extends MavenBuilderImpl {
+
+ private static final File[] FILE_CAST = new File[0];
+ private final MavenRepositorySystem system;
+ private final RepositorySystemSession session;
+
+ public SimpleMavenBuilderImpl() {
+ super();
+ this.system = new MavenRepositorySystem(new MavenRepositorySettings());
+ this.session = system.getSession();
+ }
+
+ public File[] resolveAsFiles(MavenResolutionFilter filter) throws ResolutionException {
+ Validate.notEmpty(super.getDependencies(), "No dependencies were set for resolution");
+
+ // configure filter
+ filter.configure(Collections.unmodifiableList(super.getDependencies()));
+
+ Collection<File> files = new ArrayList<File>(super.getDependencies().size());
+
+ List<Dependency> dependencies = MavenConverter.asDependencies(super.getDependencies());
+ for (Dependency dependency : dependencies) {
+ try {
+ ArtifactRequest artifactRequest = new ArtifactRequest(dependency.getArtifact(), system.getRemoteRepositories(), null);
+ ArtifactResult artifactResult = system.resolveArtifact(session, artifactRequest);
+ Artifact artifact = artifactResult.getArtifact();
+ files.add(artifact.getFile());
+ } catch (Exception e) {
+ throw new ResolutionException("Unable to resolve an artifact", e);
+ }
+ }
+
+ return files.toArray(FILE_CAST);
+ }
+}
Added: openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEArchiveAppender.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEArchiveAppender.java?rev=1177065&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEArchiveAppender.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEArchiveAppender.java Wed Sep 28 21:13:59 2011
@@ -0,0 +1,37 @@
+/**
+ * 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.common;
+
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public class TomEEArchiveAppender implements AuxiliaryArchiveAppender {
+
+ public Archive<?> createAuxiliaryArchive() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "arquillian-jboss-testenrichers.jar")
+ .addPackages(true, EJBInjectionEnricher.class.getPackage(), ResourceInjectionEnricher.class.getPackage(), CDIInjectionEnricher.class.getPackage())
+ .addAsServiceProvider(TestEnricher.class, CDIInjectionEnricher.class, EJBInjectionEnricher.class, ResourceInjectionEnricher.class);
+ return archive;
+ }
+
+}
Added: openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java?rev=1177065&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java Wed Sep 28 21:13:59 2011
@@ -0,0 +1,63 @@
+/**
+ * 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.common;
+
+import org.jboss.arquillian.spi.ConfigurationException;
+import org.jboss.arquillian.spi.client.container.ContainerConfiguration;
+
+public class TomEEConfiguration implements ContainerConfiguration {
+
+ private int httpPort = 8080;
+ private int stopPort = 8005;
+ private String dir = System.getProperty("java.io.tmpdir") + "/arquillian-apache-tomee";
+ private boolean plusContainer = true;
+
+ public int getHttpPort() {
+ return httpPort;
+ }
+
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
+ }
+
+ public int getStopPort() {
+ return stopPort;
+ }
+
+ public void setStopPort(int stopPort) {
+ this.stopPort = stopPort;
+ }
+
+ public String getDir() {
+ return dir;
+ }
+
+ public void setDir(String dir) {
+ this.dir = dir;
+ }
+
+ public boolean isPlusContainer() {
+ return plusContainer;
+ }
+
+ public void setPlusContainer(boolean plusContainer) {
+ this.plusContainer = plusContainer;
+ }
+
+ public void validate() throws ConfigurationException {
+ }
+}
Added: openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1177065&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java Wed Sep 28 21:13:59 2011
@@ -0,0 +1,137 @@
+/**
+ * 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.common;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.openejb.assembler.Deployer;
+import org.jboss.arquillian.spi.client.container.DeployableContainer;
+import org.jboss.arquillian.spi.client.container.DeploymentException;
+import org.jboss.arquillian.spi.client.container.LifecycleException;
+import org.jboss.arquillian.spi.client.protocol.ProtocolDescription;
+import org.jboss.arquillian.spi.client.protocol.metadata.HTTPContext;
+import org.jboss.arquillian.spi.client.protocol.metadata.ProtocolMetaData;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.descriptor.api.Descriptor;
+
+public abstract class TomEEContainer implements DeployableContainer<TomEEConfiguration> {
+ protected TomEEConfiguration configuration;
+ protected Map<String, String> moduleIds = new HashMap<String, String>();
+
+ public Class<TomEEConfiguration> getConfigurationClass() {
+ return TomEEConfiguration.class;
+ }
+
+ public void setup(TomEEConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public abstract void start() throws LifecycleException;
+
+ public void stop() throws LifecycleException {
+ try {
+ String command = "SHUTDOWN";
+
+ Socket socket = new Socket("localhost", configuration.getStopPort());
+ OutputStream out = socket.getOutputStream();
+ out.write(command.getBytes());
+
+ waitForShutdown(10);
+ } catch (Exception e) {
+ throw new LifecycleException("Unable to stop TomEE", e);
+ }
+ }
+
+ protected void waitForShutdown(int tries) {
+ try {
+
+ Socket socket = new Socket("localhost", configuration.getStopPort());
+ OutputStream out = socket.getOutputStream();
+ out.close();
+ } catch (Exception e) {
+ if (tries > 2) {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e2) {
+ e.printStackTrace();
+ }
+
+ waitForShutdown(--tries);
+ }
+ }
+ }
+
+ public ProtocolDescription getDefaultProtocol() {
+ return new ProtocolDescription("Servlet 3.0");
+ }
+
+ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
+ try {
+ String tmpDir = System.getProperty("java.io.tmpdir");
+ File file = new File(tmpDir + File.separator + archive.getName());
+ archive.as(ZipExporter.class).exportTo(file, true);
+
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+ properties.setProperty(Context.PROVIDER_URL, "http://localhost:" + configuration.getHttpPort() + "/openejb/ejb");
+ InitialContext context = new InitialContext(properties);
+
+ Deployer deployer = (Deployer) context.lookup("openejb/DeployerBusinessRemote");
+ deployer.deploy(file.getAbsolutePath());
+
+ moduleIds.put(archive.getName(), file.getAbsolutePath());
+
+ HTTPContext httpContext = new HTTPContext("0.0.0.0", configuration.getHttpPort());
+ return new ProtocolMetaData().addContext(httpContext);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new DeploymentException("Unable to deploy", e);
+ }
+ }
+
+ public void undeploy(Archive<?> archive) throws DeploymentException {
+ try {
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+ properties.setProperty(Context.PROVIDER_URL, "http://localhost:" + configuration.getHttpPort() + "/openejb/ejb");
+ InitialContext context = new InitialContext(properties);
+ String appId = moduleIds.get(archive.getName());
+ Deployer deployer = (Deployer) context.lookup("openejb/DeployerBusinessRemote");
+ deployer.undeploy(appId);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new DeploymentException("Unable to undeploy", e);
+ }
+ }
+
+ public void deploy(Descriptor descriptor) throws DeploymentException {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public void undeploy(Descriptor descriptor) throws DeploymentException {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+}