Author: akazakov
Date: 2010-12-24 18:36:03 -0500 (Fri, 24 Dec 2010)
New Revision: 27730
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
Log:
https://issues.jboss.org/browse/JBIDE-7961
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-24
22:34:36 UTC (rev 27729)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-24
23:36:03 UTC (rev 27730)
@@ -114,7 +114,7 @@
private BeansXmlValidationDelegate beansXmlValidator = new
BeansXmlValidationDelegate(this);
private AnnotationValidationDelegate annotationValidator = new
AnnotationValidationDelegate(this);
- static final String SHORT_ID = "jboss.cdi.core"; //$NON-NLS-1$
+ public static final String SHORT_ID = "jboss.cdi.core"; //$NON-NLS-1$
/*
* (non-Javadoc)
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java 2010-12-24
22:34:36 UTC (rev 27729)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java 2010-12-24
23:36:03 UTC (rev 27730)
@@ -10,12 +10,20 @@
******************************************************************************/
package org.jboss.tools.cdi.core.test.tck.validation;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.internal.core.validation.CDICoreValidator;
import org.jboss.tools.cdi.internal.core.validation.CDIProjectSet;
import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.internal.validation.LinkCollection;
+import org.jboss.tools.jst.web.kb.internal.validation.ProjectValidationContext;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidationContext;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
/**
* @author Alexey Kazakov
@@ -60,4 +68,33 @@
CDIProjectSet set = new CDIProjectSet(tckProject);
assertTrue("TCKProject is not included in the set of CDI projects",
set.getAllProjects().contains(tckProject));
}
+
+ /**
+ *
https://issues.jboss.org/browse/JBIDE-7961
+ */
+ public void testValidationContext() {
+ LinkCollection collection = getCoreLinks(tckProject);
+ assertFalse("Validation context for CDIproject is empty",
collection.isEmpty());
+ collection = getCoreLinks(tckProject, "jboss.seam");
+ assertTrue("Validation context for CDIproject with wrong ID is not empty",
collection.isEmpty());
+ }
+
+ private LinkCollection getCoreLinks(IProject project) {
+ return getCoreLinks(project, CDICoreValidator.SHORT_ID);
+ }
+
+ private LinkCollection getCoreLinks(IProject project, String validatorId) {
+ ValidationContext context = new ValidationContext(project);
+ List<IValidator> validators = context.getValidators();
+ IValidator cdiValidator = null;
+ for (IValidator validator : validators) {
+ if(validator instanceof CDICoreValidator) {
+ cdiValidator = validator;
+ }
+ }
+ if(cdiValidator!=null) {
+ return
((ProjectValidationContext)context.getValidatingProjectTree(cdiValidator).getBrunches().get(project).getRootContext()).getCoreLinks(validatorId);
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java 2010-12-24
22:34:36 UTC (rev 27729)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java 2010-12-24
23:36:03 UTC (rev 27730)
@@ -59,6 +59,9 @@
JobUtils.waitForIdle();
}
+ /**
+ *
https://issues.jboss.org/browse/JBIDE-7946
+ */
public void testDependentProjects() throws CoreException, IOException {
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
JobUtils.waitForIdle();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java 2010-12-24
22:34:36 UTC (rev 27729)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java 2010-12-24
23:36:03 UTC (rev 27730)
@@ -321,4 +321,8 @@
public String getId() {
return id;
}
+
+ public boolean isEmpty() {
+ return resourcesByVariableName.isEmpty() && variableNamesByResource.isEmpty()
&& resourcesByDeclaringVariableName.isEmpty() &&
declaringVariableNamesByResource.isEmpty() && unnamedResources.isEmpty();
+ }
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2010-12-24
22:34:36 UTC (rev 27729)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2010-12-24
23:36:03 UTC (rev 27730)
@@ -38,7 +38,7 @@
private ValidationResourceRegister validationResourceRegister;
- private LinkCollection getCoreLinks(String validatorId) {
+ public LinkCollection getCoreLinks(String validatorId) {
LinkCollection linkCollection = coreLinks.get(validatorId);
if(linkCollection==null) {
linkCollection = new LinkCollection(validatorId);