Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2011-01-27 19:27:03 +0000
committerDJ Houghton2011-01-27 19:27:03 +0000
commit2e968b58d5c48d4e873e49bc3a20e9681c7f5721 (patch)
treefb730242ec2b8d088006b1e2cb1c0a39d51e475f
parentc21ccd77bdf8f9f3b9cd103f35a4246456deee8e (diff)
downloadrt.equinox.p2-2e968b58d5c48d4e873e49bc3a20e9681c7f5721.tar.gz
rt.equinox.p2-2e968b58d5c48d4e873e49bc3a20e9681c7f5721.tar.xz
rt.equinox.p2-2e968b58d5c48d4e873e49bc3a20e9681c7f5721.zip
Pulled out common code for running Eclipse apps from within test suites.
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java67
2 files changed, 27 insertions, 62 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java
index 1253a193b..0cc8a12cf 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java
@@ -13,8 +13,6 @@ package org.eclipse.equinox.p2.tests.full;
import java.io.*;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.p2.tests.TestActivator;
import org.eclipse.equinox.p2.tests.reconciler.dropins.AbstractReconcilerTest;
import org.eclipse.equinox.p2.tests.reconciler.dropins.ReconcilerTestSuite;
@@ -24,26 +22,6 @@ public class Install37from36 extends AbstractReconcilerTest {
super(string);
}
- public int runDirectorToInstall(String message, File installFolder, String sourceRepo, String iuToInstall) {
- File root = new File(TestActivator.getContext().getProperty("java.home"));
- root = new File(root, "bin");
- File exe = new File(root, "javaw.exe");
- if (!exe.exists())
- exe = new File(root, "java");
- String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", //
- "-consoleLog", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), //
- "-repository", sourceRepo, "-installIU", iuToInstall, //
- "-destination", installFolder.getAbsolutePath(), //
- "-bundlepool", installFolder.getAbsolutePath(), //
- "-roaming", "-profile", "PlatformProfile", "-profileProperties", "org.eclipse.update.install.features=true", //
- "-p2.os", Platform.getOS(), "-p2.ws", Platform.getWS(), "-p2.arch", Platform.getOSArch(), //
- "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xms40m", "-Xmx256m", //
- //, "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" //for debugging
- };
-
- return run(message, command, new File(installFolder.getParentFile(), "log.log"));
- }
-
public static Test suite() {
TestSuite suite = new ReconcilerTestSuite("org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive");
suite.addTest(new Install37from36("install37From36"));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
index 303bc12e8..7f5a05a53 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
@@ -373,15 +373,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
* Run the reconciler to discover changes in the drop-ins folder and update the system state.
*/
public void reconcile(String message) {
- File root = new File(Activator.getBundleContext().getProperty("java.home"));
- root = new File(root, "bin");
- File exe = new File(root, "javaw.exe");
- if (!exe.exists())
- exe = new File(root, "java");
- String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.reconciler.application", "-vm", exe.getAbsolutePath(), "-vmArgs", "-Dosgi.checkConfiguration=true"};
- // command-line if you want to run and allow a remote debugger to connect
- // String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.reconciler.application", "-vm", exe.getAbsolutePath(), "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"};
- run(message, command);
+ runEclipse(message, new String[] {"-application", "org.eclipse.equinox.p2.reconciler.application"});
}
/*
@@ -591,55 +583,50 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
return (IInstallableUnit) queryResult.iterator().next();
}
- public int runInitialize(String message) {
+ protected int runEclipse(String message, String[] args) {
File root = new File(Activator.getBundleContext().getProperty("java.home"));
root = new File(root, "bin");
File exe = new File(root, "javaw.exe");
if (!exe.exists())
exe = new File(root, "java");
- String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-initialize", "-vmArgs", "-Dosgi.checkConfiguration=true"};
+ assertTrue("Java executable not found in: " + exe.getAbsolutePath(), exe.exists());
+ List<String> command = new ArrayList<String>();
+ Collections.addAll(command, new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-vm", exe.getAbsolutePath()});
+ Collections.addAll(command, args);
+ Collections.addAll(command, new String[] {"-vmArgs", "-Dosgi.checkConfiguration=true"});
// command-line if you want to run and allow a remote debugger to connect
- //String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), "-repository", sourceRepo, "-installIU", iuToInstall, "-uninstallIU", iuToUninstall, "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"};
- return run(message, command);
+ //Collections.addAll(command, new String[] {"-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"});
+ return run(message, command.toArray(new String[command.size()]));
+ }
+
+ public int runInitialize(String message) {
+ return runEclipse(message, new String[] {"-initialize"});
}
public int runDirectorToUpdate(String message, String sourceRepo, String iuToInstall, String iuToUninstall) {
- File root = new File(Activator.getBundleContext().getProperty("java.home"));
- root = new File(root, "bin");
- File exe = new File(root, "javaw.exe");
- if (!exe.exists())
- exe = new File(root, "java");
- String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "-consoleLog", "-console", "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), "-repository", sourceRepo, "-installIU", iuToInstall, "-uninstallIU", iuToUninstall, "-vmArgs", "-Dosgi.checkConfiguration=true"};
- // command-line if you want to run and allow a remote debugger to connect
- //String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), "-repository", sourceRepo, "-installIU", iuToInstall, "-uninstallIU", iuToUninstall, "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"};
- return run(message, command);
+ return runEclipse(message, new String[] {"-application", "org.eclipse.equinox.p2.director", "-repository", sourceRepo, "-installIU", iuToInstall, "-uninstallIU", iuToUninstall});
}
public int runDirectorToRevert(String message, String sourceRepo, String timestampToRevertTo) {
- File root = new File(Activator.getBundleContext().getProperty("java.home"));
- root = new File(root, "bin");
- File exe = new File(root, "javaw.exe");
- if (!exe.exists())
- exe = new File(root, "java");
- String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "-consoleLog", "-console", "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), "-repository", sourceRepo, "-revert", timestampToRevertTo, "-vmArgs", "-Dosgi.checkConfiguration=true"};
- // command-line if you want to run and allow a remote debugger to connect
- //String[] command = new String[] {(new File(output, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.director", "-vm", exe.getAbsolutePath(), "-repository", sourceRepo, "-revert", timestampToRevertTo, "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"};
- return run(message, command);
+ return runEclipse(message, new String[] {"-application", "org.eclipse.equinox.p2.director", "-repository", sourceRepo, "-revert", timestampToRevertTo});
+ }
+
+ public int runDirectorToInstall(String message, File installFolder, String sourceRepo, String iuToInstall) {
+ String[] command = new String[] {//
+ "-application", "org.eclipse.equinox.p2.director", //
+ "-repository", sourceRepo, "-installIU", iuToInstall, //
+ "-destination", installFolder.getAbsolutePath(), //
+ "-bundlepool", installFolder.getAbsolutePath(), //
+ "-roaming", "-profile", "PlatformProfile", "-profileProperties", "org.eclipse.update.install.features=true", //
+ "-p2.os", Platform.getOS(), "-p2.ws", Platform.getWS(), "-p2.arch", Platform.getOSArch()};
+ return runEclipse(message, command);
}
public int runVerifierBundle(File destination) {
if (destination == null)
destination = output;
String message = "Running the verifier bundle at: " + destination;
- File root = new File(Activator.getBundleContext().getProperty("java.home"));
- root = new File(root, "bin");
- File exe = new File(root, "javaw.exe");
- if (!exe.exists())
- exe = new File(root, "java");
- String[] command = new String[] {(new File(destination, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-consoleLog", "-dev", "bin", "-nosplash", "-application", "org.eclipse.equinox.p2.tests.verifier.application", "-vm", exe.getAbsolutePath(), "-vmArgs", "-Dosgi.checkConfiguration=true"};
- // command-line if you want to run and allow a remote debugger to connect
- //String[] command = new String[] {(new File(destination, "eclipse/eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-application", "org.eclipse.equinox.p2.tests.verifier.application", "-vm", exe.getAbsolutePath(), "-vmArgs", "-Dosgi.checkConfiguration=true", "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"};
- return run(message, command);
+ return runEclipse(message, new String[] {"-application", "org.eclipse.equinox.p2.tests.verifier.application"});
}
public int installAndRunVerifierBundle(File destination) {

Back to the top