Author: dgolovin
Date: 2008-10-08 16:01:45 -0400 (Wed, 08 Oct 2008)
New Revision: 10754
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/JavaSource/org/jboss/tools/test/FilterTest.java
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspTagsHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/tldUriHyperlinkTests.jsp
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/web.xml
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/classHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
Log:
add open-on tests common.ext.test
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project 2008-10-08
18:37:02 UTC (rev 10753)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project 2008-10-08
20:01:45 UTC (rev 10754)
@@ -15,6 +15,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.common.verification.verifybuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
@@ -22,5 +27,6 @@
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>org.jboss.tools.jsf.jsfnature</nature>
</natures>
</projectDescription>
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/JavaSource/org/jboss/tools/test/FilterTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/JavaSource/org/jboss/tools/test/FilterTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/JavaSource/org/jboss/tools/test/FilterTest.java 2008-10-08
20:01:45 UTC (rev 10754)
@@ -0,0 +1,9 @@
+package org.jboss.tools.test;
+
+public class FilterTest {
+
+ public FilterTest() {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/JavaSource/org/jboss/tools/test/FilterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/web.xml
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/web.xml 2008-10-08
18:37:02 UTC (rev 10753)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/web.xml 2008-10-08
20:01:45 UTC (rev 10754)
@@ -6,6 +6,16 @@
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
+ <filter>
+ <description>JUnit Test Filter</description>
+ <display-name>JUnit Test Filter Display Name</display-name>
+ <filter-name>Filter1</filter-name>
+ <filter-class>org.jboss.tools.test.FilterTest</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>Filter1</filter-name>
+ <url-pattern>*</url-pattern>
+ </filter-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
@@ -20,7 +30,36 @@
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
+ <security-constraint>
+ <display-name>Accessible For Role1</display-name>
+ <web-resource-collection>
+ <web-resource-name>stylesheets</web-resource-name>
+ <url-pattern>/stylesheet*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Designer</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <security-constraint>
+ <display-name>Accessible For Role1</display-name>
+ <web-resource-collection>
+ <web-resource-name>stylesheets</web-resource-name>
+ <url-pattern>*.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Developer</role-name>
+ </auth-constraint>
+ </security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
+ <security-role>
+ <role-name>Administrator</role-name>
+ </security-role>
+ <security-role>
+ <role-name>Designer</role-name>
+ </security-role>
+ <security-role>
+ <role-name>Developer</role-name>
+ </security-role>
</web-app>
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/classHyperlinkTests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/classHyperlinkTests.jsp 2008-10-08
18:37:02 UTC (rev 10753)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/classHyperlinkTests.jsp 2008-10-08
20:01:45 UTC (rev 10754)
@@ -29,7 +29,7 @@
<f:view>
<h1 class="style-class1">
<f:valueChangeListener
type="org.jboss.tools.test.ChangeListenerInstance"/>
- </h1>
+ </h1>
</f:view>
</body>
</html>
\ No newline at end of file
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspTagsHyperlinkTests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspTagsHyperlinkTests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspTagsHyperlinkTests.jsp 2008-10-08
20:01:45 UTC (rev 10754)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" version="2.0">
+ <jsp:directive.page language="java"
+ contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" />
+ <jsp:text>
+ <![CDATA[ <?xml version="1.0" encoding="ISO-8859-1"
?> ]]>
+ </jsp:text>
+ <jsp:text>
+ <![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ]]>
+ </jsp:text>
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>Insert title here</title>
+</head>
+<body>
+<f:view>
+
+</f:view>
+</body>
+</html>
+</jsp:root>
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/jspTagsHyperlinkTests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/tldUriHyperlinkTests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/tldUriHyperlinkTests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/tldUriHyperlinkTests.jsp 2008-10-08
20:01:45 UTC (rev 10754)
@@ -0,0 +1,2 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/tldUriHyperlinkTests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-08
18:37:02 UTC (rev 10753)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-08
20:01:45 UTC (rev 10754)
@@ -10,6 +10,7 @@
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IEditorDescriptor;
@@ -42,6 +43,7 @@
protected void setUp() {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(
STYLE_OPENON_PROJECT);
+ JobUtils.waitForIdle();
}
public OpenOnsTest() {
@@ -50,6 +52,56 @@
public static final String WEB_XML_FILE_PATH = "WebContent/WEB-INF/web.xml";
+ public void testFilterNameOpenOn() throws PartInitException, BadLocationException {
+ IFile webXml = project.getFile(WEB_XML_FILE_PATH);
+ IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
+ IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ editor = ((EditorPartWrapper)editor).getEditor();
+ JobUtils.waitForIdle();
+ DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
+ xmlMultyPageEditor.selectPageByName("Source");
+ ISourceViewer viewer = xmlMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ "Filter1", true, true, false, false);
+ reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset()+reg.getLength()+1,
+ "Filter1", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ITextSelection selection =
(ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<filter-name>", selection.getText());
+ }
+
+ public void testRoleNameOpenOn() throws PartInitException, BadLocationException {
+ IFile webXml = project.getFile(WEB_XML_FILE_PATH);
+ IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
+ IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ editor = ((EditorPartWrapper)editor).getEditor();
+ JobUtils.waitForIdle();
+ DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
+ xmlMultyPageEditor.selectPageByName("Source");
+ ISourceViewer viewer = xmlMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ "Designer", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ITextSelection selection =
(ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<role-name>", selection.getText());
+ }
+
public void testServletNameOpenOn() throws PartInitException, BadLocationException {
IFile webXml = project.getFile(WEB_XML_FILE_PATH);
IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
@@ -70,30 +122,65 @@
reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset()+reg.getLength()+1,
"Faces Servlet", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- System.out.println(editor.getSite().getSelectionProvider().getSelection().toString());
+ ITextSelection selection =
(ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<servlet-name>", selection.getText());
}
+
+ public static final String TAGLIB_URI_TEST_FILE =
"WebContent/tldUriHyperlinkTests.jsp";
- public void testTagAttributeOpenOn() throws BadLocationException {
+ public void testTaglibUriFromJarOpenOn() throws BadLocationException {
IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(STYLE_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ .getFile(TAGLIB_URI_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
IDocument document =
jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument();
IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
- "value", true, true, false, false);
+ "jsf/core", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
System.out.println(fileName);
- assertTrue("style1.css".equals(fileName));
+ assertTrue("jsf_core.tld".equals(fileName));
}
+ public static final String TAGLIB_URI_JSP_ROOT_TEST_FILE =
"WebContent/jspTagsHyperlinkTests.jsp";
+ public void testTaglibUriFromJarinJspRootOpenOn() throws BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(project
+ .getFile(TAGLIB_URI_JSP_ROOT_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JobUtils.waitForIdle();
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+ IDocument document =
jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ "jsf/core", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ System.out.println(fileName);
+ assertTrue("jsf_core.tld".equals(fileName));
+ }
+
public static final String STYLE_TEST_FILE =
"WebContent/styleHyperlinkTests.jsp";
public static final String CSS1_TEST_FILE =
"WebContent/stylesheet/style1.css";
public static final String CSS2_TEST_FILE =
"WebContent/stylesheet/style2.css";
@@ -109,6 +196,10 @@
IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
"stylesheet/style1.css", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -127,6 +218,10 @@
IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
"style-class9\"", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -136,6 +231,10 @@
reg = new FindReplaceDocumentAdapter(document).find(0,
"style-class3", true, true, false, false);
links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -146,16 +245,17 @@
"style-class6", true, true, false, false);
links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
links[0].open();
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
fileName = editor.getEditorInput().getName();
assertTrue("style2.css".equals(fileName));
}
- public void testFilterNameOpenOn() {
-
- }
-
public static final String CLASS_TEST_FILE =
"WebContent/classHyperlinkTests.jsp";
public static final String CLASS1_TEST_FILE =
"JavaSource/org/jboss/test/ChangeListenerInstance.java";
@@ -166,24 +266,41 @@
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
-// IEditorInput fileInput = new FileEditorInput(project
-// .getFile(CLASS_TEST_FILE));
-// IDocumentProvider documentProvider = DocumentProviderRegistry
-// .getDefault().getDocumentProvider(fileInput);
-//
-// documentProvider.connect(fileInput);
-// IDocument document = documentProvider.getDocument(fileInput);
IRegion reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
"org.jboss.tools.test.ChangeListenerInstance", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
-// ClassHyperlink classHyper = new ClassHyperlink();
-// classHyper.setOffset(reg.getOffset());
-// classHyper.setDocument(document);
-// classHyper.open();
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
links[0].open();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
assertTrue("ChangeListenerInstance.java".equals(fileName));
}
+
+ public void testTaglibTagNameOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(project
+ .getFile(CLASS_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "view", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ System.out.println(links[0].getClass().getName());
+ links[0].open();
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("jsf_core.tld".equals(fileName));
+ }
+
+
}