Merge "Fix raw reference to SessionNegotiatior"
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / common / actor / CommonConfigTest.java
1 package org.opendaylight.controller.cluster.common.actor;
2
3 import org.junit.Test;
4 import scala.concurrent.duration.FiniteDuration;
5
6 import java.util.concurrent.TimeUnit;
7
8 import static org.junit.Assert.assertNotNull;
9 import static org.junit.Assert.assertEquals;
10 import static org.junit.Assert.assertTrue;
11
12 public class CommonConfigTest {
13
14     @Test
15     public void testCommonConfigDefaults(){
16         CommonConfig config = new CommonConfig.Builder<>("testsystem").build();
17
18         assertNotNull(config.getActorSystemName());
19         assertNotNull(config.getMailBoxCapacity());
20         assertNotNull(config.getMailBoxName());
21         assertNotNull(config.getMailBoxPushTimeout());
22         assertNotNull(config.isMetricCaptureEnabled());
23     }
24
25     @Test
26     public void testCommonConfigOverride(){
27
28         int expectedCapacity = 123;
29         String timeoutValue = "1000ms";
30         CommonConfig config = new CommonConfig.Builder<>("testsystem")
31                 .mailboxCapacity(expectedCapacity)
32                 .mailboxPushTimeout(timeoutValue)
33                 .metricCaptureEnabled(true)
34                 .build();
35
36         assertEquals(expectedCapacity, config.getMailBoxCapacity().intValue());
37
38         FiniteDuration expectedTimeout = FiniteDuration.create(1000, TimeUnit.MILLISECONDS);
39         assertEquals(expectedTimeout.toMillis(), config.getMailBoxPushTimeout().toMillis());
40
41         assertTrue(config.isMetricCaptureEnabled());
42     }
43 }