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;
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") //
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));
}
@Test
- public void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
+ void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
RicConfigUpdate update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).blockFirst();
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));
}
@Test
- public void removedRicShouldNotifyAllObserversOfRicRemoved() {
+ void removedRicShouldNotifyAllObserversOfRicRemoved() {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
ImmutableRicConfig ricConfig2 = ImmutableRicConfig.builder() //