Author: rob.stryker(a)jboss.com
Date: 2009-04-20 05:32:06 -0400 (Mon, 20 Apr 2009)
New Revision: 14817
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/JBIDE4184Test.java
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/StartupShutdownTest.java
Log:
JBIDE-4184 test case
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2009-04-20
06:13:12 UTC (rev 14816)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2009-04-20
09:32:06 UTC (rev 14817)
@@ -30,6 +30,7 @@
import org.jboss.ide.eclipse.as.test.classpath.RuntimeServerModelTest;
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;
public class ASTestSuite extends TestSuite {
public static Test suite() {
@@ -41,6 +42,7 @@
suite.addTestSuite(JBIDE1657Test.class);
suite.addTestSuite(JBIDE2512aTest.class);
suite.addTestSuite(JBIDE2512bTest.class);
+ suite.addTestSuite(JBIDE4184Test.class);
return suite;
}
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/JBIDE4184Test.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/JBIDE4184Test.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/JBIDE4184Test.java 2009-04-20
09:32:06 UTC (rev 14817)
@@ -0,0 +1,58 @@
+package org.jboss.ide.eclipse.as.test.publishing;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IRuntime;
+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.FileUtil;
+import org.jboss.ide.eclipse.as.test.ASTest;
+import org.jboss.ide.eclipse.as.test.server.StartupShutdownTest;
+
+public class JBIDE4184Test extends TestCase {
+ private IServer server;
+ private IPath tmpPath;
+ public void setUp() {
+ try {
+ tmpPath = new Path(ASTest.JBOSS_AS_42_HOME);
+ tmpPath =
tmpPath.append("server").append("default").append("tmp").append(IDeployableServer.JBOSSTOOLS_TMP);
+ if( tmpPath.toFile().exists())
+ FileUtil.safeDelete(tmpPath.toFile());
+ assertFalse(tmpPath.toFile().exists());
+ server = StartupShutdownTest.createServer(ASTest.JBOSS_RUNTIME_42,
ASTest.JBOSS_SERVER_42, ASTest.JBOSS_AS_42_HOME,
+ StartupShutdownTest.DEFAULT_CONFIG);
+ } catch( CoreException ce) {
+ fail(ce.getMessage());
+ }
+ }
+ public void testJira() {
+ try {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ IDeployableServer ds = (IDeployableServer)wc.loadAdapter(IDeployableServer.class, new
NullProgressMonitor());
+ ds.setDeployLocationType(IDeployableServer.DEPLOY_SERVER);
+ server = wc.save(true, new NullProgressMonitor());
+ String folder = ds.getTempDeployFolder();
+ File f = new Path(folder).toFile();
+ assertTrue(f.exists());
+ } catch( CoreException ce) {
+ fail(ce.getMessage());
+ }
+ }
+ public void tearDown() {
+ try {
+ IRuntime rt = server.getRuntime();
+ server.delete();
+ rt.delete();
+ FileUtil.safeDelete(tmpPath.toFile());
+ } catch( CoreException ce) {
+ fail();
+ }
+ }
+}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/StartupShutdownTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/StartupShutdownTest.java 2009-04-20
06:13:12 UTC (rev 14816)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/StartupShutdownTest.java 2009-04-20
09:32:06 UTC (rev 14817)
@@ -64,13 +64,12 @@
*/
public class StartupShutdownTest extends TestCase {
- protected static final IVMInstall VM_INSTALL = JavaRuntime.getDefaultVMInstall();
- protected static final String DEFAULT_CONFIG = "default";
+ public static final IVMInstall VM_INSTALL = JavaRuntime.getDefaultVMInstall();
+ public static final String DEFAULT_CONFIG = "default";
- protected static final int DEFAULT_STARTUP_TIME = 150000;
- protected static final int DEFAULT_SHUTDOWN_TIME = 90000;
+ public static final int DEFAULT_STARTUP_TIME = 150000;
+ public static final int DEFAULT_SHUTDOWN_TIME = 90000;
- protected IRuntime currentRuntime;
protected IServer currentServer;
protected ServerStateListener stateListener;
@@ -104,22 +103,22 @@
- protected void createServer(String runtimeID, String serverID,
+ public static IServer createServer(String runtimeID, String serverID,
String location, String configuration) throws CoreException {
// if file doesnt exist, abort immediately.
assertTrue(new Path(location).toFile().exists());
- currentRuntime = createRuntime(runtimeID, location, configuration);
+ IRuntime currentRuntime = createRuntime(runtimeID, location, configuration);
IServerType serverType = ServerCore.findServerType(serverID);
IServerWorkingCopy serverWC = serverType.createServer(null, null, new
NullProgressMonitor());
serverWC.setRuntime(currentRuntime);
serverWC.setName(serverID);
serverWC.setServerConfiguration(null);
- currentServer = serverWC.save(true, new NullProgressMonitor());
+ return serverWC.save(true, new NullProgressMonitor());
}
- private IRuntime createRuntime(String runtimeId, String homeDir, String config) throws
CoreException {
+ private static IRuntime createRuntime(String runtimeId, String homeDir, String config)
throws CoreException {
IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(null,null, runtimeId);
assertEquals("expects only one runtime type", runtimeTypes.length, 1);
IRuntimeType runtimeType = runtimeTypes[0];
Show replies by date