Author: dsakovich
Date: 2008-07-08 09:24:18 -0400 (Tue, 08 Jul 2008)
New Revision: 9089
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2119/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2119/JBIDE-2119.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2119Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
JUnit test for
http://jira.jboss.org/jira/browse/JBIDE-2119
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2119/JBIDE-2119.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2119/JBIDE-2119.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2119/JBIDE-2119.jsp 2008-07-08
13:24:18 UTC (rev 9089)
@@ -0,0 +1,54 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+
+
+<f:loadBundle var="Message" basename="demo.Messages" />
+
+<html>
+<head>
+<title>Input User Name Page</title>
+<style type="text/css">
+h3 {
+ background: green;
+ color: red;
+}
+
+.post-info {
+ padding-top: 3px;
+ margin-left: 4px;
+ color: #00ff00;
+}
+
+.post-info a {
+ color: #bd4200;
+}
+
+</style>
+</head>
+<body>
+ <h3>Hello people</h3>
+<f:view>
+ <h:form id="greetingForm"
+ style="FONT-STYLE: italic; FONT-WEIGHT: bold;">
+ <h1><h:outputText value="#{Message.header}" /></h1>
+
+ <p class="post-info">Posted by
+ <a href="index.html">erwin</a> |
+ <h:outputLink value="/index.jsp">Home page</h:outputLink> |
+ <h:commandLink value="123456789">abcdef</h:commandLink>
+ </p>
+
+ <h:messages style="color: red" />
+ <h:outputText value="#{Message.prompt_message}" />
+ <h:inputText value="#{user.name}" required="true">
+ <f:validateLength maximum="30" minimum="3" />
+ </h:inputText>
+
+ <br/>
+
+ <h:commandButton action="hello" value="Say Hello!" />
+ </h:form>
+</f:view>
+</body>
+</html>
\ No newline at end of file
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-07-08
12:25:59 UTC (rev 9088)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-07-08
13:24:18 UTC (rev 9089)
@@ -25,6 +25,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1720Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1730Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1744Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2119Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2297Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2434Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
@@ -72,6 +73,7 @@
suite.addTestSuite(JsfJbide2170Test.class);
suite.addTestSuite(JBIDE2434Test.class);
suite.addTestSuite(JsfJbide2362Test.class);
+ suite.addTestSuite(JBIDE2119Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2119Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2119Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2119Test.java 2008-07-08
13:24:18 UTC (rev 9089)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+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.nsIDOMNode;
+
+/**
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ *
+ */
+public class JBIDE2119Test extends VpeTest {
+
+ private static final String IMPORT_PROJECT_NAME = "jsfTest";
+
+ private static final String TEST_PAGE_NAME = "JBIDE/2119/JBIDE-2119.jsp";
+
+ /**
+ * @param name
+ */
+ public JBIDE2119Test(String name) {
+ super(name);
+ }
+
+ // test method for JBIDE 2119
+ public void testJBIDE_2119() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME,
+ IMPORT_PROJECT_NAME);
+
+ 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();
+
+ // check that element is not null
+ assertNotNull(element);
+
+ // get root node
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "a" elements
+ TestUtil.findElementsByName(node, elements, HTML.TAG_A);
+ // method does not look for nested tables
+ // thus only one element is found
+ assertEquals(3, elements.size());
+
+ if (getException() != null) {
+ throw getException();
+ }
+ }
+
+}