[jbosstools-commits] JBoss Tools SVN: r22074 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 4 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu May 13 19:41:04 EDT 2010
Author: akazakov
Date: 2010-05-13 19:41:02 -0400 (Thu, 13 May 2010)
New Revision: 22074
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.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/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new CDI validation rule: session bean specifies an illegal scope (a stateless session bean must belong
to the @Dependent pseudo-scope; a singleton bean must belong to either the
@ApplicationScoped scope or to the @Dependent pseudo-scope, a stateful session
bean may have any scope)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -43,6 +43,7 @@
public String STATEFUL_ANNOTATION_TYPE_NAME = "javax.ejb.Stateful";
public String STATELESS_ANNOTATION_TYPE_NAME = "javax.ejb.Stateless";
+ public String SINGLETON_ANNOTATION_TYPE_NAME = "javax.ejb.Singleton";
public String LOCAL_ANNOTATION_TYPE_NAME = "javax.ejb.Local";
public String RESOURCE_ANNOTATION_TYPE_NAME = "javax.annotation.Resource";
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -131,6 +131,19 @@
}
/**
+ * Checks if the bean has @ApplicationScoped scope. If it has different scope then @ApplicationScoped
+ * then returns this scope declaration or a stereotype which declares the
+ * scope. Otherwise returns null.
+ *
+ * @param bean
+ * @param scopeTypeName
+ * @return
+ */
+ public static IAnnotationDeclaration getDifferentScopeDeclarationThanApplicationScoped(IScoped scoped) {
+ return getAnotherScopeDeclaration(scoped, CDIConstants.APPLICATION_SCOPED_ANNOTATION_TYPE_NAME);
+ }
+
+ /**
* Checks if the bean has given scope. If it has different scope then given
* then returns this scope declaration or a stereotype which declares the
* scope. Otherwise returns null.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-
/**
* Represents a session bean.
*
@@ -26,6 +25,20 @@
boolean isStateful();
/**
+ * Returns "true" if this bean is a stateless session bean.
+ *
+ * @return "true" if this bean is a stateless session bean.
+ */
+ boolean isStateless();
+
+ /**
+ * Returns "true" if this bean is a singleton session bean.
+ *
+ * @return "true" if this bean is a singleton session bean.
+ */
+ boolean isSingleton();
+
+ /**
* Returns @Statefull annotaion declaration.
*
* @return @Statefull annotaion declaration.
@@ -38,4 +51,11 @@
* @return @Stateless annotaion declaration.
*/
IAnnotationDeclaration getStatelessDeclaration();
+
+ /**
+ * Returns @Singleton annotaion declaration.
+ *
+ * @return @Singleton annotaion declaration.
+ */
+ IAnnotationDeclaration getSingletonDeclaration();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -691,7 +691,7 @@
bean = new InterceptorBean();
} else if(typeDefinition.getDecoratorAnnotation() != null) {
bean = new DecoratorBean();
- } else if(typeDefinition.getStatefulAnnotation() != null || typeDefinition.getStatelessAnnotation() != null) {
+ } else if(typeDefinition.getStatefulAnnotation() != null || typeDefinition.getStatelessAnnotation() != null || typeDefinition.getSingletonAnnotation() != null) {
bean = new SessionBean();
} else {
bean = new ClassBean();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -33,9 +33,33 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#getSingletonDeclaration()
+ */
+ public IAnnotationDeclaration getSingletonDeclaration() {
+ return getDefinition().getSingletonAnnotation();
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.cdi.core.ISessionBean#isStateful()
*/
public boolean isStateful() {
return getDefinition().getStatefulAnnotation() != null;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#isSingleton()
+ */
+ public boolean isSingleton() {
+ return getDefinition().getSingletonAnnotation() != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#isStateless()
+ */
+ public boolean isStateless() {
+ return getDefinition().getStatelessAnnotation() != null;
+ }
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -34,6 +34,7 @@
BASIC_ANNOTATION_TYPES.add(STATEFUL_ANNOTATION_TYPE_NAME);
BASIC_ANNOTATION_TYPES.add(STATELESS_ANNOTATION_TYPE_NAME);
+ BASIC_ANNOTATION_TYPES.add(SINGLETON_ANNOTATION_TYPE_NAME);
SCOPE_ANNOTATION_TYPES.add(APPLICATION_SCOPED_ANNOTATION_TYPE_NAME);
SCOPE_ANNOTATION_TYPES.add(CONVERSATION_SCOPED_ANNOTATION_TYPE_NAME);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-05-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -94,4 +94,8 @@
public AnnotationDeclaration getStatelessAnnotation() {
return annotationsByType.get(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME);
}
+
+ public AnnotationDeclaration getSingletonAnnotation() {
+ return annotationsByType.get(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME);
+ }
}
\ 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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -314,6 +314,8 @@
validateDisposers(bean);
if(!(bean instanceof ISessionBean)) {
validateManagedBean(bean);
+ } else {
+ validateSessionBean((ISessionBean)bean);
}
}
@@ -703,6 +705,33 @@
}
}
+ private void validateSessionBean(ISessionBean bean) {
+ if(bean.isStateless()) {
+ /*
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ */
+ ITextSourceReference declaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
+ if(declaration!=null) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, declaration, bean.getResource());
+ }
+ } else if(bean.isSingleton()) {
+ /*
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope)
+ */
+ ITextSourceReference declaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
+ if(declaration!=null) {
+ declaration = CDIUtil.getDifferentScopeDeclarationThanApplicationScoped(bean);
+ }
+ if(declaration!=null) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, declaration, bean.getResource());
+ }
+ }
+ }
+
private void validateManagedBean(IClassBean bean) {
/*
* 3.1. Managed beans
@@ -751,7 +780,7 @@
try {
IBean sBean = bean.getSpecializedBean();
if(sBean!=null) {
- if(sBean instanceof ISessionBean || sBean.getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME)!=null) {
+ if(sBean instanceof ISessionBean || sBean.getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME)!=null || sBean.getAnnotation(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME)!=null) {
// The specializing bean directly extends an enterprise bean class
addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
} else {
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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -43,7 +43,8 @@
public static String STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE;
public static String ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD;
public static String ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE;
- public static String ILLEGAL_SCOPE_FOR_SESSION_BEAN;
+ public static String ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN;
+ public static String ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN;
public static String ILLEGAL_SCOPE_FOR_PRODUCER_METHOD;
public static String ILLEGAL_SCOPE_FOR_PRODUCER_FIELD;
public static String ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED;
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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-13 23:41:02 UTC (rev 22074)
@@ -52,6 +52,11 @@
- bean class of a session bean is annotated @Interceptor or @Decorator
- session bean with a parameterized bean class declares any scope other than @Dependent
+
+
+
+
+
3.2.4. Specializing a session bean
- session bean class annotated @Specializes does not directly extend
the bean class of another session bean
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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-13 23:41:02 UTC (rev 22074)
@@ -22,7 +22,8 @@
STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE=Stereotype declares more than one scope
ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD=Managed bean with a public field declares any scope other than @Dependent
ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE=Managed bean with a parameterized bean class declares any scope other than @Dependent
-ILLEGAL_SCOPE_FOR_SESSION_BEAN=Session bean specifies an illegal scope (a stateless session bean must belong to the @Dependent pseudo-scope; a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope, a stateful session bean may have any scope)
+ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN=Session bean specifies an illegal scope. A stateless session bean must belong to the @Dependent pseudo-scope.
+ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN=Session bean specifies an illegal scope. A singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope.
ILLEGAL_SCOPE_FOR_PRODUCER_METHOD=Producer method with a parameterized return type with a type variable declares any scope other than @Dependent
ILLEGAL_SCOPE_FOR_PRODUCER_FIELD=Producer field with a parameterized type with a type variable declares any scope other than @Dependent
ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED=Bean that declares any scope other than @Dependent has an injection point of type InjectionPoint and qualifier @Default
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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -63,7 +63,7 @@
{CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingScopeWhenThereIsNoDefaultScope_label},
{CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresMoreThanOneScope_label},
{CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForManagedBean_label},
-// {CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForSessionBean_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForSessionBean_label},
{CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerMethod_label},
{CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerField_label},
// {CDIPreferences.ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeWhenTypeInjectionPointIsInjected_label},
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-13 22:33:18 UTC (rev 22073)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-13 23:41:02 UTC (rev 22074)
@@ -266,6 +266,91 @@
}
/**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testStatelessWithRequestScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithRequestScope/Beagle_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ }
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testStatelessWithApplicationScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithApplicationScope/DachshundLocal_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ }
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testStatelessWithConversationScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithConversationScope/Boxer_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ }
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testStatelessWithSessionScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/statelessWithSessionScope/Bullmastiff_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, 23);
+ }
+
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testSingletonWithConversationScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/Husky_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 24);
+ }
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testSingletonWithSessionScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithSessionScope/IrishTerrier_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 25);
+ }
+
+ /**
+ * 3.2. Session beans
+ * - session bean specifies an illegal scope
+ * (a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope)
+ *
+ * @throws Exception
+ */
+ public void testSingletonWithRequestScopeFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithRequestScope/Greyhound_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, 23);
+ }
+
+ /**
* 3.5.1. Declaring a resource
* - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
More information about the jbosstools-commits
mailing list