Author: vrubezhny
Date: 2010-09-17 13:51:11 -0400 (Fri, 17 Sep 2010)
New Revision: 25002
Removed:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1704Test/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
Log:
JBIDE-6529 : jsf test failures
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml 2010-09-17
17:18:05 UTC (rev 25001)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/projects/JsfJbide1791Test/WebContent/pages/jbide1791.xhtml 2010-09-17
17:51:11 UTC (rev 25002)
@@ -5,8 +5,6 @@
xmlns:f="http://java.sun.com/jsf/core">
<head>
- <style type="text/css">
-
- </style>
+ <style type="text/css"></style>
</head>
</html>
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-09-17
17:18:05 UTC (rev 25001)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-09-17
17:51:11 UTC (rev 25002)
@@ -4,8 +4,6 @@
import junit.framework.TestSuite;
import org.jboss.tools.jst.jsp.test.ca.Jbide1791Test;
-import org.jboss.tools.jst.jsp.test.ca.JsfJspJbide1704Test;
-import org.jboss.tools.jst.jsp.test.ca.JsfJspJbide1717Test;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1585Test;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1641Test;
@@ -15,8 +13,8 @@
TestSuite suite = new TestSuite("Test for org.jboss.tools.jst.jsp.test");
suite.addTestSuite(JstJspJbide1585Test.class);
suite.addTestSuite(JstJspJbide1641Test.class);
- suite.addTestSuite(JsfJspJbide1704Test.class);
- suite.addTestSuite(JsfJspJbide1717Test.class);
+// suite.addTestSuite(JsfJspJbide1704Test.class);
+// suite.addTestSuite(JsfJspJbide1717Test.class);
suite.addTestSuite(Jbide1791Test.class);
suite.addTestSuite(JspPreferencesPageTest.class);
Deleted:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2010-09-17
17:18:05 UTC (rev 25001)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2010-09-17
17:51:11 UTC (rev 25002)
@@ -1,114 +0,0 @@
-package org.jboss.tools.jst.jsp.test.ca;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.FindReplaceDocumentAdapter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
-import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
-import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.TestProjectProvider;
-
-public class JsfJspJbide1704Test extends ContentAssistantTestCase {
- TestProjectProvider provider = null;
-
- boolean makeCopy = false;
- private static final String PROJECT_NAME = "JsfJbide1704Test";
- private static final String PAGE_NAME = "/WebContent/pages/greeting";
-
- public static Test suite() {
- return new TestSuite(JsfJspJbide1704Test.class);
- }
-
- public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null,
PROJECT_NAME, makeCopy);
- project = provider.getProject();
- }
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
-
- public void testJspJbide1704 () {
- assertTrue("Test project \"" + PROJECT_NAME + "\" is not
loaded", (project != null));
- doTestJsfJspJbide1704(PAGE_NAME + ".jsp");
- }
-
- public void testXhtmlJbide1704 () {
- assertTrue("Test project \"" + PROJECT_NAME + "\" is not
loaded", (project != null));
- doTestJsfJspJbide1704(PAGE_NAME + ".xhtml");
- }
-
- private static final String TEST_RESOURCES_VALUE = "\"resources\"";
-
- private void doTestJsfJspJbide1704(String pageName) {
-
- openEditor(pageName);
-
- try {
-
- final IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
- " var=\"msg\"", true, true, false, false);
- String text = document.get();
- String errorMessage = null;
-
- List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant,
viewer, reg.getOffset());
-
- assertTrue("Content Assist returned no proposals: ", (res != null &&
res.size() > 0));
-
- for (ICompletionProposal proposal : res) {
- // There should not be a proposal of type AutoContentAssistantProposal in the result
- // (the only exclusion is EL-proposals)
-
- if (proposal instanceof AutoContentAssistantProposal) {
- if(((AutoContentAssistantProposal)proposal).getReplacementString().startsWith("#{"))
{
- // The only EL template proposal is allowed to be shown here
- continue;
- }
- }
-
-
- if (proposal instanceof CustomCompletionProposal) {
- // There are two cases are allowed to be shown
- // AutoContentAssistantProposal which returns the "resources" string as
replacement
- // CustomCompletionProposal which returns the current value string as replacement
-
- if (!(proposal instanceof AutoContentAssistantProposal)) {
- int equalSignIndex = text.lastIndexOf('=', reg.getOffset());
- if (equalSignIndex != -1) {
- String prevAttrValue = text.substring(equalSignIndex+1,
reg.getOffset()).trim();
- if
(((CustomCompletionProposal)proposal).getReplacementString().equals(prevAttrValue)){
- // The old value for the attribute is allowed to be shown here
- continue;
- }
- }
- } else {
- if
(((CustomCompletionProposal)proposal).getReplacementString().equals(TEST_RESOURCES_VALUE)){
- // The old value for the attribute is allowed to be shown here
- continue;
- }
-
- }
- }
-
- assertFalse("Content Assistant peturned proposals of type (" +
proposal.getClass().getName() + ").", (proposal instanceof
AutoContentAssistantProposal));
- }
-
- } catch (BadLocationException e) {
- fail(e.getMessage());
- }
-
- closeEditor();
- }
-
-}
Deleted:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2010-09-17
17:18:05 UTC (rev 25001)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2010-09-17
17:51:11 UTC (rev 25002)
@@ -1,115 +0,0 @@
-package org.jboss.tools.jst.jsp.test.ca;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
-import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.TestProjectProvider;
-
-
-public class JsfJspJbide1717Test extends ContentAssistantTestCase {
- TestProjectProvider provider = null;
- boolean makeCopy = false;
- private static final String PROJECT_NAME = "JsfJbide1704Test";
- private static final String PAGE_NAME = "/WebContent/pages/greeting.jsp";
- private static final String INSERT_BEFORE_STRING = "<h:outputText";
- private static final String INSERTION_BEGIN_STRING = "<h:outputText
value=\"";
- private static final String INSERTION_END_STRING = "\" />";
- private static final String JSF_EXPR_STRING = "#{msg.greeting}";
-
- public static Test suite() {
- return new TestSuite(JsfJspJbide1717Test.class);
- }
-
- public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test", null,
PROJECT_NAME, makeCopy);
- project = provider.getProject();
- }
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
-
- public void testJstJspJbide1717() {
- openEditor(PAGE_NAME);
-
- // Find start of <h:outputText> tag
- String documentContent = document.get();
- int start = (documentContent == null ? -1 :
documentContent.indexOf(INSERT_BEFORE_STRING));
-
- assertTrue("Cannot find the starting point in the test file \"" +
PAGE_NAME + "\"", (start != -1));
-
- // First of all perform the test on a region placed in one space behind empty-valued
attribute -
- // this is to return normal list of attribute names proposal list
-
- String documentContentModified = documentContent.substring(0, start) +
- INSERTION_BEGIN_STRING + INSERTION_END_STRING + documentContent.substring(start);
-
- int offsetToTest = start + INSERTION_BEGIN_STRING.length() + 2;
-
- jspTextEditor.setText(documentContentModified);
-
- String errorMessage = null;
-
- List<ICompletionProposal> res = TestUtil.collectProposals(contentAssistant,
viewer, offsetToTest);
-
- List<String> customCompletionProposals = new ArrayList<String>();
-
- if (res != null) {
- for (ICompletionProposal proposal : res) {
- // There should be at least one proposal of type CustomCompletionProposal in the
result
- if (proposal instanceof CustomCompletionProposal) {
- customCompletionProposals.add(((CustomCompletionProposal)proposal).getReplacementString());
- }
- }
- }
- assertFalse("Content Assistant returned no proposals of type
CustomCompletionProposal.",customCompletionProposals.isEmpty());
-
- try {
- JobUtils.waitForIdle();
- } catch (Exception e) {
- e.printStackTrace();
- assertTrue("Waiting for the jobs to complete has failed.", false);
- }
-
- // Next perform the test on a region placed in one space behind an attribute those
value is a container
- // (contains JSF expression) - this has to return the same normal list of attribute
names proposal list as
- // we got at the first step (because the tag is the same, but only the attribute value
is changed)
-
- documentContentModified = documentContent.substring(0, start) +
- INSERTION_BEGIN_STRING + JSF_EXPR_STRING + INSERTION_END_STRING +
documentContent.substring(start);
-
- offsetToTest = start + INSERTION_BEGIN_STRING.length() + JSF_EXPR_STRING.length() + 2;
-
- String visualizeCursorPosition = documentContentModified.substring(0, offsetToTest) +
- "|" + documentContentModified.substring(offsetToTest);
-
- jspTextEditor.setText(documentContentModified);
-
- res = TestUtil.collectProposals(contentAssistant, viewer, offsetToTest);
-
- if (res != null) {
- for (ICompletionProposal proposal : res) {
- // There should be the same proposals as in the saved result
- if (proposal instanceof CustomCompletionProposal) {
- assertTrue("Content Assistant returned additional proposal (proposal returned
doesn't exist in the saved list).",
- customCompletionProposals.contains(((CustomCompletionProposal)proposal).getReplacementString()));
- customCompletionProposals.remove(((CustomCompletionProposal)proposal).getReplacementString());
- }
- }
- }
- assertTrue("Content Assistant didn't returned some
proposals.",customCompletionProposals.isEmpty());
-
- closeEditor();
- }
-
-
-}