[jboss-svn-commits] JBoss Common SVN: r4644 - in arquillian/trunk/containers: glassfish-remote-3/src/main/resources/META-INF/services and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jun 30 13:51:16 EDT 2010


Author: aslak
Date: 2010-06-30 13:51:15 -0400 (Wed, 30 Jun 2010)
New Revision: 4644

Added:
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE5DeploymentAppender.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE6DeploymentAppender.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88Configuration.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88DeploymentListener.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapper.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainer.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/Greeter.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/GreeterServlet.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapperTestCase.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerEARTestCase.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerTestSuite.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerWARTestCase.java
Removed:
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE5DeploymentAppender.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE6DeploymentAppender.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88Configuration.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88DeploymentListener.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapper.java
   arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainer.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/Greeter.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/GreeterServlet.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapperTestCase.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerEARTestCase.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerTestSuite.java
   arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerWARTestCase.java
Modified:
   arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88Configuration.java
   arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88RemoteContainer.java
   arquillian/trunk/containers/glassfish-remote-3/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/containers/jsr88/pom.xml
   arquillian/trunk/containers/jsr88/src/test/resources-glassfish/arquillian.xml
   arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.ContainerConfiguration
   arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer
Log:
ARQ-200 Renamed JSR88 1.2 Remote Container package


Modified: arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88Configuration.java
===================================================================
--- arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88Configuration.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88Configuration.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -16,7 +16,7 @@
  */
 package org.jboss.arquillian.container.glassfish.remote_3;
 
-import org.jboss.arquillian.container.jsr88.JSR88Configuration;
+import org.jboss.arquillian.container.jsr88.remote_1_2.JSR88Configuration;
 
 /**
  * This class extends the {@link JSR88Configuration} to provide the

Modified: arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88RemoteContainer.java
===================================================================
--- arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88RemoteContainer.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/glassfish-remote-3/src/main/java/org/jboss/arquillian/container/glassfish/remote_3/GlassFishJSR88RemoteContainer.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -16,8 +16,8 @@
  */
 package org.jboss.arquillian.container.glassfish.remote_3;
 
-import org.jboss.arquillian.spi.ContainerConfiguration;
-import org.jboss.arquillian.container.jsr88.JSR88RemoteContainer;
+import org.jboss.arquillian.container.jsr88.remote_1_2.JSR88Configuration;
+import org.jboss.arquillian.container.jsr88.remote_1_2.JSR88RemoteContainer;
 import org.jboss.arquillian.spi.ContainerMethodExecutor;
 import org.jboss.arquillian.spi.Context;
 import org.jboss.arquillian.spi.DeploymentException;
@@ -38,7 +38,7 @@
 public class GlassFishJSR88RemoteContainer extends JSR88RemoteContainer
 {
    @Override
-   public Class<? extends ContainerConfiguration> getContainerConfigurationClass()
+   public Class<? extends JSR88Configuration> getContainerConfigurationClass()
    {
       return GlassFishJSR88Configuration.class;
    }

Modified: arquillian/trunk/containers/glassfish-remote-3/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/containers/glassfish-remote-3/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/glassfish-remote-3/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1 +1 @@
-org.jboss.arquillian.container.jsr88.EE6DeploymentAppender
+org.jboss.arquillian.container.jsr88.remote_1_2.EE6DeploymentAppender

Modified: arquillian/trunk/containers/jsr88/pom.xml
===================================================================
--- arquillian/trunk/containers/jsr88/pom.xml	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/pom.xml	2010-06-30 17:51:15 UTC (rev 4644)
@@ -12,9 +12,9 @@
    <modelVersion>4.0.0</modelVersion>
 
    <groupId>org.jboss.arquillian.container</groupId>
-   <artifactId>arquillian-jsr88</artifactId>
-   <name>Arquillian Container JSR 88-compliant Remote</name>
-   <description>JSR 88-compliant Remote Container integration for the Arquillian Project</description>
+   <artifactId>arquillian-jsr88-1.2</artifactId>
+   <name>Arquillian Container JSR 88-compliant Remote 1.2</name>
+   <description>JSR 88 1.2 compliant Remote Container integration for the Arquillian Project</description>
 
    <properties>
       <version.glassfish>3.0.1-b19</version.glassfish>

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE5DeploymentAppender.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE5DeploymentAppender.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE5DeploymentAppender.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
-import org.jboss.arquillian.spi.TestEnricher;
-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;
-
-/**
- * Package the required dependencies needed by the JSR 88 container plugin
- * to run in container.
- *
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @author Dan Allen
- */
-public class EE5DeploymentAppender implements AuxiliaryArchiveAppender
-{
-   public Archive<?> createAuxiliaryArchive()
-   {
-      JavaArchive archive = ShrinkWrap.create("arquillian-ee5-container-testenrichers.jar", JavaArchive.class)
-            .addPackages(
-                  true, 
-                  EJBInjectionEnricher.class.getPackage(),
-                  ResourceInjectionEnricher.class.getPackage())
-            .addServiceProvider(
-                  TestEnricher.class, 
-                  EJBInjectionEnricher.class,
-                  ResourceInjectionEnricher.class);
-      return archive;
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE6DeploymentAppender.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE6DeploymentAppender.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE6DeploymentAppender.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
-import org.jboss.arquillian.spi.TestEnricher;
-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;
-
-/**
- * Package the required dependencies needed by the JSR 88 container plugin
- * to run in container. 
- *
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @author Dan Allen
- */
-public class EE6DeploymentAppender implements AuxiliaryArchiveAppender
-{
-   public Archive<?> createAuxiliaryArchive()
-   {
-      JavaArchive archive = ShrinkWrap.create("arquillian-ee6-container-testenrichers.jar", JavaArchive.class)
-            .addPackages(
-                  true, 
-                  EJBInjectionEnricher.class.getPackage(),
-                  ResourceInjectionEnricher.class.getPackage(),
-                  CDIInjectionEnricher.class.getPackage())
-            .addServiceProvider(
-                  TestEnricher.class, 
-                  EJBInjectionEnricher.class,
-                  ResourceInjectionEnricher.class,
-                  CDIInjectionEnricher.class);
-      return archive;
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88Configuration.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88Configuration.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88Configuration.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import org.jboss.arquillian.spi.ContainerConfiguration;
-import org.jboss.arquillian.spi.ContainerProfile;
-
-/**
- * A {@link org.jboss.arquillian.spi.ContainerConfiguration} implementation for
- * a JSR 88-compliant container. The required configuration settings are the
- * deployment URI and the deployment factory class.
- *
- * @author Dan Allen
- * @author Iskandar Salim
- * @see http://jcp.org/en/jsr/detail?id=88
- */
-public class JSR88Configuration implements ContainerConfiguration
-{
-   private int remoteServerHttpPort = 8080;
-   private String remoteServerAddress = "localhost";
-   private String deploymentUri = "";
-   private String deploymentUsername = "";
-   private String deploymentPassword = "";
-   private String deploymentFactoryClass = "";
-   private int deploymentTimeoutSeconds = 5;
-
-   public JSR88Configuration()
-   {
-      setDefaults();
-   }
-
-   protected void setDefaults()
-   {
-   }
-
-   public ContainerProfile getContainerProfile()
-   {
-      return ContainerProfile.CLIENT;
-   }
-
-   public int getRemoteServerHttpPort()
-   {
-      return remoteServerHttpPort;
-   }
-
-   public void setRemoteServerHttpPort(int remoteServerHttpPort)
-   {
-      this.remoteServerHttpPort = remoteServerHttpPort;
-   }
-
-   public String getRemoteServerAddress()
-   {
-      return remoteServerAddress;
-   }
-
-   public void setRemoteServerAddress(String remoteServerAddress)
-   {
-      this.remoteServerAddress = remoteServerAddress;
-   }
-
-   public String getDeploymentFactoryClass()
-   {
-      return deploymentFactoryClass;
-   }
-
-   public void setDeploymentFactoryClass(String deploymentFactoryClass)
-   {
-      this.deploymentFactoryClass = deploymentFactoryClass;
-   }
-
-   public String getDeploymentPassword()
-   {
-      return deploymentPassword;
-   }
-
-   public void setDeploymentPassword(String deploymentPassword)
-   {
-      this.deploymentPassword = deploymentPassword;
-   }
-
-   public String getDeploymentUri()
-   {
-      return deploymentUri;
-   }
-
-   public void setDeploymentUri(String deploymentUri)
-   {
-      this.deploymentUri = deploymentUri;
-   }
-
-   public String getDeploymentUsername()
-   {
-      return deploymentUsername;
-   }
-
-   public void setDeploymentUsername(String deploymentUsername)
-   {
-      this.deploymentUsername = deploymentUsername;
-   }
-
-   public int getDeploymentTimeoutSeconds()
-   {
-      return deploymentTimeoutSeconds;
-   }
-
-   public void setDeploymentTimeoutSeconds(int deploymentTimeoutSeconds)
-   {
-      this.deploymentTimeoutSeconds = deploymentTimeoutSeconds;
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88DeploymentListener.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88DeploymentListener.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88DeploymentListener.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import java.util.logging.Logger;
-
-import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.spi.TargetModuleID;
-import javax.enterprise.deploy.spi.status.DeploymentStatus;
-import javax.enterprise.deploy.spi.status.ProgressEvent;
-import javax.enterprise.deploy.spi.status.ProgressListener;
-import javax.enterprise.deploy.spi.status.ProgressObject;
-
-/**
- * Listens for JSR 88 deployment events to update the deployed state
- * of the module.
- *
- * <p>During distribution (deployment), this listener observes the completed
- * operation and subsequently starts the module, marking the module as
- * started when the start operation is complete.</p>
- *
- * <p>During undeployment, this listener observes the completed operation
- * and marks the module as not started.</p>
- *
- * @author Dan Allen
- * @author Iskandar Salim
- */
-class JSR88DeploymentListener implements ProgressListener
-{
-   private static final Logger log = Logger.getLogger(JSR88RemoteContainer.class.getName());
-
-   private JSR88RemoteContainer container;
-   private TargetModuleID[] ids;
-   private CommandType type;
-
-   JSR88DeploymentListener(JSR88RemoteContainer container, TargetModuleID[] moduleIds, CommandType type)
-   {
-      this.container = container;
-      this.ids = moduleIds;
-      this.type = type;
-   }
-
-   public void handleProgressEvent(ProgressEvent event)
-   {
-      DeploymentStatus status = event.getDeploymentStatus();
-      log.info(status.getMessage());
-      if (status.isCompleted())
-      {
-         if (type.equals(CommandType.DISTRIBUTE))
-         {
-            ProgressObject startProgress = container.getDeploymentManager().start(ids);
-            startProgress.addProgressListener(new ProgressListener()
-            {
-               public void handleProgressEvent(ProgressEvent startEvent)
-               {
-                  log.info(startEvent.getDeploymentStatus().getMessage());
-                  if (startEvent.getDeploymentStatus().isCompleted())
-                  {
-                     container.moduleStarted(true);
-                  }
-               }
-            });
-         }
-         else if (type.equals(CommandType.UNDEPLOY))
-         {
-            container.moduleStarted(false);
-         }
-      }
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapper.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapper.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapper.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import javax.enterprise.deploy.shared.ModuleType;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-
-/**
- * A mapper that determines the JSR 88 {@link ModuleType} of a ShrinkWrap archive.
- *
- * @author Dan Allen
- */
-public class JSR88ModuleTypeMapper
-{
-   public JSR88ModuleTypeMapper()
-   {
-   }
-
-   public ModuleType getModuleType(Archive<?> archive)
-   {
-      if (WebArchive.class.isInstance(archive))
-      {
-         return ModuleType.WAR;
-      }
-      if (EnterpriseArchive.class.isInstance(archive))
-      {
-         return ModuleType.EAR;
-      }
-      if (ResourceAdapterArchive.class.isInstance(archive))
-      {
-         return ModuleType.RAR;
-      }
-      return ModuleType.EJB;
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainer.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainer.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainer.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,311 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
-import javax.enterprise.deploy.spi.DeploymentManager;
-import javax.enterprise.deploy.spi.TargetModuleID;
-import javax.enterprise.deploy.spi.factories.DeploymentFactory;
-import javax.enterprise.deploy.spi.status.ProgressObject;
-
-import org.jboss.arquillian.protocol.servlet.ServletMethodExecutor;
-import org.jboss.arquillian.spi.Configuration;
-import org.jboss.arquillian.spi.ContainerMethodExecutor;
-import org.jboss.arquillian.spi.Context;
-import org.jboss.arquillian.spi.DeployableContainer;
-import org.jboss.arquillian.spi.DeploymentException;
-import org.jboss.arquillian.spi.LifecycleException;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
-
-/**
- * A container implementation for a JSR 88-compliant container.
- *
- * <p>This class distributes (deploys) and undeploys ShrinkWrap
- * archives using the JSR-88 {@link DeploymentManager}. A connection
- * to the container is established during the start method and
- * released in the stop method. The deploy and undeploy methods use
- * {@link DeploymentManager#distribute(Target[], ModuleType, InputStream, InputStream)} and
- * {@link DeploymentManager#undeploy(TargetModuleID[])}, respectively.</p>
- *
- * <p>You can use this container implementation either through configuration
- * or extension. To use it via configuration, assign the deployment URI and
- * deployment factory class for the target container to the {@link JSR88Configuration}
- * object using the Arquillian configuration file (arquillian.xml). Alternatively,
- * you can choose to extend the {@link JSR88Configuration} to assign defaults for
- * these values. You should also specify the configuration class by overriding the
- * {@link JSR88CompliantRemoteContainer#getContainerConfigurationClass()}
- * method.</p>
- *
- * <p>JSR 88 deploys the archive using an {@link InputStream}. The deployed
- * archive is assigned a random name. You can specify a custom name for 
- * a war in the <code>module-name</code> element of the module deployment
- * descriptor (web.xml).</p>
- *
- * @author Dan Allen
- * @author Iskandar Salim
- * @see org.glassfish.admin.cli.resources.AddResources
- */
-public class JSR88RemoteContainer implements DeployableContainer
-{
-   public static final String HTTP_PROTOCOL = "http";
-   public static final ArchivePath MODULE_ID_STORE_PATH = ArchivePaths.create(".jsr88-module-id");
-
-   private static final CyclicBarrier PROGRESS_BARRIER = new CyclicBarrier(2);
-
-   private static final Logger log = Logger.getLogger(JSR88RemoteContainer.class.getName());
-
-   private JSR88ModuleTypeMapper moduleTypeMapper;
-   private DeploymentManager deploymentManager;
-   private boolean moduleStarted = false;
-
-   private JSR88Configuration containerConfig;
-   
-   public JSR88RemoteContainer()
-   {
-      moduleTypeMapper = new JSR88ModuleTypeMapper();
-   }
-   
-   public void setup(Context context, Configuration arquillianConfig)
-   {
-      containerConfig = arquillianConfig.getContainerConfig(getContainerConfigurationClass());
-   }
-   
-   public void start(Context context) throws LifecycleException
-   {
-      try 
-      {
-         initDeploymentManager(containerConfig.getDeploymentFactoryClass(),
-               containerConfig.getDeploymentUri(),
-               containerConfig.getDeploymentUsername(),
-               containerConfig.getDeploymentPassword());
-      } 
-      catch (Exception e) 
-      {
-         throw new LifecycleException("Could not connect to container", e);
-      }
-   }
-
-   public void stop(Context context) throws LifecycleException
-   {
-      try
-      {
-         releaseDeploymentManager();
-      }
-      catch (Exception e)
-      {
-         throw new LifecycleException("Could not release deployment manager", e);
-      }
-   }
-
-   public ContainerMethodExecutor deploy(Context context, Archive<?> archive) throws DeploymentException
-   {
-      if (deploymentManager == null)
-      {
-         throw new DeploymentException("Could not deploy since deployment manager was not loaded");
-      }
-
-      TargetModuleID moduleInfo = null;
-      try {
-         PROGRESS_BARRIER.reset();
-         resetModuleStatus();
-         ProgressObject progress = deploymentManager.distribute(
-               deploymentManager.getTargets(), moduleTypeMapper.getModuleType(archive),
-               archive.as(ZipExporter.class).exportZip(), null);
-         progress.addProgressListener(new JSR88DeploymentListener(this, progress.getResultTargetModuleIDs(), CommandType.DISTRIBUTE));
-         waitForModuleToStart();
-         // QUESTION when is getResultTargetModuleIDs() > 0?
-         moduleInfo =  progress.getResultTargetModuleIDs()[0];
-         context.add(TargetModuleID.class, moduleInfo);
-      }
-      catch (Exception e)
-      {
-         throw new DeploymentException("Could not deploy archive", e);
-      }
-
-      if (moduleInfo == null || moduleInfo.getModuleID() == null)
-      {
-         throw new DeploymentException("Could not determine module id, likely because module did not deploy");
-      }
-
-      try 
-      {
-         // FIXME pass moduleId to ServletMethodExecutor since we can't guarantee anymore it's /test
-         return new ServletMethodExecutor(
-               new URL(
-                     HTTP_PROTOCOL,
-                     containerConfig.getRemoteServerAddress(),
-                     containerConfig.getRemoteServerHttpPort(),
-                     "/")
-               );
-      } 
-      catch (Exception e) 
-      {
-         throw new RuntimeException("Could not create ContainerMethodExecutor", e);
-      }
-   }
-
-   public void undeploy(Context context, Archive<?> archive) throws DeploymentException
-   {
-      if (!moduleStarted)
-      {
-         log.info("Skipping undeploy since module is not deployed");
-         return;
-      }
-
-      if (deploymentManager == null)
-      {
-         throw new DeploymentException("Could not undeploy since deployment manager was not loaded");
-      }
-      
-      try
-      {
-         PROGRESS_BARRIER.reset();
-         TargetModuleID moduleInfo = context.get(TargetModuleID.class);
-         if (moduleInfo == null || moduleInfo.getModuleID() == null)
-         {
-            log.log(Level.INFO, "Skipping undeploy since module ID could not be determined");
-            return;
-         }
-         
-         TargetModuleID[] availableModuleIDs = deploymentManager.getAvailableModules(
-               moduleTypeMapper.getModuleType(archive), getDeploymentManager().getTargets());
-         TargetModuleID moduleInfoMatch = null;
-         for (TargetModuleID candidate : availableModuleIDs)
-         {
-            if (candidate.getModuleID().equals(moduleInfo.getModuleID()))
-            {
-               moduleInfoMatch = candidate;
-               break;
-            }
-         }
-
-         if (moduleInfoMatch != null)
-         {
-            TargetModuleID[] targetModuleIDs = { moduleInfoMatch };
-            ProgressObject progress = deploymentManager.undeploy(targetModuleIDs);
-            progress.addProgressListener(new JSR88DeploymentListener(this, targetModuleIDs, CommandType.UNDEPLOY));
-            waitForModuleToUndeploy();
-         }
-         else
-         {
-            resetModuleStatus();
-            log.info("Undeploy skipped since could not locate module in list of deployed modules");
-         }
-      }
-      catch (Exception e)
-      {
-         throw new DeploymentException("Could not undeploy module", e);
-      }
-   }
-
-   public Class<? extends JSR88Configuration> getContainerConfigurationClass()
-   {
-      return JSR88Configuration.class;
-   }
-
-   public DeploymentManager getDeploymentManager()
-   {
-      return deploymentManager;
-   }
-
-   protected DeploymentManager initDeploymentManager(String factoryClass, String uri, String username, String password) throws Exception
-   {
-      if (deploymentManager == null)
-      {
-         DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
-         dfm.registerDeploymentFactory(
-               (DeploymentFactory) Class.forName(factoryClass).newInstance());
-         deploymentManager =
-               dfm.getDeploymentManager(uri, username, password);
-      }
-      return deploymentManager;
-   }
-
-   protected void releaseDeploymentManager()
-   {
-      if (deploymentManager != null)
-      {
-         deploymentManager.release();
-      }
-   }
-
-   public boolean isModuleStarted()
-   {
-      return moduleStarted;
-   }
-
-   void moduleStarted(boolean status)
-   {
-      moduleStarted = status;
-      if (PROGRESS_BARRIER.getNumberWaiting() > 0)
-      {
-         try
-         {
-            PROGRESS_BARRIER.await();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException("Failed to report module as " + (status ? "started" : "shutdown"), e);
-         }
-      }
-   }
-
-   protected void resetModuleStatus()
-   {
-      moduleStarted = false;
-   }
-
-   private void waitForModuleToStart()
-   {
-      if (!moduleStarted)
-      {
-         try
-         {
-            PROGRESS_BARRIER.await(containerConfig.getDeploymentTimeoutSeconds(), TimeUnit.SECONDS);
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException("Module startup was interrupted or timed out", e);
-         }
-      }
-   }
-
-   private void waitForModuleToUndeploy()
-   {
-      if (moduleStarted)
-      {
-         try
-         {
-            PROGRESS_BARRIER.await(containerConfig.getDeploymentTimeoutSeconds(), TimeUnit.SECONDS);
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException("Module undeployment was interrupted or timed out", e);
-         }
-      }
-   }
-}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE5DeploymentAppender.java (from rev 4641, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE5DeploymentAppender.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE5DeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE5DeploymentAppender.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+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;
+
+/**
+ * Package the required dependencies needed by the JSR 88 container plugin
+ * to run in container.
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @author Dan Allen
+ */
+public class EE5DeploymentAppender implements AuxiliaryArchiveAppender
+{
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = ShrinkWrap.create("arquillian-ee5-container-testenrichers.jar", JavaArchive.class)
+            .addPackages(
+                  true, 
+                  EJBInjectionEnricher.class.getPackage(),
+                  ResourceInjectionEnricher.class.getPackage())
+            .addServiceProvider(
+                  TestEnricher.class, 
+                  EJBInjectionEnricher.class,
+                  ResourceInjectionEnricher.class);
+      return archive;
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE6DeploymentAppender.java (from rev 4641, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/EE6DeploymentAppender.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE6DeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/EE6DeploymentAppender.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+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;
+
+/**
+ * Package the required dependencies needed by the JSR 88 container plugin
+ * to run in container. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @author Dan Allen
+ */
+public class EE6DeploymentAppender implements AuxiliaryArchiveAppender
+{
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = ShrinkWrap.create("arquillian-ee6-container-testenrichers.jar", JavaArchive.class)
+            .addPackages(
+                  true, 
+                  EJBInjectionEnricher.class.getPackage(),
+                  ResourceInjectionEnricher.class.getPackage(),
+                  CDIInjectionEnricher.class.getPackage())
+            .addServiceProvider(
+                  TestEnricher.class, 
+                  EJBInjectionEnricher.class,
+                  ResourceInjectionEnricher.class,
+                  CDIInjectionEnricher.class);
+      return archive;
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88Configuration.java (from rev 4641, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88Configuration.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88Configuration.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88Configuration.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import org.jboss.arquillian.spi.ContainerConfiguration;
+import org.jboss.arquillian.spi.ContainerProfile;
+
+/**
+ * A {@link org.jboss.arquillian.spi.ContainerConfiguration} implementation for
+ * a JSR 88-compliant container. The required configuration settings are the
+ * deployment URI and the deployment factory class.
+ *
+ * @author Dan Allen
+ * @author Iskandar Salim
+ * @see http://jcp.org/en/jsr/detail?id=88
+ */
+public class JSR88Configuration implements ContainerConfiguration
+{
+   private int remoteServerHttpPort = 8080;
+   private String remoteServerAddress = "localhost";
+   private String deploymentUri = "";
+   private String deploymentUsername = "";
+   private String deploymentPassword = "";
+   private String deploymentFactoryClass = "";
+   private int deploymentTimeoutSeconds = 5;
+
+   public JSR88Configuration()
+   {
+      setDefaults();
+   }
+
+   protected void setDefaults()
+   {
+   }
+
+   public ContainerProfile getContainerProfile()
+   {
+      return ContainerProfile.CLIENT;
+   }
+
+   public int getRemoteServerHttpPort()
+   {
+      return remoteServerHttpPort;
+   }
+
+   public void setRemoteServerHttpPort(int remoteServerHttpPort)
+   {
+      this.remoteServerHttpPort = remoteServerHttpPort;
+   }
+
+   public String getRemoteServerAddress()
+   {
+      return remoteServerAddress;
+   }
+
+   public void setRemoteServerAddress(String remoteServerAddress)
+   {
+      this.remoteServerAddress = remoteServerAddress;
+   }
+
+   public String getDeploymentFactoryClass()
+   {
+      return deploymentFactoryClass;
+   }
+
+   public void setDeploymentFactoryClass(String deploymentFactoryClass)
+   {
+      this.deploymentFactoryClass = deploymentFactoryClass;
+   }
+
+   public String getDeploymentPassword()
+   {
+      return deploymentPassword;
+   }
+
+   public void setDeploymentPassword(String deploymentPassword)
+   {
+      this.deploymentPassword = deploymentPassword;
+   }
+
+   public String getDeploymentUri()
+   {
+      return deploymentUri;
+   }
+
+   public void setDeploymentUri(String deploymentUri)
+   {
+      this.deploymentUri = deploymentUri;
+   }
+
+   public String getDeploymentUsername()
+   {
+      return deploymentUsername;
+   }
+
+   public void setDeploymentUsername(String deploymentUsername)
+   {
+      this.deploymentUsername = deploymentUsername;
+   }
+
+   public int getDeploymentTimeoutSeconds()
+   {
+      return deploymentTimeoutSeconds;
+   }
+
+   public void setDeploymentTimeoutSeconds(int deploymentTimeoutSeconds)
+   {
+      this.deploymentTimeoutSeconds = deploymentTimeoutSeconds;
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88DeploymentListener.java (from rev 4643, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88DeploymentListener.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88DeploymentListener.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88DeploymentListener.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import java.util.logging.Logger;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+/**
+ * Listens for JSR 88 deployment events to update the deployed state
+ * of the module.
+ *
+ * <p>During distribution (deployment), this listener observes the completed
+ * operation and subsequently starts the module, marking the module as
+ * started when the start operation is complete.</p>
+ *
+ * <p>During undeployment, this listener observes the completed operation
+ * and marks the module as not started.</p>
+ *
+ * @author Dan Allen
+ * @author Iskandar Salim
+ */
+class JSR88DeploymentListener implements ProgressListener
+{
+   private static final Logger log = Logger.getLogger(JSR88RemoteContainer.class.getName());
+
+   private JSR88RemoteContainer container;
+   private TargetModuleID[] ids;
+   private CommandType type;
+
+   JSR88DeploymentListener(JSR88RemoteContainer container, TargetModuleID[] moduleIds, CommandType type)
+   {
+      this.container = container;
+      this.ids = moduleIds;
+      this.type = type;
+   }
+
+   public void handleProgressEvent(ProgressEvent event)
+   {
+      DeploymentStatus status = event.getDeploymentStatus();
+      log.info(status.getMessage());
+      if (status.isCompleted())
+      {
+         if (type.equals(CommandType.DISTRIBUTE))
+         {
+            ProgressObject startProgress = container.getDeploymentManager().start(ids);
+            startProgress.addProgressListener(new ProgressListener()
+            {
+               public void handleProgressEvent(ProgressEvent startEvent)
+               {
+                  log.info(startEvent.getDeploymentStatus().getMessage());
+                  if (startEvent.getDeploymentStatus().isCompleted())
+                  {
+                     container.moduleStarted(true);
+                  }
+               }
+            });
+         }
+         else if (type.equals(CommandType.UNDEPLOY))
+         {
+            container.moduleStarted(false);
+         }
+      }
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapper.java (from rev 4641, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapper.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapper.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapper.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import javax.enterprise.deploy.shared.ModuleType;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+/**
+ * A mapper that determines the JSR 88 {@link ModuleType} of a ShrinkWrap archive.
+ *
+ * @author Dan Allen
+ */
+public class JSR88ModuleTypeMapper
+{
+   public JSR88ModuleTypeMapper()
+   {
+   }
+
+   public ModuleType getModuleType(Archive<?> archive)
+   {
+      if (WebArchive.class.isInstance(archive))
+      {
+         return ModuleType.WAR;
+      }
+      if (EnterpriseArchive.class.isInstance(archive))
+      {
+         return ModuleType.EAR;
+      }
+      if (ResourceAdapterArchive.class.isInstance(archive))
+      {
+         return ModuleType.RAR;
+      }
+      return ModuleType.EJB;
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainer.java (from rev 4643, arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainer.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainer.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/main/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainer.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,311 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.jboss.arquillian.protocol.servlet.ServletMethodExecutor;
+import org.jboss.arquillian.spi.Configuration;
+import org.jboss.arquillian.spi.ContainerMethodExecutor;
+import org.jboss.arquillian.spi.Context;
+import org.jboss.arquillian.spi.DeployableContainer;
+import org.jboss.arquillian.spi.DeploymentException;
+import org.jboss.arquillian.spi.LifecycleException;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+
+/**
+ * A container implementation for a JSR 88-compliant container.
+ *
+ * <p>This class distributes (deploys) and undeploys ShrinkWrap
+ * archives using the JSR-88 {@link DeploymentManager}. A connection
+ * to the container is established during the start method and
+ * released in the stop method. The deploy and undeploy methods use
+ * {@link DeploymentManager#distribute(Target[], ModuleType, InputStream, InputStream)} and
+ * {@link DeploymentManager#undeploy(TargetModuleID[])}, respectively.</p>
+ *
+ * <p>You can use this container implementation either through configuration
+ * or extension. To use it via configuration, assign the deployment URI and
+ * deployment factory class for the target container to the {@link JSR88Configuration}
+ * object using the Arquillian configuration file (arquillian.xml). Alternatively,
+ * you can choose to extend the {@link JSR88Configuration} to assign defaults for
+ * these values. You should also specify the configuration class by overriding the
+ * {@link JSR88CompliantRemoteContainer#getContainerConfigurationClass()}
+ * method.</p>
+ *
+ * <p>JSR 88 deploys the archive using an {@link InputStream}. The deployed
+ * archive is assigned a random name. You can specify a custom name for 
+ * a war in the <code>module-name</code> element of the module deployment
+ * descriptor (web.xml).</p>
+ *
+ * @author Dan Allen
+ * @author Iskandar Salim
+ * @see org.glassfish.admin.cli.resources.AddResources
+ */
+public class JSR88RemoteContainer implements DeployableContainer
+{
+   public static final String HTTP_PROTOCOL = "http";
+   public static final ArchivePath MODULE_ID_STORE_PATH = ArchivePaths.create(".jsr88-module-id");
+
+   private static final CyclicBarrier PROGRESS_BARRIER = new CyclicBarrier(2);
+
+   private static final Logger log = Logger.getLogger(JSR88RemoteContainer.class.getName());
+
+   private JSR88ModuleTypeMapper moduleTypeMapper;
+   private DeploymentManager deploymentManager;
+   private boolean moduleStarted = false;
+
+   private JSR88Configuration containerConfig;
+   
+   public JSR88RemoteContainer()
+   {
+      moduleTypeMapper = new JSR88ModuleTypeMapper();
+   }
+   
+   public void setup(Context context, Configuration arquillianConfig)
+   {
+      containerConfig = arquillianConfig.getContainerConfig(getContainerConfigurationClass());
+   }
+   
+   public void start(Context context) throws LifecycleException
+   {
+      try 
+      {
+         initDeploymentManager(containerConfig.getDeploymentFactoryClass(),
+               containerConfig.getDeploymentUri(),
+               containerConfig.getDeploymentUsername(),
+               containerConfig.getDeploymentPassword());
+      } 
+      catch (Exception e) 
+      {
+         throw new LifecycleException("Could not connect to container", e);
+      }
+   }
+
+   public void stop(Context context) throws LifecycleException
+   {
+      try
+      {
+         releaseDeploymentManager();
+      }
+      catch (Exception e)
+      {
+         throw new LifecycleException("Could not release deployment manager", e);
+      }
+   }
+
+   public ContainerMethodExecutor deploy(Context context, Archive<?> archive) throws DeploymentException
+   {
+      if (deploymentManager == null)
+      {
+         throw new DeploymentException("Could not deploy since deployment manager was not loaded");
+      }
+
+      TargetModuleID moduleInfo = null;
+      try {
+         PROGRESS_BARRIER.reset();
+         resetModuleStatus();
+         ProgressObject progress = deploymentManager.distribute(
+               deploymentManager.getTargets(), moduleTypeMapper.getModuleType(archive),
+               archive.as(ZipExporter.class).exportZip(), null);
+         progress.addProgressListener(new JSR88DeploymentListener(this, progress.getResultTargetModuleIDs(), CommandType.DISTRIBUTE));
+         waitForModuleToStart();
+         // QUESTION when is getResultTargetModuleIDs() > 0?
+         moduleInfo =  progress.getResultTargetModuleIDs()[0];
+         context.add(TargetModuleID.class, moduleInfo);
+      }
+      catch (Exception e)
+      {
+         throw new DeploymentException("Could not deploy archive", e);
+      }
+
+      if (moduleInfo == null || moduleInfo.getModuleID() == null)
+      {
+         throw new DeploymentException("Could not determine module id, likely because module did not deploy");
+      }
+
+      try 
+      {
+         // FIXME pass moduleId to ServletMethodExecutor since we can't guarantee anymore it's /test
+         return new ServletMethodExecutor(
+               new URL(
+                     HTTP_PROTOCOL,
+                     containerConfig.getRemoteServerAddress(),
+                     containerConfig.getRemoteServerHttpPort(),
+                     "/")
+               );
+      } 
+      catch (Exception e) 
+      {
+         throw new RuntimeException("Could not create ContainerMethodExecutor", e);
+      }
+   }
+
+   public void undeploy(Context context, Archive<?> archive) throws DeploymentException
+   {
+      if (!moduleStarted)
+      {
+         log.info("Skipping undeploy since module is not deployed");
+         return;
+      }
+
+      if (deploymentManager == null)
+      {
+         throw new DeploymentException("Could not undeploy since deployment manager was not loaded");
+      }
+      
+      try
+      {
+         PROGRESS_BARRIER.reset();
+         TargetModuleID moduleInfo = context.get(TargetModuleID.class);
+         if (moduleInfo == null || moduleInfo.getModuleID() == null)
+         {
+            log.log(Level.INFO, "Skipping undeploy since module ID could not be determined");
+            return;
+         }
+         
+         TargetModuleID[] availableModuleIDs = deploymentManager.getAvailableModules(
+               moduleTypeMapper.getModuleType(archive), getDeploymentManager().getTargets());
+         TargetModuleID moduleInfoMatch = null;
+         for (TargetModuleID candidate : availableModuleIDs)
+         {
+            if (candidate.getModuleID().equals(moduleInfo.getModuleID()))
+            {
+               moduleInfoMatch = candidate;
+               break;
+            }
+         }
+
+         if (moduleInfoMatch != null)
+         {
+            TargetModuleID[] targetModuleIDs = { moduleInfoMatch };
+            ProgressObject progress = deploymentManager.undeploy(targetModuleIDs);
+            progress.addProgressListener(new JSR88DeploymentListener(this, targetModuleIDs, CommandType.UNDEPLOY));
+            waitForModuleToUndeploy();
+         }
+         else
+         {
+            resetModuleStatus();
+            log.info("Undeploy skipped since could not locate module in list of deployed modules");
+         }
+      }
+      catch (Exception e)
+      {
+         throw new DeploymentException("Could not undeploy module", e);
+      }
+   }
+
+   public Class<? extends JSR88Configuration> getContainerConfigurationClass()
+   {
+      return JSR88Configuration.class;
+   }
+
+   public DeploymentManager getDeploymentManager()
+   {
+      return deploymentManager;
+   }
+
+   protected DeploymentManager initDeploymentManager(String factoryClass, String uri, String username, String password) throws Exception
+   {
+      if (deploymentManager == null)
+      {
+         DeploymentFactoryManager dfm = DeploymentFactoryManager.getInstance();
+         dfm.registerDeploymentFactory(
+               (DeploymentFactory) Class.forName(factoryClass).newInstance());
+         deploymentManager =
+               dfm.getDeploymentManager(uri, username, password);
+      }
+      return deploymentManager;
+   }
+
+   protected void releaseDeploymentManager()
+   {
+      if (deploymentManager != null)
+      {
+         deploymentManager.release();
+      }
+   }
+
+   public boolean isModuleStarted()
+   {
+      return moduleStarted;
+   }
+
+   void moduleStarted(boolean status)
+   {
+      moduleStarted = status;
+      if (PROGRESS_BARRIER.getNumberWaiting() > 0)
+      {
+         try
+         {
+            PROGRESS_BARRIER.await();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException("Failed to report module as " + (status ? "started" : "shutdown"), e);
+         }
+      }
+   }
+
+   protected void resetModuleStatus()
+   {
+      moduleStarted = false;
+   }
+
+   private void waitForModuleToStart()
+   {
+      if (!moduleStarted)
+      {
+         try
+         {
+            PROGRESS_BARRIER.await(containerConfig.getDeploymentTimeoutSeconds(), TimeUnit.SECONDS);
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException("Module startup was interrupted or timed out", e);
+         }
+      }
+   }
+
+   private void waitForModuleToUndeploy()
+   {
+      if (moduleStarted)
+      {
+         try
+         {
+            PROGRESS_BARRIER.await(containerConfig.getDeploymentTimeoutSeconds(), TimeUnit.SECONDS);
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException("Module undeployment was interrupted or timed out", e);
+         }
+      }
+   }
+}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/Greeter.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/Greeter.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/Greeter.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import javax.ejb.Stateless;
-
- at Stateless
-public class Greeter
-{
-   public String greet()
-   {
-      return "hello";
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/GreeterServlet.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/GreeterServlet.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/GreeterServlet.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import java.io.IOException;
-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;
-
-/**
- * GreeterServlet
- *
- * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
- */
- at WebServlet(urlPatterns = "/Greeter")
-public class GreeterServlet extends HttpServlet
-{
-   private static final long serialVersionUID = 1L;
-
-   @EJB private Greeter greeter;
-
-   @Override
-   protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
-   {
-      response.getWriter().append(greeter.greet());
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapperTestCase.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapperTestCase.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapperTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import javax.enterprise.deploy.shared.ModuleType;
-import static org.junit.Assert.*;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-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.junit.Test;
-
-/**
- * A test that verifies the {@link JSR88ModuleTypeMapper} returns
- * the correct JSR 88 {@link ModuleType} of a ShrinkWrap archive.
- *
- * @author Dan Allen
- */
-public class JSR88ModuleTypeMapperTestCase
-{
-   @Test
-   public void testWARModuleType()
-   {
-      Archive<?> archive = ShrinkWrap.create("test.war", WebArchive.class);
-      assertSame(ModuleType.WAR, getMapper().getModuleType(archive));
-   }
-
-   @Test
-   public void testEARModuleType()
-   {
-      Archive<?> archive = ShrinkWrap.create("test.ear", EnterpriseArchive.class);
-      assertSame(ModuleType.EAR, getMapper().getModuleType(archive));
-   }
-
-   @Test
-   public void testEJBModuleType()
-   {
-      Archive<?> archive = ShrinkWrap.create("test.jar", JavaArchive.class);
-      assertSame(ModuleType.EJB, getMapper().getModuleType(archive));
-   }
-
-   @Test
-   public void testRARModuleType()
-   {
-      Archive<?> archive = ShrinkWrap.create("test.rar", ResourceAdapterArchive.class);
-      assertSame(ModuleType.RAR, getMapper().getModuleType(archive));
-   }
-
-   @Test
-   public void testSequentialUsage()
-   {
-      JSR88ModuleTypeMapper mapper = getMapper();
-      Archive<?> rar = ShrinkWrap.create("test.rar", ResourceAdapterArchive.class);
-      assertSame(ModuleType.RAR, mapper.getModuleType(rar));
-      Archive<?> war = ShrinkWrap.create("test.war", WebArchive.class);
-      assertSame(ModuleType.WAR, mapper.getModuleType(war));
-   }
-
-   private JSR88ModuleTypeMapper getMapper()
-   {
-      return new JSR88ModuleTypeMapper();
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerEARTestCase.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerEARTestCase.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerEARTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import static org.jboss.arquillian.api.RunModeType.AS_CLIENT;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.logging.Logger;
-import javax.servlet.annotation.WebServlet;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.api.Run;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-/**
- * Verifies that the an Arquillian test can be run in client
- * mode with a the JSR 88 Remote container for GlassFish.
- *
- * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
- * @author Dan Allen
- */
- at RunWith(Arquillian.class)
- at Run(AS_CLIENT)
-public class JSR88RemoteContainerEARTestCase
-{
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(JSR88RemoteContainerEARTestCase.class.getName());
-   
-   /**
-    * Deployment for the test
-    * @return
-    */
-   @Deployment
-   public static Archive<?> getTestArchive()
-   {
-      ArchivePath root = ArchivePaths.create("/");
-      final WebArchive war = ShrinkWrap.create("test.war", WebArchive.class)
-            .addClasses(GreeterServlet.class);
-      final JavaArchive ejb = ShrinkWrap.create("test.jar", JavaArchive.class)
-            .addClass(Greeter.class);
-      final EnterpriseArchive ear = ShrinkWrap.create("test.ear", EnterpriseArchive.class)
-            .setApplicationXML("application.xml")
-            .add(war, root)
-            .add(ejb, root);
-      log.info(ear.toString(true));
-      return ear;
-   }
-
-   @Test
-   public void shouldBeAbleToDeployWebArchive() throws Exception
-   {
-      String servletPath = GreeterServlet.class.getAnnotation(WebServlet.class).urlPatterns()[0];
-      String body = readAllAndClose(new URL("http://localhost:8080/test" + servletPath).openStream());
-      
-      Assert.assertEquals(
-            "Verify that the servlet was deployed and returns expected result",
-            "hello",
-            body);
-   }
-   
-   private String readAllAndClose(InputStream is) throws Exception 
-   {
-      ByteArrayOutputStream out = new ByteArrayOutputStream();
-      try
-      {
-         int read;
-         while( (read = is.read()) != -1)
-         {
-            out.write(read);
-         }
-      }
-      finally 
-      {
-         try { is.close(); } catch (Exception e) { }
-      }
-      return out.toString();
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerTestSuite.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerTestSuite.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerTestSuite.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import java.io.File;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * A JUnit 4 test suite that manages the lifecycle of a locally-installed
- * GlassFish instance in order to test the JSR 88 deployment.
- *
- * <p>This class relies on the system property glassfish.install.dir
- * to point to a valid installation of GlassFish v3.</p>
- *
- * @author Dan Allen
- */
- at RunWith(Suite.class)
- at SuiteClasses({
-   JSR88RemoteContainerWARTestCase.class,
-   JSR88RemoteContainerEARTestCase.class})
-public class JSR88RemoteContainerTestSuite
-{
-   @BeforeClass
-   public static void startContainer() throws Exception
-   {
-      Runtime.getRuntime().exec(new String[] {
-            getAsadminCommand(),
-            "start-domain",
-            "tests"}).waitFor();
-   }
-
-   @AfterClass
-   public static void stopContainer() throws Exception
-   {
-      Runtime.getRuntime().exec(new String[] {
-            getAsadminCommand(),
-            "stop-domain",
-            "tests"}).waitFor();
-   }
-
-   public static String getAsadminCommand()
-   {
-      File asadminFile = new File(System.getProperty("glassfish.install.dir") +
-            File.separator + "bin" + File.separator + "asadmin");
-      if (!asadminFile.exists() || !asadminFile.isFile())
-      {
-         Assert.fail("Path to asadmin command is invalid: " + asadminFile.getAbsolutePath());
-      }
-      return asadminFile.getAbsolutePath();
-   }
-}

Deleted: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerWARTestCase.java
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerWARTestCase.java	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerWARTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.arquillian.container.jsr88;
-
-import static org.jboss.arquillian.api.RunModeType.AS_CLIENT;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.logging.Logger;
-import javax.servlet.annotation.WebServlet;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.api.Run;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-/**
- * Verifies that the an Arquillian test can be run in client
- * mode with a the JSR 88 Remote container for GlassFish.
- *
- * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
- * @author Dan Allen
- */
- at RunWith(Arquillian.class)
- at Run(AS_CLIENT)
-public class JSR88RemoteContainerWARTestCase
-{
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(JSR88RemoteContainerWARTestCase.class.getName());
-   
-   /**
-    * Deployment for the test
-    * @return
-    */
-   @Deployment
-   public static Archive<?> getTestArchive()
-   {
-      final WebArchive war = ShrinkWrap.create("test.war", WebArchive.class)
-            .addClasses(GreeterServlet.class, Greeter.class)
-            .setWebXML("web.xml");
-      log.info(war.toString(true));
-      return war;
-   }
-
-   @Test
-   public void shouldBeAbleToDeployWebArchive() throws Exception
-   {
-      String servletPath = GreeterServlet.class.getAnnotation(WebServlet.class).urlPatterns()[0];
-      String body = readAllAndClose(new URL("http://localhost:8080/test" + servletPath).openStream());
-      
-      Assert.assertEquals(
-            "Verify that the servlet was deployed and returns expected result",
-            "hello",
-            body);
-   }
-   
-   private String readAllAndClose(InputStream is) throws Exception 
-   {
-      ByteArrayOutputStream out = new ByteArrayOutputStream();
-      try
-      {
-         int read;
-         while( (read = is.read()) != -1)
-         {
-            out.write(read);
-         }
-      }
-      finally 
-      {
-         try { is.close(); } catch (Exception e) { }
-      }
-      return out.toString();
-   }
-}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/Greeter.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/Greeter.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/Greeter.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/Greeter.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class Greeter
+{
+   public String greet()
+   {
+      return "hello";
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/GreeterServlet.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/GreeterServlet.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/GreeterServlet.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/GreeterServlet.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import java.io.IOException;
+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;
+
+/**
+ * GreeterServlet
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ */
+ at WebServlet(urlPatterns = "/Greeter")
+public class GreeterServlet extends HttpServlet
+{
+   private static final long serialVersionUID = 1L;
+
+   @EJB private Greeter greeter;
+
+   @Override
+   protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+   {
+      response.getWriter().append(greeter.greet());
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapperTestCase.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88ModuleTypeMapperTestCase.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapperTestCase.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88ModuleTypeMapperTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import javax.enterprise.deploy.shared.ModuleType;
+import static org.junit.Assert.*;
+
+import org.jboss.arquillian.container.jsr88.remote_1_2.JSR88ModuleTypeMapper;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+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.junit.Test;
+
+/**
+ * A test that verifies the {@link JSR88ModuleTypeMapper} returns
+ * the correct JSR 88 {@link ModuleType} of a ShrinkWrap archive.
+ *
+ * @author Dan Allen
+ */
+public class JSR88ModuleTypeMapperTestCase
+{
+   @Test
+   public void testWARModuleType()
+   {
+      Archive<?> archive = ShrinkWrap.create("test.war", WebArchive.class);
+      assertSame(ModuleType.WAR, getMapper().getModuleType(archive));
+   }
+
+   @Test
+   public void testEARModuleType()
+   {
+      Archive<?> archive = ShrinkWrap.create("test.ear", EnterpriseArchive.class);
+      assertSame(ModuleType.EAR, getMapper().getModuleType(archive));
+   }
+
+   @Test
+   public void testEJBModuleType()
+   {
+      Archive<?> archive = ShrinkWrap.create("test.jar", JavaArchive.class);
+      assertSame(ModuleType.EJB, getMapper().getModuleType(archive));
+   }
+
+   @Test
+   public void testRARModuleType()
+   {
+      Archive<?> archive = ShrinkWrap.create("test.rar", ResourceAdapterArchive.class);
+      assertSame(ModuleType.RAR, getMapper().getModuleType(archive));
+   }
+
+   @Test
+   public void testSequentialUsage()
+   {
+      JSR88ModuleTypeMapper mapper = getMapper();
+      Archive<?> rar = ShrinkWrap.create("test.rar", ResourceAdapterArchive.class);
+      assertSame(ModuleType.RAR, mapper.getModuleType(rar));
+      Archive<?> war = ShrinkWrap.create("test.war", WebArchive.class);
+      assertSame(ModuleType.WAR, mapper.getModuleType(war));
+   }
+
+   private JSR88ModuleTypeMapper getMapper()
+   {
+      return new JSR88ModuleTypeMapper();
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerEARTestCase.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerEARTestCase.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerEARTestCase.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerEARTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import static org.jboss.arquillian.api.RunModeType.AS_CLIENT;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.logging.Logger;
+import javax.servlet.annotation.WebServlet;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.api.Run;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Verifies that the an Arquillian test can be run in client
+ * mode with a the JSR 88 Remote container for GlassFish.
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @author Dan Allen
+ */
+ at RunWith(Arquillian.class)
+ at Run(AS_CLIENT)
+public class JSR88RemoteContainerEARTestCase
+{
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(JSR88RemoteContainerEARTestCase.class.getName());
+   
+   /**
+    * Deployment for the test
+    * @return
+    */
+   @Deployment
+   public static Archive<?> getTestArchive()
+   {
+      ArchivePath root = ArchivePaths.create("/");
+      final WebArchive war = ShrinkWrap.create("test.war", WebArchive.class)
+            .addClasses(GreeterServlet.class);
+      final JavaArchive ejb = ShrinkWrap.create("test.jar", JavaArchive.class)
+            .addClass(Greeter.class);
+      final EnterpriseArchive ear = ShrinkWrap.create("test.ear", EnterpriseArchive.class)
+            .setApplicationXML("application.xml")
+            .add(war, root)
+            .add(ejb, root);
+      log.info(ear.toString(true));
+      return ear;
+   }
+
+   @Test
+   public void shouldBeAbleToDeployWebArchive() throws Exception
+   {
+      String servletPath = GreeterServlet.class.getAnnotation(WebServlet.class).urlPatterns()[0];
+      String body = readAllAndClose(new URL("http://localhost:8080/test" + servletPath).openStream());
+      
+      Assert.assertEquals(
+            "Verify that the servlet was deployed and returns expected result",
+            "hello",
+            body);
+   }
+   
+   private String readAllAndClose(InputStream is) throws Exception 
+   {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      try
+      {
+         int read;
+         while( (read = is.read()) != -1)
+         {
+            out.write(read);
+         }
+      }
+      finally 
+      {
+         try { is.close(); } catch (Exception e) { }
+      }
+      return out.toString();
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerTestSuite.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerTestSuite.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerTestSuite.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerTestSuite.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import java.io.File;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * A JUnit 4 test suite that manages the lifecycle of a locally-installed
+ * GlassFish instance in order to test the JSR 88 deployment.
+ *
+ * <p>This class relies on the system property glassfish.install.dir
+ * to point to a valid installation of GlassFish v3.</p>
+ *
+ * @author Dan Allen
+ */
+ at RunWith(Suite.class)
+ at SuiteClasses({
+   JSR88RemoteContainerWARTestCase.class,
+   JSR88RemoteContainerEARTestCase.class})
+public class JSR88RemoteContainerTestSuite
+{
+   @BeforeClass
+   public static void startContainer() throws Exception
+   {
+      Runtime.getRuntime().exec(new String[] {
+            getAsadminCommand(),
+            "start-domain",
+            "tests"}).waitFor();
+   }
+
+   @AfterClass
+   public static void stopContainer() throws Exception
+   {
+      Runtime.getRuntime().exec(new String[] {
+            getAsadminCommand(),
+            "stop-domain",
+            "tests"}).waitFor();
+   }
+
+   public static String getAsadminCommand()
+   {
+      File asadminFile = new File(System.getProperty("glassfish.install.dir") +
+            File.separator + "bin" + File.separator + "asadmin");
+      if (!asadminFile.exists() || !asadminFile.isFile())
+      {
+         Assert.fail("Path to asadmin command is invalid: " + asadminFile.getAbsolutePath());
+      }
+      return asadminFile.getAbsolutePath();
+   }
+}

Copied: arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerWARTestCase.java (from rev 4641, arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/JSR88RemoteContainerWARTestCase.java)
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerWARTestCase.java	                        (rev 0)
+++ arquillian/trunk/containers/jsr88/src/test/java/org/jboss/arquillian/container/jsr88/remote_1_2/JSR88RemoteContainerWARTestCase.java	2010-06-30 17:51:15 UTC (rev 4644)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.container.jsr88.remote_1_2;
+
+import static org.jboss.arquillian.api.RunModeType.AS_CLIENT;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.logging.Logger;
+import javax.servlet.annotation.WebServlet;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.api.Run;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Verifies that the an Arquillian test can be run in client
+ * mode with a the JSR 88 Remote container for GlassFish.
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @author Dan Allen
+ */
+ at RunWith(Arquillian.class)
+ at Run(AS_CLIENT)
+public class JSR88RemoteContainerWARTestCase
+{
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(JSR88RemoteContainerWARTestCase.class.getName());
+   
+   /**
+    * Deployment for the test
+    * @return
+    */
+   @Deployment
+   public static Archive<?> getTestArchive()
+   {
+      final WebArchive war = ShrinkWrap.create("test.war", WebArchive.class)
+            .addClasses(GreeterServlet.class, Greeter.class)
+            .setWebXML("web.xml");
+      log.info(war.toString(true));
+      return war;
+   }
+
+   @Test
+   public void shouldBeAbleToDeployWebArchive() throws Exception
+   {
+      String servletPath = GreeterServlet.class.getAnnotation(WebServlet.class).urlPatterns()[0];
+      String body = readAllAndClose(new URL("http://localhost:8080/test" + servletPath).openStream());
+      
+      Assert.assertEquals(
+            "Verify that the servlet was deployed and returns expected result",
+            "hello",
+            body);
+   }
+   
+   private String readAllAndClose(InputStream is) throws Exception 
+   {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      try
+      {
+         int read;
+         while( (read = is.read()) != -1)
+         {
+            out.write(read);
+         }
+      }
+      finally 
+      {
+         try { is.close(); } catch (Exception e) { }
+      }
+      return out.toString();
+   }
+}

Modified: arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1 +1 @@
-org.jboss.arquillian.container.jsr88.EE6DeploymentAppender
+org.jboss.arquillian.container.jsr88.remote_1_2.EE6DeploymentAppender

Modified: arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.ContainerConfiguration
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.ContainerConfiguration	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.ContainerConfiguration	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1 +1 @@
-org.jboss.arquillian.container.jsr88.JSR88Configuration
+org.jboss.arquillian.container.jsr88.remote_1_2.JSR88Configuration

Modified: arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1 +1 @@
-org.jboss.arquillian.container.jsr88.JSR88RemoteContainer
+org.jboss.arquillian.container.jsr88.remote_1_2.JSR88RemoteContainer

Modified: arquillian/trunk/containers/jsr88/src/test/resources-glassfish/arquillian.xml
===================================================================
--- arquillian/trunk/containers/jsr88/src/test/resources-glassfish/arquillian.xml	2010-06-30 17:46:27 UTC (rev 4643)
+++ arquillian/trunk/containers/jsr88/src/test/resources-glassfish/arquillian.xml	2010-06-30 17:51:15 UTC (rev 4644)
@@ -1,6 +1,6 @@
 <arquillian xmlns="http://jboss.com/arquillian"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-   xmlns:jsr88="urn:arq:org.jboss.arquillian.container.jsr88">
+   xmlns:jsr88="urn:arq:org.jboss.arquillian.container.jsr88.remote_1_2">
 
    <jsr88:container>
       <jsr88:deploymentUri>deployer:Sun:AppServer::localhost:4848</jsr88:deploymentUri>



More information about the jboss-svn-commits mailing list