Author: dgolovin
Date: 2009-11-12 19:20:55 -0500 (Thu, 12 Nov 2009)
New Revision: 18675
Modified:
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java
Log:
test for archives view and new jar wizard
Modified:
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java
===================================================================
---
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java 2009-11-12
23:27:11 UTC (rev 18674)
+++
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java 2009-11-13
00:20:55 UTC (rev 18675)
@@ -5,17 +5,22 @@
import org.eclipse.core.commands.IParameter;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ISetSelectionTarget;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
import org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard;
import org.jboss.ide.eclipse.archives.ui.wizards.pages.ArchiveInfoWizardPage;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.WorkbenchUtils;
@@ -25,27 +30,32 @@
@Override
protected void setUp() throws Exception {
- project =
ResourcesPlugin.getWorkspace().getRoot().getProject("archives-example");
-// IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage();
-// IViewPart view= page.showView(IPageLayout.ID_RES_NAV);
-// if (view instanceof ISetSelectionTarget) {
-// ISelection selection= new StructuredSelection(resource);
-// ((ISetSelectionTarget)view).selectReveal(selection);
-// }
+ project =
ResourcesPlugin.getWorkspace().getRoot().getProject("archive-test");
+ IWorkbenchPage page=
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ IViewPart view= page.showView(IPageLayout.ID_RES_NAV);
+ if (view instanceof ISetSelectionTarget) {
+ ISelection selection= new StructuredSelection(project);
+ ((ISetSelectionTarget)view).selectReveal(selection);
+ }
}
- public void testJarWizardIsOpened() {
- IWizard
+ public void testJarWizardIsOpened() throws PartInitException {
+ NewJARWizard
aWizard = new NewJARWizard();
WizardDialog dialog = new WizardDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
aWizard);
- dialog.setBlockOnOpen(false);
- dialog.create();
+ dialog.setBlockOnOpen(false);
+ aWizard.init(PlatformUI.getWorkbench(), new StructuredSelection(project));
try {
- ArchiveInfoWizardPage page = (ArchiveInfoWizardPage)dialog.getSelectedPage();
-
+ dialog.create();
+ dialog.open();
+ ArchiveInfoWizardPage page1 = (ArchiveInfoWizardPage)dialog.getSelectedPage();
+ assertTrue(page1.isPageComplete());
+ assertTrue(aWizard.canFinish());
+ aWizard.performFinish();
} finally {
dialog.close();
}