You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2016/04/13 11:56:40 UTC
tomee git commit: TOMEE-1772 patch from Robert Panzer to make
DependsOnTest more deterministic
Repository: tomee
Updated Branches:
refs/heads/master 3d554efb7 -> 9cae46622
TOMEE-1772 patch from Robert Panzer to make DependsOnTest more deterministic
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/9cae4662
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/9cae4662
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/9cae4662
Branch: refs/heads/master
Commit: 9cae4662215af40f802d321d74e48c08dab787f0
Parents: 3d554ef
Author: Romain manni-Bucau <rm...@gmail.com>
Authored: Wed Apr 13 11:56:05 2016 +0200
Committer: Romain manni-Bucau <rm...@gmail.com>
Committed: Wed Apr 13 11:56:05 2016 +0200
----------------------------------------------------------------------
.../openejb/core/singleton/DependsOnTest.java | 53 +++++++++++++-------
1 file changed, 36 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/9cae4662/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/DependsOnTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/DependsOnTest.java b/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/DependsOnTest.java
index 9005ea8..1090811 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/DependsOnTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/DependsOnTest.java
@@ -41,6 +41,7 @@ import javax.annotation.PreDestroy;
import javax.ejb.DependsOn;
import javax.ejb.Singleton;
import javax.ejb.Startup;
+import javax.ejb.Stateless;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -83,7 +84,7 @@ public class DependsOnTest extends TestCase {
statelessContainer.properties.setProperty("MaxSize", "1");
assembler.createContainer(statelessContainer);
- actual.clear();
+ actualConstruct.clear();
final EjbJar ejbJar = new EjbJar();
@@ -95,16 +96,16 @@ public class DependsOnTest extends TestCase {
// startup and trigger @PostConstruct
assembler.createApplication(config.configureApplication(ejbJar));
- assertEquals(expected(four, three, two, one), actual);
+ assertEquals(expected(four, three, two, one), actualConstruct);
- actual.clear();
+ actualDestroy.clear();
// startup and trigger @PreDestroy
for (final AppInfo appInfo : assembler.getDeployedApplications()) {
assembler.destroyApplication(appInfo.path);
}
- assertEquals(expected(one, two, three, four), actual);
+ assertEquals(expected(one, two, three, four), actualDestroy);
}
public void testNoStartUp() throws Exception {
@@ -121,7 +122,7 @@ public class DependsOnTest extends TestCase {
// containers
assembler.createContainer(config.configureService(SingletonSessionContainerInfo.class));
- actual.clear();
+ actualConstruct.clear();
final EjbJar ejbJar = new EjbJar();
@@ -133,16 +134,16 @@ public class DependsOnTest extends TestCase {
// startup and trigger @PostConstruct
assembler.createApplication(config.configureApplication(ejbJar));
- assertEquals(expected(four, three, two, one), actual);
+ assertEquals(expected(four, three, two, one), actualConstruct);
- actual.clear();
+ actualDestroy.clear();
// startup and trigger @PreDestroy
for (final AppInfo appInfo : assembler.getDeployedApplications()) {
assembler.destroyApplication(appInfo.path);
}
- assertEquals(expected(one, two, three, four), actual);
+ assertEquals(expected(one, two, three, four), actualDestroy);
}
public void testNoSuchEjb() throws Exception {
@@ -213,7 +214,9 @@ public class DependsOnTest extends TestCase {
return Arrays.asList(strings);
}
- private final static List<String> actual = new ArrayList<String>();
+ private final static List<String> actualConstruct = new ArrayList<String>();
+
+ private final static List<String> actualDestroy = new ArrayList<String>();
public static interface Bean {
@@ -225,9 +228,13 @@ public class DependsOnTest extends TestCase {
public static class One implements Bean {
@PostConstruct
+ public void callbackConstruct() {
+ actualConstruct.add(one);
+ }
+
@PreDestroy
- public void callback() {
- actual.add(one);
+ public void callbackDestroy() {
+ actualDestroy.add(one);
}
}
@@ -237,9 +244,13 @@ public class DependsOnTest extends TestCase {
public static class Two implements Bean {
@PostConstruct
+ public void callbackConstruct() {
+ actualConstruct.add(two);
+ }
+
@PreDestroy
- public void callback() {
- actual.add(two);
+ public void callbackDestroy() {
+ actualDestroy.add(two);
}
}
@@ -249,9 +260,13 @@ public class DependsOnTest extends TestCase {
public static class Three implements Bean {
@PostConstruct
+ public void callbackConstruct() {
+ actualConstruct.add(three);
+ }
+
@PreDestroy
- public void callback() {
- actual.add(three);
+ public void callbackDestroy() {
+ actualDestroy.add(three);
}
}
@@ -260,9 +275,13 @@ public class DependsOnTest extends TestCase {
public static class Four implements Bean {
@PostConstruct
+ public void callbackConstruct() {
+ actualConstruct.add(four);
+ }
+
@PreDestroy
- public void callback() {
- actual.add(four);
+ public void callbackDestroy() {
+ actualDestroy.add(four);
}
}
}