Author: dazarov
Date: 2009-01-26 12:58:58 -0500 (Mon, 26 Jan 2009)
New Revision: 13276
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java
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/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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,11 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class CssClassNewWizardTest extends TestCase {
+public class CssClassNewWizardTest extends WizardTest {
+ public CssClassNewWizardTest(){
+ super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
+ }
public void testCssClassNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssFileNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,11 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class CssFileNewWizardTest extends TestCase {
+public class CssFileNewWizardTest extends WizardTest {
+ public CssFileNewWizardTest(){
+ super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSFileWizard");
+ }
public void testCssFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ 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-01-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/FacesConfigNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,95 +1,47 @@
package org.jboss.tools.jsf.ui.test;
-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.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
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;
-public class FacesConfigNewWizardTest extends TestCase {
- private IProject project;
+
+public class FacesConfigNewWizardTest extends WizardTest {
+ public FacesConfigNewWizardTest(){
+ super("org.jboss.tools.jsf.ui.wizard.newfile.NewFacesConfigFileWizard");
+ }
-// @Override
-// protected void setUp() throws Exception {
-// super.setUp();
-//
-// project =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("TestWizards");
-// if(project == null) {
-// ProjectImportTestSetup setup = new ProjectImportTestSetup(
-// this,
-// "org.jboss.tools.jsf.ui.test",
-// "projects/TestWizards",
-// "TestWizards");
-// project = setup.importProject();
-// }
-// this.project = project.getProject();
-//
-// JobUtils.waitForIdle();
-// }
-
-// @Override
-// protected void tearDown() throws Exception {
-// boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
-// try {
-// JobUtils.waitForIdle();
-// if(project != null){
-// project.close(new NullProgressMonitor());
-// project.delete(true, new NullProgressMonitor());
-// project = null;
-// JobUtils.waitForIdle();
-// }
-// } finally {
-// ResourcesUtils.setBuildAutomatically(saveAutoBuild);
-// }
-//
-// }
-
public void testNewFacesConfigNewWizardIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.jsf.ui.wizard.newfile.NewFacesConfigFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
public void testFacesConfigNewWizardValidation() {
+ IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+
+
+ System.out.println("Wizard - "+wizard.getClass());
+ 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
- fail("Not implemented yet");
}
public void testFacesConfigNewWizardResults() {
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/HtmlFileNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,12 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class HtmlFileNewWizardTest extends TestCase {
+public class HtmlFileNewWizardTest extends WizardTest {
+ public HtmlFileNewWizardTest(){
+ super("org.jboss.tools.common.model.ui.wizard.newfile.NewHTMLFileWizard");
+ }
+
public void testHtmlFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.common.model.ui.wizard.newfile.NewHTMLFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsFileNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,12 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class JsFileNewWizardTest extends TestCase {
+public class JsFileNewWizardTest extends WizardTest {
+ public JsFileNewWizardTest(){
+ super("org.jboss.tools.jst.web.ui.wizards.newfile.NewJSFileWizard");
+ }
+
public void testJsFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.jst.web.ui.wizards.newfile.NewJSFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JspFileNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,12 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class JspFileNewWizardTest extends TestCase {
+public class JspFileNewWizardTest extends WizardTest {
+ public JspFileNewWizardTest(){
+ super("org.jboss.tools.common.model.ui.wizard.newfile.NewJSPFileWizard");
+ }
+
public void testJspFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.common.model.ui.wizard.newfile.NewJSPFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/PropertiesNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,12 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class PropertiesNewWizardTest extends TestCase {
+public class PropertiesNewWizardTest extends WizardTest {
+ public PropertiesNewWizardTest(){
+ super("org.jboss.tools.common.model.ui.wizard.newfile.NewPropertiesFileWizard");
+ }
+
public void testPropertiesFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.common.model.ui.wizard.newfile.NewPropertiesFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}
Added:
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
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -0,0 +1,78 @@
+package org.jboss.tools.jsf.ui.test;
+
+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.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+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;
+
+public abstract class WizardTest extends TestCase {
+ protected String id;
+ private IProject project;
+
+ public WizardTest(String id){
+ this.id = id;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ project =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("TestWizards");
+ if(project == null) {
+ ProjectImportTestSetup setup = new ProjectImportTestSetup(
+ this,
+ "org.jboss.tools.jsf.ui.test",
+ "projects/TestWizards",
+ "TestWizards");
+ project = setup.importProject();
+ }
+ this.project = project.getProject();
+ System.out.println("Project - "+project);
+ JobUtils.waitForIdle();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ try {
+ JobUtils.waitForIdle();
+ if(project != null){
+ project.close(new NullProgressMonitor());
+ project.delete(true, new NullProgressMonitor());
+ project = null;
+ JobUtils.waitForIdle();
+ }
+ } finally {
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+
+ }
+
+ public void wizardIsCreated() {
+ IWizard wizard = WorkbenchUtils.findWizardByDefId(id);
+
+ WizardDialog dialog = new WizardDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ wizard);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ try {
+ IWizardPage startPage = wizard.getStartingPage();
+ assertNotNull(startPage);
+ }catch(Exception ex){
+ fail(ex.getMessage());
+ } finally {
+ dialog.close();
+ }
+
+ }
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/WizardTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-26
15:58:57 UTC (rev 13275)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/XhtmlFileNewWizardTest.java 2009-01-26
17:58:58 UTC (rev 13276)
@@ -1,31 +1,12 @@
package org.jboss.tools.jsf.ui.test;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.util.WorkbenchUtils;
-import junit.framework.TestCase;
-
-public class XhtmlFileNewWizardTest extends TestCase {
+public class XhtmlFileNewWizardTest extends WizardTest {
+ public XhtmlFileNewWizardTest(){
+ super("org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard");
+ }
+
public void testXhtmlFileNewWizardTestIsCreated() {
- IWizard
- aWizard =
WorkbenchUtils.findWizardByDefId("org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard");
-
- WizardDialog dialog = new WizardDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- aWizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- try {
- IWizardPage startPage = aWizard.getStartingPage();
- assertNotNull(startPage);
- }catch(Exception ex){
- fail(ex.getMessage());
- } finally {
- dialog.close();
- }
-
+ wizardIsCreated();
}
}