[jbosstools-commits] JBoss Tools SVN: r30897 - in trunk/as: plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7 and 5 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Apr 28 05:06:50 EDT 2011


Author: adietish
Date: 2011-04-28 05:06:49 -0400 (Thu, 28 Apr 2011)
New Revision: 30897

Added:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
Removed:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java
   trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml
   trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
   trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java
   trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java
   trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java
   trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
[JBIDE-8793] implemented shutdown server in adapter

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,132 @@
+/******************************************************************************* 
+ * Copyright (c) 2007 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
+
+public interface IJBoss7ManagerService {
+
+	public static final String AS_VERSION_PROPERTY = "as.version"; //$NON-NLS-1$
+
+	public static final String AS_VERSION_700 = "700"; //$NON-NLS-1$
+
+	/**
+	 * Asynchronously deploy a file to a server
+	 * 
+	 * @param host
+	 *            The host
+	 * @param port
+	 *            The port
+	 * @param name
+	 *            The deployment's name
+	 * @param file
+	 *            The file to be deployed
+	 * @param monitor
+	 *            The progress monitor
+	 * 
+	 * @return Not sure what to return yet
+	 * @throws Exception
+	 */
+	public IJBoss7DeploymentResult deployAsync(String host, int port,
+			String deploymentName, File file, IProgressMonitor monitor) throws Exception;
+
+	/**
+	 * Synchronously deploy a file to a server
+	 * 
+	 * @param host
+	 *            The host
+	 * @param port
+	 *            The port
+	 * @param name
+	 *            The deployment's name
+	 * @param file
+	 *            The file to be deployed
+	 * @param monitor
+	 *            The progress monitor
+	 * 
+	 * @return Not sure what to return yet
+	 * @throws Exception
+	 */
+	public IJBoss7DeploymentResult deploySync(String host, int port,
+			String deploymentName, File file, IProgressMonitor monitor) throws Exception;
+
+	/**
+	 * Asynchronously undeploy a file to a server
+	 * 
+	 * @param host
+	 *            The host
+	 * @param port
+	 *            The port
+	 * @param name
+	 *            The deployment's name
+	 * @param file
+	 *            The file to be deployed
+	 * @param monitor
+	 *            The progress monitor
+	 * 
+	 * @return Not sure what to return yet
+	 * @throws Exception
+	 */
+	public IJBoss7DeploymentResult undeployAsync(String host, int port,
+			String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
+
+	/**
+	 * Synchronously undeploy a file to a server
+	 * 
+	 * @param host
+	 *            The host
+	 * @param port
+	 *            The port
+	 * @param name
+	 *            The deployment's name
+	 * @param file
+	 *            The file to be deployed
+	 * @param monitor
+	 *            The progress monitor
+	 * 
+	 * @return Not sure what to return yet
+	 * @throws Exception
+	 */
+	public IJBoss7DeploymentResult syncUndeploy(String host, int port,
+			String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
+
+	/**
+	 * Returns the state for a given deployment name on a given host and port.
+	 * 
+	 * @param host
+	 *            the host to query
+	 * @param port
+	 *            the port to contact it on
+	 * @param deploymentName
+	 *            the name of the deployment that shall be queried
+	 * 
+	 * @return the state of the deployment
+	 * @throws Exception
+	 */
+	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception;
+
+	/**
+	 * Stops the given server
+	 * 
+	 * @throws JBoss7ManangerException
+	 * @throws Exception 
+	 */
+	public void stop(String host, int port) throws Exception;
+
+	public void stop(String host) throws Exception;
+
+	public void dispose();
+}

Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/IJBoss7Manager.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,125 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is made available under the terms of the 
- * Eclipse Public License v1.0 which accompanies this distribution, 
- * and is available at http://www.eclipse.org/legal/epl-v10.html 
- * 
- * Contributors: 
- * Red Hat, Inc. - initial API and implementation 
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface IJBoss7Manager {
-
-	public static final String AS_VERSION_PROPERTY = "as.version"; //$NON-NLS-1$
-
-	public static final String AS_VERSION_700 = "700"; //$NON-NLS-1$
-
-	/**
-	 * Asynchronously deploy a file to a server
-	 * 
-	 * @param host
-	 *            The host
-	 * @param port
-	 *            The port
-	 * @param name
-	 *            The deployment's name
-	 * @param file
-	 *            The file to be deployed
-	 * @param monitor
-	 *            The progress monitor
-	 * 
-	 * @return Not sure what to return yet
-	 * @throws Exception
-	 */
-	public IJBoss7DeploymentResult deployAsync(String host, int port,
-			String deploymentName, File file, IProgressMonitor monitor) throws Exception;
-
-	/**
-	 * Synchronously deploy a file to a server
-	 * 
-	 * @param host
-	 *            The host
-	 * @param port
-	 *            The port
-	 * @param name
-	 *            The deployment's name
-	 * @param file
-	 *            The file to be deployed
-	 * @param monitor
-	 *            The progress monitor
-	 * 
-	 * @return Not sure what to return yet
-	 * @throws Exception
-	 */
-	public IJBoss7DeploymentResult deploySync(String host, int port,
-			String deploymentName, File file, IProgressMonitor monitor) throws Exception;
-
-	/**
-	 * Asynchronously undeploy a file to a server
-	 * 
-	 * @param host
-	 *            The host
-	 * @param port
-	 *            The port
-	 * @param name
-	 *            The deployment's name
-	 * @param file
-	 *            The file to be deployed
-	 * @param monitor
-	 *            The progress monitor
-	 * 
-	 * @return Not sure what to return yet
-	 * @throws Exception
-	 */
-	public IJBoss7DeploymentResult undeployAsync(String host, int port,
-			String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
-
-	/**
-	 * Synchronously undeploy a file to a server
-	 * 
-	 * @param host
-	 *            The host
-	 * @param port
-	 *            The port
-	 * @param name
-	 *            The deployment's name
-	 * @param file
-	 *            The file to be deployed
-	 * @param monitor
-	 *            The progress monitor
-	 * 
-	 * @return Not sure what to return yet
-	 * @throws Exception
-	 */
-	public IJBoss7DeploymentResult syncUndeploy(String host, int port,
-			String deploymentName, boolean removeFile, IProgressMonitor monitor) throws Exception;
-
-	/**
-	 * Returns the state for a given deployment name on a given host and port.
-	 * 
-	 * @param host
-	 *            the host to query
-	 * @param port
-	 *            the port to contact it on
-	 * @param deploymentName
-	 *            the name of the deployment that shall be queried
-	 * 
-	 * @return the state of the deployment
-	 * @throws Exception
-	 */
-	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception;
-
-	/**
-	 * Stops the given server
-	 * 
-	 * @throws JBoss7ManangerException
-	 * @throws Exception 
-	 */
-	public void stop(String host, int port) throws Exception;
-}

Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,57 +0,0 @@
-package org.jboss.ide.eclipse.as.core.server.internal.v7;
-
-import java.io.File;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class JBoss7ManagerProxy extends ServiceTracker<IJBoss7Manager, IJBoss7Manager>
-		implements IJBoss7Manager {
-
-	public JBoss7ManagerProxy(BundleContext context, String asVersion) throws InvalidSyntaxException {
-		super(
-				context,
-				context.createFilter(MessageFormat
-						.format("(&(objectClass={0})(as.version={1}))", IJBoss7Manager.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
-	}
-
-	public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
-			IProgressMonitor monitor) throws Exception {
-		return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
-	}
-
-	public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName, File file,
-			IProgressMonitor monitor) throws Exception {
-		return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
-	}
-
-	public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName, boolean removeFile,
-			IProgressMonitor monitor) throws Exception {
-		return checkedGetService().undeployAsync(host, port, deploymentName, removeFile, monitor);
-	}
-
-	public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName, boolean removeFile,
-			IProgressMonitor monitor) throws Exception {
-		return checkedGetService().syncUndeploy(host, port, deploymentName, removeFile, monitor);
-	}
-
-	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
-		return checkedGetService().getDeploymentState(host, port, deploymentName);
-	}
-
-	public void stop(String host, int port) throws Exception {
-		checkedGetService().stop(host, port);
-	}
-
-	private IJBoss7Manager checkedGetService() throws JBoss7ManangerException {
-		IJBoss7Manager service = getService();
-		if (service == null) {
-			throw new JBoss7ManangerException("Could not acquire JBoss Management service"); //$NON-NLS-1$
-		}
-		return service;
-	}
-
-}

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerProxy.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,66 @@
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class JBoss7ManagerServiceProxy extends ServiceTracker<IJBoss7ManagerService, IJBoss7ManagerService>
+		implements IJBoss7ManagerService {
+
+	public JBoss7ManagerServiceProxy(BundleContext context, String asVersion) throws InvalidSyntaxException {
+		super(
+				context,
+				context.createFilter(MessageFormat
+						.format("(&(objectClass={0})(as.version={1}))", IJBoss7ManagerService.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
+	}
+
+	public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
+			IProgressMonitor monitor) throws Exception {
+		return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
+	}
+
+	public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName, File file,
+			IProgressMonitor monitor) throws Exception {
+		return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
+	}
+
+	public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName, boolean removeFile,
+			IProgressMonitor monitor) throws Exception {
+		return checkedGetService().undeployAsync(host, port, deploymentName, removeFile, monitor);
+	}
+
+	public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName, boolean removeFile,
+			IProgressMonitor monitor) throws Exception {
+		return checkedGetService().syncUndeploy(host, port, deploymentName, removeFile, monitor);
+	}
+
+	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
+		return checkedGetService().getDeploymentState(host, port, deploymentName);
+	}
+
+	public void stop(String host, int port) throws Exception {
+		checkedGetService().stop(host, port);
+	}
+
+	public void stop(String host) throws Exception {
+		checkedGetService().stop(host);
+	}
+
+	private IJBoss7ManagerService checkedGetService() throws JBoss7ManangerException {
+		IJBoss7ManagerService service = getService();
+		if (service == null) {
+			throw new JBoss7ManangerException("Could not acquire JBoss Management service"); //$NON-NLS-1$
+		}
+		return service;
+	}
+
+	public void dispose() {
+		close();
+	}
+
+}


Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -12,18 +12,21 @@
 
 import org.eclipse.wst.server.core.IServer;
 import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
 import org.osgi.framework.BundleContext;
 
 public class JBoss7ManagerUtil {
 	
 	public static final String SERVICE_VERSION_70 = "org.jboss.ide.eclipse.as.management.as7.service"; //$NON-NLS-1$
 
-	public static IJBoss7Manager findManagementService(IServer server) throws Exception {
+	public static IJBoss7ManagerService findManagementService(IServer server) throws Exception {
 		BundleContext context = JBossServerCorePlugin.getContext();
-		return new JBoss7ManagerProxy(context, getRequiredVersion(server));
+		JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
+		proxy.open();
+		return proxy;
 	}
 
 	private static String getRequiredVersion(IServer server) {
-		return IJBoss7Manager.AS_VERSION_700;
+		return IJBoss7ManagerService.AS_VERSION_700;
 	}
 }

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -24,12 +24,15 @@
 import org.eclipse.wst.server.core.IModule;
 import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
 import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
 import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
 import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
 import org.jboss.ide.eclipse.as.core.util.ServerConverter;
 
 public class JBoss7ServerBehavior extends JBossServerBehavior {
+
+	private IJBoss7ManagerService service;
+
 	private static HashMap<String, Class> delegateClassMap;
 	static {
 		delegateClassMap = new HashMap<String, Class>();
@@ -44,7 +47,14 @@
 
 	
 	public void stop(boolean force) {
-		setServerStopped();
+		try {
+			IJBoss7ManagerService service = getService();
+			// TODO: for now only local, implement for remote afterwards
+			service.stop("localhost"); //$NON-NLS-1$
+			setServerStopped();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
 	}
 	
 	public boolean shouldSuspendScanner() {
@@ -83,4 +93,19 @@
 		} else 
 			super.publishFinish(monitor);
 	}
+
+	private IJBoss7ManagerService getService() throws Exception {
+		if (service == null) {
+			service = JBoss7ManagerUtil.findManagementService(getServer());
+		}
+		return service;
+	}
+	
+	@Override
+	public void dispose() {
+		super.dispose();
+		if (service != null) {
+			service.dispose();
+		}
+	}
 }

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -16,6 +16,7 @@
 
 public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
 	public IStatus canChangeState(String launchMode) {
-		return Status.CANCEL_STATUS;
+//		return Status.CANCEL_STATUS;
+		return Status.OK_STATUS;
 	}
 }

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar" sourcepath="/jboss-as-controller-client"/>
+	<classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar" sourcepath="/jboss-as-controller-client/src"/>
 	<classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Beta3.jar"/>
 	<classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Beta5.jar" sourcepath="/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/jboss-dmr-1.0.0.Beta5-sources.jar"/>
 	<classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.Beta3.jar"/>

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/jboss-management-service.xml	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.jboss.ide.eclipse.as.management.as7.service">
-   <implementation class="org.jboss.ide.eclipse.as.management.as7.deployment.JBoss7Manager"/>
+   <implementation class="org.jboss.ide.eclipse.as.management.as7.deployment.JBoss7ManagerService"/>
    <service>
-      <provide interface="org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager"/>
+      <provide interface="org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService"/>
    </service>
    <property name="as.version" type="String" value="700"/>
 </scr:component>

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -43,10 +43,16 @@
  */
 public class AS7Manager {
 
+	public static final int MGMT_PORT = 9999;
+
 	private ModelControllerClient client;
 	private ServerDeploymentManager manager;
 
-	public AS7Manager(String host, int port) throws UnknownHostException {
+	public AS7Manager(String host) throws UnknownHostException {
+		this(host, MGMT_PORT);
+	}
+
+		public AS7Manager(String host, int port) throws UnknownHostException {
 		this.client = ModelControllerClient.Factory.create(host, port);
 		this.manager = ServerDeploymentManager.Factory.create(client);
 	}
@@ -139,7 +145,7 @@
 	 * 
 	 * @throws JBoss7ManangerException
 	 */
-	public void stop() throws JBoss7ManangerException {		
+	public void stopServer() throws JBoss7ManangerException {
 		ModelNode request = new ModelNode();
 		request.get(OP).set(SHUTDOWN);
 		quietlyExecute(request);

Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,156 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2011 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is made available under the terms of the 
- * Eclipse Public License v1.0 which accompanies this distribution, 
- * and is available at http://www.eclipse.org/legal/epl-v10.html 
- * 
- * Contributors: 
- * Red Hat, Inc. - initial API and implementation 
- ******************************************************************************/ 
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADD;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.INPUT_STREAM_INDEX;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.REMOVE;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.UNDEPLOY;
-
-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.Operation;
-import org.jboss.as.controller.client.OperationBuilder;
-import org.jboss.as.protocol.StreamUtils;
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-
-/**
- * @author André Dietisheim
- */
-public class DetypedDeployer {
-
-	public static void undeploy(String name, String host, int port) throws JBoss7ManangerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-			// undeploy
-			ModelNode request = new ModelNode();
-			request.get(OP).set(UNDEPLOY);
-			request.get(ADDRESS).add(DEPLOYMENT, name);
-			ModelNode result = client.execute(request);
-			throwOnFailure(result);
-
-			remove(name, host, port);
-			
-		} catch (Exception e) {
-			throw new JBoss7ManangerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void remove(String name, String host, int port) throws JBoss7ManangerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-
-			// remove
-			ModelNode request = new ModelNode();
-			request.get(OP).set(REMOVE);
-			request.get(ADDRESS).add(DEPLOYMENT, name);
-			client.execute(request);
-		} catch (Exception e) {
-			throw new JBoss7ManangerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void deploy(File file, String host, int port) throws JBoss7ManangerException {
-		deploy(file.getName(), file, host, port);
-	}
-
-	public static void deploy(String name, File file, String host, int port) throws JBoss7ManangerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-
-			ModelNode request = new ModelNode();
-			request.get(OP).set(ADD);
-			request.get(ADDRESS).add(DEPLOYMENT, name);
-			request.get(ENABLED).set(true);
-
-			OperationBuilder builder = OperationBuilder.Factory.create(request);
-			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
-			Operation operation = builder.build();
-			request.get(INPUT_STREAM_INDEX).set(0);
-
-			ModelNode result = client.execute(operation);
-			System.out.println(result);
-
-			throwOnFailure(result);
-		} catch (Exception e) {
-			throw new JBoss7ManangerException(e);
-		} finally {
-			StreamUtils.safeClose(client);
-		}
-	}
-
-	public static void replace(String name, File file, String host, int port) throws JBoss7ManangerException {
-		ModelControllerClient client = null;
-		try {
-			client = ModelControllerClient.Factory.create(host, port);
-
-			ModelNode request = new ModelNode();
-			request.get("operation").set("full-replace-deployment");
-			request.get("name").set(name);
-
-			OperationBuilder builder = OperationBuilder.Factory.create(request);
-			builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
-			Operation operation = builder.build();
-			request.get("input-stream-index").set(0);
-
-			ModelNode result = client.execute(operation);
-
-			throwOnFailure(result);
-		} catch (Exception e) {
-			throw new JBoss7ManangerException(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 AS7ManagerUtil.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 AS7ManagerUtil.getDeployments(client);
-	}
-
-	private static void throwOnFailure(ModelNode result) throws JBoss7ManangerException {
-		if (!AS7ManagerUtil.isSuccess(result)) {
-			throw new JBoss7ManangerException(AS7ManagerUtil.getFailureDescription(result));
-		}
-	}
-
-	private DetypedDeployer() {
-		// inhibit instantiation
-	}
-}

Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,57 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2011 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is made available under the terms of the 
- * Eclipse Public License v1.0 which accompanies this distribution, 
- * and is available at http://www.eclipse.org/legal/epl-v10.html 
- * 
- * Contributors: 
- * Red Hat, Inc. - initial API and implementation 
- ******************************************************************************/ 
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
-
-/**
- * @author Rob Stryker
- */
-public class JBoss7Manager implements IJBoss7Manager {
-
-	public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
-			File file, IProgressMonitor monitor) throws Exception {
-		AS7Manager manager = new AS7Manager(host, port);
-		return manager.deploy(deploymentName, file);
-	}
-
-	public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName,
-			File file, IProgressMonitor monitor) throws Exception {
-		AS7Manager manager = new AS7Manager(host, port);
-		return manager.deploySync(deploymentName, file, monitor);
-	}
-
-	public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName,
-			boolean removeFile, IProgressMonitor monitor) throws Exception {
-		AS7Manager manager = new AS7Manager(host, port);
-		return manager.undeploy(deploymentName);
-	}
-
-	public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName,
-			boolean removeFile, IProgressMonitor monitor) throws Exception {
-		AS7Manager manager = new AS7Manager(host, port);
-		return manager.undeploySync(deploymentName, monitor);
-	}
-
-	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
-		AS7Manager manager = new AS7Manager(host, port);
-		return manager.getDeploymentState(deploymentName);
-	}
-	
-	public void stop(String host, int port) throws Exception {
-		new AS7Manager(host, port).stop();
-	}
-}

Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java (from rev 30870, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7Manager.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java	                        (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -0,0 +1,65 @@
+/******************************************************************************* 
+ * Copyright (c) 2011 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+
+/**
+ * @author Rob Stryker
+ */
+public class JBoss7ManagerService implements IJBoss7ManagerService {
+
+	public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
+			File file, IProgressMonitor monitor) throws Exception {
+		AS7Manager manager = new AS7Manager(host, port);
+		return manager.deploy(deploymentName, file);
+	}
+
+	public IJBoss7DeploymentResult deploySync(String host, int port, String deploymentName,
+			File file, IProgressMonitor monitor) throws Exception {
+		AS7Manager manager = new AS7Manager(host, port);
+		return manager.deploySync(deploymentName, file, monitor);
+	}
+
+	public IJBoss7DeploymentResult undeployAsync(String host, int port, String deploymentName,
+			boolean removeFile, IProgressMonitor monitor) throws Exception {
+		AS7Manager manager = new AS7Manager(host, port);
+		return manager.undeploy(deploymentName);
+	}
+
+	public IJBoss7DeploymentResult syncUndeploy(String host, int port, String deploymentName,
+			boolean removeFile, IProgressMonitor monitor) throws Exception {
+		AS7Manager manager = new AS7Manager(host, port);
+		return manager.undeploySync(deploymentName, monitor);
+	}
+
+	public JBoss7DeploymentState getDeploymentState(String host, int port, String deploymentName) throws Exception {
+		AS7Manager manager = new AS7Manager(host, port);
+		return manager.getDeploymentState(deploymentName);
+	}
+	
+	public void stop(String host) throws Exception {
+		new AS7Manager(host).stopServer();
+	}
+	
+	public void stop(String host, int port) throws Exception {
+		new AS7Manager(host, port).stopServer();
+	}
+
+	@Override
+	public void dispose() {
+	}
+}

Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerIntegrationTest.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -41,9 +41,9 @@
 	@Before
 	public void setUp() throws IOException {
 		assertTrue("There is no server at " + AS7ManagerTestUtils.HOST +
-				" that listens on port " + AS7ManagerTestUtils.MGMT_PORT,
-				AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
-		this.manager = new AS7Manager(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
+				" that listens on port " + AS7Manager.MGMT_PORT,
+				AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
+		this.manager = new AS7Manager(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT);
 	}
 
 	@After
@@ -160,9 +160,11 @@
 	}
 
 	@Test
-	public void canShutdown() throws JBoss7ManangerException, UnknownHostException, IOException {
-		assertTrue(AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
-		manager.stop();
-		assertFalse(AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT));
+	public void canStopServer() throws JBoss7ManangerException, UnknownHostException, IOException {
+		assertTrue(
+				AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
+		manager.stopServer();
+		assertFalse(
+				AS7ManagerTestUtils.isListening(AS7ManagerTestUtils.HOST, AS7Manager.MGMT_PORT));
 	}
 }
\ No newline at end of file

Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/AS7ManagerTestUtils.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -39,7 +39,6 @@
 	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/";

Deleted: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -1,100 +0,0 @@
-/******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
- * Distributed under license by Red Hat, Inc. All rights reserved. 
- * This program is made available under the terms of the 
- * Eclipse Public License v1.0 which accompanies this distribution, 
- * and is available at http://www.eclipse.org/legal/epl-v10.html 
- * 
- * Contributors: 
- * Red Hat, Inc. - initial API and implementation 
- ******************************************************************************/ 
-package org.jboss.ide.eclipse.as.management.as7.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.util.List;
-
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.DetypedDeployer;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class DetypedDeployerIntegrationTest {
-
-	@Test
-	public void canDeploy() throws Exception {
-		File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
-		try {
-			DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-
-			String response = AS7ManagerTestUtils.waitForRespose("minimalistic", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.WEB_PORT);
-			assertTrue(response.indexOf("minimalistic") >= 0);
-
-		} finally {
-			quietlyUndeploy(warFile);
-		}
-	}
-
-	@Test(expected = JBoss7ManangerException.class)
-	public void cannotDeployWarTwice() throws Exception {
-		File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
-		try {
-			DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-		} finally {
-			quietlyUndeploy(warFile);
-		}
-	}
-
-	@Test
-	public void canReplaceWar() throws Exception {
-		File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
-		File warFile2 = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.GWT_HELLOWORLD_WAR);
-		String name = warFile.getName();
-		try {
-			DetypedDeployer.deploy(name, warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			DetypedDeployer.replace(name, warFile2, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			String response = AS7ManagerTestUtils.waitForRespose(
-					"minimalistic", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.WEB_PORT);
-			assertTrue(response.indexOf("GWT") >= 0);
-		} finally {
-			quietlyUndeploy(warFile);
-		}
-	}
-
-	@Test(expected = JBoss7ManangerException.class)
-	public void cannotUndeployNondeployed() throws JBoss7ManangerException {
-		DetypedDeployer.undeploy("inexistant", AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-	}
-
-	@Test
-	public void canQueryDeploymentdeployedState() throws Exception {
-		File warFile = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.MINIMALISTIC_WAR);
-		File warFile2 = AS7ManagerTestUtils.getWarFile(AS7ManagerTestUtils.GWT_HELLOWORLD_WAR);
-		try {
-			DetypedDeployer.deploy(warFile, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			DetypedDeployer.deploy(warFile2, AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			List<String> deployments = DetypedDeployer.getDeployments(AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-			assertThat(deployments.size(), is(2));
-			assertThat(deployments, hasItems(AS7ManagerTestUtils.MINIMALISTIC_WAR, AS7ManagerTestUtils.GWT_HELLOWORLD_WAR));
-		} finally {
-			quietlyUndeploy(warFile);
-			quietlyUndeploy(warFile2);
-		}
-	}
-
-	private void quietlyUndeploy(File file) {
-		try {
-			DetypedDeployer.undeploy(file.getName(), AS7ManagerTestUtils.HOST, AS7ManagerTestUtils.MGMT_PORT);
-		} catch (Exception e) {
-			e.printStackTrace();
-			// ignore
-		}
-	}
-}

Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementServiceIntegrationTest.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -14,7 +14,7 @@
 
 import java.net.UnknownHostException;
 
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -43,10 +43,10 @@
 	public void serviceIsReachable() throws BundleException {
 		ensureDSIsRunning();
 		BundleContext context = Activator.getContext();
-		ServiceReference<IJBoss7Manager> reference = 
-				context.getServiceReference(IJBoss7Manager.class);
+		ServiceReference<IJBoss7ManagerService> reference = 
+				context.getServiceReference(IJBoss7ManagerService.class);
 		assertNotNull(reference);
-		IJBoss7Manager service = context.getService(reference);
+		IJBoss7ManagerService service = context.getService(reference);
 		assertNotNull(service);
 	}
 
@@ -56,7 +56,7 @@
 		Bundle bundle = getDSBundle();
 		assertNotNull(
 				DS_BUNDLEID + " not installed. You have to install the declarative services daemon so that "
-						+ IJBoss7Manager.class + " service is registered"
+						+ IJBoss7ManagerService.class + " service is registered"
 				, bundle);
 		if (bundle.getState() != Bundle.ACTIVE) {
 			bundle.start();

Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java	2011-04-28 07:50:07 UTC (rev 30896)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java	2011-04-28 09:06:49 UTC (rev 30897)
@@ -7,10 +7,10 @@
 import java.util.Hashtable;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
 import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7Manager;
 import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerProxy;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerServiceProxy;
 import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
 import org.jboss.ide.eclipse.as.test.ASTest;
 import org.junit.Test;
@@ -22,10 +22,10 @@
 	@Test
 	public void canUseService() throws JBoss7ManangerException, InvalidSyntaxException {
 		BundleContext context = ASTest.getContext();
-		JBoss7ManagerProxy serviceProxy = new JBoss7ManagerProxy(context,
-				IJBoss7Manager.AS_VERSION_700);
+		JBoss7ManagerServiceProxy serviceProxy = new JBoss7ManagerServiceProxy(context,
+				IJBoss7ManagerService.AS_VERSION_700);
 		serviceProxy.open();
-		IJBoss7Manager manager = serviceProxy.getService();
+		IJBoss7ManagerService manager = serviceProxy.getService();
 		assertNotNull(manager);
 	}
 
@@ -33,10 +33,10 @@
 	public void canUseServiceEvenIfAlternativeIsRegistered() throws JBoss7ManangerException, InvalidSyntaxException {
 		BundleContext context = ASTest.getDefault().getBundle().getBundleContext();
 		registerFakeASService("710");
-		JBoss7ManagerProxy serviceProxy =
-				new JBoss7ManagerProxy(context, IJBoss7Manager.AS_VERSION_700);
+		JBoss7ManagerServiceProxy serviceProxy =
+				new JBoss7ManagerServiceProxy(context, IJBoss7ManagerService.AS_VERSION_700);
 		serviceProxy.open();
-		IJBoss7Manager manager = serviceProxy.getService();
+		IJBoss7ManagerService manager = serviceProxy.getService();
 		assertNotNull(manager);
 	}
 
@@ -44,22 +44,22 @@
 	public void canUseAlternative() throws Exception {
 		BundleContext context = ASTest.getDefault().getBundle().getBundleContext();
 		registerFakeASService("710");
-		JBoss7ManagerProxy managerProxy =
-				new JBoss7ManagerProxy(context, "710");
+		JBoss7ManagerServiceProxy managerProxy =
+				new JBoss7ManagerServiceProxy(context, "710");
 		managerProxy.open();
-		IJBoss7Manager manager = managerProxy.getService();
+		IJBoss7ManagerService manager = managerProxy.getService();
 		assertNotNull(manager);
 		manager.getDeploymentState("fake", 4242, "fake");
 	}
 
 	private void registerFakeASService(String version) {
 		Dictionary<String, String> serviceProperties = new Hashtable<String, String>();
-		serviceProperties.put(IJBoss7Manager.AS_VERSION_PROPERTY, version);
-		ASTest.getContext().registerService(IJBoss7Manager.class, new JBoss71Manager(),
+		serviceProperties.put(IJBoss7ManagerService.AS_VERSION_PROPERTY, version);
+		ASTest.getContext().registerService(IJBoss7ManagerService.class, new JBoss71Manager(),
 				serviceProperties);
 	}
 
-	private static class JBoss71Manager implements IJBoss7Manager {
+	private static class JBoss71Manager implements IJBoss7ManagerService {
 
 		public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
 				IProgressMonitor monitor) throws JBoss7ManangerException {
@@ -88,5 +88,12 @@
 		
 		public void stop(String host, int port) throws JBoss7ManangerException {
 		}
+
+		public void stop(String host) throws JBoss7ManangerException {
+		}
+
+		@Override
+		public void dispose() {
+		}
 	}
 }



More information about the jbosstools-commits mailing list