[jbosstools-commits] JBoss Tools SVN: r30579 - in workspace/adietish: org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Apr 14 13:29:25 EDT 2011


Author: adietish
Date: 2011-04-14 13:29:25 -0400 (Thu, 14 Apr 2011)
New Revision: 30579

Modified:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
Log:


Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java	2011-04-14 15:50:49 UTC (rev 30578)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java	2011-04-14 17:29:25 UTC (rev 30579)
@@ -36,17 +36,17 @@
 public class TypedDeployer {
 
 	private static final long TIMEOUT = 15 * 1000;
-	
+
 	public static void undeploy(String name, String host, int port) throws DeployerException {
 		ModelControllerClient client = null;
 		try {
 			client = ModelControllerClient.Factory.create(host, port);
 			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
 			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
-			
+
 			DeploymentPlan plan = builder.undeploy(name).andRemoveUndeployed().build();
 			manager.execute(plan).get(TIMEOUT, TimeUnit.MILLISECONDS);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
@@ -54,16 +54,19 @@
 	}
 
 	public static void deploy(File file, String host, int port) throws DeployerException {
+		deploy(file.getName(), file, host, port);
+	}
+
+	public static void deploy(String name, File file, String host, int port) throws DeployerException {
 		ModelControllerClient client = null;
 		try {
 			client = ModelControllerClient.Factory.create(host, port);
 			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
 			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
 
-			String name = file.getName();
 			DeploymentPlan plan = builder.add(name, file).deploy(name).build();
 			manager.execute(plan).get(TIMEOUT, TimeUnit.MILLISECONDS);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
@@ -71,16 +74,19 @@
 	}
 
 	public static void replace(File file, String host, int port) throws DeployerException {
+		replace(file.getName(), file, host, port);
+	}
+
+	public static void replace(String name, File file, String host, int port) throws DeployerException {
 		ModelControllerClient client = null;
 		try {
 			client = ModelControllerClient.Factory.create(host, port);
 			ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
 			InitialDeploymentPlanBuilder builder = manager.newDeploymentPlan();
 
-			String name = file.getName();
-			DeploymentPlan plan = builder.replace(name, file).deploy(name).build();
+			DeploymentPlan plan = builder.replace(name, file).build();
 			manager.execute(plan).get(TIMEOUT, TimeUnit.MILLISECONDS);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
@@ -88,25 +94,30 @@
 	}
 
 	//
-//	public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
-//		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
-//		try {
-//			return Util.isDeployed(name, client);
-//		} finally {
-//			StreamUtils.safeClose(client);
-//		}
-//	}
-//
-//	public static List<String> getDeployments(String host, int port) throws UnknownHostException {
-//		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
-//		return Util.getDeployments(client);
-//	}
-//
-//	private static void throwOnFailure(ModelNode result) throws DeployerException {
-//		if (!Util.isSuccess(result)) {
-//			throw new DeployerException(Util.getFailureDescription(result));
-//		}
-//	}
+	// public static boolean isDeployed(String name, String host, int port)
+	// throws CancellationException, IOException {
+	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
+	// port);
+	// try {
+	// return Util.isDeployed(name, client);
+	// } finally {
+	// StreamUtils.safeClose(client);
+	// }
+	// }
+	//
+	// public static List<String> getDeployments(String host, int port) throws
+	// UnknownHostException {
+	// ModelControllerClient client = ModelControllerClient.Factory.create(host,
+	// port);
+	// return Util.getDeployments(client);
+	// }
+	//
+	// private static void throwOnFailure(ModelNode result) throws
+	// DeployerException {
+	// if (!Util.isSuccess(result)) {
+	// throw new DeployerException(Util.getFailureDescription(result));
+	// }
+	// }
 
 	private TypedDeployer() {
 		// inhibit instantiation

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java	2011-04-14 15:50:49 UTC (rev 30578)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java	2011-04-14 17:29:25 UTC (rev 30579)
@@ -50,13 +50,14 @@
 			request.get("operation").set("undeploy");
 			request.get("address").add("deployment", name);
 			ModelNode result = client.execute(request);
+			throwOnFailure(result);
 
 			// remove
 			request = new ModelNode();
 			request.get("operation").set("remove");
 			request.get("address").add("deployment", name);
 			result = client.execute(request);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
@@ -64,10 +65,13 @@
 	}
 
 	public static void deploy(File file, String host, int port) throws DeployerException {
+		deploy(file.getName(), file, host, port);
+	}
+
+	public static void deploy(String name, File file, String host, int port) throws DeployerException {
 		ModelControllerClient client = null;
 		try {
 			client = ModelControllerClient.Factory.create(host, port);
-			String name = file.getName();
 
 			ModelNode request = new ModelNode();
 			request.get("operation").set("add");
@@ -82,18 +86,17 @@
 			ModelNode result = client.execute(operation);
 
 			throwOnFailure(result);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
 		}
 	}
 
-	public static void replace(File file, String host, int port) throws DeployerException {
+	public static void replace(String name, File file, String host, int port) throws DeployerException {
 		ModelControllerClient client = null;
 		try {
 			client = ModelControllerClient.Factory.create(host, port);
-			String name = file.getName();
 
 			ModelNode request = new ModelNode();
 			request.get("operation").set("full-replace-deployment");
@@ -107,13 +110,13 @@
 			ModelNode result = client.execute(operation);
 
 			throwOnFailure(result);
-		} catch(Exception e) {
+		} catch (Exception e) {
 			throw new DeployerException(e);
 		} finally {
 			StreamUtils.safeClose(client);
 		}
 	}
-	
+
 	public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
 		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
 		try {

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java	2011-04-14 15:50:49 UTC (rev 30578)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java	2011-04-14 17:29:25 UTC (rev 30579)
@@ -29,6 +29,7 @@
 import java.net.HttpURLConnection;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.text.MessageFormat;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Platform;
@@ -39,11 +40,17 @@
  */
 public class DeployerTestUtils {
 	
+	public static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
+	public static final String MINIMALISTIC_WAR = "minimalistic.war";
+	
+	public static final String HOST = "localhost";
+	public static final int MGMT_PORT = 9999;
+	public static final int WEB_PORT = 8080;
+
 	private static final String WAR_FOLDER = "/wars/";
 	private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
 
 	private static final int WEBAPP_RESPONSE_TIMEOUT = 10 * 1024;
-
 	
 	public static File getWarFile(String name) throws URISyntaxException, IOException {
 		Bundle bundle = Platform.getBundle(BUNDLE_ID);
@@ -51,7 +58,13 @@
 		return new File(FileLocator.resolve(entryUrl).toURI());
 	}
 
-	public static String getServerResponse(URL url) throws IOException {
+	public static String getWebappResponse(String name, String host, int port) throws IOException {
+		return getServerResponse(new URL(
+				MessageFormat.format(
+						"http://{0}:{1}/{2}", host, String.valueOf(port), name)));
+	}
+
+		public static String getServerResponse(URL url) throws IOException {
 		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
 		connection.setUseCaches(false);
 		connection.setDoInput(true);

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java	2011-04-14 15:50:49 UTC (rev 30578)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java	2011-04-14 17:29:25 UTC (rev 30579)
@@ -27,12 +27,11 @@
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
-import java.net.URL;
-import java.text.MessageFormat;
 import java.util.List;
 
 import org.jboss.ide.eclipse.as7.deployment.detyped.DeployerException;
 import org.jboss.ide.eclipse.as7.deployment.detyped.DetypedDeployer;
+import org.jboss.ide.eclipse.as7.deployment.internal.TypedDeployer;
 import org.junit.Test;
 
 /**
@@ -40,22 +39,13 @@
  */
 public class DetypedDeployerIntegrationTest {
 
-	private static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
-	private static final String MINIMALISTIC_WAR = "minimalistic.war";
-
-	private static final String HOST = "localhost";
-	private static final int MGMT_PORT = 9999;
-	private static final int WEB_PORT = 8080;
-
 	@Test
 	public void canDeploy() throws Exception {
-		File warFile = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
 		try {
-			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+			DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 
-			String response = DeployerTestUtils.getServerResponse(new URL(
-					MessageFormat.format(
-							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+			String response = DeployerTestUtils.getWebappResponse("minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
 			assertTrue(response.indexOf("minimalistic") >= 0);
 
 		} finally {
@@ -65,36 +55,46 @@
 
 	@Test(expected = DeployerException.class)
 	public void cannotDeployWarTwice() throws Exception {
-		File warFile = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
 		try {
-			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+			DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 		} finally {
 			quietlyUndeploy(warFile);
 		}
 	}
 
 	@Test
-	public void canRedeployWar() throws Exception {
-		File warFile = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
+	public void canReplaceWar() throws Exception {
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+		File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+		String name = warFile.getName();
 		try {
-			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-			DetypedDeployer.replace(warFile, HOST, MGMT_PORT);
+			DetypedDeployer.deploy(name, warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			DetypedDeployer.replace(name, warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			String response = DeployerTestUtils.getWebappResponse(
+					"minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+			assertTrue(response.indexOf("GWT") >= 0);
 		} finally {
 			quietlyUndeploy(warFile);
 		}
 	}
 
+	@Test(expected = DeployerException.class)
+	public void cannotUndeployNondeployed() throws DeployerException {
+		DetypedDeployer.undeploy("inexistant", DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+	}
+
 	@Test
 	public void canQueryDeploymentdeployedState() throws Exception {
-		File warFile = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
-		File warFile2 = DeployerTestUtils.getWarFile(GWT_HELLOWORLD_WAR);
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+		File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
 		try {
-			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-			DetypedDeployer.deploy(warFile2, HOST, MGMT_PORT);
-			List<String> deployments = DetypedDeployer.getDeployments(HOST, MGMT_PORT);
+			DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			DetypedDeployer.deploy(warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			List<String> deployments = DetypedDeployer.getDeployments(DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 			assertThat(deployments.size(), is(2));
-			assertThat(deployments, hasItems( MINIMALISTIC_WAR, GWT_HELLOWORLD_WAR));
+			assertThat(deployments, hasItems(DeployerTestUtils.MINIMALISTIC_WAR, DeployerTestUtils.GWT_HELLOWORLD_WAR));
 		} finally {
 			quietlyUndeploy(warFile);
 			quietlyUndeploy(warFile2);
@@ -103,7 +103,7 @@
 
 	private void quietlyUndeploy(File file) {
 		try {
-			DetypedDeployer.undeploy(file.getName(), HOST, MGMT_PORT);
+			DetypedDeployer.undeploy(file.getName(), DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 		} catch (Exception e) {
 			e.printStackTrace();
 			// ignore

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java	2011-04-14 15:50:49 UTC (rev 30578)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java	2011-04-14 17:29:25 UTC (rev 30579)
@@ -24,9 +24,8 @@
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
-import java.net.URL;
-import java.text.MessageFormat;
 
+import org.jboss.ide.eclipse.as7.deployment.internal.DeployerException;
 import org.jboss.ide.eclipse.as7.deployment.internal.TypedDeployer;
 import org.junit.Test;
 
@@ -36,23 +35,14 @@
  */
 public class TypedDeployerIntegrationTest {
 
-	private static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
-	private static final String MINIMALISTIC_WAR = "minimalistic.war";
-	private static final String WAR_FOLDER = "/wars/";
-
-	private static final String HOST = "localhost";
-	private static final int MGMT_PORT = 9999;
-	private static final int WEB_PORT = 8080;
-
 	@Test
 	public void canDeploy() throws Exception {
-		File warFile = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
 		try {
-			TypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+			TypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 
-			String response = DeployerTestUtils.getServerResponse(new URL(
-					MessageFormat.format(
-							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+			String response = DeployerTestUtils.getWebappResponse(
+					"minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
 			assertTrue(response.indexOf("minimalistic") >= 0);
 
 		} finally {
@@ -60,61 +50,85 @@
 		}
 	}
 
-//	@Test(expected = Exception.class)
-//	public void cannotDeployWarTwice() throws Exception {
-//		File warFile = getWarFile(MINIMALISTIC_WAR);
-//		try {
-//			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-//			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-//		} finally {
-//			quietlyUndeploy(warFile);
-//		}
-//	}
-//
-//	@Test
-//	public void canQueryDeploymentdeployedState() throws Exception {
-//		File warFile = getWarFile(MINIMALISTIC_WAR);
-//		File warFile2 = getWarFile(GWT_HELLOWORLD_WAR);
-//		try {
-//			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
-//			DetypedDeployer.deploy(warFile2, HOST, MGMT_PORT);
-//			List<String> deployments = DetypedDeployer.getDeployments(HOST, MGMT_PORT);
-//			assertThat(deployments.size(), is(2));
-//			assertThat(deployments, hasItems( MINIMALISTIC_WAR, GWT_HELLOWORLD_WAR));
-//		} finally {
-//			quietlyUndeploy(warFile);
-//		}
-//	}
-//
-//	private File getWarFile(String name) throws URISyntaxException, IOException {
-//		Bundle bundle = Platform.getBundle(BUNDLE_ID);
-//		URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
-//		return new File(FileLocator.resolve(entryUrl).toURI());
-//	}
-//
-//	private String getServerResponse(URL url) throws IOException {
-//		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-//		connection.setUseCaches(false);
-//		connection.setDoInput(true);
-//		connection.setAllowUserInteraction(false);
-//		connection.setConnectTimeout(WEBAPP_RESPONSE_TIMEOUT);
-//		connection.setInstanceFollowRedirects(true);
-//		connection.setDoOutput(false);
-//		BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
-//		return toString(in);
-//	}
-//
-//	private String toString(InputStream in) throws IOException {
-//		StringWriter writer = new StringWriter();
-//		for (int data = -1; ((data = in.read()) != -1);) {
-//			writer.write(data);
-//		}
-//		return writer.toString();
-//	}
-//
+	@Test(expected = DeployerException.class)
+	public void cannotDeployWarTwice() throws Exception {
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+		try {
+			TypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			TypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+		} finally {
+			quietlyUndeploy(warFile);
+		}
+	}
+
+	@Test(expected = DeployerException.class)
+	public void cannotUndeployNondeployed() throws DeployerException {
+		TypedDeployer.undeploy("inexistant", DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+	}
+
+	@Test
+	public void canReplaceyWar() throws Exception {
+		File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+		File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+		String name = warFile.getName();
+		try {
+			TypedDeployer.deploy(name, warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			TypedDeployer.replace(name, warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+			String response = DeployerTestUtils.getWebappResponse(
+					"minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+			assertTrue(response.indexOf("GWT") >= 0);
+		} finally {
+			quietlyUndeploy(warFile);
+		}
+	}
+
+	// @Test
+	// public void canQueryDeploymentdeployedState() throws Exception {
+	// File warFile = getWarFile(MINIMALISTIC_WAR);
+	// File warFile2 = getWarFile(GWT_HELLOWORLD_WAR);
+	// try {
+	// DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+	// DetypedDeployer.deploy(warFile2, HOST, MGMT_PORT);
+	// List<String> deployments = DetypedDeployer.getDeployments(HOST,
+	// MGMT_PORT);
+	// assertThat(deployments.size(), is(2));
+	// assertThat(deployments, hasItems( MINIMALISTIC_WAR, GWT_HELLOWORLD_WAR));
+	// } finally {
+	// quietlyUndeploy(warFile);
+	// }
+	// }
+	//
+	// private File getWarFile(String name) throws URISyntaxException,
+	// IOException {
+	// Bundle bundle = Platform.getBundle(BUNDLE_ID);
+	// URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+	// return new File(FileLocator.resolve(entryUrl).toURI());
+	// }
+	//
+	// private String getServerResponse(URL url) throws IOException {
+	// HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+	// connection.setUseCaches(false);
+	// connection.setDoInput(true);
+	// connection.setAllowUserInteraction(false);
+	// connection.setConnectTimeout(WEBAPP_RESPONSE_TIMEOUT);
+	// connection.setInstanceFollowRedirects(true);
+	// connection.setDoOutput(false);
+	// BufferedInputStream in = new
+	// BufferedInputStream(connection.getInputStream());
+	// return toString(in);
+	// }
+	//
+	// private String toString(InputStream in) throws IOException {
+	// StringWriter writer = new StringWriter();
+	// for (int data = -1; ((data = in.read()) != -1);) {
+	// writer.write(data);
+	// }
+	// return writer.toString();
+	// }
+	//
 	private void quietlyUndeploy(File file) {
 		try {
-			TypedDeployer.undeploy(file.getName(), HOST, MGMT_PORT);
+			TypedDeployer.undeploy(file.getName(), DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
 		} catch (Exception e) {
 			e.printStackTrace();
 			// ignore



More information about the jbosstools-commits mailing list