[jbosstools-commits] JBoss Tools SVN: r21853 - trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon May 3 09:57:35 EDT 2010


Author: mareshkau
Date: 2010-05-03 09:57:35 -0400 (Mon, 03 May 2010)
New Revision: 21853

Modified:
   trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6216, https://jira.jboss.org/jira/browse/JBIDE-6190

Modified: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java	2010-05-03 11:31:35 UTC (rev 21852)
+++ trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java	2010-05-03 13:57:35 UTC (rev 21853)
@@ -10,15 +10,25 @@
  ******************************************************************************/ 
 package org.jboss.tools.jst.web.ui.test;
 
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.jboss.tools.common.model.ui.test.AbstractModelNewWizardTest;
 import org.jboss.tools.common.model.ui.wizard.newfile.NewHTMLFileWizard;
 import org.jboss.tools.common.model.ui.wizard.newfile.NewJSPFileWizard;
 import org.jboss.tools.common.model.ui.wizard.newfile.NewPropertiesFileWizard;
+import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
 import org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSFileWizard;
 import org.jboss.tools.jst.web.ui.wizards.newfile.NewJSFileWizard;
 import org.jboss.tools.jst.web.ui.wizards.newfile.NewTLDFileWizard;
 import org.jboss.tools.jst.web.ui.wizards.newfile.NewWebFileWizard;
 import org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard;
+import org.jboss.tools.test.util.WorkbenchUtils;
 
 /**
  * @author eskimo
@@ -41,9 +51,38 @@
 	public void testNewJspWizardInstanceIsCreated() {
 		testNewWizardInstanceIsCreated(NewJSPFileWizard.class.getName());
 	}
-	
+	//rewritten by Maksim Areshkau, as fix for https://jira.jboss.org/jira/browse/JBIDE-6216,
+	//https://jira.jboss.org/jira/browse/JBIDE-6190
 	public void testNewXhtmlWizardInstanceIsCreated() {
-		testNewWizardInstanceIsCreated(NewXHTMLWizard.class.getName());
+		//commented by Maksim Areshkau, because in this methid not called
+		//init for wizard
+		//testNewWizardInstanceIsCreated(NewXHTMLWizard.class.getName());
+		IWorkbenchWizard 
+		aWizard = (IWorkbenchWizard) WorkbenchUtils.findWizardByDefId(
+				NewXHTMLWizard.class.getName());
+		WizardDialog dialog = new WizardDialog(
+				PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+				aWizard);
+		try {
+			//here we show view to get initialized selection
+			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.jdt.ui.PackageExplorer"); //$NON-NLS-1$
+		} catch (PartInitException e) {
+			fail(e.toString());
+		}
+	    ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+		ISelection eclipseSelection = selectionService.getSelection();
+		aWizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) eclipseSelection);
+	    dialog.setBlockOnOpen(false);
+		try {
+			dialog.open();
+			IWizardPage htmlWizardNewFileCreationPage = dialog.getCurrentPage();
+			assertEquals("The Page should be","HTMLWizardNewFileCreationPage", htmlWizardNewFileCreationPage.getName());  //$NON-NLS-1$//$NON-NLS-2$
+			IWizardPage newXHTMLTemplatesWizardPage=htmlWizardNewFileCreationPage.getNextPage();
+			assertEquals("The Page should be","NewXHTMLTemplatesWizardPage", newXHTMLTemplatesWizardPage.getName());  //$NON-NLS-1$//$NON-NLS-2$
+			assertTrue("Start page is not loaded",newXHTMLTemplatesWizardPage.getNextPage() instanceof DefaultStandardStep); //$NON-NLS-1$
+		} finally {
+			dialog.close();
+		}
 	}
 	
 	public void testNewHtmlWizardInstanceIsCreated() {



More information about the jbosstools-commits mailing list