Author: dazarov
Date: 2009-01-28 13:12:33 -0500 (Wed, 28 Jan 2009)
New Revision: 13309
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/CssFileNewWizardTest.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/HtmlFileNewWizardTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsFileNewWizardTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JspFileNewWizardTest.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
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/XhtmlFileNewWizardTest.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-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class CssClassNewWizardTest extends WizardTest {
public CssClassNewWizardTest(){
super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
@@ -8,4 +10,42 @@
public void testCssClassNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testCssClassNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testCssClassNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
+
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssFileNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssFileNewWizardTest.java 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssFileNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class CssFileNewWizardTest extends WizardTest {
public CssFileNewWizardTest(){
super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSFileWizard");
@@ -8,4 +10,41 @@
public void testCssFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testCssFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testCssFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}
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-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,13 @@
package org.jboss.tools.jsf.ui.test;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+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;
import org.jboss.tools.common.util.WorkbenchUtils;
@@ -14,10 +21,16 @@
}
public void testFacesConfigNewWizardValidation() {
- IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+ IWizard wizard = getWizardWithoutSelection();
+ boolean canFinish = wizard.canFinish();
- System.out.println("Wizard - "+wizard.getClass());
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testFacesConfigNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
boolean canFinish = wizard.canFinish();
// Assert Finish button is enabled by default if wizard is called on Project
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/HtmlFileNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/HtmlFileNewWizardTest.java 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/HtmlFileNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class HtmlFileNewWizardTest extends WizardTest {
public HtmlFileNewWizardTest(){
super("org.jboss.tools.common.model.ui.wizard.newfile.NewHTMLFileWizard");
@@ -9,4 +11,41 @@
public void testHtmlFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testHtmlFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testHtmlFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsFileNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsFileNewWizardTest.java 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsFileNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class JsFileNewWizardTest extends WizardTest {
public JsFileNewWizardTest(){
super("org.jboss.tools.jst.web.ui.wizards.newfile.NewJSFileWizard");
@@ -9,4 +11,41 @@
public void testJsFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testJsFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testJsFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JspFileNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JspFileNewWizardTest.java 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JspFileNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class JspFileNewWizardTest extends WizardTest {
public JspFileNewWizardTest(){
super("org.jboss.tools.common.model.ui.wizard.newfile.NewJSPFileWizard");
@@ -9,4 +11,41 @@
public void testJspFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testJspFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testJspFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}
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 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/PropertiesNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class PropertiesNewWizardTest extends WizardTest {
public PropertiesNewWizardTest(){
super("org.jboss.tools.common.model.ui.wizard.newfile.NewPropertiesFileWizard");
@@ -9,4 +11,41 @@
public void testPropertiesFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testPropertiesFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testPropertiesFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}
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-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,13 +1,20 @@
package org.jboss.tools.jsf.ui.test;
+import java.util.ArrayList;
+
+import javax.swing.text.View;
+
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;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.util.WorkbenchUtils;
import org.jboss.tools.test.util.JobUtils;
@@ -16,8 +23,10 @@
public abstract class WizardTest extends TestCase {
protected String id;
- private IProject project;
+ protected IProject project;
+ protected WizardDialog dialog;
+
public WizardTest(String id){
this.id = id;
}
@@ -36,12 +45,14 @@
project = setup.importProject();
}
this.project = project.getProject();
- System.out.println("Project - "+project);
JobUtils.waitForIdle();
}
@Override
protected void tearDown() throws Exception {
+ if(dialog != null)
+ dialog.close();
+
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
try {
JobUtils.waitForIdle();
@@ -60,11 +71,22 @@
public void wizardIsCreated() {
IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
- WizardDialog dialog = new WizardDialog(
+ dialog = new WizardDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard);
dialog.setBlockOnOpen(false);
+ //dialog.
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);
@@ -75,4 +97,36 @@
}
}
+
+ public IWizard getWizardWithoutSelection(){
+ IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+
+ dialog = new WizardDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ return wizard;
+ }
+
+ public IWizard getWizardOnProject(){
+ ArrayList<IProject> list = new ArrayList<IProject>();
+
+ list.add(project);
+
+ StructuredSelection selection = new StructuredSelection(list);
+
+ IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+
+ ((IWorkbenchWizard)wizard).init(PlatformUI.getWorkbench(), selection);
+
+ dialog = new WizardDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ return wizard;
+ }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/XhtmlFileNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/XhtmlFileNewWizardTest.java 2009-01-28
16:54:26 UTC (rev 13308)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/XhtmlFileNewWizardTest.java 2009-01-28
18:12:33 UTC (rev 13309)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.test;
+import org.eclipse.jface.wizard.IWizard;
+
public class XhtmlFileNewWizardTest extends WizardTest {
public XhtmlFileNewWizardTest(){
super("org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard");
@@ -9,4 +11,41 @@
public void testXhtmlFileNewWizardTestIsCreated() {
wizardIsCreated();
}
+
+ public void testXhtmlFileNewWizardValidation() {
+ IWizard wizard = getWizardWithoutSelection();
+
+ boolean canFinish = wizard.canFinish();
+
+ assertFalse("Finish button is enabled at first wizard page.", canFinish);
+ }
+
+ public void testXhtmlFileNewWizardValidation2() {
+ IWizard wizard = getWizardOnProject();
+
+ boolean canFinish = wizard.canFinish();
+
+ // Assert Finish button is enabled by default if wizard is called on Project
+ assertTrue("Finish button is disabled at first wizard page.", canFinish);
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
}