[jbosstools-commits] JBoss Tools SVN: r41672 - in branches/jbosstools-3.3.x/as: tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 4 08:20:40 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-06-04 08:20:39 -0400 (Mon, 04 Jun 2012)
New Revision: 41672

Added:
   branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/DeployAndTempDeployFolderTest.java
Modified:
   branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
   branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
   branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java
Log:
JBIDE-12090 to cr1

Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java	2012-06-04 11:17:21 UTC (rev 41671)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java	2012-06-04 12:20:39 UTC (rev 41672)
@@ -66,7 +66,6 @@
 
 	public String getDeployFolder(String type) {
 		if( type.equals(DEPLOY_SERVER) ) {
-			// TODO make sure this is correct?! Upstream APIs have this wrong for as7
 			IRuntime rt = getServer().getRuntime();
 			if( rt == null )
 				return null;
@@ -76,10 +75,13 @@
 		return getDeployFolder(this, type);
 	}
 	
-	// Just force it to be in metadata location, for now
 	public String getTempDeployFolder() {
-		IRuntime rt = getServer().getRuntime();
-		IPath p = rt.getLocation().append(AS7_STANDALONE).append(FOLDER_TMP);
-		return ServerUtil.makeGlobal(rt, p).toString();
+		String type = getDeployLocationType();
+		if( DEPLOY_SERVER.equals(type)) {
+			IRuntime rt = getServer().getRuntime();
+			IPath p = rt.getLocation().append(AS7_STANDALONE).append(FOLDER_TMP);
+			return ServerUtil.makeGlobal(rt, p).toString();
+		}
+		return getTempDeployFolder(this, type);
 	}
 }

Modified: branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
--- branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java	2012-06-04 11:17:21 UTC (rev 41671)
+++ branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java	2012-06-04 12:20:39 UTC (rev 41672)
@@ -31,6 +31,7 @@
 import org.jboss.ide.eclipse.as.test.classpath.RuntimeServerModelTest;
 import org.jboss.ide.eclipse.as.test.defects.WebDeployableArtifactUtilDefectTest;
 import org.jboss.ide.eclipse.as.test.projectcreation.TestEar5WithJBossRuntime;
+import org.jboss.ide.eclipse.as.test.publishing.DeployAndTempDeployFolderTest;
 import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512aTest;
 import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512bTest;
 import org.jboss.ide.eclipse.as.test.publishing.JBIDE4184Test;
@@ -73,6 +74,7 @@
         suite.addTestSuite(StringSubstitutionTest.class);
         
         // Publishing tests
+        suite.addTestSuite(DeployAndTempDeployFolderTest.class);
         suite.addTestSuite(BehaviourModelDefectTest.class);
         suite.addTestSuite(WebDeployableArtifactUtilDefectTest.class);
         suite.addTestSuite(MockJSTPublisherTest.class);

Added: branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/DeployAndTempDeployFolderTest.java
===================================================================
--- branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/DeployAndTempDeployFolderTest.java	                        (rev 0)
+++ branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/DeployAndTempDeployFolderTest.java	2012-06-04 12:20:39 UTC (rev 41672)
@@ -0,0 +1,64 @@
+package org.jboss.ide.eclipse.as.test.publishing;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.test.ASTest;
+import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectUtility;
+
+public class DeployAndTempDeployFolderTest extends TestCase {
+	public void tearDown() throws Exception {
+		ServerRuntimeUtils.deleteAllServers();
+		ServerRuntimeUtils.deleteAllRuntimes();
+		ProjectUtility.deleteAllProjects();
+		ASTest.clearStateLocation();
+	}
+
+	private IDeployableServer initAS7Server(String type) throws CoreException {
+		IServer s = ServerRuntimeUtils.createMockJBoss7Server();
+		IServerWorkingCopy wc = s.createWorkingCopy();
+		wc.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, type);
+		s = wc.save(true, null);
+		IDeployableServer ds = ServerConverter.getDeployableServer(s);
+		return ds;
+	}
+	
+	public void testAS7xServer() throws CoreException {
+		IDeployableServer ds = initAS7Server(IDeployableServer.DEPLOY_SERVER);
+		assertEquals("/standalone/deployments", ds.getDeployFolder());
+		assertEquals("/standalone/tmp", ds.getTempDeployFolder());
+	}
+
+	public void testAS7xMetadata() throws CoreException {
+		IDeployableServer ds = initAS7Server(IDeployableServer.DEPLOY_METADATA);
+		assertTrue(ds.getDeployFolder().endsWith("org.jboss.ide.eclipse.as.core/org.jboss.ide.eclipse.as.70/deploy"));
+		assertTrue(ds.getTempDeployFolder().endsWith("org.jboss.ide.eclipse.as.core/org.jboss.ide.eclipse.as.70/tempDeploy"));
+	}
+	
+	public void testAS7xCustomGlobal() throws CoreException {
+		IServer s = ServerRuntimeUtils.createMockJBoss7Server("/rtHome", "/home/test1", "/home/test2");
+		IServerWorkingCopy wc = s.createWorkingCopy();
+		wc.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_CUSTOM);
+		s = wc.save(true, null);
+		IDeployableServer ds = ServerConverter.getDeployableServer(s);
+		assertTrue("/home/test1".equals(ds.getDeployFolder()));
+		assertTrue("/home/test2".equals(ds.getTempDeployFolder()));
+	}
+
+	public void testAS7xCustomRelative() throws CoreException {
+		IServer s = ServerRuntimeUtils.createMockJBoss7Server("/rtHome", "home/test1", "home/test2");
+		IServerWorkingCopy wc = s.createWorkingCopy();
+		wc.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_CUSTOM);
+		s = wc.save(true, null);
+		IDeployableServer ds = ServerConverter.getDeployableServer(s);
+		assertTrue("/rtHome/home/test1".equals(ds.getDeployFolder()));
+		assertTrue("/rtHome/home/test2".equals(ds.getTempDeployFolder()));
+	}
+
+	
+}

Modified: branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java
===================================================================
--- branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java	2012-06-04 11:17:21 UTC (rev 41671)
+++ branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ServerRuntimeUtils.java	2012-06-04 12:20:39 UTC (rev 41672)
@@ -129,7 +129,11 @@
 	}
 	
 	public static IServer createMockJBoss7Server(String deployLocation, String tempDeployLocation) throws CoreException {
-		IRuntime runtime = RuntimeUtils.createRuntime(IJBossToolingConstants.AS_70, "/", "default");
+		return createMockJBoss7Server("/", deployLocation, tempDeployLocation);
+	}
+
+	public static IServer createMockJBoss7Server(String rtLoc, String deployLocation, String tempDeployLocation) throws CoreException {
+		IRuntime runtime = RuntimeUtils.createRuntime(IJBossToolingConstants.AS_70, rtLoc, "default");
 		IServer s = ServerCreationUtils.createServer2(runtime, IJBossToolingConstants.SERVER_AS_70);
 		IServerWorkingCopy swc = s.createWorkingCopy();
 		swc.setServerConfiguration(null);
@@ -138,7 +142,7 @@
 		IServer server = swc.save(true, null);
 		return server;
 	}
-	
+
 	public static IServer useMockPublishMethod(IServer server) throws CoreException {
 		IServerWorkingCopy wc = server.createWorkingCopy();
 		wc.setAttribute(IDeployableServer.SERVER_MODE, "mock");



More information about the jbosstools-commits mailing list