Author: akazakov
Date: 2008-02-27 12:24:48 -0500 (Wed, 27 Feb 2008)
New Revision: 6607
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.2
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.java
Removed:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/widget/editor/
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1807Test.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1803 Added JUnitTest
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF 2008-02-27 17:10:34
UTC (rev 6606)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF 2008-02-27 17:24:48
UTC (rev 6607)
@@ -16,5 +16,6 @@
org.jboss.tools.jst.jsp,
org.jboss.tools.common.text.ext,
org.jboss.tools.jst.web
-Export-Package: org.jboss.tools.jst.jsp.test
+Export-Package: org.jboss.tools.jst.jsp.test,
+ org.jboss.tools.jst.jsp.test.ca
Bundle-ClassPath: jst-jsp-test.jar
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-02-27
17:10:34 UTC (rev 6606)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-02-27
17:24:48 UTC (rev 6607)
@@ -85,19 +85,20 @@
(document instanceof IStructuredDocument));
}
- protected void contentAssistantCommonTest(String fileName, int offset, String[]
proposals, boolean exactly){
- contentAssistantCommonTest(fileName, null, offset, proposals, exactly);
+
+ protected void checkProposals(String fileName, int offset, String[] proposals, boolean
exactly){
+ checkProposals(fileName, null, offset, proposals, exactly);
}
-
- protected void contentAssistantCommonTest(String fileName, String substring, int offset,
String[] proposals, boolean exactly){
+
+ protected void checkProposals(String fileName, String substring, int offset, String[]
proposals, boolean exactly){
openEditor(fileName);
-
+
int position = 0;
if(substring != null){
String documentContent = document.get();
position = documentContent.indexOf(substring);
}
-
+
ICompletionProposal[] result= null;
IContentAssistProcessor p= TestUtil.getProcessor(viewer, position+offset,
contentAssistant);
@@ -110,19 +111,19 @@
}
assertTrue("Content Assistant returned no proposals", (result != null
&& result.length > 0));
-
+
// for (int i = 0; i < result.length; i++) {
// System.out.println("proposal - "+result[i].getDisplayString());
// }
-
+
for (int i = 0; i < proposals.length; i++) {
assertTrue("Proposal "+proposals[i]+" not found!",
compareProposal(proposals[i], result));
}
-
+
if(exactly)
assertTrue("Some other proposals was found!", result.length ==
proposals.length);
}
-
+
protected boolean compareProposal(String proposalName, ICompletionProposal[]
proposals){
for (int i = 0; i < proposals.length; i++) {
if(proposals[i].getDisplayString().equals(proposalName)) return true;
@@ -136,7 +137,5 @@
.getActivePage().closeEditor(jspEditor, false);
jspEditor = null;
}
-
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1807Test.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1807Test.java 2008-02-27
17:10:34 UTC (rev 6606)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1807Test.java 2008-02-27
17:24:48 UTC (rev 6607)
@@ -42,7 +42,7 @@
"#{sessionScope}",
"#{view}"
};
-
- contentAssistantCommonTest(PAGE_NAME, "<input type=\"image\"
src=\"", 25, proposals, true);
+
+ checkProposals(PAGE_NAME, "<input type=\"image\" src=\"",
25, proposals, true);
}
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath 2008-02-27
17:10:34 UTC (rev 6606)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/.classpath 2008-02-27
17:24:48 UTC (rev 6607)
@@ -2,9 +2,9 @@
<classpath>
<classpathentry kind="src" output="WebContent/WEB-INF/dev"
path="src/action"/>
<classpathentry kind="src" path="src/model"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_07"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.jboss.ide.eclipse.as.classpath.core.runtime.ProjectRuntimeInitializer/JBoss
4.2 Runtime"/>
<classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry exported="true" kind="con"
path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="output" path="build/classes"/>
-</classpath>
+</classpath>
\ No newline at end of file
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml 2008-02-27
17:24:48 UTC (rev 6607)
@@ -0,0 +1,13 @@
+<!DOCTYPE composition 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">
+
+ <h:dataTable value="#{mapItems}" var="mapItem">
+ <h:dataTable value="#{mapItem.value.items}" var="test">
+ <h:outputText value="#{test.}"/>
+ </h:dataTable>
+ </h:dataTable>
+
+</html>
\ No newline at end of file
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1 2008-02-27
17:24:48 UTC (rev 6607)
@@ -0,0 +1,44 @@
+package demo;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.datamodel.DataModel;
+
+@Name("testComponentForVars")
+public class TestComponentForVarAttributes {
+
+ @DataModel
+ private Set<Value> setItems;
+
+ @DataModel
+ private List<Value> listItems;
+
+ @DataModel
+ private Map<String, Test> mapItems;
+
+ @DataModel
+ private Value[] arrayItems;
+
+ public Test getTest() {
+ return null;
+ }
+
+ public List<Value> getList() {
+ return null;
+ }
+
+ public static class Value {
+ public String getName() {
+ return null;
+ }
+ }
+
+ public static class Test {
+ public List<Value> getItems() {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.2
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.2
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.2 2008-02-27
17:24:48 UTC (rev 6607)
@@ -0,0 +1,5 @@
+package demo;
+
+public class TestComponentForVarAttributes {
+
+}
\ No newline at end of file
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.java
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.java 2008-02-27
17:24:48 UTC (rev 6607)
@@ -0,0 +1,5 @@
+package demo;
+
+public class TestComponentForVarAttributes {
+
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-02-27
17:10:34 UTC (rev 6606)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-02-27
17:24:48 UTC (rev 6607)
@@ -5,20 +5,21 @@
import java.util.Set;
import java.util.TreeSet;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextUtilities;
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.contentassist.IContentAssistantExtension;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -28,23 +29,18 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.eclipse.wst.sse.ui.internal.editor.EditorModelUtil;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-import org.jboss.tools.common.model.XJob;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
+import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
+import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class SeamELContentAssistTest extends TestCase {
+public class SeamELContentAssistTest extends ContentAssistantTestCase {
TestProjectProvider provider = null;
- IProject project = null;
boolean makeCopy = false;
private static final String PROJECT_NAME = "TestSeamELContentAssist";
private static final String PAGE_NAME = "/WebContent/login.xhtml";
@@ -72,6 +68,37 @@
}
}
+ /**
+ * Test for
http://jira.jboss.com/jira/browse/JBIDE-1803
+ */
+ public void testVarAttributes() {
+ try {
+ EditorTestHelper.joinBackgroundActivities();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("Test project \"" + PROJECT_NAME + "\" is not
loaded", (project != null));
+
+ IFile component =
project.getFile("src/action/demo/TestComponentForVarAttributes.java");
+ IFile newComponent =
project.getFile("src/action/demo/TestComponentForVarAttributes.1");
+ IFile emptyComponent =
project.getFile("src/action/demo/TestComponentForVarAttributes.2");
+ try{
+ component.setContents(newComponent.getContents(), true, false, new
NullProgressMonitor());
+ }catch(Exception e){
+ JUnitUtils.fail("Error during changing
'TestComponentForVarAttributes.java' content to
'TestComponentForVarAttributes.1'", e);
+ }
+ EditorTestHelper.joinJobs(1000,10000,500);
+
+ checkProposals("/WebContent/varAttributes.xhtml", 458, new
String[]{"test.name"}, false);
+
+ try{
+ component.setContents(emptyComponent.getContents(), true, false, new
NullProgressMonitor());
+ }catch(Exception e){
+ JUnitUtils.fail("Error during changing
'TestComponentForVarAttributes.java' content to
'TestComponentForVarAttributes.2'", e);
+ }
+ EditorTestHelper.joinJobs(1000,10000,500);
+ }
+
private static final String[] VALID_SEAM_EL_PROPOSALS = new String[] {
"TestSeamELContentAssistEntityManagerFactory",
"actor",
@@ -413,7 +440,6 @@
public void testSeamELContentAssist() {
try {
-// XJob.waitForJob();
EditorTestHelper.joinBackgroundActivities();
} catch (Exception e) {
e.printStackTrace();
@@ -444,7 +470,6 @@
// Delay for 3 seconds so that
// the Favorites view can be seen.
try {
-// XJob.waitForJob();
EditorTestHelper.joinBackgroundActivities();
} catch (Exception e) {
e.printStackTrace();
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2008-02-27
17:10:34 UTC (rev 6606)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2008-02-27
17:24:48 UTC (rev 6607)
@@ -13,7 +13,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.ITypedRegion;
@@ -26,13 +25,12 @@
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.editor.EditorModelUtil;
-import org.jboss.tools.common.model.XJob;
-import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
import org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlinkPartitioner;
import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.test.util.xpl.EditorTestHelper;
public class SeamViewHyperlinkPartitionerTest extends TestCase {
@@ -46,9 +44,8 @@
}
public void setUp() throws Exception {
- //provider = new TestProjectProvider("", null, PROJECT_NAME, makeCopy);
+ //provider = new TestProjectProvider("", null, PROJECT_NAME, makeCopy);
project =
ResourcesUtils.importProject(Platform.getBundle("org.jboss.tools.seam.ui.test"),
"/projects/TestSeamELContentAssist", new NullProgressMonitor());
- Throwable exception = null;
project.refreshLocal(IResource.DEPTH_INFINITE, null);
}
@@ -60,9 +57,10 @@
public void testSeamViewPartitioner() {
try {
- XJob.waitForJob();
- } catch (InterruptedException e) {
+ EditorTestHelper.joinBackgroundActivities();
+ } catch (Exception e) {
e.printStackTrace();
+ fail("Waiting for the jobs to complete has failed.");
}
assertTrue("Test project \"" + PROJECT_NAME + "\" is not
loaded", (project != null));