Author: scabanovich
Date: 2011-02-07 07:48:59 -0500 (Mon, 07 Feb 2011)
New Revision: 29038
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JavaClassContentAssistProviderTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
Log:
JBIDE-8328
https://issues.jboss.org/browse/JBIDE-8328
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2011-02-07 11:45:16
UTC (rev 29037)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2011-02-07 12:48:59
UTC (rev 29038)
@@ -30,6 +30,7 @@
org.jboss.tools.jsf,
org.eclipse.jst.standard.schemas,
org.jboss.tools.vpe.ui.palette,
- org.eclipse.gef
+ org.eclipse.gef,
+ org.eclipse.pde.ui
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JavaClassContentAssistProviderTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JavaClassContentAssistProviderTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JavaClassContentAssistProviderTest.java 2011-02-07
12:48:59 UTC (rev 29038)
@@ -0,0 +1,64 @@
+package org.jboss.tools.jsf.jsp.ca.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.pde.internal.ui.editor.contentassist.TypeContentProposal;
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.ui.attribute.adapter.JavaClassContentAssistProvider;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+import junit.framework.TestCase;
+
+public class JavaClassContentAssistProviderTest extends TestCase {
+ static String jsfProjectName = "testJSFProject";
+ static IProject jsfProject;
+
+ public void setUp() throws Exception {
+ loadProjects();
+ List<IProject> projectList = new ArrayList<IProject>();
+ projectList.add(jsfProject);
+ J2EEComponentClasspathUpdater.getInstance().forceUpdate(projectList);
+ loadProjects();
+ }
+
+ private void loadProjects() throws Exception {
+ jsfProject = ProjectImportTestSetup.loadProject(jsfProjectName);
+ jsfProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ }
+
+ public void testJavaClassContentAssistProvider() {
+ IModelNature n = EclipseResourceUtil.getModelNature(jsfProject);
+ XModel model = n.getModel();
+ XModelObject listener = model.createModelObject("WebAppListener24", new
Properties());
+ assertNotNull(listener);
+ XAttribute a = listener.getModelEntity().getAttribute("listener-class");
+ JavaClassContentAssistProvider p = new JavaClassContentAssistProvider();
+ p.init(listener, null, a);
+ IContentProposalProvider pv = p.getContentProposalProvider();
+ IContentProposal[] ps = pv.getProposals("java.lang.", 10);
+ assertNotNull(ps);
+ assertTrue(ps.length > 0);
+ assertTrue(ps[0] instanceof TypeContentProposal);
+ Set<String> proposals = new HashSet<String>();
+ for (IContentProposal c: ps) {
+ proposals.add(c.getLabel());
+ }
+ assertTrue(proposals.contains("Double - java.lang"));
+
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JavaClassContentAssistProviderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2011-02-07
11:45:16 UTC (rev 29037)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2011-02-07
12:48:59 UTC (rev 29038)
@@ -23,6 +23,7 @@
import org.jboss.tools.jsf.jsp.ca.test.CASuggestsNotOnlyELProposalsJBIDE2437Test;
import
org.jboss.tools.jsf.jsp.ca.test.CAUnnecessaryElementsForDirAttributeInXHTMLPageJBIDE1813Test;
import org.jboss.tools.jsf.jsp.ca.test.CAVarAttributeForDataTableTagJBIDE2016;
+import org.jboss.tools.jsf.jsp.ca.test.JavaClassContentAssistProviderTest;
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide1704Test;
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide1717Test;
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide6259Test;
@@ -80,6 +81,11 @@
"org.jboss.tools.jsf.ui.test",
new String[] { "projects/testJSFProject", }, //$NON-NLS-1$
new String[] { "testJSFProject" })); //$NON-NLS-1$
+ suite.addTest(
+ new ProjectImportTestSetup(new TestSuite(JavaClassContentAssistProviderTest.class),
+ "org.jboss.tools.jsf.ui.test",
+ new String[] { "projects/testJSFProject", }, //$NON-NLS-1$
+ new String[] { "testJSFProject" })); //$NON-NLS-1$
suite.addTestSuite(JsfUiPreferencesPagesTest.class);
suite.addTestSuite(TaglibXMLUnformatedDTD_JBIDE5642.class);