Author: dazarov
Date: 2009-02-17 13:29:19 -0500 (Tue, 17 Feb 2009)
New Revision: 13642
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3500
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2009-02-17
16:11:08 UTC (rev 13641)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2009-02-17
18:29:19 UTC (rev 13642)
@@ -7,7 +7,9 @@
public CssClassNewWizardTest(){
super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
}
+
public void testCssClassNewWizardTestIsCreated() {
+ needClose = false;
wizardIsCreated();
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java 2009-02-17
16:11:08 UTC (rev 13641)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java 2009-02-17
18:29:19 UTC (rev 13642)
@@ -73,7 +73,7 @@
wizard.performFinish();
- dialog.close();
+ //dialog.close();
JobUtils.waitForIdle();
@@ -111,7 +111,7 @@
((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), selection);
- support.setAttributeValue(0, "name", "faces-config22");
+ support.setAttributeValue(0, "name", "faces-config11");
support.setAttributeValue(0, "folder",
"/TestWizards/WebContent/WEB-INF");
support.setAttributeValue(0, "register in web.xml", "yes");
@@ -123,6 +123,8 @@
boolean canFinish = wizard.canFinish();
+ System.out.println("Message - "+dialog.getCurrentPage().getErrorMessage());
+
assertTrue("Finish button is disabled.", canFinish);
wizard.performFinish();
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java 2009-02-17
16:11:08 UTC (rev 13641)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java 2009-02-17
18:29:19 UTC (rev 13642)
@@ -5,8 +5,6 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
@@ -17,9 +15,7 @@
import org.jboss.tools.common.model.ui.wizard.newfile.NewFileContextEx;
import org.jboss.tools.common.model.ui.wizard.newfile.NewFileWizardEx;
import org.jboss.tools.common.util.WorkbenchUtils;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.jst.jsp.outline.cssdialog.CSSClassDialog;
public abstract class WizardTest extends TestCase {
protected String id;
@@ -27,6 +23,8 @@
protected boolean projectRemovalRequired = false;
protected WizardDialog dialog;
+ protected boolean needClose = true;
+
public WizardTest(String id){
this.id = id;
}
@@ -34,43 +32,50 @@
@Override
protected void setUp() throws Exception {
super.setUp();
-
+
project = new TestWizardsProject().importProject();
}
-
+
public void wizardIsCreated() {
IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ ArrayList<IProject> list = new ArrayList<IProject>();
+
+ StructuredSelection selection = new StructuredSelection(list);
+
+ ((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), selection);
+
dialog = new WizardDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard);
dialog.setBlockOnOpen(false);
+
dialog.open();
-// System.out.println("\nWizard ID - "+id);
-// System.out.println("Wizard Class - "+wizard.getClass());
-//
-// System.out.println("Pages - "+wizard.getPages().length);
-//
-// for(int i = 0; i < wizard.getPages().length;i++){
-// System.out.println("Wizard Page Class -
"+wizard.getPages()[i].getClass());
-// }
-
try {
IWizardPage startPage = wizard.getStartingPage();
assertNotNull(startPage);
+
+
}catch(Exception ex){
+ ex.printStackTrace();
fail(ex.getMessage());
- } finally {
- dialog.close();
+ }finally{
+ if(needClose)
+ dialog.close();
}
-
}
public IWizard getWizard(){
IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ ArrayList<IProject> list = new ArrayList<IProject>();
+
+ StructuredSelection selection = new StructuredSelection(list);
+
+ ((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), selection);
+
dialog = new WizardDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard);
@@ -164,7 +169,7 @@
// Assert Finish button is enabled by default if wizard is called on Project
assertTrue("Finish button is disabled at first wizard page.", canFinish);
- dialog.close();
+ wizard.performCancel();
// Assert Finish button is disabled and error is present if
// Folder field is empty
@@ -174,7 +179,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when folder field is empty.",
canFinish);
- dialog.close();
+ wizard.performCancel();
// Assert Finish button is disabled and error is present if
@@ -185,7 +190,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when folders field points to folder that
does not exist", canFinish);
- dialog.close();
+ wizard.performCancel();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -195,7 +200,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field is empty.",
canFinish);
- dialog.close();
+ wizard.performCancel();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -205,7 +210,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field contains forbiden
characters.", canFinish);
- dialog.close();
+ wizard.performCancel();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -215,6 +220,6 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field contains file name that
already exists.", canFinish);
- dialog.close();
+ wizard.performCancel();
}
}