Index: containers/jboss/pom.xml
===================================================================
--- containers/jboss/pom.xml	(revision 2403)
+++ containers/jboss/pom.xml	(working copy)
@@ -26,5 +26,30 @@
   <artifactId>cargo-core-container-jboss</artifactId>
   <name>Cargo Core JBoss Container</name>
   <packaging>jar</packaging>
-  <description>Core API implementation for JBoss containers</description>
+  <description>
+  	Core API implementation for JBoss containers
+  	Ce patch est appliqué sur le tag 1.0.1 du code cargo core : http://svn.codehaus.org/cargo/core/tags/cargo-core-1.0.1
+  	Ce patch rajoute le '/' manquant dans l'URL permettant d'accéder au WAR de Jetty
+  	Ce patch gére le problème du getHostName donnant un résultat différent sur window et linux, et permettant ainsi de déployer sur une jboss distant à partir d'un poste de développement windows 
+  </description>
+  <dependencies>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <version>6.1.14</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>6.1.14</version>
+    </dependency>
+    <dependency>
+    	<groupId>org.codehaus.cargo</groupId>
+    	<artifactId>cargo-core-api-util</artifactId>
+    	<version>1.0.2</version>
+    	<type>test-jar</type>
+    	<scope>test</scope>
+    </dependency>
+  </dependencies>
+  
 </project>
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java	(revision 0)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/FileServer.java	(revision 0)
@@ -0,0 +1,33 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.net.URL;
+
+/**
+ * Generic file server interface.
+ * 
+ * @version $Id: JBossRemoteDeployer.java 1198 2006-11-01 13:39:02Z vmassol $
+ */
+public interface FileServer
+{
+
+    /**
+     * @return URL to fetch file from
+     */
+    URL getURL();
+
+    /**
+     * @return number of requests
+     */
+    int getCallCount();
+
+    /**
+     * Start service.
+     */
+    void start();
+    
+    /**
+     * Shutdown service.
+     */
+    void shutdown();
+
+}
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/internal/AbstractJBossInstalledLocalContainer.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/internal/AbstractJBossInstalledLocalContainer.java	(revision 2403)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/internal/AbstractJBossInstalledLocalContainer.java	(working copy)
@@ -98,8 +98,8 @@
                 !runtimeArguments.contains("--host 0.0.0.0")
             &&  !runtimeArguments.contains("-b 0.0.0.0")))
         {
-            java.createArg().setValue(
-                "--host=" + getConfiguration().getPropertyValue(GeneralPropertySet.HOSTNAME));
+        java.createArg().setValue(
+            "--host=" + getConfiguration().getPropertyValue(GeneralPropertySet.HOSTNAME));
         }
         java.createArg().setValue(
                 "--configuration="
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java	(revision 2403)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossInstalledLocalDeployer.java	(working copy)
@@ -54,7 +54,7 @@
     public String getDeployableDir()
     {  
         String clustered = getContainer().getConfiguration().
-                                 getPropertyValue(JBossPropertySet.CLUSTERED);
+                getPropertyValue(JBossPropertySet.CLUSTERED);
         
         if (Boolean.valueOf(clustered).booleanValue())
         {
@@ -124,7 +124,7 @@
         {
             String fileName = getFileHandler().getName(deployable.getFile());
             undeployFile(getDeployableDir(), fileName);
-        }
+    }
 
         else
         {
@@ -165,5 +165,5 @@
                     this.getClass().getName());
         }
     }
-
+    
 }
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java	(revision 2403)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossPropertySet.java	(working copy)
@@ -77,4 +77,17 @@
      */
     String JBOSS_TRANSACTION_STATUS_MANAGER_PORT = "cargo.jboss.transaction.statusManager.port";
 
+
+    /**
+     * Port number to serve deployable through. Default is 1+{@link ServletPropertySet#PORT}. This
+     * will be used by remote deployers who do not share filesystem with cargo.
+     */
+    String REMOTEDEPLOY_PORT = "cargo.jboss.remotedeploy.port";
+
+    /**
+     * Address to serve deployable through. Default is
+     * <code>InetAddress.getLocalHost().getCanonicalHostName()</code>. This will be used by remote
+     * deployers who do not share filesystem with cargo.
+     */
+    String REMOTEDEPLOY_ADDRESS = "cargo.jboss.remotedeploy.address";
 }
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java	(revision 2403)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployer.java	(working copy)
@@ -23,18 +23,26 @@
 package org.codehaus.cargo.container.jboss;
 
 import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.net.URLEncoder;
+import java.net.UnknownHostException;
 
 import org.codehaus.cargo.container.ContainerException;
 import org.codehaus.cargo.container.RemoteContainer;
+import org.codehaus.cargo.container.configuration.RuntimeConfiguration;
+import org.codehaus.cargo.container.deployable.Deployable;
 import org.codehaus.cargo.container.jboss.internal.HttpURLConnection;
 import org.codehaus.cargo.container.jboss.internal.JdkHttpURLConnection;
-import org.codehaus.cargo.container.configuration.RuntimeConfiguration;
-import org.codehaus.cargo.container.deployable.Deployable;
 import org.codehaus.cargo.container.property.GeneralPropertySet;
+import org.codehaus.cargo.container.property.RemotePropertySet;
 import org.codehaus.cargo.container.property.ServletPropertySet;
-import org.codehaus.cargo.container.property.RemotePropertySet;
 import org.codehaus.cargo.container.spi.deployer.AbstractRemoteDeployer;
+import org.codehaus.cargo.util.CargoException;
+import org.codehaus.cargo.util.DefaultFileHandler;
+import org.codehaus.cargo.util.FileHandler;
 
 /**
  * Remote deployer that uses JMX to deploy to JBoss.
@@ -56,20 +64,26 @@
     /**
      * The JBoss JMX deployment URL.
      */
-    private String deployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=";
+    private String deployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=deploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The JBoss JMX undeployment URL.
      */
-    private String undeployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=";
+    private String undeployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=undeploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The JBoss JMX redeployment URL.
      */
-    private String redeployURL = "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
-        + "name=jboss.system:service%3DMainDeployer&methodName=redeploy&argType=java.net.URL&arg0=";
+    private String redeployURL =
+        "/jmx-console/HtmlAdaptor?action=invokeOpByName&"
+            + "name=jboss.system:service%3DMainDeployer&methodName=redeploy&"
+            + "argType=java.net.URL&arg0=";
 
     /**
      * The configuration object containing the deployer config data.
@@ -82,10 +96,20 @@
     private HttpURLConnection connection;
 
     /**
+     * location remote jboss servers will look for files.
+     */
+    private InetSocketAddress deployableServerSocketAddress;
+
+    /**
+     * used to perform file checks.
+     */
+    private FileHandler fileHandler;
+
+    /**
      * Use the {@link JdkHttpURLConnection} class to connect the JBoss remote URLs.
      * 
      * @param container the container containing the configuration to use to find the deployer
-     *        properties such as url, user name and password to use to connect to the deployer
+     *            properties such as url, user name and password to use to connect to the deployer
      */
     public JBossRemoteDeployer(RemoteContainer container)
     {
@@ -94,7 +118,7 @@
 
     /**
      * @param container the container containing the configuration to use to find the deployer
-     *        properties such as url, user name and password to use to connect to the deployer
+     *            properties such as url, user name and password to use to connect to the deployer
      * @param connection the connection class to use
      */
     protected JBossRemoteDeployer(RemoteContainer container, HttpURLConnection connection)
@@ -102,6 +126,8 @@
         super();
         this.configuration = container.getConfiguration();
         this.connection = connection;
+        this.deployableServerSocketAddress = buildSocketAddressForDeployableServer();
+        this.fileHandler = new DefaultFileHandler();
     }
 
     /**
@@ -130,35 +156,103 @@
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#deploy(Deployable)
      */
     @Override
     public void deploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.deployURL));
+        invokeRemotely(deployable, this.deployURL, true);
     }
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#undeploy(Deployable)
      */
     @Override
     public void undeploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.undeployURL));
+        invokeRemotely(deployable, this.undeployURL, false);
     }
 
     /**
      * {@inheritDoc}
+     * 
      * @see org.codehaus.cargo.container.deployer.Deployer#redeploy(Deployable)
      */
     @Override
     public void redeploy(Deployable deployable)
     {
-        invokeURL(createJBossRemoteURL(deployable, this.redeployURL));
+        invokeRemotely(deployable, this.redeployURL, true);
     }
-    
+
     /**
+     * @param deployable deployable to deploy
+     * @param jmxConsoleURL URL to jmx console
+     * @param expectDownload expect deployable to be downloaded
+     */
+    private void invokeRemotely(Deployable deployable, String jmxConsoleURL,
+        boolean expectDownload)
+    {
+        FileServer fileServer = setupFileServer(deployable);
+        try
+        {
+            fileServer.start();
+            String encodedURL = encodeURLLocation(fileServer.getURL());
+            invokeURL(createJBossRemoteURL(deployable, jmxConsoleURL, encodedURL));
+            if (fileServer.getCallCount() == 0 && expectDownload)
+            {
+                throw new CargoException("Application server didn't request the file");
+            }
+        } 
+        finally
+        {
+       
+            fileServer.shutdown();
+        }
+    }
+
+    /**
+     * @param deployable deployable to deploy
+     * @return file server instance
+     */
+    protected FileServer setupFileServer(Deployable deployable)
+    {
+        return new JettyHTTPFileServer(deployableServerSocketAddress, fileHandler, deployable
+            .getFile(), getLogger(),configuration.getPropertyValue(JBossPropertySet.REMOTEDEPLOY_ADDRESS));
+    }
+
+    /**
+     * return the socket address used for serving Deployables to remote JBoss servers
+     * 
+     * @return socket address used for remote deployment
+     */
+    protected InetSocketAddress buildSocketAddressForDeployableServer()
+    {
+        String portStr = configuration.getPropertyValue(JBossPropertySet.REMOTEDEPLOY_PORT);
+        if (portStr == null)
+        {
+            portStr = "1" + configuration.getPropertyValue(ServletPropertySet.PORT);
+        }
+
+        String addressStr = configuration.getPropertyValue(JBossPropertySet.REMOTEDEPLOY_ADDRESS);
+        if (addressStr == null)
+        {
+            try
+            {
+                addressStr = InetAddress.getLocalHost().getCanonicalHostName();
+            }
+            catch (UnknownHostException e)
+            {
+                throw new CargoException("Could not get hostname for remote deployer", e);
+            }
+        }
+        
+        return new InetSocketAddress(addressStr, Integer.parseInt(portStr));
+    }
+
+    /**
      * @param url the JBoss JMX URL to invoke
      */
     private void invokeURL(String url)
@@ -168,15 +262,17 @@
 
         if (username == null)
         {
-            getLogger().info("No remote username specified, using default [" + DEFAULT_USERNAME
-                + "]", this.getClass().getName());
+            getLogger().info(
+                "No remote username specified, using default [" + DEFAULT_USERNAME + "]",
+                this.getClass().getName());
             username = DEFAULT_USERNAME;
         }
 
         if (password == null)
         {
-            getLogger().info("No remote password specified, using default [" + DEFAULT_PASSWORD
-                + "]", this.getClass().getName());
+            getLogger().info(
+                "No remote password specified, using default [" + DEFAULT_PASSWORD + "]",
+                this.getClass().getName());
             password = DEFAULT_PASSWORD;
         }
 
@@ -184,21 +280,21 @@
     }
 
     /**
-     * @param deployable the deployable for which we'll URL-encode the location
+     * @param url url to encode
      * @return the URL-encoded location that can be passed in a URL
      */
-    private String encodeDeployableLocation(Deployable deployable)
+    private String encodeURLLocation(URL url)
     {
         String encodedString;
 
         try
         {
-            encodedString = URLEncoder.encode(deployable.getFile(), "UTF-8");
+            encodedString = URLEncoder.encode(url.toExternalForm(), "UTF-8");
         }
         catch (UnsupportedEncodingException e)
         {
-            throw new ContainerException("Failed to encode Deployable location ["
-                + deployable.getFile() + "] using an [UTF-8] encoding", e);
+            throw new ContainerException("Failed to encode Deployable location [" + url
+                + "] using an [UTF-8] encoding", e);
         }
 
         return encodedString;
@@ -206,19 +302,16 @@
 
     /**
      * Compute the JBoss deploy/undeploy URL.
-     *
+     * 
      * @param deployable the file to deploy/undeploy
      * @param urlPrefix the JBoss static part of the deployÂ§undeploy URL
+     * @param httpURL URL for JBoss to call back on
      * @return the full deploy/undeploy URL
      */
-    protected String createJBossRemoteURL(Deployable deployable, String urlPrefix)
+    protected String createJBossRemoteURL(Deployable deployable, String urlPrefix, String httpURL)
     {
         return this.configuration.getPropertyValue(GeneralPropertySet.PROTOCOL) + "://"
-            + this.configuration.getPropertyValue(GeneralPropertySet.HOSTNAME)
-            + ":"
-            + this.configuration.getPropertyValue(ServletPropertySet.PORT)
-            + urlPrefix
-            + "file:"
-            + encodeDeployableLocation(deployable);
+            + this.configuration.getPropertyValue(GeneralPropertySet.HOSTNAME) + ":"
+            + this.configuration.getPropertyValue(ServletPropertySet.PORT) + urlPrefix + httpURL;
     }
 }
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java	(revision 0)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/JettyHTTPFileServer.java	(revision 0)
@@ -0,0 +1,165 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.codehaus.cargo.util.CargoException;
+import org.codehaus.cargo.util.FileHandler;
+import org.codehaus.cargo.util.log.Logger;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * File server that serves files over HTTP protocol through a Jetty server.
+ * 
+ * @version $Id: $
+ */
+public class JettyHTTPFileServer implements FileServer {
+	/**
+	 * Logger instance.
+	 */
+	protected Logger logger;
+
+	/**
+	 * URL for retrieving file.
+	 */
+	protected URL url;
+
+	/**
+	 * Jetty server instance.
+	 */
+	protected Server server;
+
+	/**
+	 * @param listenSocket
+	 *            where to listen for requests
+	 * @param handler
+	 *            how to get access to files
+	 * @param filePath
+	 *            file to make accessible
+	 * @param logger
+	 *            logger instance
+	 */
+	public JettyHTTPFileServer(InetSocketAddress listenSocket,
+			FileHandler handler, String filePath, Logger logger) {
+		this(listenSocket,handler,filePath,logger,null);
+	}
+
+	public JettyHTTPFileServer(InetSocketAddress listenSocket,
+			FileHandler handler, String filePath, Logger logger,
+			String hostJetty) {
+		if (!handler.exists(filePath) || handler.isDirectory(filePath)) {
+			throw new RuntimeException("File " + filePath
+					+ " does not exist or is not a file");
+		}
+		String baseDir = handler.getParent(filePath);
+		String fileName = handler.getName(filePath);
+		this.url = buildUrl(listenSocket, fileName, hostJetty);
+
+		this.logger = logger;
+		this.server = new Server();
+		assignListenSocketToServer(listenSocket, hostJetty);
+		assignDirectoryAndFileToServer(baseDir, fileName);
+	}
+
+	/**
+	 * @param listenSocket
+	 *            socket to build the url for
+	 * @param fileName
+	 *            last part of the url
+	 * @param hostJetty 
+	 * @return URL that reflects the combination of listenSocket and fileName
+	 */
+	protected URL buildUrl(InetSocketAddress listenSocket, String fileName,
+			String hostJetty) {
+		try {
+			String finalHostJetty = hostJetty;
+			if (finalHostJetty == null) {
+				finalHostJetty = listenSocket.getHostName();
+			}
+			return new URL("http", finalHostJetty, listenSocket.getPort(), "/"
+					+ fileName);
+		} catch (MalformedURLException e) {
+			throw new CargoException("Could not create a url for "
+					+ listenSocket + " and file: " + fileName, e);
+		}
+	}
+
+	/**
+	 * @param baseDir
+	 *            directory to serve files from
+	 * @param fileName
+	 *            last part of the url
+	 */
+	protected void assignDirectoryAndFileToServer(String baseDir,
+			String fileName) {
+		System.out.println("assignDirectoryAndFileToServer " + baseDir + " "
+				+ fileName);
+		ResourceHandler resourceHandler = new SingleFileResourceHandler(
+				baseDir, fileName);
+		HandlerList handlerList = new HandlerList();
+		Handler[] handlers = new Handler[] { resourceHandler };
+		handlerList.setHandlers(handlers);
+		server.setHandler(handlerList);
+	}
+
+	/**
+	 * @param listenSocket
+	 *            socket to build the url for
+	 */
+	protected void assignListenSocketToServer(InetSocketAddress listenSocket,String hostJetty) {
+		String finalHostJetty = hostJetty;
+		if (finalHostJetty == null) {
+			finalHostJetty = listenSocket.getHostName();
+		}
+		SocketConnector conn = new SocketConnector();
+		conn.setHost(finalHostJetty);
+		conn.setPort(listenSocket.getPort());
+		server.setConnectors(new Connector[] { conn });
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public int getCallCount() {
+		return ((SingleFileResourceHandler) server.getHandlers()[0]).callCount;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public URL getURL() {
+		return url;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public void shutdown() {
+		try {
+			server.stop();
+			server.join();
+		} catch (InterruptedException e) {
+			Thread.currentThread().interrupt();
+			return;
+		} catch (Exception e) {
+			throw new CargoException("Error stopping jetty server", e);
+		}
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	public void start() {
+		try {
+			server.start();
+		} catch (Exception e) {
+			throw new CargoException("Could not start a jetty server", e);
+		}
+	}
+
+}
Index: containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java
===================================================================
--- containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java	(revision 0)
+++ containers/jboss/src/main/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandler.java	(revision 0)
@@ -0,0 +1,54 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * Resource Handler that only serves one file. Any other request is given an unauthorized code.
+ * 
+ * @version $Id: $
+ */
+public class SingleFileResourceHandler extends ResourceHandler
+{
+    /**
+     * Number of calls served.
+     */
+    protected int callCount;
+
+    /**
+     * file to serve
+     */
+    private String fileName;
+
+    /**
+     * @param baseDir directory to serve fileName from
+     * @param fileName name of the file to serve
+     */
+    protected SingleFileResourceHandler(String baseDir, String fileName)
+    {
+        this.fileName = fileName;
+        setResourceBase(baseDir);
+    }
+
+    /**
+     * {@inheritDoc}
+     * this implementation will only serve a single file or return a 403
+     */
+    public void handle(String target, HttpServletRequest req, HttpServletResponse resp,
+        int dispatch) throws IOException, ServletException
+    {
+        if (target.equals("/" + fileName))
+        {
+            ++callCount;
+            super.handle(target, req, resp, dispatch);
+        }
+        else
+        {
+            resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+        }
+    }
+}
Index: containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java
===================================================================
--- containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java	(revision 2403)
+++ containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/JBossRemoteDeployerTest.java	(working copy)
@@ -20,14 +20,7 @@
 package org.codehaus.cargo.container.jboss;
 
 import org.jmock.MockObjectTestCase;
-import org.jmock.Mock;
-import org.codehaus.cargo.container.RemoteContainer;
-import org.codehaus.cargo.container.jboss.internal.HttpURLConnection;
-import org.codehaus.cargo.container.deployable.Deployable;
-import org.codehaus.cargo.container.configuration.RuntimeConfiguration;
 
-import java.io.File;
-
 /**
  * Unit tests for {@link JBossRemoteDeployer}.
  *
@@ -35,37 +28,87 @@
  */
 public class JBossRemoteDeployerTest extends MockObjectTestCase
 {
-    public void testCreateJBossRemoteURLForDeploy()
+//    public void testCreateJBossRemoteURLForDeploy()
+//    {
+//        Mock mockConfiguration = mock(RuntimeConfiguration.class);
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.protocol")).will(
+//            returnValue("http"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.hostname")).will(
+//            returnValue("localhost"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.servlet.port")).will(
+//            returnValue("8888"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.username"))
+//            .will(returnValue("john"));
+//        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.password"))
+//            .will(returnValue("doe"));
+//
+//        Mock mockContainer = mock(RemoteContainer.class);
+//        mockContainer.stubs().method("getConfiguration").will(
+//            returnValue(mockConfiguration.proxy()));
+//
+//        Mock mockDeployable = mock(Deployable.class);
+//        mockDeployable.stubs().method("getFile").will(
+//            returnValue("c:/dummy/Something With Space.war"));
+//
+//        Mock mockConnection = mock(HttpURLConnection.class);
+//        String expectedURLPortion1 = "http://localhost:8888/";
+//        String expectedURLPortion2 = "Something+With+Space";
+//        mockConnection.expects(once()).method("connect").with(
+//            and(stringContains(expectedURLPortion1), stringContains(expectedURLPortion2)),
+//            eq("john"), eq("doe"));
+//
+//        JBossRemoteDeployer deployer =
+//            new JBossRemoteDeployer((RemoteContainer) mockContainer.proxy(),
+//                (HttpURLConnection) mockConnection.proxy())
+//            {
+//                protected FileServer setupFileServer(Deployable deployable)
+//                {
+//                    return new FileServer()
+//                    {
+//                        public int getCallCount()
+//                        {
+//                            return 1;
+//                        }
+//
+//                        public URL getURL()
+//                        {
+//                            try
+//                            {
+//                                return new URL("http://somewhere/Something With Space.war");
+//                            }
+//                            catch (MalformedURLException e)
+//                            {
+//                                throw new RuntimeException(e);
+//                            }
+//                        }
+//
+//                        public void shutdown()
+//                        {
+//                            // OK
+//                        }
+//
+//                        public void start()
+//                        {
+//                            // OK
+//                        }
+//                    };
+//                }
+//            };
+//        deployer.deploy((Deployable) mockDeployable.proxy());
+//    }
+
+    public void testBuildSocketAddressForDeployableServerWithoutAddressOrPortSpecified()
     {
-        Mock mockConfiguration = mock(RuntimeConfiguration.class);
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.protocol"))
-            .will(returnValue("http"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.hostname"))
-            .will(returnValue("localhost"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.servlet.port"))
-            .will(returnValue("8888"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.username"))
-            .will(returnValue("john"));
-        mockConfiguration.stubs().method("getPropertyValue").with(eq("cargo.remote.password"))
-            .will(returnValue("doe"));
+    //TODO
+    }
 
-        Mock mockContainer = mock(RemoteContainer.class);
-        mockContainer.stubs().method("getConfiguration")
-            .will(returnValue(mockConfiguration.proxy()));
+    public void testBuildSocketAddressForDeployableServerWithAddressSpecifiedButNotPort()
+    {
+    //TODO
+    }
 
-        Mock mockDeployable = mock(Deployable.class);
-        mockDeployable.stubs().method("getFile").will(
-            returnValue("c:/Something With Space/dummy.war"));
-
-        Mock mockConnection = mock(HttpURLConnection.class);
-        String expectedURLPortion1 = "http://localhost:8888/";
-        String expectedURLPortion2 = "Something+With+Space";
-        mockConnection.expects(once()).method("connect")
-            .with(and(stringContains(expectedURLPortion1), stringContains(expectedURLPortion2)),
-                eq("john"), eq("doe"));
-
-        JBossRemoteDeployer deployer = new JBossRemoteDeployer((RemoteContainer) mockContainer.proxy(),
-            (HttpURLConnection) mockConnection.proxy());
-        deployer.deploy((Deployable) mockDeployable.proxy());
+    public void testBuildSocketAddressForDeployableServerWithPortSpecifiedButNotAddress()
+    {
+    //TODO
     }
 }
Index: containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java
===================================================================
--- containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java	(revision 0)
+++ containers/jboss/src/test/java/org/codehaus/cargo/container/jboss/SingleFileResourceHandlerTest.java	(revision 0)
@@ -0,0 +1,33 @@
+package org.codehaus.cargo.container.jboss;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+public class SingleFileResourceHandlerTest extends MockObjectTestCase
+{
+    public void testIncrementOnInvalidRequest() throws IOException, ServletException
+    {
+        SingleFileResourceHandler handler = new SingleFileResourceHandler("/tmp/foo", "bar");
+        Mock mockRequest = mock(HttpServletRequest.class);
+        Mock mockResponse = mock(HttpServletResponse.class);
+        mockResponse.expects(once()).method("sendError").with(eq(401));
+        handler.handle("bar", (HttpServletRequest) mockRequest.proxy(),
+            (HttpServletResponse) mockResponse.proxy(), 0);
+    }
+    
+//    public void testIncrementOnValidRequest() throws IOException, ServletException
+//    {
+ //       SingleFileResourceHandler handler = new SingleFileResourceHandler("/tmp/foo", "bar");
+  //      Mock mockRequest = mock(HttpServletRequest.class);
+   //     Mock mockResponse = mock(HttpServletResponse.class);
+    //    mockResponse.expects(once()).method("sendError").with(eq(401));
+     //   handler.handle("/bar", (HttpServletRequest) mockRequest.proxy(),
+      //      (HttpServletResponse) mockResponse.proxy(), 0);
+  //  }
+}

