Rename Onap A1 client 31/2731/2
authorRehanRaza <muhammad.rehan.raza@est.tech>
Tue, 10 Mar 2020 09:24:50 +0000 (10:24 +0100)
committerRehanRaza <muhammad.rehan.raza@est.tech>
Tue, 10 Mar 2020 12:31:08 +0000 (13:31 +0100)
Change-Id: I651b1f278b92659b5c5a58a972a39c7b603fc716
Issue-ID: NONRTRIC-161
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
policy-agent/src/test/java/org/oransc/policyagent/clients/A1ClientFactoryTest.java

index d906930..1fa66cb 100644 (file)
@@ -69,14 +69,14 @@ public class A1ClientFactory {
             return Mono.just(createOscA1Client(ric));
         } else if (version == A1ProtocolType.SDNC_OSC) {
             return Mono.just(createSdncOscA1Client(ric));
-        } else { // A1ProtocolType.SDNR_ONAP
-            return Mono.just(createSdnrOnapA1Client(ric));
+        } else { // A1ProtocolType.SDNC_ONAP
+            return Mono.just(createSdncOnapA1Client(ric));
         }
     }
 
     private Mono<A1Client.A1ProtocolType> getProtocolVersion(Ric ric) {
         if (ric.getProtocolVersion() == A1ProtocolType.UNKNOWN) {
-            return fetchVersion(createSdnrOnapA1Client(ric)) //
+            return fetchVersion(createSdncOnapA1Client(ric)) //
                 .onErrorResume(notUsed -> fetchVersion(createSdncOscA1Client(ric))) //
                 .onErrorResume(notUsed -> fetchVersion(createOscA1Client(ric))) //
                 .onErrorResume(notUsed -> fetchVersion(createStdA1ClientImpl(ric))) //
@@ -101,7 +101,7 @@ public class A1ClientFactory {
             appConfig.getA1ControllerUsername(), appConfig.getA1ControllerPassword());
     }
 
-    protected A1Client createSdnrOnapA1Client(Ric ric) {
+    protected A1Client createSdncOnapA1Client(Ric ric) {
         return new SdncOnapA1Client(ric.getConfig(), appConfig.getA1ControllerBaseUrl(),
             appConfig.getA1ControllerUsername(), appConfig.getA1ControllerPassword());
     }
index b9d7f35..0568c36 100644 (file)
@@ -45,7 +45,7 @@ public class SdncOnapA1Client implements A1Client {
     public SdncOnapA1Client(RicConfig ricConfig, String baseUrl, String username, String password) {
         this(ricConfig, username, password, new AsyncRestClient(baseUrl + "/restconf/operations"));
         if (logger.isDebugEnabled()) {
-            logger.debug("SdnrOnapA1Client for ric: {}, a1ControllerBaseUrl: {}", ricConfig.name(), baseUrl);
+            logger.debug("SdncOnapA1Client for ric: {}, a1ControllerBaseUrl: {}", ricConfig.name(), baseUrl);
         }
     }
 
index 23cb671..6122c19 100644 (file)
@@ -66,7 +66,7 @@ public class A1ClientFactoryTest {
     A1Client sdncOscA1ClientMock;
 
     @Mock
-    A1Client sdnrOnapA1ClientMock;
+    A1Client sdncOnapA1ClientMock;
 
     private ImmutableRicConfig ricConfig =
         ImmutableRicConfig.builder().name(RIC_NAME).baseUrl("baseUrl").managedElementIds(new Vector<>()).build();
@@ -81,7 +81,7 @@ public class A1ClientFactoryTest {
 
     @Test
     public void createStd_ok() {
-        whenGetProtocolVersionSdnrOnapA1ClientThrowException();
+        whenGetProtocolVersionSdncOnapA1ClientThrowException();
         whenGetProtocolVersionSdncOscA1ClientThrowException();
         whenGetProtocolVersionOscA1ClientThrowException();
         whenGetProtocolVersionStdA1ClientReturnCorrectProtocol();
@@ -96,7 +96,7 @@ public class A1ClientFactoryTest {
 
     @Test
     public void createOsc_ok() {
-        whenGetProtocolVersionSdnrOnapA1ClientThrowException();
+        whenGetProtocolVersionSdncOnapA1ClientThrowException();
         whenGetProtocolVersionSdncOscA1ClientThrowException();
         whenGetProtocolVersionOscA1ClientReturnCorrectProtocol();
 
@@ -110,7 +110,7 @@ public class A1ClientFactoryTest {
 
     @Test
     public void createSdncOsc_ok() {
-        whenGetProtocolVersionSdnrOnapA1ClientThrowException();
+        whenGetProtocolVersionSdncOnapA1ClientThrowException();
         whenGetProtocolVersionSdncOscA1ClientReturnCorrectProtocol();
 
         StepVerifier.create(factoryUnderTest.createA1Client(ric)) //
@@ -122,12 +122,12 @@ public class A1ClientFactoryTest {
     }
 
     @Test
-    public void createSdnrOnap_ok() {
-        whenGetProtocolVersionSdnrOnapA1ClientReturnCorrectProtocol();
+    public void createSdncOnap_ok() {
+        whenGetProtocolVersionSdncOnapA1ClientReturnCorrectProtocol();
 
         StepVerifier.create(factoryUnderTest.createA1Client(ric)) //
             .expectSubscription() //
-            .expectNext(sdnrOnapA1ClientMock) //
+            .expectNext(sdncOnapA1ClientMock) //
             .verifyComplete();
 
         assertEquals(A1ProtocolType.SDNC_ONAP, ric.getProtocolVersion(), "Not correct protocol");
@@ -135,7 +135,7 @@ public class A1ClientFactoryTest {
 
     @Test
     public void createWithNoProtocol_error() {
-        whenGetProtocolVersionSdnrOnapA1ClientThrowException();
+        whenGetProtocolVersionSdncOnapA1ClientThrowException();
         whenGetProtocolVersionSdncOscA1ClientThrowException();
         whenGetProtocolVersionOscA1ClientThrowException();
         whenGetProtocolVersionStdA1ClientThrowException();
@@ -167,20 +167,20 @@ public class A1ClientFactoryTest {
 
         assertEquals(A1ProtocolType.STD_V1, ric.getProtocolVersion(), "Not correct protocol");
 
-        verifyNoMoreInteractions(sdnrOnapA1ClientMock);
+        verifyNoMoreInteractions(sdncOnapA1ClientMock);
         verifyNoMoreInteractions(sdncOscA1ClientMock);
         verifyNoMoreInteractions(oscA1ClientMock);
         verifyNoMoreInteractions(stdA1ClientMock);
     }
 
-    private void whenGetProtocolVersionSdnrOnapA1ClientThrowException() {
-        doReturn(sdnrOnapA1ClientMock).when(factoryUnderTest).createSdnrOnapA1Client(ric);
-        when(sdnrOnapA1ClientMock.getProtocolVersion()).thenReturn(Mono.error(new Exception(EXCEPTION_MESSAGE)));
+    private void whenGetProtocolVersionSdncOnapA1ClientThrowException() {
+        doReturn(sdncOnapA1ClientMock).when(factoryUnderTest).createSdncOnapA1Client(ric);
+        when(sdncOnapA1ClientMock.getProtocolVersion()).thenReturn(Mono.error(new Exception(EXCEPTION_MESSAGE)));
     }
 
-    private void whenGetProtocolVersionSdnrOnapA1ClientReturnCorrectProtocol() {
-        doReturn(sdnrOnapA1ClientMock).when(factoryUnderTest).createSdnrOnapA1Client(any(Ric.class));
-        when(sdnrOnapA1ClientMock.getProtocolVersion()).thenReturn(Mono.just(A1ProtocolType.SDNC_ONAP));
+    private void whenGetProtocolVersionSdncOnapA1ClientReturnCorrectProtocol() {
+        doReturn(sdncOnapA1ClientMock).when(factoryUnderTest).createSdncOnapA1Client(any(Ric.class));
+        when(sdncOnapA1ClientMock.getProtocolVersion()).thenReturn(Mono.just(A1ProtocolType.SDNC_ONAP));
     }
 
     private void whenGetProtocolVersionSdncOscA1ClientThrowException() {