Author: sdzmitrovich
Date: 2008-01-09 08:17:09 -0500 (Wed, 09 Jan 2008)
New Revision: 5552
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
Log:
update junit (Divide JsfJbideTest)
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-01-09
13:09:05 UTC (rev 5551)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-01-09
13:17:09 UTC (rev 5552)
@@ -10,11 +10,12 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test;
-import org.eclipse.core.runtime.CoreException;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1467Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1501Test;
+
/**
* Class for testing all RichFaces components
*
@@ -29,7 +30,8 @@
TestSuite suite = new TestSuite("Tests for Vpe Jsf components"); //
$NON-NLS-1$
// $JUnit-BEGIN$
suite.addTestSuite(JsfComponentTest.class);
- suite.addTestSuite(JsfJbideTest.class);
+ suite.addTestSuite(JsfJbide1467Test.class);
+ suite.addTestSuite(JsfJbide1501Test.class);
//cleanUpTests();
// $JUnit-END$
return suite;
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2008-01-09
13:09:05 UTC (rev 5551)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2008-01-09
13:17:09 UTC (rev 5552)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test;
-import org.eclipse.ui.PartInitException;
import org.jboss.tools.vpe.ui.test.VpeTest;
/**
@@ -21,110 +20,110 @@
*/
public class JsfComponentTest extends VpeTest {
- //import project name
- private static final String IMPORT_PROJECT_NAME = "jsfTest";
-
+ // import project name
+ private static final String IMPORT_PROJECT_NAME = "jsfTest";
+
public JsfComponentTest(String name) {
- super(name,IMPORT_PROJECT_NAME,JsfTestPlugin.getPluginResourcePath());
+ super(name, IMPORT_PROJECT_NAME, JsfTestPlugin.getPluginResourcePath());
}
/*
* JSF HTML test cases
*/
- public void testCommandButton() throws PartInitException, Throwable {
+ public void testCommandButton() throws Throwable {
performTestForJsfComponent("components/commandButton.jsp"); // $NON-NLS-1$
}
- public void testCommandLink() throws PartInitException, Throwable {
+ public void testCommandLink() throws Throwable {
performTestForJsfComponent("components/commandLink.jsp"); // $NON-NLS-1$
}
- public void testDataTable() throws PartInitException, Throwable {
+ public void testDataTable() throws Throwable {
performTestForJsfComponent("components/dataTable.jsp"); // $NON-NLS-1$
}
- public void testForm() throws PartInitException, Throwable {
+ public void testForm() throws Throwable {
performTestForJsfComponent("components/form.jsp"); // $NON-NLS-1$
}
- public void testGraphicImage() throws PartInitException, Throwable {
+ public void testGraphicImage() throws Throwable {
performTestForJsfComponent("components/graphicImage.jsp"); // $NON-NLS-1$
}
- public void testInputHidden() throws PartInitException, Throwable {
+ public void testInputHidden() throws Throwable {
performTestForJsfComponent("components/inputHidden.jsp"); // $NON-NLS-1$
}
- public void testInputSecret() throws PartInitException, Throwable {
+ public void testInputSecret() throws Throwable {
performTestForJsfComponent("components/inputSecret.jsp"); // $NON-NLS-1$
}
- public void testInputText() throws PartInitException, Throwable {
+ public void testInputText() throws Throwable {
performTestForJsfComponent("components/inputText.jsp"); // $NON-NLS-1$
}
- public void testInputTextArea() throws PartInitException, Throwable {
+ public void testInputTextArea() throws Throwable {
performTestForJsfComponent("components/inputTextArea.jsp"); // $NON-NLS-1$
}
- public void testMessage() throws PartInitException, Throwable {
+ public void testMessage() throws Throwable {
performTestForJsfComponent("components/message.jsp"); // $NON-NLS-1$
}
- public void testMessages() throws PartInitException, Throwable {
+ public void testMessages() throws Throwable {
performTestForJsfComponent("components/messages.jsp"); // $NON-NLS-1$
}
- public void testOutputFormat() throws PartInitException, Throwable {
+ public void testOutputFormat() throws Throwable {
performTestForJsfComponent("components/outputFormat.jsp"); // $NON-NLS-1$
}
- public void testOutputLabel() throws PartInitException, Throwable {
+ public void testOutputLabel() throws Throwable {
performTestForJsfComponent("components/outputLabel.jsp"); // $NON-NLS-1$
}
- public void testOutputLink() throws PartInitException, Throwable {
+ public void testOutputLink() throws Throwable {
performTestForJsfComponent("components/outputLink.jsp"); // $NON-NLS-1$
}
- public void testOutputText() throws PartInitException, Throwable {
+ public void testOutputText() throws Throwable {
performTestForJsfComponent("components/outputText.jsp"); // $NON-NLS-1$
}
- public void testPanelGrid() throws PartInitException, Throwable {
+ public void testPanelGrid() throws Throwable {
performTestForJsfComponent("components/panelGrid.jsp"); // $NON-NLS-1$
}
- public void testPanelGroup() throws PartInitException, Throwable {
+ public void testPanelGroup() throws Throwable {
performTestForJsfComponent("components/panelGroup.jsp"); // $NON-NLS-1$
}
- public void testSelectBooleanCheckbox() throws PartInitException, Throwable {
+ public void testSelectBooleanCheckbox() throws Throwable {
performTestForJsfComponent("components/selectBooleanCheckbox.jsp"); //
$NON-NLS-1$
}
- public void testSelectManyCheckbox() throws PartInitException, Throwable {
+ public void testSelectManyCheckbox() throws Throwable {
performTestForJsfComponent("components/selectManyCheckbox.jsp"); //
$NON-NLS-1$
}
- public void testSelectManyListbox() throws PartInitException, Throwable {
+ public void testSelectManyListbox() throws Throwable {
performTestForJsfComponent("components/selectManyListbox.jsp"); //
$NON-NLS-1$
}
- public void testSelectManyMenu() throws PartInitException, Throwable {
+ public void testSelectManyMenu() throws Throwable {
performTestForJsfComponent("components/selectManyMenu.jsp"); // $NON-NLS-1$
}
- public void testSelectOneListbox() throws PartInitException, Throwable {
+ public void testSelectOneListbox() throws Throwable {
performTestForJsfComponent("components/selectOneListbox.jsp"); //
$NON-NLS-1$
}
- public void testSelectOneMenu() throws PartInitException, Throwable {
+ public void testSelectOneMenu() throws Throwable {
performTestForJsfComponent("components/selectOneMenu.jsp"); // $NON-NLS-1$
}
- public void testSelectOneRadio() throws PartInitException, Throwable {
+ public void testSelectOneRadio() throws Throwable {
performTestForJsfComponent("components/selectOneRadio.jsp"); // $NON-NLS-1$
}
@@ -132,84 +131,83 @@
* JSF Core test cases
*/
- public void testActionListener() throws PartInitException, Throwable {
+ public void testActionListener() throws Throwable {
performTestForJsfComponent("components/actionListener.jsp"); // $NON-NLS-1$
}
- public void testAttribute() throws PartInitException, Throwable {
+ public void testAttribute() throws Throwable {
performTestForJsfComponent("components/attribute.jsp"); // $NON-NLS-1$
}
- public void testConvertDateTime() throws PartInitException, Throwable {
+ public void testConvertDateTime() throws Throwable {
performTestForJsfComponent("components/convertDateTime.jsp"); // $NON-NLS-1$
}
- public void testConvertNumber() throws PartInitException, Throwable {
+ public void testConvertNumber() throws Throwable {
performTestForJsfComponent("components/convertNumber.jsp"); // $NON-NLS-1$
}
- public void testConverter() throws PartInitException, Throwable {
+ public void testConverter() throws Throwable {
performTestForJsfComponent("components/converter.jsp"); // $NON-NLS-1$
}
- public void testFacet() throws PartInitException, Throwable {
+ public void testFacet() throws Throwable {
performTestForJsfComponent("components/facet.jsp"); // $NON-NLS-1$
}
- public void testLoadBundle() throws PartInitException, Throwable {
+ public void testLoadBundle() throws Throwable {
performTestForJsfComponent("components/loadBundle.jsp"); // $NON-NLS-1$
}
- public void testParam() throws PartInitException, Throwable {
+ public void testParam() throws Throwable {
performTestForJsfComponent("components/param.jsp"); // $NON-NLS-1$
}
- public void testPhaseListener() throws PartInitException, Throwable {
+ public void testPhaseListener() throws Throwable {
performTestForJsfComponent("components/phaseListener.jsp"); // $NON-NLS-1$
}
- public void testSelectItem() throws PartInitException, Throwable {
+ public void testSelectItem() throws Throwable {
performTestForJsfComponent("components/selectItem.jsp"); // $NON-NLS-1$
}
- public void testSelectItems() throws PartInitException, Throwable {
+ public void testSelectItems() throws Throwable {
performTestForJsfComponent("components/selectItems.jsp"); // $NON-NLS-1$
}
- public void testSetPropertyActionListener() throws PartInitException,
- Throwable {
+ public void testSetPropertyActionListener() throws Throwable {
performTestForJsfComponent("components/setPropertyActionListener.jsp"); //
$NON-NLS-1$
}
- public void testSubview() throws PartInitException, Throwable {
+ public void testSubview() throws Throwable {
performTestForJsfComponent("components/subview.jsp"); // $NON-NLS-1$
}
- public void testValidateDoubleRange() throws PartInitException, Throwable {
+ public void testValidateDoubleRange() throws Throwable {
performTestForJsfComponent("components/validateDoubleRange.jsp"); //
$NON-NLS-1$
}
- public void testValidateLength() throws PartInitException, Throwable {
+ public void testValidateLength() throws Throwable {
performTestForJsfComponent("components/validateLength.jsp"); // $NON-NLS-1$
}
- public void testValidateLongRange() throws PartInitException, Throwable {
+ public void testValidateLongRange() throws Throwable {
performTestForJsfComponent("components/validateLongRange.jsp"); //
$NON-NLS-1$
}
- public void testValidator() throws PartInitException, Throwable {
+ public void testValidator() throws Throwable {
performTestForJsfComponent("components/validator.jsp"); // $NON-NLS-1$
}
- public void testValueChangeListener() throws PartInitException, Throwable {
+ public void testValueChangeListener() throws Throwable {
performTestForJsfComponent("components/valueChangeListener.jsp"); //
$NON-NLS-1$
}
- public void testVerbatim() throws PartInitException, Throwable {
+ public void testVerbatim() throws Throwable {
performTestForJsfComponent("components/verbatim.jsp"); // $NON-NLS-1$
}
- public void testView() throws PartInitException, Throwable {
+ public void testView() throws Throwable {
performTestForJsfComponent("components/view.jsp"); // $NON-NLS-1$
}
}
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-09
13:09:05 UTC (rev 5551)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-09
13:17:09 UTC (rev 5552)
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.vpe.jsf.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.FileEditorInput;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNamedNodeMap;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
-/**
- * Class for testing all jsf bugs
- *
- * @author sdzmitrovich
- *
- */
-public class JsfJbideTest extends VpeTest {
-
- // type of input tag
- private static final String ATTR_TYPE_VALUE = "radio";
-
- //import project name
-
- private static final String IMPORT_PROJECT_NAME = "jsfTest";
-
- public JsfJbideTest(String name) {
- super(name,IMPORT_PROJECT_NAME,JsfTestPlugin.getPluginResourcePath());
- }
-
-
- /*
- * JBIDE's test cases
- */
-
- /**
- * test for
http://jira.jboss.com/jira/browse/JBIDE-1467
- *
- * the cause of bug : <input type=radio > tags ( which vpe template forms
- * when process "selectOneRadio" jsf tag ) didn't have equal
"name"
- * attribute
- *
- * REQUIREMENT :test page must has only one <h:selectOneRadio > tag
- *
- * test checks that all "radio" elements ( of xulRunner DOMDocument ) have
- * equal "name" attributes
- */
- public void testJBIDE_1467() throws PartInitException, Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
- // get test page path
- IFile file = (IFile) TestUtil
- .getComponentPath("JBIDE/1467/JBIDE-1467.jsp",getImportProjectName());
-
- assertNotNull("Could not open specified file "+file.getFullPath(), file);
-
- IEditorInput input = new FileEditorInput(file);
-
- assertNotNull("Editor input is null",input);
- // open and get editor
- JSPMultiPageEditor part = openEditor(input);
-
- // get dom document
- nsIDOMDocument document = getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
-
- if (element != null) {
-
- // get root node
- nsIDOMNode node = (nsIDOMNode) element
- .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "input" elements
- findElementsByName(node, elements, HTML.TAG_INPUT);
-
- // check that "radio" elements have equal names
- // (size of list of names == 1 )
- assertEquals(1, getRadioNames(elements).size());
-
- }
-
- // check exception
- if (getException() != null) {
- throw getException();
- }
-
- }
-
- /**
- * test for
http://jira.jboss.com/jira/browse/JBIDE-1467
- *
- * the cause of bug :
- *
- * 1. <select ... > tag ( which vpe template forms when process
- * "selectManyMenu" and "selectManyListbox" jsf tags ) didn't
have
- * multiple="multiple" attribute
- *
- * 2. <select ... > tag ( which vpe template forms when process
- * "selectOneListbox" and "selectManyListbox" jsf tags ) sometimes
had
- * incorrect "size" attribute
- *
- * DISCRIPTION: test consist of two part
- *
- * 1. The first page (JBIDE-1501_multiple.jsp) has "selectManyMenu" and
- * "selectManyListbox" jsf tags. And test checks that all "select"
elements
- * have "multiple" attribute
- *
- * 2. The second page (JBIDE-1501_size.jsp) has "selectOneListbox" and
- * "selectManyListbox" jsf tags and they was formed so that all
"select"
- * elements must have size="2" attribute . And test checks "size"
attribute
- */
- public void testJBIDE_1501() throws PartInitException, Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
- // _____1st Part____//
-
- // get test page path
- IFile file = (IFile) TestUtil
- .getComponentPath("JBIDE/1501/JBIDE-1501_multiple.jsp",getImportProjectName());
-
- IEditorInput input = new FileEditorInput(file);
-
- // open and get editor
- JSPMultiPageEditor part = openEditor(input);
-
- // get dom document
- nsIDOMDocument document = getVpeVisualDocument(part);
- assertNotNull(document);
-
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
- assertNotNull(element);
-
- // get root node
- nsIDOMNode node = (nsIDOMNode) element
- .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "select" elements
- findElementsByName(node, elements, HTML.TAG_SELECT);
-
- for (nsIDOMNode select : elements) {
-
- // get attributes
- nsIDOMNamedNodeMap attributes = select.getAttributes();
-
- // "select" must have attributes
- assertNotNull(attributes);
-
- // select must have "multiple" attribute
- assertNotNull(attributes.getNamedItem(HTML.ATTR_MULTIPLE));
-
- }
-
- // _____2nd Part____//
-
- // get test page path
- file = (IFile) TestUtil
- .getComponentPath("JBIDE/1501/JBIDE-1501_size.jsp",getImportProjectName());
-
- input = new FileEditorInput(file);
-
- // open and get editor
- part = openEditor(input);
-
- // get dom document
- document = getVpeVisualDocument(part);
- assertNotNull(document);
-
- // get dom element
- element = document.getDocumentElement();
- assertNotNull(element);
-
- // get root node
- node = (nsIDOMNode) element.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-
- elements = new ArrayList<nsIDOMNode>();
-
- // find "select" elements
- findElementsByName(node, elements, HTML.TAG_SELECT);
-
- for (nsIDOMNode select : elements) {
-
- // get attributes
- nsIDOMNamedNodeMap attributes = select.getAttributes();
-
- // "select" must have attributes
- assertNotNull(attributes);
-
- // select must have "size" attribute
- nsIDOMNode size = attributes.getNamedItem(HTML.ATTR_SIZE);
- assertNotNull(size);
-
- //
- assertEquals(2, Integer.parseInt(size.getNodeValue()));
-
- }
-
- // check exception
- if (getException() != null) {
- throw getException();
- }
-
- }
-
- /**
- * find elements by name
- *
- * @param node -
- * current node
- * @param elements -
- * list of found elements
- * @param name -
- * name element
- */
- private void findElementsByName(nsIDOMNode node, List<nsIDOMNode> elements,
- String name) {
-
- // get children
- nsIDOMNodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- nsIDOMNode child = children.item(i);
-
- // if current child is required then add his to list
- if (name.equalsIgnoreCase((child.getNodeName()))) {
-
- elements.add(child);
-
- } else {
-
- findElementsByName(child, elements, name);
-
- }
- }
-
- }
- /**
- *
- * @param elements
- * list of "input" elements
- * @return list of names
- */
- private List<String> getRadioNames(List<nsIDOMNode> elements) {
-
- // list of "name" of "radio" elements
- List<String> radioNames = new ArrayList<String>();
-
- for (nsIDOMNode element : elements) {
- // attributes
- nsIDOMNamedNodeMap attributes = element.getAttributes();
-
- if (attributes != null) {
- // get type of element
- nsIDOMNode type = attributes.getNamedItem(HTML.ATTR_TYPE);
-
- // if type is "radio"
- if ((type != null)
- && (ATTR_TYPE_VALUE.equalsIgnoreCase(type
- .getNodeValue()))) {
-
- // get "name" attribute
- nsIDOMNode name = attributes.getNamedItem(HTML.ATTR_NAME);
-
- // check for null
- assertNotNull(name);
-
- // if name is unique
- if (!radioNames.contains(name.getNodeValue()))
- radioNames.add(name.getNodeValue());
-
- }
- }
- }
-
- return radioNames;
-
- }
-
-}