summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-04-05 22:26:36 (EDT)
committerPascal Rapicault2013-04-08 07:55:49 (EDT)
commit60bd035f465db40a2168d713d86f51001aa91a41 (patch)
tree0207d7f61b3b943e9f9edd41c5a3df8952016f52
parentffb765137956d162e3596b5e835e4df33a521cdb (diff)
downloadrt.equinox.p2-60bd035f465db40a2168d713d86f51001aa91a41.zip
rt.equinox.p2-60bd035f465db40a2168d713d86f51001aa91a41.tar.gz
rt.equinox.p2-60bd035f465db40a2168d713d86f51001aa91a41.tar.bz2
Test cancellation logic
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/artifacts.jarbin667 -> 664 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/content.jarbin1416 -> 1435 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304051618.jarbin424 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304052215.jarbin0 -> 424 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304051618.jarbin408 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304052215.jarbin0 -> 407 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304051618.jarbin407 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304052215.jarbin0 -> 407 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304051618.jarbin21793 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304052215.jarbin0 -> 22440 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304051618.jarbin394 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304052215.jarbin0 -> 393 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304051618.jarbin393 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304052215.jarbin0 -> 392 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java10
19 files changed, 114 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
index c9a77e1..5e61517 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.tests.verifier.Activator
Export-Package: org.eclipse.equinox.internal.p2.tests.verifier;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.equinox.p2.core
+ org.eclipse.equinox.p2.core,
+ org.eclipse.equinox.p2.ui.sdk.scheduler;bundle-version="1.2.0",
+ org.eclipse.swt;bundle-version="3.102.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration,
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
index 2527e5f..70b8b7b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.tests.verifier;
import java.io.*;
+import java.net.URI;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
@@ -21,6 +22,7 @@ import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.ImportFromInstallationWizard_c;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
@@ -29,6 +31,7 @@ import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
import org.osgi.framework.Bundle;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -327,9 +330,23 @@ public class VerifierApplication implements IApplication {
result.merge(temp);
assumeMigrated();
+
+ handleWizardCancellation();
return result;
}
+ private void handleWizardCancellation() {
+ if (properties.getProperty("checkMigration.cancelAnswer") == null)
+ return;
+ new Display();
+ IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfile profile = reg.getProfile(IProfileRegistry.SELF);
+
+ ImportFromInstallationWizard_c wizardPage = new ImportFromInstallationWizard_c(profile, new URI[0]);
+ int cancelAnswer = Integer.parseInt(properties.getProperty("checkMigration.cancelAnswer"));
+ wizardPage.rememberCancellationDecision(cancelAnswer);
+ }
+
private IStatus checkSystemProperties() {
final String ABSENT_SYS_PROPERTY = "not.sysprop.";
final String PRESENT_SYS_PROPERTY = "sysprop.";
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java
index 53d6479..1d76fe1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java
@@ -24,6 +24,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(NeedsMigration.class);
suite.addTest(BaseChange.suite());
suite.addTest(BaseChangeWithoutUserChange.suite());
+ suite.addTest(Cancellation.suite());
suite.addTest(DoubleBaseChange.suite());
suite.addTest(MultipleChanges.suite());
suite.addTest(InstallInUserSpace.suite());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java
new file mode 100644
index 0000000..ec14372
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson AB 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:
+ * Ericsson AB - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.p2.tests.sharedinstall;
+
+import java.util.Properties;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.p2.tests.reconciler.dropins.ReconcilerTestSuite;
+
+public class Cancellation extends AbstractSharedInstallTest {
+
+ public static Test suite() {
+ TestSuite suite = new ReconcilerTestSuite();
+ suite.setName(Cancellation.class.getName());
+ suite.addTest(new Cancellation("testCancellation"));
+ return suite;
+ }
+
+ public Cancellation(String name) {
+ super(name);
+ }
+
+ public void testCancellation() {
+ if (!Platform.getOS().equals(Platform.OS_WIN32))
+ return;
+ assertInitialized();
+ setupReadOnlyInstall();
+ System.out.println(readOnlyBase);
+ System.out.println(userBase);
+
+ { //install verifier and something else in user and checks there are there
+ installFeature1AndVerifierInUser();
+ Properties verificationProperties = new Properties();
+
+ //no wizard should get opened
+ verificationProperties.setProperty("checkMigrationWizard", "true");
+ verificationProperties.setProperty("checkMigrationWizard.open", "false");
+ executeVerifier(verificationProperties);
+ }
+
+ { //Now change the base. Install the verifier in the base, and run the verifier as a user
+ installVerifierInBase();
+
+ Properties verificationProperties = new Properties();
+ verificationProperties.setProperty("checkMigrationWizard", "true");
+ verificationProperties.setProperty("checkMigrationWizard.open", "true");
+ verificationProperties.setProperty("checkMigration.cancelAnswer", "1"); //Cancel, but do later
+ executeVerifier(verificationProperties);
+ }
+
+ {
+ //Check again that the wizard opens, and this time tell it to not prompt again
+ Properties verificationProperties = new Properties();
+ verificationProperties.setProperty("checkMigrationWizard", "true");
+ verificationProperties.setProperty("checkMigrationWizard.open", "true");
+ verificationProperties.setProperty("checkMigration.cancelAnswer", "0"); //Don't prompt for migration again
+ executeVerifier(verificationProperties);
+ }
+
+ {
+ //Check again that we are not prompted anymore
+ Properties verificationProperties = new Properties();
+ verificationProperties.setProperty("checkMigrationWizard", "true");
+ verificationProperties.setProperty("checkMigrationWizard.open", "false");
+ executeVerifier(verificationProperties);
+ }
+
+ { //install something in the user, then install something in the base and verify that the wizard is opened again
+ installFeature1InUser();
+ installFeature2InBase();
+
+ Properties verificationProperties = new Properties();
+ verificationProperties.setProperty("checkMigrationWizard", "true");
+ verificationProperties.setProperty("checkMigrationWizard.open", "true");
+ executeVerifier(verificationProperties);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/artifacts.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/artifacts.jar
index a1c4cdb..1e39046 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/artifacts.jar
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/artifacts.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/content.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/content.jar
index 0f6ab92..87057b6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/content.jar
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/content.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304051618.jar
deleted file mode 100644
index 80687d3..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304052215.jar
new file mode 100644
index 0000000..81c140e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/Verifier_1.0.0.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304051618.jar
deleted file mode 100644
index edda04e..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304052215.jar
new file mode 100644
index 0000000..ca707ab
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature1_1.0.0.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304051618.jar
deleted file mode 100644
index c8065be..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304052215.jar
new file mode 100644
index 0000000..30f0987
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/features/p2TestFeature2_1.0.0.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304051618.jar
deleted file mode 100644
index e368ff1..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304052215.jar
new file mode 100644
index 0000000..26486ff
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/org.eclipse.equinox.p2.tests.verifier_1.0.100.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304051618.jar
deleted file mode 100644
index 4653648..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304052215.jar
new file mode 100644
index 0000000..a26f71b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle1_1.0.0.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304051618.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304051618.jar
deleted file mode 100644
index d128775..0000000
--- a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304051618.jar
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304052215.jar b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304052215.jar
new file mode 100644
index 0000000..c5dbbe6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/sharedInstall/repo/plugins/p2TestBundle2_1.0.0.201304052215.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
index 1c4c7e7..623ba4c 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/ImportFromInstallationWizard_c.java
@@ -142,11 +142,15 @@ public class ImportFromInstallationWizard_c extends InstallWizard implements IIm
}
public boolean performCancel() {
- boolean result = false;
String[] buttons = new String[] {IDialogConstants.YES_LABEL, ProvUIMessages.ImportFromInstallationPag_LATER_BUTTON, IDialogConstants.NO_LABEL};
MessageDialog dialog = new MessageDialog(getShell(), ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_TITLE, null, ProvUIMessages.ImportFromInstallationPage_CONFIRMATION_DIALOG, MessageDialog.QUESTION, buttons, 2);
- int answer = dialog.open();
+ return rememberCancellationDecision(dialog.open());
+ }
+
+ //Method public for test
+ public boolean rememberCancellationDecision(int answer) {
+ boolean result = false;
switch (answer) {
case -1 : // if the user closes the dialog without clicking any button.
break;
@@ -164,6 +168,6 @@ public class ImportFromInstallationWizard_c extends InstallWizard implements IIm
break;
}
return result;
-
}
+
}