From jbosstools-commits at lists.jboss.org Mon Feb 11 12:41:16 2008 Content-Type: multipart/mixed; boundary="===============5539768481725281161==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r6245 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test: resources/jsfTest/WebContent/pages/JBIDE/788 and 2 other directories. Date: Mon, 11 Feb 2008 12:41:15 -0500 Message-ID: --===============5539768481725281161== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/WebCo= ntent/pages/JBIDE/788/ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebCo= ntent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebCo= ntent/pages/JBIDE/788/testCAforHtml.html trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebCo= ntent/pages/JBIDE/788/testCAforJSP.jsp trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebCo= ntent/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/W= ebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml = (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml 2008-02-11 17:41:15 = UTC (rev 6245) @@ -0,0 +1,15 @@ + + + + XHTML TEST Page + + + +
+ +
+ + \ No newline at end of file Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/W= ebContent/pages/JBIDE/788/testCAforHtml.html =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforHtml.html (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforHtml.html 2008-02-11 17:41:15 UTC (rev 6245) @@ -0,0 +1,7 @@ + + + + + Test + + Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/W= ebContent/pages/JBIDE/788/testCAforJSP.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforJSP.jsp (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforJSP.jsp 2008-02-11 17:41:15 UTC (rev 6245) @@ -0,0 +1,25 @@ +<%@ taglib uri=3D"http://java.sun.com/jsf/html" prefix=3D"h" %> +<%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix=3D"f" %> +<%@ taglib uri=3D"http://jakarta.apache.org/taglibs/standard/scriptfree" p= refix=3D"scriptfree" %> +<%@ taglib uri=3D"http://jakarta.apache.org/taglibs/standard/permittedTagl= ibs" prefix=3D"permittedTaglibs" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/sql" prefix=3D"sql" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/fmt" prefix=3D"fmt" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/functions" prefix=3D"fn" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/core" prefix=3D"c" %> +<%@ taglib uri=3D"http://java.sun.com/jsp/jstl/xml" prefix=3D"x" %> +<%@ taglib uri=3D"http://java.sun.com/jstl/sql" prefix=3D"sql" %> +<%@ taglib uri=3D"http://java.sun.com/jstl/xml" prefix=3D"x" %> +<%@ taglib uri=3D"http://java.sun.com/jstl/core" prefix=3D"c" %> +<%@ taglib uri=3D"http://java.sun.com/jstl/fmt" prefix=3D"fmt" %> + + + + + + +

CA Test Page

Test + = + +
+ = + = Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/W= ebContent/pages/JBIDE/788/testCAforXHTML.xhtml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforXHTML.xhtml (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebC= ontent/pages/JBIDE/788/testCAforXHTML.xhtml 2008-02-11 17:41:15 UTC (rev 62= 45) @@ -0,0 +1,22 @@ + + + + + + + +

Test of CA XHTML

+ CA Test + +
+ = + = Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/to= ols/jsf/vpe/jsf/test/JsfAllTests.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/js= f/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/js= f/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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/js= f/vpe/jsf/test/jbide/JBIDE788Test.java (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/js= f/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 =3D "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/testCAforH= tml.html", 32, 79); + + // check exception + if (getException() !=3D 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/testCAforJ= SP.jsp", 1000, 110); + // check exception + if (getException() !=3D 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/testCAforX= HTML.xhtml", 745, 96); + // check exception + if (getException() !=3D null) { + = + throw getException(); + } + } + /** + * Perfoms base test of ca, compare number of proposals which what return= ed 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 positio= n, int numberOfProposals) throws CoreException { + // get test page path + IFile file =3D (IFile) TestUtil.getComponentPath(testPagePath, + IMPORT_PROJECT_NAME); + assertNotNull("Could not open specified file " + file.getFullPath(), + file); + + IEditorInput input =3D new FileEditorInput(file); + + assertNotNull("Editor input is null", input); + = + // open and get editor + JSPMultiPageEditor part =3D openEditor(input); + TestUtil.waitForJobs(); + TestUtil.delay(2000); + SourceViewerConfiguration sourceViewerConfiguration =3D ((JSPTextEditor= )part.getSourceEditor()).getSourceViewerConfigurationForTest(); + + StructuredTextViewerConfiguration stvc =3D (StructuredTextViewerConfigur= ation) sourceViewerConfiguration; + IContentAssistant iContentAssistant =3D stvc.getContentAssistant((ISourc= eViewer) part.getSourceEditor().getAdapter(ISourceViewer.class)); + assertNotNull(iContentAssistant); + IContentAssistProcessor iContentAssistProcessor=3D iContentAssistant.get= ContentAssistProcessor(caName); + assertNotNull(iContentAssistProcessor); + ICompletionProposal[] results =3D iContentAssistProcessor.computeComplet= ionProposals(part.getSourceEditor().getTextViewer(), position); + assertNotNull(results); + assertEquals(numberOfProposals,results.length); + } +} --===============5539768481725281161==--