Search in sources :

Example 1 with AkkaConfigurationReader

use of org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader in project controller by opendaylight.

the class RpcRegistryTest method staticSetup.

@BeforeClass
public static void staticSetup() throws InterruptedException {
    AkkaConfigurationReader reader = ConfigFactory::load;
    RemoteRpcProviderConfig config1 = new RemoteRpcProviderConfig.Builder("memberA").gossipTickInterval("200ms").withConfigReader(reader).build();
    RemoteRpcProviderConfig config2 = new RemoteRpcProviderConfig.Builder("memberB").gossipTickInterval("200ms").withConfigReader(reader).build();
    RemoteRpcProviderConfig config3 = new RemoteRpcProviderConfig.Builder("memberC").gossipTickInterval("200ms").withConfigReader(reader).build();
    node1 = ActorSystem.create("opendaylight-rpc", config1.get());
    node2 = ActorSystem.create("opendaylight-rpc", config2.get());
    node3 = ActorSystem.create("opendaylight-rpc", config3.get());
    waitForMembersUp(node1, Cluster.get(node2).selfUniqueAddress(), Cluster.get(node3).selfUniqueAddress());
    waitForMembersUp(node2, Cluster.get(node1).selfUniqueAddress(), Cluster.get(node3).selfUniqueAddress());
}
Also used : AkkaConfigurationReader(org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader) RemoteRpcProviderConfig(org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig) BeforeClass(org.junit.BeforeClass)

Example 2 with AkkaConfigurationReader

use of org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader in project controller by opendaylight.

the class RemoteRpcProviderConfigTest method testConfigCustomizations.

@Test
public void testConfigCustomizations() {
    AkkaConfigurationReader reader = new TestConfigReader();
    final int expectedCapacity = 100;
    String timeOutVal = "10ms";
    FiniteDuration expectedTimeout = FiniteDuration.create(10, TimeUnit.MILLISECONDS);
    RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("unit-test").metricCaptureEnabled(// enable metric capture
    true).mailboxCapacity(expectedCapacity).mailboxPushTimeout(timeOutVal).withConfigReader(reader).build();
    Assert.assertTrue(config.isMetricCaptureEnabled());
    Assert.assertEquals(expectedCapacity, config.getMailBoxCapacity().intValue());
    Assert.assertEquals(expectedTimeout.toMillis(), config.getMailBoxPushTimeout().toMillis());
    // Now check this config inside an actor
    ActorSystem system = ActorSystem.create("unit-test", config.get());
    TestActorRef<ConfigTestActor> configTestActorTestActorRef = TestActorRef.create(system, Props.create(ConfigTestActor.class));
    ConfigTestActor actor = configTestActorTestActorRef.underlyingActor();
    Config actorConfig = actor.getConfig();
    config = new RemoteRpcProviderConfig(actorConfig);
    Assert.assertTrue(config.isMetricCaptureEnabled());
    Assert.assertEquals(expectedCapacity, config.getMailBoxCapacity().intValue());
    Assert.assertEquals(expectedTimeout.toMillis(), config.getMailBoxPushTimeout().toMillis());
}
Also used : ActorSystem(akka.actor.ActorSystem) Config(com.typesafe.config.Config) FiniteDuration(scala.concurrent.duration.FiniteDuration) AkkaConfigurationReader(org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader) Test(org.junit.Test)

Aggregations

AkkaConfigurationReader (org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader)2 ActorSystem (akka.actor.ActorSystem)1 Config (com.typesafe.config.Config)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 RemoteRpcProviderConfig (org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig)1 FiniteDuration (scala.concurrent.duration.FiniteDuration)1