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());
}
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());
}
Aggregations