Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Use ActorSystem.terminate()
[controller.git]
/
opendaylight
/
md-sal
/
sal-clustering-commons
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
common
/
actor
/
MeteredBoundedMailboxTest.java
diff --git
a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
index 60efb9d7ca1ec163b826b62efd485a7939e88068..9fe8a13222f9e731ea8312e10a249dc79764e41a 100644
(file)
--- a/
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
+++ b/
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
@@
-12,15
+12,15
@@
import akka.actor.ActorSystem;
import akka.actor.DeadLetter;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.actor.DeadLetter;
import akka.actor.Props;
import akka.actor.UntypedActor;
-import akka.japi.Creator;
import akka.testkit.JavaTestKit;
import akka.testkit.JavaTestKit;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import scala.concurrent.duration.FiniteDuration;
-
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import scala.concurrent.duration.FiniteDuration;
public class MeteredBoundedMailboxTest {
public class MeteredBoundedMailboxTest {
@@
-28,16
+28,23
@@
public class MeteredBoundedMailboxTest {
private static CommonConfig config;
private final ReentrantLock lock = new ReentrantLock();
private static CommonConfig config;
private final ReentrantLock lock = new ReentrantLock();
- @Before
- public void setUp() throws Exception {
- config = new CommonConfig.Builder<>("testsystem").build();
+ @BeforeClass
+ public static void setUp() throws Exception {
+ config = new CommonConfig.Builder<>("testsystem").withConfigReader(new AkkaConfigurationReader() {
+ @Override
+ public Config read() {
+ return ConfigFactory.load();
+ }
+ }).build();
actorSystem = ActorSystem.create("testsystem", config.get());
}
actorSystem = ActorSystem.create("testsystem", config.get());
}
- @After
- public void tearDown() throws Exception {
- if (actorSystem != null)
- actorSystem.shutdown();
+ @AfterClass
+ public static void tearDown() throws Exception {
+ if (actorSystem != null) {
+ actorSystem.terminate();
+ actorSystem = null;
+ }
}
@Test
}
@Test
@@
-75,26
+82,21
@@
public class MeteredBoundedMailboxTest {
ReentrantLock lock;
ReentrantLock lock;
- private PingPongActor(ReentrantLock lock){
+ private PingPongActor(
final
ReentrantLock lock){
this.lock = lock;
}
public static Props props(final ReentrantLock lock){
this.lock = lock;
}
public static Props props(final ReentrantLock lock){
- return Props.create(new Creator<PingPongActor>(){
- private static final long serialVersionUID = 1L;
- @Override
- public PingPongActor create() throws Exception {
- return new PingPongActor(lock);
- }
- });
+ return Props.create(PingPongActor.class, lock);
}
@Override
}
@Override
- public void onReceive(Object message) throws Exception {
+ public void onReceive(
final
Object message) throws Exception {
lock.lock();
try {
lock.lock();
try {
- if ("ping".equals(message))
+ if ("ping".equals(message))
{
getSender().tell("pong", getSelf());
getSender().tell("pong", getSelf());
+ }
} finally {
lock.unlock();
}
} finally {
lock.unlock();
}