Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2011-01-19 17:00:19 -0500
committerDJ Houghton2011-01-19 17:00:19 -0500
commit3878170337fa4d297b73e44ed46155cbc3db25a5 (patch)
treea62353e2ad6512b559d09d0eda9782198288a8d1
parent399a463c78ff025543a7c04b35394fe5f9777430 (diff)
downloadrt.equinox.p2-3878170337fa4d297b73e44ed46155cbc3db25a5.tar.gz
rt.equinox.p2-3878170337fa4d297b73e44ed46155cbc3db25a5.tar.xz
rt.equinox.p2-3878170337fa4d297b73e44ed46155cbc3db25a5.zip
Bug 324962 - [tests] Add test to update from 3.6 to 3.7.
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AllTests.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/From36to37.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java73
3 files changed, 124 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AllTests.java
index 896914599..f06db4f90 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,10 +20,10 @@ public class AllTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
suite.addTestSuite(End2EndTest.class);
-
- //TODO upgrade these tests to exercise 3.6->3.7 scenarios. See bug 324962
// suite.addTest(From35to36.suite());
// suite.addTest(Install36from35.suite());
+ suite.addTest(From36to37.suite());
+ suite.addTest(Install37from36.suite());
return suite;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/From36to37.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/From36to37.java
new file mode 100644
index 000000000..2bb43d744
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/From36to37.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.full;
+
+import java.io.File;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
+import org.eclipse.equinox.p2.tests.reconciler.dropins.AbstractReconcilerTest;
+import org.eclipse.equinox.p2.tests.reconciler.dropins.ReconcilerTestSuite;
+
+public class From36to37 extends AbstractReconcilerTest {
+
+ public From36to37(String string) {
+ super(string);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new ReconcilerTestSuite("org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive");
+ suite.addTest(new From36to37("from36To37"));
+ return suite;
+ }
+
+ public void from36To37() {
+ String currentBuildRepo = System.getProperty("org.eclipse.equinox.p2.tests.current.build.repo");
+ if (currentBuildRepo == null)
+ currentBuildRepo = "http://download.eclipse.org/eclipse/updates/3.7-I-builds";
+ runInitialize("Initializing 3.6 to get the profile paths properly setup.");
+ SimpleProfileRegistry registry = new SimpleProfileRegistry(getAgent(), new File(output, "eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/"), null, false);
+ String initialTimestamp = Long.toString(registry.getProfile("PlatformProfile").getTimestamp());
+
+ //Take 3.6 archive, unzip, run it to update to 3.7
+ assertEquals(0, runDirectorToUpdate("Updating from 3.6 to 3.7", currentBuildRepo, "org.eclipse.platform.ide", "org.eclipse.platform.ide"));
+ assertEquals(0, installAndRunVerifierBundle(null));
+
+ // revert to 3.6
+ assertEquals(0, runDirectorToRevert("Reverting from 3.7 to 3.6", "http://download.eclipse.org/eclipse/updates/3.6", initialTimestamp));
+ assertEquals(0, installAndRunVerifierBundle35(null));
+ }
+}
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
new file mode 100644
index 000000000..f0fa72e21
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/Install37from36.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+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;
+
+//Install 3.7 using 3.6
+public class Install37from36 extends AbstractReconcilerTest {
+ public Install37from36(String string) {
+ 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"));
+ return suite;
+ }
+
+ public void install37From36() throws IOException {
+ //Create a new installation of 3.7 using 3.6
+ File installFolder = getTestFolder("install37From36");
+ System.out.println(installFolder);
+ int result = runDirectorToInstall("Installing 3.7 from 3.6", new File(installFolder, "eclipse"), "http://download.eclipse.org/eclipse/updates/3.7-I-builds", "org.eclipse.platform.ide");
+ if (result != 0) {
+ File logFile = new File(installFolder, "log.log");
+ if (logFile.exists()) {
+ StringBuffer fileContents = new StringBuffer();
+ BufferedReader reader = new BufferedReader(new FileReader(logFile));
+ while (reader.ready())
+ fileContents.append(reader.readLine());
+ reader.close();
+ fail("runDirector returned " + result + "\n" + fileContents.toString());
+ } else {
+ fail("runDirector returned " + result);
+ }
+ }
+ assertEquals(0, installAndRunVerifierBundle(installFolder));
+ }
+} \ No newline at end of file

Back to the top