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

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Apr 14 08:56:46 EDT 2011


Author: adietish
Date: 2011-04-14 08:56:45 -0400 (Thu, 14 Apr 2011)
New Revision: 30571

Added:
   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/DeploymentManagerIntegratonTest.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/Activator.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
Removed:
   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/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/StandaloneOperationsIntegrationTest.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/StandaloneTypedOperations.java
Modified:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java
Log:
starting minimalistic typed deployer with tests

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF	2011-04-14 12:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF	2011-04-14 12:56:45 UTC (rev 30571)
@@ -3,7 +3,7 @@
 Bundle-Name: Deployment
 Bundle-SymbolicName: org.jboss.ide.eclipse.as7.deployment
 Bundle-Version: 0.0.1.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as7.deployment.Activator
+Bundle-Activator: org.jboss.ide.eclipse.as7.deployment.internal.Activator
 Require-Bundle: org.eclipse.core.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java	2011-04-14 12:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -1,30 +0,0 @@
-package org.jboss.ide.eclipse.as7.deployment;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
-	private static BundleContext context;
-
-	public static BundleContext getContext() {
-		return context;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext bundleContext) throws Exception {
-		Activator.context = bundleContext;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext bundleContext) throws Exception {
-		Activator.context = null;
-	}
-
-}

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java (from rev 30566, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as7.deployment.internal;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	private static BundleContext context;
+
+	public static BundleContext getContext() {
+		return context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		Activator.context = bundleContext;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		Activator.context = null;
+	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Activator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java	2011-04-14 12:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/Deployable.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -10,7 +10,6 @@
 import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
 import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
 import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
-import org.jboss.ide.eclipse.as7.deployment.Activator;
 
 public class Deployable {
 

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java (from rev 30566, workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/StandaloneTypedOperations.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.internal;
+
+import static org.jboss.as.protocol.StreamUtils.safeClose;
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+
+/**
+ * Used to deploy/undeploy deployments to a running <b>standalone</b>
+ * application server
+ * 
+ * @author <a href="adietish at redhat.com">André Dietisheim</a>
+ */
+public class DeploymentManager {
+
+	public static final long DEFAULT_TIMEOUT = 15000;
+
+	private final List<IDeploymentPlanBuilderOperation> deployments = new ArrayList<IDeploymentPlanBuilderOperation>();
+	private final ModelControllerClient client;
+	private final ServerDeploymentManager manager;
+	private long timeout = DEFAULT_TIMEOUT;
+
+	public DeploymentManager(String host, int port) throws UnknownHostException {
+		client = ModelControllerClient.Factory.create(host, port);
+		manager = ServerDeploymentManager.Factory.create(client);
+	}
+
+	public synchronized DeploymentManager deploy(File file) {
+		deployments.add(new DeployOperation(file));
+		return this;
+	}
+
+	public synchronized DeploymentManager deploy(String name, File file) {
+		deployments.add(new DeployOperation(name, file));
+		return this;
+	}
+
+	public synchronized DeploymentManager undeploy(String name) {
+		deployments.add(new UndeployOperation(name));
+		return this;
+	}
+
+	public synchronized DeploymentManager undeploy(File file) {
+		deployments.add(new UndeployOperation(file));
+		return this;
+	}
+
+	public synchronized void execute() throws DeployerException {
+		try {
+			DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+			for (IDeploymentPlanBuilderOperation deployment : deployments) {
+				builder = deployment.addTo(builder);
+			}
+			manager.execute(builder.build()).get(timeout, TimeUnit.MILLISECONDS);
+		} catch (Exception e) {
+			throw new DeployerException(e);
+		}
+	}
+
+	public void setTimeout(long timeout) {
+		this.timeout = timeout;
+	}
+
+	public void dispose() {
+		safeClose(client);
+	}
+
+	private static class DeployOperation extends FileOperation {
+
+		private DeployOperation(File file) {
+			super(file);
+		}
+
+		private DeployOperation(String name, File file) {
+			super(name, file);
+		}
+
+		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+			String name = getName();
+			return builder.add(name, getFile()).deploy(name);
+		}		
+	}
+	
+	private static class UndeployOperation extends FileOperation {
+
+		private UndeployOperation(File file) {
+			super(file);
+		}
+
+		private UndeployOperation(String name) {
+			super(name, null);
+		}
+
+		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+			String name = getName();
+			return builder.undeploy(name).undeploy(name);
+		}
+	}
+	
+	private abstract static class FileOperation extends NamedOperation {
+
+		private File file;
+
+		private FileOperation(File file) {
+			this(null, file);
+		}
+
+		private FileOperation(String name, File file) {
+			super(name);
+			this.file = file;
+		}
+
+		protected File getFile() {
+			return file;
+		}
+
+		protected String getName() {
+			if (name != null) {
+				return name;
+			} else {
+				return file.getName();
+			}
+		}
+
+	}
+
+	private abstract static class NamedOperation implements IDeploymentPlanBuilderOperation {
+
+		protected String name;
+
+		private NamedOperation(String name) {
+			this.name = name;
+		}
+	}
+
+	private interface IDeploymentPlanBuilderOperation {
+
+		public DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception;
+
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/DeploymentManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/StandaloneTypedOperations.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/StandaloneTypedOperations.java	2011-04-14 12:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/StandaloneTypedOperations.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -1,170 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as7.deployment.internal;
-
-import static org.jboss.as.protocol.StreamUtils.safeClose;
-
-import java.io.File;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
-
-/**
- * Used to deploy/undeploy deployments to a running <b>standalone</b>
- * application server
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @author <a href="adietish at redhat.com">André Dietisheim</a>
- */
-public class StandaloneTypedOperations {
-
-	public static final long DEFAULT_TIMEOUT = 15000;
-
-	private final List<IDeploymentPlanBuilderOperation> deployments = new ArrayList<IDeploymentPlanBuilderOperation>();
-	private final ModelControllerClient client;
-	private final ServerDeploymentManager manager;
-	private long timeout = DEFAULT_TIMEOUT;
-
-	public StandaloneTypedOperations(String host, int port) throws UnknownHostException {
-		client = ModelControllerClient.Factory.create(host, port);
-		manager = ServerDeploymentManager.Factory.create(client);
-	}
-
-	public synchronized StandaloneTypedOperations deploy(File file) {
-		deployments.add(new DeployOperation(file));
-		return this;
-	}
-
-	public synchronized StandaloneTypedOperations deploy(String name, File file) {
-		deployments.add(new DeployOperation(name, file));
-		return this;
-	}
-
-	public synchronized StandaloneTypedOperations undeploy(String name) {
-		deployments.add(new UndeployOperation(name));
-		return this;
-	}
-
-	public synchronized StandaloneTypedOperations undeploy(File file) {
-		deployments.add(new UndeployOperation(file));
-		return this;
-	}
-
-	public synchronized void execute() throws DeployerException {
-		try {
-			DeploymentPlanBuilder builder = manager.newDeploymentPlan();
-			for (IDeploymentPlanBuilderOperation deployment : deployments) {
-				builder = deployment.addTo(builder);
-			}
-			manager.execute(builder.build()).get(timeout, TimeUnit.MILLISECONDS);
-		} catch (Exception e) {
-			throw new DeployerException(e);
-		}
-	}
-
-	public void setTimeout(long timeout) {
-		this.timeout = timeout;
-	}
-
-	public void dispose() {
-		safeClose(client);
-	}
-
-	private static class DeployOperation extends FileOperation {
-
-		private DeployOperation(File file) {
-			super(file);
-		}
-
-		private DeployOperation(String name, File file) {
-			super(name, file);
-		}
-
-		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
-			String name = getName();
-			return builder.add(name, getFile()).deploy(name);
-		}		
-	}
-	
-	private static class UndeployOperation extends FileOperation {
-
-		private UndeployOperation(File file) {
-			super(file);
-		}
-
-		private UndeployOperation(String name) {
-			super(name, null);
-		}
-
-		public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
-			String name = getName();
-			return builder.undeploy(name).undeploy(name);
-		}
-	}
-	
-	private abstract static class FileOperation extends NamedOperation {
-
-		private File file;
-
-		private FileOperation(File file) {
-			this(null, file);
-		}
-
-		private FileOperation(String name, File file) {
-			super(name);
-			this.file = file;
-		}
-
-		protected File getFile() {
-			return file;
-		}
-
-		protected String getName() {
-			if (name != null) {
-				return name;
-			} else {
-				return file.getName();
-			}
-		}
-
-	}
-
-	private abstract static class NamedOperation implements IDeploymentPlanBuilderOperation {
-
-		protected String name;
-
-		private NamedOperation(String name) {
-			this.name = name;
-		}
-	}
-
-	private interface IDeploymentPlanBuilderOperation {
-
-		public DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception;
-
-	}
-}

Added: 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	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.internal;
+
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.InitialDeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+import org.jboss.as.protocol.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+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 plan = manager.newDeploymentPlan();
+			
+			plan.undeploy(name).undeploy(name).andRemoveUndeployed();
+			manager.execute(plan.build()).get(TIMEOUT, TimeUnit.MILLISECONDS);
+		} catch(Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+//	public static void deploy(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");
+//			request.get("address").add("deployment", name);
+//			request.get("enabled").set(true);
+//
+//			OperationBuilder operation = OperationBuilder.Factory.create(request);
+//			operation.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+//			request.get("input-stream-index").set(0);
+//			ModelNode result = client.execute(operation.build());
+//
+//			throwOnFailure(result);
+//		} 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 {
+//			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));
+//		}
+//	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/internal/TypedDeployer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java (from rev 30570, 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/DetypedDeployer.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.detyped;
+
+import java.io.BufferedInputStream;
+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;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.OperationBuilder;
+import org.jboss.as.protocol.StreamUtils;
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as7.deployment.detyped.util.Util;
+
+/**
+ * @author André Dietisheim
+ */
+public class DetypedDeployer {
+
+	public static void undeploy(String name, String host, int port) throws DeployerException {
+		ModelControllerClient client = null;
+		try {
+			client = ModelControllerClient.Factory.create(host, port);
+			// undeploy
+			ModelNode request = new ModelNode();
+			request.get("operation").set("undeploy");
+			request.get("address").add("deployment", name);
+			ModelNode result = client.execute(request);
+
+			// remove
+			request = new ModelNode();
+			request.get("operation").set("remove");
+			request.get("address").add("deployment", name);
+			result = client.execute(request);
+		} catch(Exception e) {
+			throw new DeployerException(e);
+		} finally {
+			StreamUtils.safeClose(client);
+		}
+	}
+
+	public static void deploy(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");
+			request.get("address").add("deployment", name);
+			request.get("enabled").set(true);
+
+			OperationBuilder operation = OperationBuilder.Factory.create(request);
+			operation.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+			request.get("input-stream-index").set(0);
+			ModelNode result = client.execute(operation.build());
+
+			throwOnFailure(result);
+		} 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 {
+			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));
+		}
+	}
+
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/DetypedDeployer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: 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:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.detyped/src/org/jboss/ide/eclipse/as7/deployment/detyped/MinimalisticStandaloneDeployer.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as7.deployment.detyped;
-
-import java.io.BufferedInputStream;
-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;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.OperationBuilder;
-import org.jboss.as.protocol.StreamUtils;
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as7.deployment.detyped.util.Util;
-
-/**
- * @author André Dietisheim
- */
-public class MinimalisticStandaloneDeployer {
-
-	public static void undeploy(String name, String host, int port) throws DeployerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-			// undeploy
-			ModelNode request = new ModelNode();
-			request.get("operation").set("undeploy");
-			request.get("address").add("deployment", name);
-			ModelNode result = client.execute(request);
-
-			// remove
-			request = new ModelNode();
-			request.get("operation").set("remove");
-			request.get("address").add("deployment", name);
-			result = client.execute(request);
-		} catch(Exception e) {
-			throw new DeployerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void deploy(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");
-			request.get("address").add("deployment", name);
-			request.get("enabled").set(true);
-
-			OperationBuilder operation = OperationBuilder.Factory.create(request);
-			operation.addInputStream(new BufferedInputStream(new FileInputStream(file)));
-			request.get("input-stream-index").set(0);
-			ModelNode result = client.execute(operation.build());
-
-			throwOnFailure(result);
-		} 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 {
-			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));
-		}
-	}
-
-}

Added: 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	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.tests;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeployerTestUtils {
+	
+	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);
+		URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+		return new File(FileLocator.resolve(entryUrl).toURI());
+	}
+
+	public static 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);
+	}
+
+	public static String toString(InputStream in) throws IOException {
+		StringWriter writer = new StringWriter();
+		for (int data = -1; ((data = in.read()) != -1);) {
+			writer.write(data);
+		}
+		return writer.toString();
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeployerTestUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java (from rev 30566, workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneOperationsIntegrationTest.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+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;
+import org.jboss.ide.eclipse.as7.deployment.internal.DeployerException;
+import org.jboss.ide.eclipse.as7.deployment.internal.DeploymentManager;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * 
+ * @author André Dietisheim
+ */
+public class DeploymentManagerIntegratonTest {
+
+	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;
+
+	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 {
+		DeploymentManager deployer = null;
+		File warFile = getWarFile("minimalistic.war");
+		try {
+			deployer = new DeploymentManager(HOST, MGMT_PORT);
+			deployer.deploy(warFile).execute();
+
+			String response = getServerResponse(new URL(
+					MessageFormat.format(
+							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+			assertTrue(response.indexOf("minimalistic") >= 0);
+
+		} finally {
+			quietlyUndeploy(warFile, deployer);
+		}
+	}
+
+	@Test(expected = DeployerException.class)
+	public void cannotDeployWarTwice() throws Exception {
+		DeploymentManager deployer = null;
+		File warFile = getWarFile("minimalistic.war");
+		try {
+			deployer = new DeploymentManager(HOST, MGMT_PORT);
+			deployer.deploy(warFile).execute();
+			deployer.deploy(warFile).execute();
+		} finally {
+			quietlyUndeploy(warFile, deployer);
+		}
+	}
+
+	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, DeploymentManager deployer) {
+		try {
+			if (deployer != null) {
+				deployer.undeploy(file).execute();
+				deployer.dispose();
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+			// ignore
+		}
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentManagerIntegratonTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java (from rev 30570, 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/DetypedDeployerIntegrationTest.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+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.File;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as7.deployment.detyped.DetypedDeployer;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+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);
+		try {
+			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+
+			String response = DeployerTestUtils.getServerResponse(new URL(
+					MessageFormat.format(
+							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+			assertTrue(response.indexOf("minimalistic") >= 0);
+
+		} finally {
+			quietlyUndeploy(warFile);
+		}
+	}
+
+	@Test(expected = Exception.class)
+	public void cannotDeployWarTwice() throws Exception {
+		File warFile = DeployerTestUtils.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 = DeployerTestUtils.getWarFile(MINIMALISTIC_WAR);
+		File warFile2 = DeployerTestUtils.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 void quietlyUndeploy(File file) {
+		try {
+			DetypedDeployer.undeploy(file.getName(), HOST, MGMT_PORT);
+		} catch (Exception e) {
+			e.printStackTrace();
+			// ignore
+		}
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DetypedDeployerIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: 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:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/MinimalisticDeployerIntegrationTest.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-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;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.HttpURLConnection;
-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;
-import org.jboss.ide.eclipse.as7.deployment.detyped.MinimalisticStandaloneDeployer;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * 
- * @author André Dietisheim
- */
-public class MinimalisticDeployerIntegrationTest {
-
-	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 BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
-
-	private static final int WEBAPP_RESPONSE_TIMEOUT = 10 * 1024;
-
-	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 = getWarFile(MINIMALISTIC_WAR);
-		try {
-			MinimalisticStandaloneDeployer.deploy(warFile, HOST, MGMT_PORT);
-
-			String response = getServerResponse(new URL(
-					MessageFormat.format(
-							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
-			assertTrue(response.indexOf("minimalistic") >= 0);
-
-		} finally {
-			quietlyUndeploy(warFile);
-		}
-	}
-
-	@Test(expected = Exception.class)
-	public void cannotDeployWarTwice() throws Exception {
-		File warFile = getWarFile(MINIMALISTIC_WAR);
-		try {
-			MinimalisticStandaloneDeployer.deploy(warFile, HOST, MGMT_PORT);
-			MinimalisticStandaloneDeployer.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 {
-			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);
-		}
-	}
-
-	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 {
-			MinimalisticStandaloneDeployer.undeploy(file.getName(), HOST, MGMT_PORT);
-		} catch (Exception e) {
-			e.printStackTrace();
-			// ignore
-		}
-	}
-}

Deleted: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneOperationsIntegrationTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneOperationsIntegrationTest.java	2011-04-14 12:34:04 UTC (rev 30570)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneOperationsIntegrationTest.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as7.deployment.tests;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-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;
-import org.jboss.ide.eclipse.as7.deployment.internal.DeployerException;
-import org.jboss.ide.eclipse.as7.deployment.internal.StandaloneTypedOperations;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * 
- * @author André Dietisheim
- */
-public class StandaloneOperationsIntegrationTest {
-
-	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;
-
-	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 {
-		StandaloneTypedOperations deployer = null;
-		File warFile = getWarFile("minimalistic.war");
-		try {
-			deployer = new StandaloneTypedOperations(HOST, MGMT_PORT);
-			deployer.deploy(warFile).execute();
-
-			String response = getServerResponse(new URL(
-					MessageFormat.format(
-							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
-			assertTrue(response.indexOf("minimalistic") >= 0);
-
-		} finally {
-			quietlyUndeploy(warFile, deployer);
-		}
-	}
-
-	@Test(expected = DeployerException.class)
-	public void cannotDeployWarTwice() throws Exception {
-		StandaloneTypedOperations deployer = null;
-		File warFile = getWarFile("minimalistic.war");
-		try {
-			deployer = new StandaloneTypedOperations(HOST, MGMT_PORT);
-			deployer.deploy(warFile).execute();
-			deployer.deploy(warFile).execute();
-		} finally {
-			quietlyUndeploy(warFile, deployer);
-		}
-	}
-
-	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, StandaloneTypedOperations deployer) {
-		try {
-			if (deployer != null) {
-				deployer.undeploy(file).execute();
-				deployer.dispose();
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-			// ignore
-		}
-	}
-}

Added: 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	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java	2011-04-14 12:56:45 UTC (rev 30571)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as7.deployment.tests;
+
+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.detyped.DetypedDeployer;
+import org.junit.Test;
+
+/**
+ * 
+ * @author André Dietisheim
+ */
+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);
+		try {
+			DetypedDeployer.deploy(warFile, HOST, MGMT_PORT);
+
+			String response = DeployerTestUtils.getServerResponse(new URL(
+					MessageFormat.format(
+							"http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+			assertTrue(response.indexOf("minimalistic") >= 0);
+
+		} finally {
+			quietlyUndeploy(warFile);
+		}
+	}
+
+//	@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();
+//	}
+//
+	private void quietlyUndeploy(File file) {
+		try {
+			DetypedDeployer.undeploy(file.getName(), HOST, MGMT_PORT);
+		} catch (Exception e) {
+			e.printStackTrace();
+			// ignore
+		}
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/TypedDeployerIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list