diff options
author | Pascal Rapicault (Ericsson) | 2013-04-06 00:17:16 +0000 |
---|---|---|
committer | Pascal Rapicault | 2013-04-06 00:17:16 +0000 |
commit | f1234380acbcaa417f903667243d9441cda35fa6 (patch) | |
tree | fcb6c4e95bfb43c5f416b88b8253d80b203a7f21 /bundles/org.eclipse.equinox.p2.tests.verifier | |
parent | cacedf0145c6fc46e417a2cfe5960c4913562e38 (diff) | |
download | rt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.tar.gz rt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.tar.xz rt.equinox.p2-f1234380acbcaa417f903667243d9441cda35fa6.zip |
New test cases and simple refactoring to accomodate those
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.verifier')
2 files changed, 58 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/MigrationWizardTestHelper.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/MigrationWizardTestHelper.java new file mode 100644 index 000000000..49635a008 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/MigrationWizardTestHelper.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.internal.p2.tests.verifier; + +import java.net.URI; +import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.MigrationSupport; +import org.eclipse.equinox.p2.engine.IProfile; + +public class MigrationWizardTestHelper extends MigrationSupport { + //Variable that keeps track if the wizard has been requested to open + public boolean wizardOpened = false; + + @Override + protected void openMigrationWizard(IProfile inputProfile, URI[] reposToMigrate) { + wizardOpened = true; + } + +} 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 d8ad7f105..2527e5f64 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 @@ -281,7 +281,7 @@ public class VerifierApplication implements IApplication { IProfile profile = registry.getProfile(IProfileRegistry.SELF); if (profile == null) return createError("SELF profile not available in profile registry."); //$NON-NLS-1$ - if (!Boolean.FALSE.toString().equals(properties.get("checkPresenceOfVerifier"))) { + if (properties.get("checkPresenceOfVerifier") != null && !Boolean.FALSE.toString().equals(properties.get("checkPresenceOfVerifier"))) { IQueryResult results = profile.query(QueryUtil.createIUQuery(Activator.PLUGIN_ID), null); if (results.isEmpty()) return createError(NLS.bind("IU for {0} not found in SELF profile.", Activator.PLUGIN_ID)); //$NON-NLS-1$ @@ -322,6 +322,11 @@ public class VerifierApplication implements IApplication { if (!temp.isOK()) result.merge(temp); + temp = checkMigrationWizard(); + if (!temp.isOK()) + result.merge(temp); + + assumeMigrated(); return result; } @@ -412,4 +417,31 @@ public class VerifierApplication implements IApplication { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The flag indicating that a profile has been reset is incorrectly setup"); } + + private IStatus checkMigrationWizard() { + if (properties.getProperty("checkMigrationWizard") == null) + return Status.OK_STATUS; + + IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); + IProfile profile = reg.getProfile(IProfileRegistry.SELF); + + //Fake the opening of the wizard + MigrationWizardTestHelper migrationSupport = new MigrationWizardTestHelper(); + migrationSupport.performMigration(agent, reg, profile); + + boolean wizardExpectedToOpen = Boolean.parseBoolean(properties.getProperty("checkMigrationWizard.open")); + if (migrationSupport.wizardOpened == wizardExpectedToOpen) + return Status.OK_STATUS; + + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The migration wizard did " + (wizardExpectedToOpen ? "not" : "") + " open"); + } + + private void assumeMigrated() { + if (properties.getProperty("checkMigrationWizard.simulate.reinstall") == null) + return; + + IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); + IProfile profile = reg.getProfile(IProfileRegistry.SELF); + new MigrationWizardTestHelper().rememberMigrationCompleted(profile.getProfileId()); + } } |