Author: akazakov
Date: 2010-04-05 15:05:08 -0400 (Mon, 05 Apr 2010)
New Revision: 21271
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ScopeDefinitionTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808 Added new CDI Core tests for Scope
definitions.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ScopeDefinitionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ScopeDefinitionTest.java 2010-04-05
18:18:07 UTC (rev 21270)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ScopeDefinitionTest.java 2010-04-05
19:05:08 UTC (rev 21271)
@@ -69,4 +69,88 @@
assertEquals("Wrong scope type",
"javax.enterprise.context.Dependent",
bean.getScope().getSourceType().getFullyQualifiedName());
}
+
+ /**
+ * section 2.4.4 e), section 2.7.2 a)
+ *
+ * @throws JavaModelException
+ */
+ public void testScopeSpecifiedAndStereotyped() throws JavaModelException {
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.definition.scope.Minnow");
+ assertEquals("Wrong number of beans.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type",
+ "javax.enterprise.context.RequestScoped", bean.getScope()
+ .getSourceType().getFullyQualifiedName());
+ Set<IScopeDeclaration> declarations = bean.getScopeDeclarations();
+ assertEquals("Wrong number of scope declarations", 1, declarations
+ .size());
+ assertLocationEquals(declarations, 920, 14);
+ }
+
+ /**
+ * section 2.4.4 da)
+ *
+ * @throws JavaModelException
+ */
+ public void testMultipleIncompatibleScopeStereotypesWithScopeSpecified()
+ throws JavaModelException {
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.definition.scope.Pollock");
+ assertEquals("Wrong number of beans.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type",
"javax.enterprise.context.Dependent",
+ bean.getScope().getSourceType().getFullyQualifiedName());
+ Set<IScopeDeclaration> declarations = bean.getScopeDeclarations();
+ assertEquals("Wrong number of scope declarations", 1, declarations
+ .size());
+ assertLocationEquals(declarations, 930, 10);
+ }
+
+ /**
+ * section 2.4.4 c)
+ *
+ * @throws JavaModelException
+ */
+ public void testMultipleCompatibleScopeStereotypes()
+ throws JavaModelException {
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.definition.scope.Grayling");
+ assertEquals("Wrong number of beans.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type",
+ "javax.enterprise.context.ApplicationScoped", bean.getScope()
+ .getSourceType().getFullyQualifiedName());
+ }
+
+ /**
+ * section 2.7.2 db), section 4.1 ab)
+ *
+ * @throws JavaModelException
+ */
+ public void testWebBeanScopeTypeOverridesStereotype()
+ throws JavaModelException {
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.definition.scope.RedSnapper");
+ assertEquals("Wrong number of beans.", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type",
+ "javax.enterprise.context.RequestScoped", bean.getScope()
+ .getSourceType().getFullyQualifiedName());
+ Set<IScopeDeclaration> declarations = bean.getScopeDeclarations();
+ assertEquals("Wrong number of scope declarations", 1, declarations
+ .size());
+ assertLocationEquals(declarations, 915, 14);
+ }
+
+ /**
+ * section 4.1 ba)
+ *
+ * @throws JavaModelException
+ */
+ public void testScopeTypeDeclaredInheritedIsInherited()
+ throws JavaModelException {
+ Set<IBean> beans =
getBeans("org.jboss.jsr299.tck.tests.definition.scope.BorderCollie");
+ IBean bean = beans.iterator().next();
+ assertEquals("Wrong scope type",
+ "javax.enterprise.context.RequestScoped", bean.getScope()
+ .getSourceType().getFullyQualifiedName());
+ }
}
\ No newline at end of file