Author: akazakov
Date: 2010-05-11 12:11:41 -0400 (Tue, 11 May 2010)
New Revision: 22014
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
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/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/beans.xml
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new CDI validation rule: Interceptor
or decorator is an alternative.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -35,5 +35,6 @@
defaultPreferences.put(CDIPreferences.DECORATOR_HAS_NAME, CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.ILLEGAL_SCOPE_FOR_INTERCEPTOR,
CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR,
CDIPreferences.WARNING);
+ defaultPreferences.put(CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE,
CDIPreferences.WARNING);
}
}
\ No newline at end of file
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-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -724,8 +724,8 @@
private void validateInterceptor(IInterceptor interceptor) {
/*
- * 2.5.3. Beans with no EL name - interceptor has a name (Non-Portable
- * behavior)
+ * 2.5.3. Beans with no EL name
+ * - interceptor has a name (Non-Portable behavior)
*/
if(interceptor.getName()!=null) {
ITextSourceReference declaration =
interceptor.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
@@ -737,6 +737,15 @@
}
addError(CDIValidationMessages.INTERCEPTOR_HAS_NAME,
CDIPreferences.INTERCEPTOR_HAS_NAME, declaration, interceptor.getResource());
}
+
+ /*
+ * 2.6.1. Declaring an alternative
+ * - interceptor is an alternative (Non-Portable behavior)
+ */
+ ITextSourceReference declaration = interceptor.getAlternativeDeclaration();
+ if(declaration!=null) {
+ addError(CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE,
CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration,
interceptor.getResource());
+ }
}
private void validateDecorator(IDecorator decorator) {
@@ -754,6 +763,15 @@
}
addError(CDIValidationMessages.DECORATOR_HAS_NAME, CDIPreferences.DECORATOR_HAS_NAME,
declaration, decorator.getResource());
}
+
+ /*
+ * 2.6.1. Declaring an alternative
+ * - decorator is an alternative (Non-Portable behavior)
+ */
+ ITextSourceReference declaration = decorator.getAlternativeDeclaration();
+ if(declaration!=null) {
+ addError(CDIValidationMessages.DECORATOR_IS_ALTERNATIVE,
CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration,
decorator.getResource());
+ }
}
private IAnnotationDeclaration getNamedStereotypeDeclaration(IStereotyped stereotyped)
{
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -81,7 +81,8 @@
public static String ILLEGAL_INTERCEPTOR_BINDING_METHOD;
public static String CONFLICTING_INTERCEPTOR_BINDINGS;
public static String OBSERVER_IN_INTERCEPTOR_OR_DECORATOR;
- public static String INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE;
+ public static String INTERCEPTOR_IS_ALTERNATIVE;
+ public static String DECORATOR_IS_ALTERNATIVE;
public static String MISSING_INTERCEPTOR_BINDING;
public static String ILLEGAL_SPECIALIZING_MANAGED_BEAN;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-11
16:11:41 UTC (rev 22014)
@@ -1,4 +1,5 @@
Definition Errors
+
2.2.2. Restricting the bean types of a bean
- bean class or producer method or field specifies a @Typed annotation,
and the value member specifies a class which does not correspond to a type
@@ -7,10 +8,6 @@
2.4.1. Built-in scope types
- interceptor or decorator has any scope other than @Dependent (Non-Portable behavior)
-
-
-
-
2.4.3. Declaring the bean scope
- bean class or producer method or field specifies multiple scope type annotations
@@ -32,6 +29,10 @@
- stereotype declares any other qualifier annotation
- stereotype is annotated @Typed
+
+
+
+
3.1. Managed beans
- the bean class of a managed bean is annotated with both
the @Interceptor and @Decorator stereotypes
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-11
16:11:41 UTC (rev 22014)
@@ -61,7 +61,8 @@
ILLEGAL_INTERCEPTOR_BINDING_METHOD=Non-static, non-private, final method of a managed
bean has a interceptor binding (either method level, or declaring class level)
CONFLICTING_INTERCEPTOR_BINDINGS=The set of interceptor bindings of a bean or
interceptor, including bindings inherited from stereotypes and other interceptor bindings,
has two instances of a certain interceptor binding type and the instances have different
values of some annotation member
OBSERVER_IN_INTERCEPTOR_OR_DECORATOR=Interceptor or decorator has a method with a
parameter annotated @Observes
-INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE=Interceptor or decorator is an alternative
+INTERCEPTOR_IS_ALTERNATIVE=Interceptor is an alternative
+DECORATOR_IS_ALTERNATIVE=Decorator is an alternative
MISSING_INTERCEPTOR_BINDING=Interceptor declared using @Interceptor does not declare any
interceptor binding
ILLEGAL_SPECIALIZING_MANAGED_BEAN=Managed bean class annotated @Specializes does not
directly extend the bean class of another managed bean
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -113,7 +113,7 @@
// {CDIPreferences.ILLEGAL_INTERCEPTOR_BINDING_METHOD,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInterceptorBindingMethod_label},
// {CDIPreferences.CONFLICTING_INTERCEPTOR_BINDINGS,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingInterceptorBindings_label},
// {CDIPreferences.OBSERVER_IN_INTERCEPTOR_OR_DECORATOR,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerInInterceptorOrDecorator_label},
-// {CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorOrDecoratorIsAlternative_label},
+ {CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorOrDecoratorIsAlternative_label},
// {CDIPreferences.MISSING_INTERCEPTOR_BINDING,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingInterceptorBinding_label},
},
CDICorePlugin.PLUGIN_ID
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.decorators;
+
+import javax.decorator.Decorator;
+import javax.enterprise.inject.Alternative;
+
+@Decorator
+@Alternative
+public class AlternativeDecoratorBroken {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/beans.xml
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/beans.xml 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/decorators/beans.xml 2010-05-11
16:11:41 UTC (rev 22014)
@@ -2,5 +2,6 @@
<decorators>
<class>org.jboss.jsr299.tck.tests.jdt.validation.decorators.NamedDecoratorBroken</class>
<class>org.jboss.jsr299.tck.tests.jdt.validation.decorators.DecoratorWithWrongScopeBroken</class>
+
<class>org.jboss.jsr299.tck.tests.jdt.validation.decorators.AlternativeDecoratorBroken</class>
</decorators>
-</beans>
+</beans>
\ No newline at end of file
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import javax.enterprise.inject.Alternative;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+@Alternative
+public class AlternativeInterceptorBroken {
+
+ @AroundInvoke
+ public Object alwaysReturnThis(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml 2010-05-11
16:11:41 UTC (rev 22014)
@@ -3,5 +3,6 @@
<class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.NamedInterceptorBroken</class>
<class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.FordInterceptor</class>
<class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.InterceptorWithWrongScopeBroken</class>
+
<class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.AltrenativeInterceptorBroken</class>
</interceptors>
</beans>
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-11
15:24:42 UTC (rev 22013)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-11
16:11:41 UTC (rev 22014)
@@ -58,8 +58,35 @@
}
/**
+ * 2.4.3. Declaring the bean scope
+ * - bean class or producer method or field specifies multiple scope type
annotations
+ *
+ * @throws Exception
+ */
+ public void testMultipleBeanScope() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/scope/broken/tooManyScopes/BeanWithTooManyScopeTypes_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, 22, 23);
+ int markerNumbers = getMarkersNumber(file);
+ assertEquals("StereotypeWithTyped_Broken.java should has two error markers.",
markerNumbers, 2);
+ }
+
+ /**
+ * 2.4.4. Default scope
+ * - bean does not explicitly declare a scope when there is no default scope
+ * (there are two different stereotypes declared by the bean that declare
different default scopes)
+ *
+ * @throws Exception
+ */
+ public void testBeanWithMultipleScopedStereotypes() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/Scallop_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, 24, 25);
+ int markerNumbers = getMarkersNumber(file);
+ assertEquals("Scallop_Broken.java should has two error markers.",
markerNumbers, 2);
+ }
+
+ /**
* 2.5.3. Beans with no EL name
- * - interceptor or decorator has a name (Non-Portable behavior)
+ * - interceptor has a name (Non-Portable behavior)
*
* @throws Exception
*/
@@ -71,54 +98,69 @@
}
/**
- * 2.7.1.3. Stereotype declares a non-empty @Named annotation (Non-Portable behavior)
- *
+ * 2.5.3. Beans with no EL name
+ * - decorator has a name (Non-Portable behavior)
+ *
* @throws Exception
*/
- public void testNonEmptyNamedForStereotype() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/nonEmptyNamed/StereotypeWithNonEmptyNamed_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.STEREOTYPE_DECLARES_NON_EMPTY_NAME, 31);
- int markerNumbers = getMarkersNumber(file);
- assertEquals("StereotypeWithNonEmptyNamed_Broken.java should has the only error
marker.", markerNumbers, 1);
+ public void testNamedDecorator() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedDecoratorBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 10);
+ file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedStereotypedDecoratorBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 8);
}
/**
- * 3.5.1. Declaring a resource
- * - producer field declaration specifies an EL name (together with one of @Resource,
@PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
- *
+ * 2.6.1. Declaring an alternative
+ * - interceptor is an alternative (Non-Portable behavior)
+ *
* @throws Exception
*/
- public void testResourceWithELName() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, 15, 19, 24, 27, 31);
+ public void testAlternativeInterceptor() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE,
9);
}
/**
- * 3.11. The qualifier @Named at injection points
- * - injection point other than injected field declares a @Named annotation that does
not specify the value member
+ * 2.6.1. Declaring an alternative
+ * - decorator is an alternative (Non-Portable behavior)
+ *
+ * @throws Exception
+ */
+ public void testAlternativeDecorator() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/AlternativeDecoratorBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_IS_ALTERNATIVE,
7);
+ }
+
+ /**
+ * 2.7.1.1. Declaring the default scope for a stereotype
+ * - stereotype declares more than one scope
*
* @throws Exception
*/
- public void testNamedInjectPoint() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/NamedInjectionBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, 10, 16);
+ public void testStereotypeScope() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/tooManyScopes/StereotypeWithTooManyScopeTypes_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, 32, 33);
+ int markerNumbers = getMarkersNumber(file);
+ assertEquals("StereotypeWithTooManyScopeTypes_Broken.java should has two error
markers.", markerNumbers, 2);
}
/**
- * 2.5.3. Beans with no EL name
- * - interceptor or decorator has a name (Non-Portable behavior)
- *
+ * 2.7.1.3. Declaring a @Named stereotype
+ * - stereotype declares a non-empty @Named annotation (Non-Portable behavior)
+ *
* @throws Exception
*/
- public void testNamedDecorator() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 10);
- file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/decorators/NamedStereotypedDecoratorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DECORATOR_HAS_NAME, 8);
+ public void testNonEmptyNamedForStereotype() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/nonEmptyNamed/StereotypeWithNonEmptyNamed_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.STEREOTYPE_DECLARES_NON_EMPTY_NAME, 31);
+ int markerNumbers = getMarkersNumber(file);
+ assertEquals("StereotypeWithNonEmptyNamed_Broken.java should has the only error
marker.", markerNumbers, 1);
}
/**
- * 2.7.1.3. Stereotype declares any other qualifier annotation
+ * 2.7.1.3. Declaring a @Named stereotype
+ * - stereotype declares any other qualifier annotation
*
* @throws Exception
*/
@@ -130,7 +172,8 @@
}
/**
- * 2.7.1.3. Stereotype is annotated @Typed
+ * 2.7.1.3. Declaring a @Named stereotype
+ * - stereotype is annotated @Typed
*
* @throws Exception
*/
@@ -142,46 +185,28 @@
}
/**
- * 2.7.1.1. Declaring the default scope for a stereotype
- * - stereotype declares more than one scope
+ * 3.5.1. Declaring a resource
+ * - producer field declaration specifies an EL name (together with one of @Resource,
@PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
* @throws Exception
*/
- public void testStereotypeScope() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/tooManyScopes/StereotypeWithTooManyScopeTypes_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, 32, 33);
- int markerNumbers = getMarkersNumber(file);
- assertEquals("StereotypeWithTooManyScopeTypes_Broken.java should has two error
markers.", markerNumbers, 2);
+ public void testResourceWithELName() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, 15, 19, 24, 27, 31);
}
/**
- * 2.4.3. Declaring the bean scope
- * - bean class or producer method or field specifies multiple scope type
annotations
+ * 3.11. The qualifier @Named at injection points
+ * - injection point other than injected field declares a @Named annotation that does
not specify the value member
*
* @throws Exception
*/
- public void testMultipleBeanScope() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/scope/broken/tooManyScopes/BeanWithTooManyScopeTypes_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, 22, 23);
- int markerNumbers = getMarkersNumber(file);
- assertEquals("StereotypeWithTyped_Broken.java should has two error markers.",
markerNumbers, 2);
+ public void testNamedInjectPoint() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/NamedInjectionBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, 10, 16);
}
/**
- * 2.4.4. Default scope
- * - bean does not explicitly declare a scope when there is no default scope
- * (there are two different stereotypes declared by the bean that declare
different default scopes)
- *
- * @throws Exception
- */
- public void testBeanWithMultipleScopedStereotypes() throws Exception {
- IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/Scallop_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE,
CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, 24, 25);
- int markerNumbers = getMarkersNumber(file);
- assertEquals("Scallop_Broken.java should has two error markers.",
markerNumbers, 2);
- }
-
- /**
* 3.3.6. Declaring a disposer method
* - method has more than one parameter annotated @Disposes
*