Author: dazarov
Date: 2010-11-12 04:55:55 -0500 (Fri, 12 Nov 2010)
New Revision: 26497
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/PropertiesNewWizardTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7560
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 2010-11-12
09:53:22 UTC (rev 26496)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2010-11-12
09:55:55 UTC (rev 26497)
@@ -5,7 +5,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
@@ -25,21 +24,19 @@
}
public void testCssClassNewWizardTestIsCreated() {
- needClose = false;
wizardIsCreated();
}
public void testCssClassNewWizardValidation() {
- IWizard wizard = getWizard();
+ wizard = getWizard();
boolean canFinish = wizard.canFinish();
assertFalse("Finish button is enabled at first wizard page.", canFinish);
//$NON-NLS-1$
- wizard.performCancel();
}
public void testCssClassNewWizardValidation2() {
- IWizard wizard = getWizardOnProject();
+ wizard = getWizardOnProject();
boolean canFinish = wizard.canFinish();
@@ -65,17 +62,15 @@
// Assert Finish button is disabled and error is present if
// Folder field is correct
// Name field contains file name that already exists
- wizard.performCancel();
}
public void testCssClassEditing() {
-
ArrayList<IResource> list = new ArrayList<IResource>();
IResource cssFile = project.findMember(CSS_FILE_PATH);
assertNotNull(cssFile);
list.add(cssFile);
StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
@@ -122,7 +117,6 @@
assertFalse("Finish button is not disabled.", wizard.canFinish());
//$NON-NLS-1$
wizard.getContainer().showPage(wizard.getNextPage(wizard.getContainer().getCurrentPage()));
assertTrue("Finish button is disabled.", wizard.canFinish()); //$NON-NLS-1$
- wizard.performCancel();
}
public void testCssClassWithEditor() {
@@ -139,7 +133,7 @@
// assertNotNull(cssFile);
// list.add(cssFile);
// StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
//
// ((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
@@ -147,9 +141,6 @@
.getActiveWorkbenchWindow().getShell(), wizard);
dialog.setBlockOnOpen(false);
dialog.open();
-
- wizard.performCancel();
-
}
}
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 2010-11-12
09:53:22 UTC (rev 26496)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java 2010-11-12
09:55:55 UTC (rev 26497)
@@ -7,7 +7,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.PlatformUI;
@@ -29,12 +28,11 @@
}
public void _testFacesConfigNewWizardValidation() {
- IWizard wizard = getWizard();
+ wizard = getWizard();
boolean canFinish = wizard.canFinish();
assertFalse("Finish button is enabled at first wizard page.", canFinish);
- wizard.performCancel();
}
public void testFacesConfigNewWizardValidation2() {
@@ -46,7 +44,7 @@
StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
NewFileWizardEx wiz = (NewFileWizardEx)wizard;
@@ -68,13 +66,11 @@
// Assert file with name from Name field created in folder with name form Folder field
-
boolean canFinish = wizard.canFinish();
assertTrue("Finish button is disabled.", canFinish);
wizard.performFinish();
- dialog.close();
JobUtils.waitForIdle();
@@ -103,7 +99,7 @@
StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
NewFileWizardEx wiz = (NewFileWizardEx)wizard;
@@ -148,6 +144,5 @@
int p = webXmlContent.indexOf("faces-config22.xml");
assertTrue("File faces-config22.xml is not registered in web.xml", p >=
0);
- dialog.close();
}
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/PropertiesNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/PropertiesNewWizardTest.java 2010-11-12
09:53:22 UTC (rev 26496)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/PropertiesNewWizardTest.java 2010-11-12
09:55:55 UTC (rev 26497)
@@ -1,7 +1,6 @@
package org.jboss.tools.jsf.ui.test;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.wizard.IWizard;
import org.jboss.tools.test.util.JobUtils;
@@ -15,7 +14,7 @@
}
public void testPropertiesFileNewWizardValidation() {
- IWizard wizard = getWizard();
+ wizard = getWizard();
boolean canFinish = wizard.canFinish();
@@ -28,7 +27,7 @@
public void testPropertiesFileNewWizardResults() {
// Assert file with name from Name field created in folder with name form Folder field
- IWizard wizard = getWizardOnProject("aaa");
+ wizard = getWizardOnProject("aaa");
boolean canFinish = wizard.canFinish();
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 2010-11-12
09:53:22 UTC (rev 26496)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java 2010-11-12
09:55:55 UTC (rev 26497)
@@ -14,17 +14,16 @@
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
import org.jboss.tools.common.model.ui.wizard.newfile.NewFileContextEx;
import org.jboss.tools.common.model.ui.wizard.newfile.NewFileWizardEx;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSClassDialog;
import org.jboss.tools.test.util.WorkbenchUtils;
public abstract class WizardTest extends TestCase {
protected String id;
protected IProject project;
protected boolean projectRemovalRequired = false;
+
+ protected IWizard wizard;
protected WizardDialog dialog;
- protected boolean needClose = true;
-
public WizardTest(String id){
this.id = id;
}
@@ -37,8 +36,13 @@
}
+ protected void tearDown() throws Exception {
+ close();
+ }
+
+
public void wizardIsCreated() {
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
ArrayList<IProject> list = new ArrayList<IProject>();
@@ -61,14 +65,11 @@
}catch(Exception ex){
ex.printStackTrace();
fail(ex.getMessage());
- }finally{
- if(needClose)
- dialog.close();
}
}
public IWizard getWizard(){
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
ArrayList<IProject> list = new ArrayList<IProject>();
@@ -86,7 +87,7 @@
}
public IWizard getWizard(String folder, String name){
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
NewFileWizardEx wiz = (NewFileWizardEx)wizard;
@@ -119,7 +120,7 @@
StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), selection);
@@ -139,7 +140,7 @@
StructuredSelection selection = new StructuredSelection(list);
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ wizard = WorkbenchUtils.findWizardByDefId(id);
NewFileWizardEx wiz = (NewFileWizardEx)wizard;
@@ -161,7 +162,7 @@
}
protected void validateFolderAndName(){
- IWizard wizard = getWizardOnProject("aaa");
+ wizard = getWizardOnProject("aaa");
boolean canFinish = wizard.canFinish();
@@ -169,7 +170,7 @@
// Assert Finish button is enabled by default if wizard is called on Project
assertTrue("Finish button is disabled at first wizard page.", canFinish);
- wizard.performCancel();
+ close();
// Assert Finish button is disabled and error is present if
// Folder field is empty
@@ -179,7 +180,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when folder field is empty.",
canFinish);
- wizard.performCancel();
+ close();
// Assert Finish button is disabled and error is present if
@@ -190,7 +191,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when folders field points to folder that
does not exist", canFinish);
- wizard.performCancel();
+ close();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -200,7 +201,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field is empty.",
canFinish);
- wizard.performCancel();
+ close();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -210,7 +211,7 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field contains forbiden
characters.", canFinish);
- wizard.performCancel();
+ close();
// Assert Finish button is disabled and error is present if
// Folder field is correct
@@ -220,6 +221,17 @@
canFinish = wizard.canFinish();
assertFalse("Finish button is enabled when name field contains file name that
already exists.", canFinish);
- wizard.performCancel();
+ close();
}
+
+ private void close(){
+ if(wizard != null){
+ wizard.performCancel();
+ wizard = null;
+ }
+ if(dialog != null){
+ dialog.close();
+ dialog = null;
+ }
+ }
}