Author: akazakov
Date: 2012-08-16 18:45:09 -0400 (Thu, 16 Aug 2012)
New Revision: 43079
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTAnnotationValidationTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTDefenitionErrorsValidationTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/AbstractAnnotationTest.java
Log:
https://issues.jboss.org/browse/JBIDE-10611 As-you-type CDI validation
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2012-08-16
22:38:16 UTC (rev 43078)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2012-08-16
22:45:09 UTC (rev 43079)
@@ -54,6 +54,7 @@
import org.jboss.tools.cdi.core.test.tck.lookup.ResolutionByNameTest;
import org.jboss.tools.cdi.core.test.tck.lookup.ResolutionByTypeTest;
import org.jboss.tools.cdi.core.test.tck.lookup.UnsatisfiedDependencyTest;
+import org.jboss.tools.cdi.core.test.tck.validation.AYTAnnotationValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.AYTDefenitionErrorsValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.AnnotationsValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.BeansXmlValidationTest;
@@ -134,6 +135,12 @@
// As-you-type validation tests
suite.addTestSuite(AYTDefenitionErrorsValidationTest.class);
+// suite.addTestSuite(DeploymentProblemsValidationTests.class);
+// suite.addTestSuite(BeansXmlValidationTest.class);
+ suite.addTestSuite(AYTAnnotationValidationTest.class);
+// suite.addTestSuite(CoreValidationTest.class);
+// suite.addTestSuite(ELValidationTest.class);
+// suite.addTestSuite(SuppressWarningsTests.class);
// Refactoring test
suite.addTestSuite(NamedBeanRefactoringTest.class);
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTAnnotationValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTAnnotationValidationTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTAnnotationValidationTest.java 2012-08-16
22:45:09 UTC (rev 43079)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.test.tck.validation;
+
+import org.jboss.tools.tests.IAnnotationTest;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class AYTAnnotationValidationTest extends AnnotationsValidationTest {
+
+ private CDIAnnotationTest annotationTest = new CDIAnnotationTest();
+
+ @Override
+ protected IAnnotationTest getAnnotationTest() {
+ return annotationTest;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTAnnotationValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTDefenitionErrorsValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTDefenitionErrorsValidationTest.java 2012-08-16
22:38:16 UTC (rev 43078)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTDefenitionErrorsValidationTest.java 2012-08-16
22:45:09 UTC (rev 43079)
@@ -20,6 +20,7 @@
private CDIAnnotationTest annotationTest = new CDIAnnotationTest();
+ @Override
protected IAnnotationTest getAnnotationTest() {
return annotationTest;
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2012-08-16
22:38:16 UTC (rev 43078)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2012-08-16
22:45:09 UTC (rev 43079)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IFile;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
+import org.jboss.tools.tests.IAnnotationTest;
/**
* Wrong targets in CDI annotation types.
@@ -24,101 +25,107 @@
*/
public class AnnotationsValidationTest extends ValidationTest {
+ private IAnnotationTest annotationTest = new AbstractResourceMarkerTest();
+
+ protected IAnnotationTest getAnnotationTest() {
+ return annotationTest;
+ }
+
public void testQualifierWithMissingTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/qualifier/broken/Hairy_MissingTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 36);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 36);
}
public void testQualifierWithMissingRetention() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/qualifier/broken/Hairy_MissingRetention.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, 36);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_QUALIFIER_TYPE, 36);
}
public void testQualifierWithWrongTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/qualifier/broken/Hairy_WrongTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 32);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 32);
}
public void testQualifierWithTargetOk() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/qualifier/HairyTargetOk.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 14);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE.substring(0, 56) +
".*", 14);
}
public void testStereotypeWithMissingTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/stereotype/broken/FishStereotype_MissingTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE.substring(0, 56) +
".*", 19);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE.substring(0, 56) +
".*", 19);
}
public void testStereotypeWithMissingRetention() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/stereotype/broken/FishStereotype_MissingRetention.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE, 19);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE, 19);
}
public void testStereotypeWithWrongTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/stereotype/broken/FishStereotype_WrongTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE.substring(0, 56) +
".*", 15);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE.substring(0, 56) +
".*", 15);
}
public void testScopeWithMissingTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/scope/broken/FooScoped_MissingTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE.substring(0, 52) +
".*", 33);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE.substring(0, 52) +
".*", 33);
}
public void testScopeWithMissingRetention() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/scope/broken/FooScoped_MissingRetention.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE, 33);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE, 33);
}
public void testScopeWithWrongTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/scope/broken/FooScoped_WrongTarget.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE.substring(0, 52) +
".*", 30);
+ getAnnotationTest().assertAnnotationIsCreated(file,
CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE.substring(0, 52) +
".*", 30);
}
public void testStereotypesWithAdditionalStereotypesWithTMFTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeTMFBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF,
"StereotypeWTypeTarget", "StereotypeTMFBroken"), 15);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF,
"StereotypeWTypeTarget", "StereotypeTMFBroken"), 15);
}
public void testStereotypesWithAdditionalStereotypesWithMTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeMBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M,
"StereotypeWTypeTarget", "StereotypeMBroken"), 13);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M,
"StereotypeWTypeTarget", "StereotypeMBroken"), 13);
}
public void testStereotypesWithAdditionalStereotypesWithFTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeFBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F,
"StereotypeWTypeTarget", "StereotypeFBroken"), 13);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F,
"StereotypeWTypeTarget", "StereotypeFBroken"), 13);
}
public void testStereotypesWithAdditionalStereotypesWithMFTarget() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeMFBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF,
"StereotypeWTypeTarget", "StereotypeMFBroken"), 14);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF,
"StereotypeWTypeTarget", "StereotypeMFBroken"), 14);
}
public void testStereotypesWithAdditionalStereotypesOk() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeOk.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF,
"StereotypeWTypeTarget", "StereotypeOk"), 13);
}
public void testInterceptorBindingWithAdditionalInterceptorBindings() throws Exception
{
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/InterceptorBindingBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE,
"InterceptorBindingWTypeTarget", "InterceptorBindingBroken"), 16);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE,
"InterceptorBindingWTypeTarget", "InterceptorBindingBroken"), 16);
}
public void testInterceptorBindingWithAdditionalInterceptorBindingsOk() throws Exception
{
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/InterceptorBindingOk.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE,
"InterceptorBindingWTypeTarget", "InterceptorBindingOk"), 15);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE,
"InterceptorBindingWTypeTarget", "InterceptorBindingOk"), 15);
}
public void testInterceptorBindingsForStereotypes() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE,
"StereotypeWithInterceptorBindingBroken",
"InterceptorBindingWTypeTarget"), 16);
+ getAnnotationTest().assertAnnotationIsCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE,
"StereotypeWithInterceptorBindingBroken",
"InterceptorBindingWTypeTarget"), 16);
}
public void testInterceptorBindingsForStereotypesOk() throws Exception {
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeOk.java");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE,
"StereotypeOk", "InterceptorBindingWTypeTarget"), 15);
+ getAnnotationTest().assertAnnotationIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE,
"StereotypeOk", "InterceptorBindingWTypeTarget"), 15);
}
}
\ No newline at end of file
Modified:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/AbstractAnnotationTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/AbstractAnnotationTest.java 2012-08-16
22:38:16 UTC (rev 43078)
+++
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/AbstractAnnotationTest.java 2012-08-16
22:45:09 UTC (rev 43079)
@@ -175,7 +175,7 @@
manager.validateJavaElement(dirtyRegions, helper, reporter);
// manager.validateString(dirtyRegions, helper, reporter);
- StringBuffer messagesSB = new StringBuffer("AYT annotations: [\r\n");
//$NON-NLS-1$
+ StringBuffer messagesSB = new StringBuffer("AYT messages: [\r\n");
//$NON-NLS-1$
List<IMessage> messages = new ArrayList<IMessage>();
i=0;
for (Object object : reporter.getMessages()) {
@@ -195,7 +195,7 @@
assertEquals("The number of markers doesn't equal to the number of AYT
messages for " + resource + ".\r\nThe full list of the markers and
messages:\r\n" + markersSB + "\r\n" + messagesSB, allMarkers.length,
messages.size());
for (IMessage message : messages) {
- assertTrue("Can't find message: [" + message + "] for " +
resource + ".\r\nThe full list of the markers and messages:\r\n" + markersSB +
"\r\n" + messagesSB, contains(allMarkers, message));
+ assertTrue("Can't find message: [text=\"" + message.getText() +
"\"; line=\"" + message.getLineNumber() + "\";
start=\"" + message.getOffset() + "\"; end=\"" +
message.getOffset() + message.getLength() + "\"; type=\"] for " +
resource + ".\r\nThe full list of the markers and messages:\r\n" + markersSB +
"\r\n" + messagesSB, contains(allMarkers, message));
}
} catch (BadLocationException e) {
throw new CoreException(new Status(IStatus.ERROR, BaseTestPlugin.PLUGIN_ID,
e.getMessage(), e));