Author: sdzmitrovich
Date: 2008-06-10 11:54:48 -0400 (Tue, 10 Jun 2008)
New Revision: 8687
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/template_doctype_test.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/templates/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/templates/common.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_doctype.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_not_doctype.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2170
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/template_doctype_test.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/template_doctype_test.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/template_doctype_test.xhtml 2008-06-10
15:54:48 UTC (rev 8687)
@@ -0,0 +1,26 @@
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:c="http://java.sun.com/jstl/core">
+
+ <f:loadBundle basename="resources" var="msg" />
+
+ <ui:composition template="templates/common.xhtml">
+
+ <ui:define name="pageTitle">Input User Name</ui:define>
+
+ <ui:define name="pageHeader">Facelets Hello
Application</ui:define>
+
+ <ui:define name="body">
+ <h:message showSummary="true" showDetail="false"
style="color: red; font-weight: bold;" for="name" />
+ <form jsfc="h:form" id="helloForm">
+ ${msg.prompt}
+ <input label="Name" jsfc="h:inputText"
required="true" id="name" value="#{person.name}" />
+ <input type="submit" jsfc="h:commandButton"
id="submit"
+ action="greeting" value="Say Hello" />
+ </form>
+
+ </ui:define>
+ </ui:composition>
+</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/templates/common.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/templates/common.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/templates/common.xhtml 2008-06-10
15:54:48 UTC (rev 8687)
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+ <f:loadBundle basename="resources" var="msg" />
+ <head>
+ <title><ui:insert name="pageTitle">Page
Title</ui:insert></title>
+ <style type="text/css">
+ body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ }
+ .header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+ }
+ .bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+ }
+ </style>
+ </head>
+
+<body bgcolor="#ffffff">
+<table style="border:1px solid #CAD6E0" align="center"
cellpadding="0" cellspacing="0" border="0"
width="400">
+<tbody>
+
+ <tr>
+ <td class="header" height="42" align="center"
valign="middle" width="100%" bgcolor="#E4EBEB">
+ <ui:insert name="pageHeader">Page Header</ui:insert>
+ </td>
+ </tr>
+ <tr>
+ <td height="1" width="100%"
bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height:150px" align="left"
cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%"
valign="middle">
+
+ <ui:insert name="body">Page Body</ui:insert>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1"
width="100%" bgcolor="#CAD6E0"></td>
+ </tr>
+</tbody>
+</table>
+</body>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_doctype.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_doctype.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_doctype.xhtml 2008-06-10
15:54:48 UTC (rev 8687)
@@ -0,0 +1,74 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+<f:loadBundle basename="resources" var="msg" />
+<head>
+<title><ui:insert name="pageTitle">Page
Title</ui:insert></title>
+<style type="text/css">
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+}
+
+.header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+}
+
+.bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+}
+</style>
+</head>
+
+<body bgcolor="#ffffff">
+<table style="border: 1px solid #CAD6E0" align="center"
cellpadding="0"
+ cellspacing="0" border="0" width="400">
+ <tbody>
+
+ <tr>
+ <td class="header" height="42" align="center"
valign="middle"
+ width="100%" bgcolor="#E4EBEB">Facelets Hello
Application</td>
+ </tr>
+ <tr>
+ <td height="1" width="100%"
bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height: 150px"
align="left"
+ cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%"
valign="middle"><h:message
+ showSummary="true" showDetail="false"
+ style="color: red; font-weight: bold;" for="name" />
+ <form jsfc="h:form" id="helloForm">${msg.prompt}
<input
+ label="Name" jsfc="h:inputText" required="true"
id="name"
+ value="#{person.name}" /> <input type="submit"
+ jsfc="h:commandButton" id="submit"
action="greeting"
+ value="Say Hello" /></form>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1"
width="100%"
+ bgcolor="#CAD6E0"></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_not_doctype.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_not_doctype.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/2170/there_is_not_doctype.xhtml 2008-06-10
15:54:48 UTC (rev 8687)
@@ -0,0 +1,73 @@
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+<f:loadBundle basename="resources" var="msg" />
+<head>
+<title><ui:insert name="pageTitle">Page
Title</ui:insert></title>
+<style type="text/css">
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+}
+
+.header {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 18px;
+}
+
+.bottom {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ text-align: center;
+ vertical-align: middle;
+ color: #8E969D;
+}
+</style>
+</head>
+
+<body bgcolor="#ffffff">
+<table style="border: 1px solid #CAD6E0" align="center"
cellpadding="0"
+ cellspacing="0" border="0" width="400">
+ <tbody>
+
+ <tr>
+ <td class="header" height="42" align="center"
valign="middle"
+ width="100%" bgcolor="#E4EBEB">Facelets Hello
Application</td>
+ </tr>
+ <tr>
+ <td height="1" width="100%"
bgcolor="#CAD6E0"></td>
+ </tr>
+
+ <tr>
+ <td width="100%" colspan="2">
+ <table width="100%" style="height: 150px"
align="left"
+ cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <tr>
+ <td align="center" width="100%"
valign="middle"><h:message
+ showSummary="true" showDetail="false"
+ style="color: red; font-weight: bold;" for="name" />
+ <form jsfc="h:form" id="helloForm">${msg.prompt}
<input
+ label="Name" jsfc="h:inputText" required="true"
id="name"
+ value="#{person.name}" /> <input type="submit"
+ jsfc="h:commandButton" id="submit"
action="greeting"
+ value="Say Hello" /></form>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" valign="bottom" height="1"
width="100%"
+ bgcolor="#CAD6E0"></td>
+ </tr>
+ </tbody>
+</table>
+</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-06-10
15:52:48 UTC (rev 8686)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-06-10
15:54:48 UTC (rev 8687)
@@ -32,6 +32,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1501Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1568Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1718Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide2170Test;
import org.jboss.tools.jsf.vpe.jsf.test.perfomance.PerfomanceTest;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
@@ -66,6 +67,7 @@
suite.addTestSuite(JBIDE1730Test.class);
suite.addTestSuite(JBIDE1494Test.class);
suite.addTestSuite(JBIDE2297Test.class);
+ suite.addTestSuite(JsfJbide2170Test.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/JsfJbide2170Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JsfJbide2170Test.java 2008-06-10
15:54:48 UTC (rev 8687)
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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.jbide;
+
+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.DocTypeUtil;
+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.nsIDOMDocumentType;
+
+/**
+ *
+ * @author sdzmitrovich
+ *
+ * test for
http://jira.jboss.com/jira/browse/JBIDE-1718
+ *
+ */
+public class JsfJbide2170Test extends VpeTest {
+
+ public static final String IMPORT_PROJECT_NAME = "jsfTest";
+
+ private static final String WITHOUT_DOCTYPE_TEST_PAGE_NAME =
"JBIDE/2170/there_is_not_doctype.xhtml";
+
+ private static final String WITH_DOCTYPE_TEST_PAGE_NAME =
"JBIDE/2170/there_is_doctype.xhtml";
+
+ private static final String TEMPLATE_DOCTYPE_TEST_PAGE_NAME =
"JBIDE/2170/template_doctype_test.xhtml";
+
+ public JsfJbide2170Test(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ * @throws Throwable
+ */
+ public void testWithoutDoctypePage() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ WITHOUT_DOCTYPE_TEST_PAGE_NAME, IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get doctype from opened page
+ String basicDoctypeString = DocTypeUtil.getDoctype(input);
+
+ // doctype must be not null
+ assertNotNull(basicDoctypeString);
+
+ // length of doctype must be 0
+ assertEquals(0, basicDoctypeString.length());
+
+ // get dom document from vpe
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ // get doctype from vpe's dom model
+ nsIDOMDocumentType vpeDocumentType = document.getDoctype();
+
+ // doctype must be null
+ assertNull(vpeDocumentType);
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+
+ /**
+ *
+ * @throws Throwable
+ */
+ public void testWithDoctypePage() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ WITH_DOCTYPE_TEST_PAGE_NAME, IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get doctype from opened page
+ String basicDoctypeString = DocTypeUtil.getDoctype(input);
+
+ // doctype must be not null
+ assertNotNull(basicDoctypeString);
+ // length of doctype must be more than 0
+ assertEquals(true, basicDoctypeString.length() > 0);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ // get doctype
+ nsIDOMDocumentType vpeDocumentType = document.getDoctype();
+
+ // doctype must be not null
+ assertNotNull(vpeDocumentType);
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+
+ /**
+ *
+ * @throws Throwable
+ */
+ public void testTemplateDoctypePage() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(
+ TEMPLATE_DOCTYPE_TEST_PAGE_NAME, IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get doctype from opened page
+ String basicDoctypeString = DocTypeUtil.getDoctype(input);
+
+ // doctype must be not null
+ assertNotNull(basicDoctypeString);
+ // length of doctype must be more than 0
+ assertEquals(true, basicDoctypeString.length() > 0);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ // get doctype
+ nsIDOMDocumentType vpeDocumentType = document.getDoctype();
+
+ // doctype must be not null
+ assertNotNull(vpeDocumentType);
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+}