X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractTest.java;h=790c5c7ea05fab0c18586e72857e3466123c630c;hp=c0df6bd0059cf106ec549c83692ef49b20854e05;hb=aeabc9205320987968f20f19119b2591ac6c8d6a;hpb=283929615619b09a664fd46bd13e19cdb163ec4d diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java index c0df6bd005..790c5c7ea0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java @@ -7,8 +7,14 @@ */ package org.opendaylight.controller.cluster.datastore; +import akka.actor.ActorSystem; +import akka.testkit.JavaTestKit; +import com.typesafe.config.ConfigFactory; +import java.util.ArrayList; +import java.util.Collection; import java.util.concurrent.CompletionStage; import java.util.concurrent.atomic.AtomicLong; +import org.junit.After; import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier; import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier; import org.opendaylight.controller.cluster.access.concepts.FrontendType; @@ -32,6 +38,8 @@ public abstract class AbstractTest { private static final AtomicLong HISTORY_COUNTER = new AtomicLong(); private static final AtomicLong TX_COUNTER = new AtomicLong(); + private final Collection actorSystems = new ArrayList<>(); + protected static void setUpStatic() { HISTORY_COUNTER.set(1L); TX_COUNTER.set(1L); @@ -49,4 +57,17 @@ public abstract class AbstractTest { throws Exception { return Await.result(FutureConverters.toScala(completionStage), timeout); } + + @After + public void actorSystemCleanup() { + for (final ActorSystem system : actorSystems) { + JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE); + } + } + + protected ActorSystem newActorSystem(String name, String config) { + ActorSystem system = ActorSystem.create(name, ConfigFactory.load().getConfig(config)); + actorSystems.add(system); + return system; + } }