Merge "Updated documentation and scripts using https between agent and MR"
[nonrtric.git] / policy-agent / src / test / java / org / oransc / policyagent / configuration / ApplicationConfigTest.java
index 27b9c87..5667fd2 100644 (file)
 package org.oransc.policyagent.configuration;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Properties;
 import java.util.Vector;
 
 import org.junit.jupiter.api.Test;
@@ -37,7 +37,7 @@ import org.oransc.policyagent.configuration.ApplicationConfigParser.ConfigParser
 import org.oransc.policyagent.exceptions.ServiceException;
 
 @ExtendWith(MockitoExtension.class)
-public class ApplicationConfigTest {
+class ApplicationConfigTest {
 
     private static final ImmutableRicConfig RIC_CONFIG_1 = ImmutableRicConfig.builder() //
         .name("ric1") //
@@ -49,14 +49,14 @@ public class ApplicationConfigTest {
     ConfigParserResult configParserResult(RicConfig... rics) {
         return ImmutableConfigParserResult.builder() //
             .ricConfigs(Arrays.asList(rics)) //
-            .dmaapConsumerConfig(new Properties()) //
-            .dmaapPublisherConfig(new Properties()) //
+            .dmaapConsumerTopicUrl("dmaapConsumerTopicUrl") //
+            .dmaapProducerTopicUrl("dmaapProducerTopicUrl") //
             .controllerConfigs(new HashMap<>()) //
             .build();
     }
 
     @Test
-    public void gettingNotAddedRicShouldThrowException() {
+    void gettingNotAddedRicShouldThrowException() {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
@@ -69,7 +69,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
+    void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         RicConfigUpdate update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).blockFirst();
@@ -78,10 +78,15 @@ public class ApplicationConfigTest {
 
         assertEquals(RIC_CONFIG_1, appConfigUnderTest.getRic(RIC_CONFIG_1.name()),
             "Not correct Ric retrieved from configurations.");
+
+        update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).blockFirst();
+        assertNull(update, "Nothing should be updated");
+        assertTrue(appConfigUnderTest.getRicConfigs().contains(RIC_CONFIG_1), "Ric should remain.");
+
     }
 
     @Test
-    public void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
+    void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
@@ -101,7 +106,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void removedRicShouldNotifyAllObserversOfRicRemoved() {
+    void removedRicShouldNotifyAllObserversOfRicRemoved() {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         ImmutableRicConfig ricConfig2 = ImmutableRicConfig.builder() //