Author: jharting
Date: 2009-07-22 04:59:04 -0400 (Wed, 22 Jul 2009)
New Revision: 3125
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Air.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Bird.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Car.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/CircularDependencyTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/DependentSelfConsumingNormalProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Food.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/House.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingDependentProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingNormalProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Petrol.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Pig.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Planet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingDependent1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Space.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Violation.java
Log:
Made a copy of circular dependency tests from webbeans tests
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Air.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Air.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Air.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+
+@ApplicationScoped
+class Air
+{
+
+ public Air()
+ {
+
+ }
+
+ @Initializer
+ public Air(Bird bird)
+ {
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Bird.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Bird.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Bird.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+
+@ApplicationScoped
+@SuppressWarnings("unused")
+class Bird
+{
+
+ private Air air;
+
+ public Bird()
+ {
+
+ }
+
+ @Initializer
+ public Bird(Air air)
+ {
+ this.air = air;
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Car.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Car.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Car.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,32 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Current;
+
+class Car
+{
+
+ public static boolean success;
+
+ @Current Petrol petrol;
+
+ public Car()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (petrol.getName().equals("petrol"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "herbie";
+ }
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/CircularDependencyTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/CircularDependencyTest.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/CircularDependencyTest.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,110 @@
+/*
+ * 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.circular;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * Spec version: 20090625
+ *
+ */
+@Artifact
+public class CircularDependencyTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testCircularInjectionOnTwoNormalBeans() throws Exception
+ {
+ getInstanceByType(Pig.class).getName();
+ assert Pig.success;
+ assert Food.success;
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testCircularInjectionOnOneNormalAndOneDependentBean() throws Exception
+ {
+
+ getInstanceByType(Car.class).getName();
+ assert Petrol.success;
+ assert Car.success;
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testCircularInjectionOnOneDependentAndOneNormalBean() throws Exception
+ {
+ getInstanceByType(Petrol.class).getName();
+ assert Petrol.success;
+ assert Car.success;
+ }
+
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testNormalProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean()
throws Exception
+ {
+ getInstanceByType(NormalSelfConsumingNormalProducer.class).ping();
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testNormalProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean()
throws Exception
+ {
+ getInstanceByType(DependentSelfConsumingNormalProducer.class).ping();
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testDependentProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean()
throws Exception
+ {
+ getInstanceByType(NormalSelfConsumingDependentProducer.class).ping();
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testNormalSelfConsumingProducer() throws Exception
+ {
+ getInstanceByType(Violation.class).ping();
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testNormalCircularConstructors() throws Exception
+ {
+ assert getInstanceByType(Bird.class) != null;
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testNormalAndDependentCircularConstructors() throws Exception
+ {
+ assert getInstanceByType(Planet.class) != null;
+ }
+
+ @Test
+ @SpecAssertion(section="5", id="b")
+ public void testSelfConsumingConstructorsOnNormalBean() throws Exception
+ {
+ assert getInstanceByType(House.class) != null;
+ }
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/DependentSelfConsumingNormalProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/DependentSelfConsumingNormalProducer.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/DependentSelfConsumingNormalProducer.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+class DependentSelfConsumingNormalProducer
+{
+ @SelfConsumingNormal1 Violation violation;
+
+ @Produces @ApplicationScoped @SelfConsumingNormal1
+ public Violation produceViolation() {
+ return new Violation();
+ }
+
+ public void ping() {
+
+ }
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Food.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Food.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Food.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,34 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Current;
+
+@ApplicationScoped
+class Food
+{
+
+ public static boolean success;
+
+ @Current Pig pig;
+
+ public Food()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (pig.getName().equals("john"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "food";
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/House.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/House.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/House.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+
+@ApplicationScoped
+class House
+{
+
+ // For serialization
+ public House() {}
+
+ @Initializer
+ public House(House house)
+ {
+ house.ping();
+ }
+
+ private void ping()
+ {
+
+ }
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingDependentProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingDependentProducer.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingDependentProducer.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+@ApplicationScoped
+class NormalSelfConsumingDependentProducer
+{
+ @SelfConsumingDependent1 Violation violation;
+
+ @Produces @SelfConsumingDependent1
+ public Violation produceViolation() {
+ return new Violation();
+ }
+
+ public void ping() {
+
+ }
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingNormalProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingNormalProducer.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/NormalSelfConsumingNormalProducer.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+@ApplicationScoped
+class NormalSelfConsumingNormalProducer
+{
+ @SelfConsumingNormal Violation violation;
+
+ @Produces @ApplicationScoped @SelfConsumingNormal
+ public Violation produceViolation() {
+ return new Violation();
+ }
+
+ public void ping() {
+
+ }
+}
\ No newline at end of file
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Petrol.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Petrol.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Petrol.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,34 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Current;
+
+@ApplicationScoped
+class Petrol
+{
+
+ public static boolean success;
+
+ @Current Car car;
+
+ public Petrol()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (car.getName().equals("herbie"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "petrol";
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Pig.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Pig.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Pig.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,34 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Current;
+
+@ApplicationScoped
+class Pig
+{
+
+ public static boolean success;
+
+ @Current Food food;
+
+ public Pig()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (food.getName().equals("food"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "john";
+ }
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Planet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Planet.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Planet.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.inject.Initializer;
+
+@SuppressWarnings("unused")
+class Planet
+{
+
+ private Space space;
+
+ @Initializer
+ public Planet(Space space)
+ {
+ this.space = space;
+ }
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingDependent1.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingDependent1.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingDependent1.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface SelfConsumingDependent1
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface SelfConsumingNormal
+{
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal1.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal1.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/SelfConsumingNormal1.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface SelfConsumingNormal1
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Space.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Space.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Space.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Initializer;
+
+@ApplicationScoped
+class Space
+{
+
+ // For serialization
+ public Space() {}
+
+ @Initializer
+ public Space(Planet planet)
+ {
+ }
+
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Violation.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Violation.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/circular/Violation.java 2009-07-22
08:59:04 UTC (rev 3125)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.lookup.circular;
+
+import java.io.Serializable;
+
+class Violation implements Serializable
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public void ping()
+ {
+
+ }
+
+}