Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHamdan Msheik2013-01-16 15:47:16 -0500
committerPascal Rapicault2013-01-22 09:44:37 -0500
commitb3f8ef311e27dc903d146ad6b89661a5fbcdaee8 (patch)
tree848a55bdf885d98869c2fa48a969d488b47bcf62 /bundles/org.eclipse.equinox.p2.tests.ui
parent33ca260a9e8a71cbbeda3bb311903e5c15d94332 (diff)
downloadrt.equinox.p2-b3f8ef311e27dc903d146ad6b89661a5fbcdaee8.tar.gz
rt.equinox.p2-b3f8ef311e27dc903d146ad6b89661a5fbcdaee8.tar.xz
rt.equinox.p2-b3f8ef311e27dc903d146ad6b89661a5fbcdaee8.zip
Bypass install license wizard page via plugin_customizationv20130122-144437
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java66
1 files changed, 64 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
index 2722523ee..936705c4c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2013 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
+ * Ericsson AB (Hamdan Msheik) - Bypass install license wizard page via plugin_customization
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.dialogs;
@@ -21,6 +22,7 @@ import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.ui.AcceptLicensesWizardPage;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizardPage;
@@ -127,6 +129,66 @@ public class InstallWizardTest extends WizardTest {
}
}
+ public void testInstallWizardWithoutLicenceBypass() throws Exception {
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ iusInvolved.add(toInstall);
+ InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved);
+ op.setProfileId(TESTPROFILE);
+ PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null);
+ wizard.setBypassLicencePage(false);
+ ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ ProfileModificationJob longOp = null;
+
+ try {
+ SelectableIUsPage selectableIUsPage = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
+ // should already have a plan
+ assertTrue("1.0", selectableIUsPage.isPageComplete());
+ // simulate the next button by getting next page and showing
+ InstallWizardPage installWizardPage = (InstallWizardPage) selectableIUsPage.getNextPage();
+
+ assertFalse("Licence page bypass flag must be false", wizard.isBypassLicencePage());
+ IWizardPage licensePage = installWizardPage.getNextPage();
+ assertTrue("Expected instance of AcceptLicensesWizardPage", licensePage instanceof AcceptLicensesWizardPage);
+
+ } finally {
+ dialog.getShell().close();
+ if (longOp != null)
+ longOp.cancel();
+ }
+ }
+
+ public void testInstallWizardWithLicenceBypass() throws Exception {
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ iusInvolved.add(toInstall);
+ InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved);
+ op.setProfileId(TESTPROFILE);
+ PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getProvisioningUI(), op, iusInvolved, null);
+ wizard.setBypassLicencePage(true);
+ ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ ProfileModificationJob longOp = null;
+
+ try {
+ SelectableIUsPage selectableIUsPage = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
+ // should already have a plan
+ assertTrue("1.0", selectableIUsPage.isPageComplete());
+ // simulate the next button by getting next page and showing
+ InstallWizardPage installWizardPage = (InstallWizardPage) selectableIUsPage.getNextPage();
+
+ assertTrue("Licence page bypass flag must be true", wizard.isBypassLicencePage());
+ IWizardPage licensePage = installWizardPage.getNextPage();
+ assertNull("Expected instance of AcceptLicensesWizardPage must be null", licensePage);
+
+ } finally {
+ dialog.getShell().close();
+ if (longOp != null)
+ longOp.cancel();
+ }
+ }
+
private static class MyNewInstallOperation extends InstallOperation {
public MyNewInstallOperation(ProvisioningSession session, Collection<IInstallableUnit> toInstall) {
super(session, toInstall);

Back to the top