Package csw.testkit.javadsl
Class FrameworkTestKitJunitResource
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- csw.testkit.javadsl.FrameworkTestKitJunitResource
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public final class FrameworkTestKitJunitResource extends org.junit.rules.ExternalResourceA Junit external resource for theFrameworkTestKit, making it possible to have Junit manage the lifecycle of the testkit. The testkit will be automatically shut down when the test completes or fails.Example:
public class JFrameworkExampleTest { @ClassRule public static final FrameworkTestKitJunitResource testKit = new FrameworkTestKitJunitResource(JCSWService.EventServer, JCSWService.ConfigServer); @Test public void spawnContainer() { ActorRef<ContainerMessage> containerRef = testKit.spawnContainer(ConfigFactory.load("container.conf")) } }
-
-
Constructor Summary
Constructors Constructor Description FrameworkTestKitJunitResource()Initialize testkit with default configurationFrameworkTestKitJunitResource(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol> actorSystem)Initialize testkit with provided actorSystemFrameworkTestKitJunitResource(FrameworkTestKit frameworkTestKit, java.util.List<csw.testkit.scaladsl.CSWService> services)FrameworkTestKitJunitResource(java.util.List<csw.testkit.scaladsl.CSWService> services)Initialize testkit and start all the provided services.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol>actorSystem()voidafter()Shuts down the FrameworkTestKitvoidbefore()Start FrameworkTestKitFrameworkTestKitframeworkTestKit()IEventServicejEventService()ILocationServicejLocationService()akka.actor.typed.ActorRef<ContainerMessage>spawnContainer(com.typesafe.config.Config config)Delegate to framework testkitakka.actor.typed.ActorRef<ComponentMessage>spawnStandalone(com.typesafe.config.Config config)Delegate to framework testkit
-
-
-
Constructor Detail
-
FrameworkTestKitJunitResource
public FrameworkTestKitJunitResource(FrameworkTestKit frameworkTestKit, java.util.List<csw.testkit.scaladsl.CSWService> services)
-
FrameworkTestKitJunitResource
public FrameworkTestKitJunitResource()
Initialize testkit with default configurationBy default only Location server gets started, if your tests requires other services [ex. Config, Event, Alarm etc.] along with location, then use other override which accepts sequence of
csw.testkit.scaladsl.CSWServiceto create instance of testkit
-
FrameworkTestKitJunitResource
public FrameworkTestKitJunitResource(java.util.List<csw.testkit.scaladsl.CSWService> services)
Initialize testkit and start all the provided services.- Parameters:
services- (undocumented)
-
FrameworkTestKitJunitResource
public FrameworkTestKitJunitResource(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol> actorSystem)
Initialize testkit with provided actorSystem
-
-
Method Detail
-
actorSystem
public akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol> actorSystem()
-
after
public void after()
Shuts down the FrameworkTestKit- Overrides:
afterin classorg.junit.rules.ExternalResource
-
before
public void before()
Start FrameworkTestKit- Overrides:
beforein classorg.junit.rules.ExternalResource
-
frameworkTestKit
public FrameworkTestKit frameworkTestKit()
-
jEventService
public IEventService jEventService()
-
jLocationService
public ILocationService jLocationService()
-
spawnContainer
public akka.actor.typed.ActorRef<ContainerMessage> spawnContainer(com.typesafe.config.Config config)
Delegate to framework testkit
-
spawnStandalone
public akka.actor.typed.ActorRef<ComponentMessage> spawnStandalone(com.typesafe.config.Config config)
Delegate to framework testkit
-
-