[jbosstools-commits] JBoss Tools SVN: r41852 - in trunk: cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation and 2 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Sat Jun 9 13:18:18 EDT 2012
Author: vrubezhny
Date: 2012-06-09 13:18:17 -0400 (Sat, 09 Jun 2012)
New Revision: 41852
Added:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaValidationTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java
Log:
JBIDE-10738
As-you-type EL validation
JUnit test is added for CDI project
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2012-06-09 14:04:51 UTC (rev 41851)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2012-06-09 17:18:17 UTC (rev 41852)
@@ -24,6 +24,7 @@
import org.jboss.tools.cdi.ui.test.search.ELReferencesQueryParticipantTest;
import org.jboss.tools.cdi.ui.test.search.FiveDependentProjectsSearchParticipantTest;
import org.jboss.tools.cdi.ui.test.search.FiveDependentProjectsTestSetup;
+import org.jboss.tools.cdi.ui.test.validation.java.CDIAsYouTypeInJavaValidationTest;
import org.jboss.tools.cdi.ui.test.wizard.AddQualifiersToBeanWizardTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIClassWizardFactoryTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIWebProjectWizardTest;
@@ -61,13 +62,14 @@
suite.addTestSuite(ELReferencesQueryParticipantTest.class);
suite.addTestSuite(CATest.class);
suite.addTestSuite(OpenCDINamedBeanDialogTest.class);
+ suite.addTestSuite(CDIAsYouTypeInJavaValidationTest.class);
suiteAll.addTest(new CDICoreTestSetup(suite));
suiteAll.addTestSuite(AddQualifiersToBeanWizardTest.class);
suiteAll.addTestSuite(CDIRefactoringTest.class);
-
+
TestSuite dependentSuite = new TestSuite("Dependent Projects Tests");
dependentSuite.addTestSuite(FiveDependentProjectsSearchParticipantTest.class);
FiveDependentProjectsTestSetup dependent = new FiveDependentProjectsTestSetup(dependentSuite);
Added: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaValidationTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaValidationTest.java 2012-06-09 17:18:17 UTC (rev 41852)
@@ -0,0 +1,56 @@
+package org.jboss.tools.cdi.ui.test.validation.java;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.common.base.test.validation.java.BaseAsYouTypeInJavaValidationTest;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+public class CDIAsYouTypeInJavaValidationTest extends TCKTest {
+ private static final String PAGE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/TestBean.java";
+
+ private BaseAsYouTypeInJavaValidationTest baseTest;
+ protected IProject project;
+
+
+ private static final String [][] EL2VALIDATE =
+ {
+ {"#{namedBean.foos}", "\"foos\" cannot be resolved"},
+ {"#{snamedBean.foo}", "\"snamedBean\" cannot be resolved"},
+ {"#{['}", "EL syntax error: Expecting expression."}
+ };
+
+ public void setUp() throws Exception {
+ project = TCKTest.importPreparedProject("/");
+ baseTest = new BaseAsYouTypeInJavaValidationTest(project);
+ }
+
+ public void testAsYouTypeInJavaValidation() throws JavaModelException {
+ assertNotNull("Test project '" + TCKTest.MAIN_PROJECT_NAME + "' is not prepared", project);
+ baseTest.openEditor(PAGE_NAME);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ String defaultValidateUnresolvedEL = SeverityPreferences.ENABLE;
+ String defaultUnknownELVariableName = SeverityPreferences.IGNORE;
+ try {
+ defaultValidateUnresolvedEL = store.getString(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL);
+ defaultUnknownELVariableName = store.getString(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, SeverityPreferences.ENABLE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, SeverityPreferences.ERROR);
+ for (int i = 0; i < EL2VALIDATE.length; i++) {
+ baseTest.doAsYouTipeInJavaValidationTest(EL2VALIDATE[i][0], EL2VALIDATE[i][1]);
+ }
+ } finally {
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, defaultValidateUnresolvedEL);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, defaultUnknownELVariableName);
+ baseTest.closeEditor();
+ }
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java 2012-06-09 14:04:51 UTC (rev 41851)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java 2012-06-09 17:18:17 UTC (rev 41852)
@@ -66,6 +66,12 @@
public static final String EL2FIND_START = "#{";
public static final String EL2FIND_END = "}";
+ public BaseAsYouTypeInJavaValidationTest(IProject project) {
+ this.project = project;
+ }
+ public BaseAsYouTypeInJavaValidationTest() {
+ }
+
public void openEditor(String fileName) {
this.fileName = fileName;
editorPart = WorkbenchUtils.openEditor(project.getName()
@@ -127,7 +133,7 @@
return javaEditor != null ? javaEditor.getViewer() : null;
}
- protected void doAsYouTipeInJavaValidationTest(String elToValidate,
+ public void doAsYouTipeInJavaValidationTest(String elToValidate,
String errorMessage) throws JavaModelException {
String documentContent = document.get();
int start = (documentContent == null ? -1 : documentContent
More information about the jbosstools-commits
mailing list