Author: jharting
Date: 2009-07-28 04:31:29 -0400 (Tue, 28 Jul 2009)
New Revision: 3307
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/Salmon.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java
Log:
Tests for Unified EL integration
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java 2009-07-28
08:01:35 UTC (rev 3306)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/ResolutionByNameTest.java 2009-07-28
08:31:29 UTC (rev 3307)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.jsr299.tck.tests.lookup.el;
import javax.enterprise.context.Conversation;
@@ -17,7 +33,7 @@
public class ResolutionByNameTest extends AbstractJSR299Test
{
- @Test
+ @Test(groups="rewrite")
@SpecAssertions({
@SpecAssertion(section="5.8", id="c"),
@SpecAssertion(section="2.5", id="a")
@@ -29,10 +45,7 @@
}
@Test(groups = "beanLifecycle")
- @SpecAssertions({
- @SpecAssertion(section = "5.8", id = "bc"),
- @SpecAssertion(section = "6.5.2", id = "a")
- })
+ @SpecAssertion(section = "6.5.2", id = "a")
public void testContextCreatesNewInstanceForInjection()
{
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
@@ -41,5 +54,18 @@
TunaFarm tunaFarm =
getCurrentConfiguration().getEl().evaluateValueExpression("#{tunaFarm}",
TunaFarm.class);
assert tunaFarm.tuna != null;
}
+
+ @Test(groups="el")
+ @SpecAssertion(section="5.8", id="bb")
+ public void testUnresolvedNameReturnsNull() {
+ assert
getCurrentConfiguration().getEl().evaluateValueExpression("#{nonExistingTuna}",
Tuna.class) == null;
+ }
+ @Test(groups = "el")
+ @SpecAssertion(section="5.8", id="bc")
+ public void testELResolverReturnsContextualInstance() {
+ Salmon salmon = getInstanceByType(Salmon.class);
+ salmon.setAge(3);
+ assert
getCurrentConfiguration().getEl().evaluateValueExpression("#{salmon}",
Salmon.class).getAge() == 3;
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/Salmon.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/Salmon.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/el/Salmon.java 2009-07-28
08:31:29 UTC (rev 3307)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.lookup.el;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Named;
+
+@Named
+@RequestScoped
+class Salmon
+{
+ private int age = 0;
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+}