[jbosstools-commits] JBoss Tools SVN: r23863 - in trunk/vpe/tests: org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Aug 2 07:24:36 EDT 2010
Author: dmaliarevich
Date: 2010-08-02 07:24:35 -0400 (Mon, 02 Aug 2010)
New Revision: 23863
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Log:
https://jira.jboss.org/browse/JBIDE-6711 , ComponentContentTest class was updated, component file could be found by the full path.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringAllTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringAllTests.java 2010-08-02 10:33:31 UTC (rev 23862)
+++ trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringAllTests.java 2010-08-02 11:24:35 UTC (rev 23863)
@@ -33,6 +33,7 @@
TestSuite suite = new TestSuite("Tests for Vpe Spring components"); //$NON-NLS-1$
// $JUnit-BEGIN$
suite.addTestSuite(SpringComponentTest.class);
+ suite.addTestSuite(SpringComponentContentTest.class);
//cleanUpTests();
// $JUnit-END$
return new VpeTestSetup(suite);
Modified: trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringComponentContentTest.java 2010-08-02 10:33:31 UTC (rev 23862)
+++ trunk/vpe/tests/org.jboss.tools.vpe.spring.test/src/org/jboss/tools/vpe/spring/test/SpringComponentContentTest.java 2010-08-02 11:24:35 UTC (rev 23863)
@@ -30,7 +30,7 @@
}
public void testCheckbox() throws Throwable {
-// performContentTest("components/inplaceSelect/JBIDE4309.xhtml"); //$NON-NLS-1$
+ performContentTestByFullPath("src/main/webapp/WEB-INF/jsp/checkbox.jsp"); //$NON-NLS-1$
}
@Override
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-08-02 10:33:31 UTC (rev 23862)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-08-02 11:24:35 UTC (rev 23863)
@@ -64,31 +64,39 @@
* @throws Throwable
*/
protected void performContentTest(String elementPagePath) throws Throwable {
+ performContentTestByFullPath(TestUtil.COMPONENTS_PATH + elementPagePath);
+ }
+
+ protected void performContentTestByFullPath(String elementPagePath) throws Throwable {
setException(null);
-
- IFile elementPageFile = (IFile) TestUtil.getComponentPath(
+ IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
elementPagePath, getTestProjectName());
-
TestUtil.waitForIdle();
-
+ /*
+ * Test that test file was found and exists
+ */
+ assertNotNull("Could not find component file '"+elementPagePath+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
+
IEditorPart editor = WorkbenchUtils.openEditor(elementPageFile,EDITOR_ID);
-
assertNotNull(editor);
-
VpeController controller = TestUtil.getVpeController((JSPMultiPageEditor) editor);
-
- // get xml test file
- File xmlTestFile = TestUtil.getComponentPath(
+ /*
+ * Get xml test file
+ */
+ File xmlTestFile = TestUtil.getComponentFileByFullPath(
elementPagePath + XML_FILE_EXTENSION, getTestProjectName())
.getLocation().toFile();
-
- // get document
+ /*
+ * Test that XML test file was found and exists
+ */
+ assertNotNull("Could not find XML component file '"+elementPagePath + XML_FILE_EXTENSION+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Get document
+ */
compareContent(controller, xmlTestFile);
-
if (getException() != null) {
throw getException();
}
-
}
protected void compareContent(VpeController controller, File xmlTestFile)
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2010-08-02 10:33:31 UTC (rev 23862)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2010-08-02 11:24:35 UTC (rev 23863)
@@ -47,7 +47,7 @@
public class TestUtil {
/** The Constant COMPONENTS_PATH. */
- private static final String COMPONENTS_PATH = "WebContent/pages"; //$NON-NLS-1$
+ public static final String COMPONENTS_PATH = "WebContent/pages/"; //$NON-NLS-1$
/** The Constant WEBCONTENT_PATH. */
private static final String WEBCONTENT_PATH = "WebContent"; //$NON-NLS-1$
@@ -75,10 +75,31 @@
if (project != null) {
return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
}
-
return null;
}
+ /**
+ * Gets the component path.
+ *
+ * @param componentPage the component page
+ * @param projectName the project name
+ *
+ * @return the component path
+ *
+ * @throws CoreException the core exception
+ * @throws IOException
+ */
+ public static IResource getComponentFileByFullPath(String componentPage,
+ String projectName) throws CoreException, IOException {
+ IProject project = ProjectsLoader.getInstance().getProject(projectName);
+ if (project != null) {
+ return project.findMember(componentPage);
+ }
+ return null;
+ }
+
+
+
public static IResource getResource(String path,
String projectName) throws CoreException, IOException {
IProject project = ProjectsLoader.getInstance().getProject(projectName);
@@ -186,21 +207,19 @@
*/
static public void findElementsByName(nsIDOMNode node,
List<nsIDOMNode> elements, String name) {
-
- // get children
+ /*
+ * 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 current child is required then add it to list
+ */
if (name.equalsIgnoreCase((child.getNodeName()))) {
-
elements.add(child);
-
} else {
-
findElementsByName(child, elements, name);
-
}
}
@@ -218,7 +237,6 @@
*/
static public void findAllElementsByName(nsIDOMNode node,
List<nsIDOMNode> elements, String name) {
-
try {
nsIDOMNodeList list = node.getChildNodes();
if (node.getNodeName().equalsIgnoreCase(name)) {
More information about the jbosstools-commits
mailing list