Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1253 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
23 changed files
with
559 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Air.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.context.ApplicationScoped; | ||
import javax.inject.Initializer; | ||
|
||
@ApplicationScoped | ||
class Air | ||
{ | ||
@Initializer | ||
public Air(Fish fish) | ||
{ | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.context.ApplicationScoped; | ||
import javax.inject.Current; | ||
|
||
@ApplicationScoped | ||
class Bar | ||
{ | ||
|
||
public static boolean success; | ||
|
||
@Current Foo foo; | ||
|
||
public Bar() | ||
{ | ||
success = false; | ||
} | ||
|
||
@PostConstruct | ||
public void postConstruct() | ||
{ | ||
if (foo.getName().equals("foo")) | ||
{ | ||
success = true; | ||
} | ||
} | ||
|
||
public String getName() | ||
{ | ||
return "bar"; | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bird.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.context.ApplicationScoped; | ||
import javax.inject.Initializer; | ||
|
||
@ApplicationScoped | ||
class Bird | ||
{ | ||
|
||
private Water water; | ||
|
||
@Initializer | ||
public Bird(Water water) | ||
{ | ||
this.water = water; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Car.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.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"; | ||
} | ||
|
||
} |
223 changes: 223 additions & 0 deletions
223
...ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import org.jboss.webbeans.test.unit.AbstractTest; | ||
import org.testng.annotations.Test; | ||
|
||
public class CircularDependencyTest extends AbstractTest | ||
{ | ||
|
||
|
||
@Test(groups="broken") | ||
public void testCircularInjectionOnTwoNormalBeans() throws Exception | ||
{ | ||
deployBeans(Pig.class, Food.class); | ||
manager.getInstanceByType(Pig.class).getName(); | ||
assert Pig.success; | ||
assert Food.success; | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testCircularInjectionOnOneNormalAndOneDependentBean() throws Exception | ||
{ | ||
deployBeans(Car.class, Petrol.class); | ||
manager.getInstanceByType(Petrol.class).getName(); | ||
assert Petrol.success; | ||
assert Car.success; | ||
} | ||
|
||
|
||
@Test(groups="broken") | ||
public void testCircularInjectionOnTwoSimpleDependentBeans() throws Exception | ||
{ | ||
deployBeans(Foo.class, Bar.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Foo.class).getName(); | ||
assert Foo.success; | ||
assert Bar.success; | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception | ||
{ | ||
deployBeans(DependentSelfConsumingDependentProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(DependentSelfConsumingDependentProducer.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test | ||
public void testNormalProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception | ||
{ | ||
deployBeans(NormalSelfConsumingNormalProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(NormalSelfConsumingNormalProducer.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test | ||
public void testNormalProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception | ||
{ | ||
deployBeans(DependentSelfConsumingNormalProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(DependentSelfConsumingNormalProducer.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test | ||
public void testDependentProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception | ||
{ | ||
deployBeans(NormalSelfConsumingDependentProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(NormalSelfConsumingDependentProducer.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test | ||
public void testNormalSelfConsumingProducer() throws Exception | ||
{ | ||
deployBeans(NormalLoopingProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Violation.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testDependentSelfConsumingProducer() throws Exception | ||
{ | ||
deployBeans(DependentLoopingProducer.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Violation.class).ping(); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testDependentCircularConstructors() throws Exception | ||
{ | ||
deployBeans(Water.class, Fish.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Fish.class); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testNormalCircularConstructors() throws Exception | ||
{ | ||
deployBeans(Bird.class, Air.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Bird.class); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testNormalAndDependentCircularConstructors() throws Exception | ||
{ | ||
deployBeans(Space.class, Planet.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Planet.class); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testSelfConsumingConstructorsOnDependentBean() throws Exception | ||
{ | ||
deployBeans(Farm.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(Farm.class); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
@Test(groups="broken") | ||
public void testSelfConsumingConstructorsOnNormalBean() throws Exception | ||
{ | ||
deployBeans(House.class); | ||
new RunInDependentContext() | ||
{ | ||
|
||
@Override | ||
protected void execute() throws Exception | ||
{ | ||
manager.getInstanceByType(House.class); | ||
} | ||
|
||
}.run(); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
.../src/test/java/org/jboss/webbeans/test/unit/lookup/circular/DependentLoopingProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...org/jboss/webbeans/test/unit/lookup/circular/DependentSelfConsumingDependentProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...va/org/jboss/webbeans/test/unit/lookup/circular/DependentSelfConsumingNormalProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Farm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.inject.Initializer; | ||
|
||
class Farm | ||
{ | ||
|
||
@Initializer | ||
public Farm(Farm farm) | ||
{ | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Fish.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.inject.Initializer; | ||
|
||
class Fish | ||
{ | ||
|
||
private Water water; | ||
|
||
@Initializer | ||
public Fish(Water water) | ||
{ | ||
this.water = water; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Foo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jboss.webbeans.test.unit.lookup.circular; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.inject.Current; | ||
|
||
class Foo | ||
{ | ||
|
||
public static boolean success; | ||
|
||
@Current Bar bar; | ||
|
||
public Foo() | ||
{ | ||
success = false; | ||
} | ||
|
||
@PostConstruct | ||
public void postConstruct() | ||
{ | ||
if (bar.getName().equals("bar")) | ||
{ | ||
success = true; | ||
} | ||
} | ||
|
||
public String getName() | ||
{ | ||
return "foo"; | ||
} | ||
|
||
} |
Oops, something went wrong.