[jbosstools-commits] JBoss Tools SVN: r30569 - in workspace/adietish: org.jboss.ide.eclipse.as7.deployment.tests/META-INF and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Apr 14 08:28:49 EDT 2011


Author: adietish
Date: 2011-04-14 08:28:48 -0400 (Thu, 14 Apr 2011)
New Revision: 30569

Modified:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/MinimalisticStandaloneDeployer.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/MinimalisticDeployerIntegrationTest.java
Log:
added deployment queries

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/MinimalisticStandaloneDeployer.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/MinimalisticStandaloneDeployer.java	2011-04-14 12:03:41 UTC (rev 30568)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/MinimalisticStandaloneDeployer.java	2011-04-14 12:28:48 UTC (rev 30569)
@@ -25,6 +25,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.net.UnknownHostException;
 import java.util.List;
 import java.util.concurrent.CancellationException;
 
@@ -79,27 +80,24 @@
 		}
 	}
 
-	private static void throwOnFailure(ModelNode result) {
-		if (!Util.isSuccess(result)) {
-			throw new RuntimeException(Util.getFailureDescription(result));
-		}
-	}
-
 	public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
 		ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
 		try {
-			ModelNode request = new ModelNode();
-			request.get("operation").set("read-children-names");
-			request.get("child-type").set("deployment");
-			
-			ModelNode result = client.execute(request);
-			return false;
+			return Util.isDeployed(name, client);
 		} finally {
 			StreamUtils.safeClose(client);
 		}
 	}
 
-	public static List<String> getDeployments() {
-		return null;
+	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) {
+		if (!Util.isSuccess(result)) {
+			throw new RuntimeException(Util.getFailureDescription(result));
+		}
+	}
+
 }

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF	2011-04-14 12:03:41 UTC (rev 30568)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF	2011-04-14 12:28:48 UTC (rev 30569)
@@ -7,6 +7,7 @@
 Require-Bundle: org.junit;bundle-version="[4.8.1,5.0.0)",
  org.eclipse.core.runtime;bundle-version="3.7.0",
  org.jboss.ide.eclipse.as7.deployment,
- org.jboss.ide.eclipse.as7.deployment.detyped
+ org.jboss.ide.eclipse.as7.deployment.detyped,
+ org.hamcrest;bundle-version="1.1.0"
 Bundle-ClassPath: .,
  wars/

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/MinimalisticDeployerIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/MinimalisticDeployerIntegrationTest.java	2011-04-14 12:03:41 UTC (rev 30568)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/MinimalisticDeployerIntegrationTest.java	2011-04-14 12:28:48 UTC (rev 30569)
@@ -21,6 +21,9 @@
  */
 package org.jboss.ide.eclipse.as7.deployment.tests;
 
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedInputStream;
@@ -32,6 +35,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.text.MessageFormat;
+import java.util.List;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Platform;
@@ -86,10 +90,13 @@
 	public void canQueryDeploymentdeployedState() throws Exception {
 		StandaloneTypedOperations deployer = null;
 		File warFile = getWarFile("minimalistic.war");
+		File warFile2 = getWarFile("gwt-helloworld.war");
 		try {
-			deployer = new StandaloneTypedOperations(HOST, MGMT_PORT);
-			deployer.deploy(warFile).execute();
-			deployer.deploy(warFile).execute();
+			MinimalisticStandaloneDeployer.deploy(warFile, HOST, MGMT_PORT);
+			MinimalisticStandaloneDeployer.deploy(warFile2, HOST, MGMT_PORT);
+			List<String> deployments = MinimalisticStandaloneDeployer.getDeployments(HOST, MGMT_PORT);
+			assertThat(deployments.size(), is(2));
+			assertThat(deployments, hasItems( "minimalistic.war", "gwt-helloworld.war"));
 		} finally {
 			quietlyUndeploy(warFile);
 		}



More information about the jbosstools-commits mailing list