X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FMeteredBoundedMailboxTest.java;h=c027de0acf57fbeae8eeb129fc1d0a9be5921453;hb=refs%2Fchanges%2F62%2F27562%2F9;hp=60efb9d7ca1ec163b826b62efd485a7939e88068;hpb=2e15a7b29e4517e7b1b1ded0acb5a0ccf03d77e0;p=controller.git 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 60efb9d7ca..c027de0acf 100644 --- 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,16 +12,16 @@ import akka.actor.ActorSystem; import akka.actor.DeadLetter; import akka.actor.Props; import akka.actor.UntypedActor; -import akka.japi.Creator; import akka.testkit.JavaTestKit; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantLock; import org.junit.After; import org.junit.Before; import org.junit.Test; import scala.concurrent.duration.FiniteDuration; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantLock; - public class MeteredBoundedMailboxTest { private static ActorSystem actorSystem; @@ -30,14 +30,20 @@ public class MeteredBoundedMailboxTest { @Before public void setUp() throws Exception { - config = new CommonConfig.Builder<>("testsystem").build(); + config = new CommonConfig.Builder<>("testsystem").withConfigReader(new AkkaConfigurationReader() { + @Override + public Config read() { + return ConfigFactory.load(); + } + }).build(); actorSystem = ActorSystem.create("testsystem", config.get()); } @After public void tearDown() throws Exception { - if (actorSystem != null) - actorSystem.shutdown(); + if (actorSystem != null) { + actorSystem.shutdown(); + } } @Test @@ -80,21 +86,16 @@ public class MeteredBoundedMailboxTest { } public static Props props(final ReentrantLock lock){ - return Props.create(new Creator(){ - private static final long serialVersionUID = 1L; - @Override - public PingPongActor create() throws Exception { - return new PingPongActor(lock); - } - }); + return Props.create(PingPongActor.class, lock); } @Override public void onReceive(Object message) throws Exception { lock.lock(); try { - if ("ping".equals(message)) + if ("ping".equals(message)) { getSender().tell("pong", getSelf()); + } } finally { lock.unlock(); }