[jboss-svn-commits] JBoss Common SVN: r4422 - in arquillian/trunk/containers: jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60 and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat May 22 19:54:15 EDT 2010
Author: aslak
Date: 2010-05-22 19:54:14 -0400 (Sat, 22 May 2010)
New Revision: 4422
Modified:
arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASConfiguration.java
arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASRemoteContainer.java
arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASConfiguration.java
arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASRemoteContainer.java
Log:
ARQ-150 added remoteServerAddress, remoteServerHttpPort, localDeploymentBindAddres and localDeploymentBindPort to configuration
Modified: arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASConfiguration.java
===================================================================
--- arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASConfiguration.java 2010-05-22 21:46:07 UTC (rev 4421)
+++ arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASConfiguration.java 2010-05-22 23:54:14 UTC (rev 4422)
@@ -24,49 +24,91 @@
* the JBoss AS container.
*
* @author <a href="mailto:german.escobarc at gmail.com">German Escobar</a>
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
* @version $Revision: $
*/
public class JBossASConfiguration implements ContainerConfiguration
{
- private String bindAddress = "localhost";
+ /**
+ * ProfileService profileKey. Used to load the correct profile into the DeploymentManager.
+ */
+ private String profileName = "default";
+
+ /**
+ * Used by Servlet Protocol to connect to deployment.
+ * // TODO: these belongs to the configuration of Servlet Protocol. Extract out.
+ */
+ private String remoteServerAddress = "localhost";
- private int bindPort = 8181;
+ /**
+ * Used by Servlet Protocol to connect to deployment.
+ */
+ private int remoteServerHttpPort = 8080;
- private String profileName = "default";
-
+ /**
+ * Bind Address for HTTP server for serving deployments to the remote server.
+ * Address should be reachable from remote server.
+ */
+ private String localDeploymentBindAddress = "localhost";
+
+ /**
+ * Bind Port for HTTP server for serving deployments to remote server.
+ * Port must be reachable from remote server.
+ */
+ private int localDeploymentBindPort = 9999;
+
public ContainerProfile getContainerProfile()
{
return ContainerProfile.CLIENT;
}
- public String getBindAddress()
+ public String getProfileName()
{
- return bindAddress;
+ return profileName;
}
-
- public void setBindAddress(String bindAddress)
+
+ public void setProfileName(String profileName)
{
- this.bindAddress = bindAddress;
+ this.profileName = profileName;
}
- public int getBindPort()
+ public String getRemoteServerAddress()
{
- return bindPort;
+ return remoteServerAddress;
}
- public void setBindPort(int bindPort)
+ public void setRemoteServerAddress(String remoteServerAddress)
{
- this.bindPort = bindPort;
+ this.remoteServerAddress = remoteServerAddress;
}
- public String getProfileName()
+ public int getRemoteServerHttpPort()
{
- return profileName;
+ return remoteServerHttpPort;
}
- public void setProfileName(String profileName)
+ public void setRemoteServerHttpPort(int remoteServerHttpPort)
{
- this.profileName = profileName;
+ this.remoteServerHttpPort = remoteServerHttpPort;
}
-
+
+ public String getLocalDeploymentBindAddress()
+ {
+ return localDeploymentBindAddress;
+ }
+
+ public void setLocalDeploymentBindAddress(String localDeploymentBindAddress)
+ {
+ this.localDeploymentBindAddress = localDeploymentBindAddress;
+ }
+
+ public int getLocalDeploymentBindPort()
+ {
+ return localDeploymentBindPort;
+ }
+
+ public void setLocalDeploymentBindPort(int localDeploymentBindPort)
+ {
+ this.localDeploymentBindPort = localDeploymentBindPort;
+ }
}
Modified: arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASRemoteContainer.java
===================================================================
--- arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASRemoteContainer.java 2010-05-22 21:46:07 UTC (rev 4421)
+++ arquillian/trunk/containers/jbossas-remote-51/src/main/java/org/jboss/arquillian/jbossas/remote51/JBossASRemoteContainer.java 2010-05-22 23:54:14 UTC (rev 4422)
@@ -57,11 +57,6 @@
*/
public class JBossASRemoteContainer implements DeployableContainer
{
- // TODO: replace by configuration
- private static final String HOST_ADDRESS = "localhost";
-
- //private static final Logger log = Logger.getLogger(JbossRemoteContainer.class.getName());
-
private final List<String> failedUndeployments = new ArrayList<String>();
private DeploymentManager deploymentManager;
@@ -80,7 +75,11 @@
{
// TODO: configure http bind address
httpFileServer = HttpServer.create();
- httpFileServer.bind(new InetSocketAddress(InetAddress.getByName(HOST_ADDRESS), 9000), -1);
+ httpFileServer.bind(
+ new InetSocketAddress(
+ InetAddress.getByName(configuration.getLocalDeploymentBindAddress()),
+ configuration.getLocalDeploymentBindPort()),
+ -1);
httpFileServer.start();
initDeploymentManager();
}
@@ -171,8 +170,8 @@
return new ServletMethodExecutor(
new URL(
"http",
- findRemoteServerHostAddress(),
- 8080,
+ configuration.getRemoteServerAddress(),
+ configuration.getRemoteServerHttpPort(),
"/")
);
}
@@ -214,7 +213,7 @@
private void initDeploymentManager() throws Exception
{
- String profileName = "default";
+ String profileName = configuration.getProfileName();
InitialContext ctx = new InitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
deploymentManager = ps.getDeploymentManager();
@@ -268,29 +267,15 @@
failedUndeployments.clear();
}
- private String findRemoteServerHostAddress() {
- try
- {
- String providerURL = (String)new InitialContext().getEnvironment().get(
- InitialContext.PROVIDER_URL);
-
- return providerURL.substring(0, providerURL.indexOf(":"));
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not determine host address", e);
- }
- }
-
private static void copy(InputStream source, OutputStream destination) throws IOException
{
if (source == null)
{
- throw new IllegalArgumentException("source cannot be null");
+ throw new IllegalArgumentException("source must be specified");
}
if (destination == null)
{
- throw new IllegalArgumentException("destination cannot be null");
+ throw new IllegalArgumentException("destination must be specified");
}
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
Modified: arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASConfiguration.java
===================================================================
--- arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASConfiguration.java 2010-05-22 21:46:07 UTC (rev 4421)
+++ arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASConfiguration.java 2010-05-22 23:54:14 UTC (rev 4422)
@@ -24,49 +24,91 @@
* the JBoss AS container.
*
* @author <a href="mailto:german.escobarc at gmail.com">German Escobar</a>
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
* @version $Revision: $
*/
public class JBossASConfiguration implements ContainerConfiguration
{
- private String bindAddress = "localhost";
+ /**
+ * ProfileService profileKey. Used to load the correct profile into the DeploymentManager.
+ */
+ private String profileName = "default";
+
+ /**
+ * Used by Servlet Protocol to connect to deployment.
+ * // TODO: these belongs to the configuration of Servlet Protocol. Extract out.
+ */
+ private String remoteServerAddress = "localhost";
- private int bindPort = 8181;
+ /**
+ * Used by Servlet Protocol to connect to deployment.
+ */
+ private int remoteServerHttpPort = 8080;
- private String profileName = "default";
-
+ /**
+ * Bind Address for HTTP server for serving deployments to the remote server.
+ * Address should be reachable from remote server.
+ */
+ private String localDeploymentBindAddress = "localhost";
+
+ /**
+ * Bind Port for HTTP server for serving deployments to remote server.
+ * Port must be reachable from remote server.
+ */
+ private int localDeploymentBindPort = 9999;
+
public ContainerProfile getContainerProfile()
{
return ContainerProfile.CLIENT;
}
- public String getBindAddress()
+ public String getProfileName()
{
- return bindAddress;
+ return profileName;
}
-
- public void setBindAddress(String bindAddress)
+
+ public void setProfileName(String profileName)
{
- this.bindAddress = bindAddress;
+ this.profileName = profileName;
}
- public int getBindPort()
+ public String getRemoteServerAddress()
{
- return bindPort;
+ return remoteServerAddress;
}
- public void setBindPort(int bindPort)
+ public void setRemoteServerAddress(String remoteServerAddress)
{
- this.bindPort = bindPort;
+ this.remoteServerAddress = remoteServerAddress;
}
- public String getProfileName()
+ public int getRemoteServerHttpPort()
{
- return profileName;
+ return remoteServerHttpPort;
}
- public void setProfileName(String profileName)
+ public void setRemoteServerHttpPort(int remoteServerHttpPort)
{
- this.profileName = profileName;
+ this.remoteServerHttpPort = remoteServerHttpPort;
}
-
+
+ public String getLocalDeploymentBindAddress()
+ {
+ return localDeploymentBindAddress;
+ }
+
+ public void setLocalDeploymentBindAddress(String localDeploymentBindAddress)
+ {
+ this.localDeploymentBindAddress = localDeploymentBindAddress;
+ }
+
+ public int getLocalDeploymentBindPort()
+ {
+ return localDeploymentBindPort;
+ }
+
+ public void setLocalDeploymentBindPort(int localDeploymentBindPort)
+ {
+ this.localDeploymentBindPort = localDeploymentBindPort;
+ }
}
Modified: arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASRemoteContainer.java
===================================================================
--- arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASRemoteContainer.java 2010-05-22 21:46:07 UTC (rev 4421)
+++ arquillian/trunk/containers/jbossas-remote-60/src/main/java/org/jboss/arquillian/jbossas/remote60/JBossASRemoteContainer.java 2010-05-22 23:54:14 UTC (rev 4422)
@@ -56,11 +56,6 @@
*/
public class JBossASRemoteContainer implements DeployableContainer
{
- // TODO: replace by configuration
- private static final String HOST_ADDRESS = "localhost";
-
- //private static final Logger log = Logger.getLogger(JbossRemoteContainer.class.getName());
-
private final List<String> failedUndeployments = new ArrayList<String>();
private DeploymentManager deploymentManager;
@@ -68,10 +63,6 @@
private JBossASConfiguration configuration;
- public JBossASRemoteContainer()
- {
- }
-
public void setup(Context context, Configuration configuration)
{
this.configuration = configuration.getContainerConfig(JBossASConfiguration.class);
@@ -83,7 +74,11 @@
{
// TODO: configure http bind address
httpFileServer = HttpServer.create();
- httpFileServer.bind(new InetSocketAddress(InetAddress.getByName(HOST_ADDRESS), 9000), -1);
+ httpFileServer.bind(
+ new InetSocketAddress(
+ InetAddress.getByName(configuration.getLocalDeploymentBindAddress()),
+ configuration.getLocalDeploymentBindPort()),
+ -1);
httpFileServer.start();
initDeploymentManager();
}
@@ -174,8 +169,8 @@
return new ServletMethodExecutor(
new URL(
"http",
- findRemoteServerHostAddress(),
- 8080,
+ configuration.getRemoteServerAddress(),
+ configuration.getRemoteServerHttpPort(),
"/")
);
}
@@ -217,7 +212,7 @@
private void initDeploymentManager() throws Exception
{
- String profileName = "default";
+ String profileName = configuration.getProfileName();
InitialContext ctx = new InitialContext();
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
deploymentManager = ps.getDeploymentManager();
@@ -270,29 +265,15 @@
failedUndeployments.clear();
}
- private String findRemoteServerHostAddress() {
- try
- {
- String providerURL = (String)new InitialContext().getEnvironment().get(
- InitialContext.PROVIDER_URL);
-
- return providerURL.substring(0, providerURL.indexOf(":"));
- }
- catch (Exception e)
- {
- throw new RuntimeException("Could not determine host address", e);
- }
- }
-
private static void copy(InputStream source, OutputStream destination) throws IOException
{
if (source == null)
{
- throw new IllegalArgumentException("source cannot be null");
+ throw new IllegalArgumentException("source must be specified");
}
if (destination == null)
{
- throw new IllegalArgumentException("destination cannot be null");
+ throw new IllegalArgumentException("destination must be specified");
}
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
More information about the jboss-svn-commits
mailing list