Author: mareshkau
Date: 2008-02-11 12:41:15 -0500 (Mon, 11 Feb 2008)
New Revision: 6245
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforHtml.html
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforJSP.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforXHTML.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
base tests for CA,
http://jira.jboss.com/jira/browse/JBIDE-788
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml 2008-02-11
17:41:15 UTC (rev 6245)
@@ -0,0 +1,15 @@
+<!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:rich="http://richfaces.org/rich"
+
xmlns:s="http://jboss.com/products/seam/taglib"
+
xmlns:a4j="http://richfaces.org/a4j">
+<head>
+ XHTML TEST Page
+</head>
+<body>
+<s:button value="Submit"></s:button>
+<div
xmlns:rich="http://jboss.com/products/seam/taglib">
+ <rich:button value="Submit"></rich:button>
+</div>
+</body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforHtml.html
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforHtml.html
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforHtml.html 2008-02-11
17:41:15 UTC (rev 6245)
@@ -0,0 +1,7 @@
+<html>
+<head>
+</head>
+<body>
+ Test
+</body>
+</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforJSP.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforJSP.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforJSP.jsp 2008-02-11
17:41:15 UTC (rev 6245)
@@ -0,0 +1,25 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://jakarta.apache.org/taglibs/standard/scriptfree"
prefix="scriptfree" %>
+<%@ taglib
uri="http://jakarta.apache.org/taglibs/standard/permittedTaglibs"
prefix="permittedTaglibs" %>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"
%>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"
%>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/xml" prefix="x"
%>
+<%@ taglib
uri="http://java.sun.com/jstl/sql" prefix="sql" %>
+<%@ taglib
uri="http://java.sun.com/jstl/xml" prefix="x" %>
+<%@ taglib
uri="http://java.sun.com/jstl/core" prefix="c" %>
+<%@ taglib
uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <H1> CA Test Page </H1> Test
+
+ <h:outputText value="Test" />
+ </f:view>
+ </body>
+</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforXHTML.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforXHTML.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/testCAforXHTML.xhtml 2008-02-11
17:41:15 UTC (rev 6245)
@@ -0,0 +1,22 @@
+<!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:h="http://java.sun.com/jsf/html"
+xmlns:f="http://java.sun.com/jsf/core"
+xmlns:scriptfree="http://jakarta.apache.org/taglibs/standard/scriptfree"
+xmlns:permittedTaglibs="http://jakarta.apache.org/taglibs/standard/permittedTaglibs"
+xmlns:sql="http://java.sun.com/jsp/jstl/sql"
+xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
+xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+xmlns:c="http://java.sun.com/jsp/jstl/core"
+xmlns:x="http://java.sun.com/jsp/jstl/xml" >
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <H1>Test of CA XHTML</H1>
+ CA Test
+ <h:outputText value="Test" />
+ </f:view>
+ </body>
+</html>
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-02-11
16:40:49 UTC (rev 6244)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-02-11
17:41:15 UTC (rev 6245)
@@ -19,6 +19,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1479Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1484Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1615Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1467Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1501Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1548Test;
@@ -47,6 +48,7 @@
suite.addTestSuite(JsfJbide1568Test.class);
suite.addTestSuite(JBIDE1615Test.class);
suite.addTestSuite(JBIDE1479Test.class);
+ suite.addTestSuite(JBIDE788Test.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/JBIDE788Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-02-11
17:41:15 UTC (rev 6245)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+* 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.core.runtime.CoreException;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ * @author Max Areshkau
+ *
+ * JUnit test for
http://jira.jboss.com/jira/browse/JBIDE-788
+ */
+public class JBIDE788Test extends VpeTest{
+
+ private static final String IMPORT_PROJECT_NAME = "jsfTest";
+
+ public JBIDE788Test(String name) {
+ super(name);
+ }
+ /**
+ * Tests CA on html files
+ * @throws Throwable
+ */
+ public void testCAforHtmlFiles() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ //Tests CA
+ baseCheckofCA("org.eclipse.wst.html.HTML_DEFAULT",
"JBIDE/788/testCAforHtml.html", 32, 79);
+
+ // check exception
+ if (getException() != null) {
+
+ throw getException();
+ }
+ }
+ /**
+ * Tests CA on jsp files
+ * @throws Throwable
+ */
+ public void testCAforJSPFiles() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ //Tests CA
+ baseCheckofCA("org.eclipse.wst.html.HTML_DEFAULT",
"JBIDE/788/testCAforJSP.jsp", 1000, 110);
+ // check exception
+ if (getException() != null) {
+
+ throw getException();
+ }
+ }
+ /**
+ * Tests CA on jsp files
+ * @throws Throwable
+ */
+ public void testCAforXHTMLFiles() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ //Tests CA
+ baseCheckofCA("org.eclipse.wst.html.HTML_DEFAULT",
"JBIDE/788/testCAforXHTML.xhtml", 745, 96);
+ // check exception
+ if (getException() != null) {
+
+ throw getException();
+ }
+ }
+ /**
+ * Perfoms base test of ca, compare number of proposals which what returned by ca
+ * with etalon
+ * @param caName - content assistent name
+ * @param testPagePath - test page
+ * @param position - position on test page
+ * @param numberOfProposals - standard number of proposals
+ * @throws CoreException
+ */
+ private void baseCheckofCA(String caName,String testPagePath, int position, int
numberOfProposals) throws CoreException {
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(testPagePath,
+ 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);
+ TestUtil.waitForJobs();
+ TestUtil.delay(2000);
+ SourceViewerConfiguration sourceViewerConfiguration =
((JSPTextEditor)part.getSourceEditor()).getSourceViewerConfigurationForTest();
+
+ StructuredTextViewerConfiguration stvc = (StructuredTextViewerConfiguration)
sourceViewerConfiguration;
+ IContentAssistant iContentAssistant = stvc.getContentAssistant((ISourceViewer)
part.getSourceEditor().getAdapter(ISourceViewer.class));
+ assertNotNull(iContentAssistant);
+ IContentAssistProcessor iContentAssistProcessor=
iContentAssistant.getContentAssistProcessor(caName);
+ assertNotNull(iContentAssistProcessor);
+ ICompletionProposal[] results =
iContentAssistProcessor.computeCompletionProposals(part.getSourceEditor().getTextViewer(),
position);
+ assertNotNull(results);
+ assertEquals(numberOfProposals,results.length);
+ }
+}