Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2011-05-10 14:27:25 +0000
committerPascal Rapicault2011-05-10 14:27:25 +0000
commit120d8051fdffddf067bc3b60bfb5390a9a6df52f (patch)
tree884d9590c08ba6c04073da53a9ef73c86516b64c /bundles/org.eclipse.equinox.p2.tests.ui/src
parent47e1d43cc64c2b74eabf89b5d186cd156ee7efa5 (diff)
downloadrt.equinox.p2-120d8051fdffddf067bc3b60bfb5390a9a6df52f.tar.gz
rt.equinox.p2-120d8051fdffddf067bc3b60bfb5390a9a6df52f.tar.xz
rt.equinox.p2-120d8051fdffddf067bc3b60bfb5390a9a6df52f.zip
Bug 336015 - [ui] ProvisioningOperationWizard will not use ProfileChangeOperation
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java44
1 files changed, 39 insertions, 5 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 2d9134a69..2722523ee 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
@@ -10,18 +10,17 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.dialogs;
-import org.eclipse.equinox.p2.metadata.MetadataFactory;
-import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
-
+import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.equinox.internal.p2.metadata.License;
import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.dialogs.*;
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
import org.eclipse.equinox.p2.metadata.*;
-import org.eclipse.equinox.p2.operations.InstallOperation;
-import org.eclipse.equinox.p2.operations.ProfileModificationJob;
+import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
+import org.eclipse.equinox.p2.operations.*;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizardPage;
@@ -99,6 +98,41 @@ public class InstallWizardTest extends WizardTest {
}
}
+ public void testInstallWizard() 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);
+ ProvisioningWizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ ProfileModificationJob longOp = null;
+
+ try {
+ SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
+ // should already have a plan
+ assertTrue("1.0", page1.isPageComplete());
+ // simulate the next button by getting next page and showing
+ InstallWizardPage page = (InstallWizardPage) page1.getNextPage();
+
+ // get the operation
+ Field opField = ResolutionResultsWizardPage.class.getDeclaredField("resolvedOperation");
+ opField.setAccessible(true);
+ assertTrue("Expected instance of MyNewInstallOperation", opField.get(page) instanceof MyNewInstallOperation);
+ } 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);
+ }
+ }
+
/**
* Tests the wizard
*/

Back to the top