MsoRestClientNew not extends RestMsoImplementation 05/96505/2
authorEylon Malin <eylon.malin@intl.att.com>
Wed, 2 Oct 2019 12:41:08 +0000 (15:41 +0300)
committerIttay Stern <ittay.stern@att.com>
Wed, 2 Oct 2019 18:49:46 +0000 (18:49 +0000)
Issue-ID: VID-253
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I2e67f31bee79e05286fec4152ae5c85a96186047

vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerNewTest.java
vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java

index 5b05caa..4e7a77c 100644 (file)
@@ -30,6 +30,7 @@ import org.onap.vid.mso.MsoBusinessLogic;
 import org.onap.vid.mso.MsoBusinessLogicImpl;
 import org.onap.vid.mso.MsoInterface;
 import org.onap.vid.mso.MsoProperties;
+import org.onap.vid.mso.RestMsoImplementation;
 import org.onap.vid.mso.rest.MsoRestClientNew;
 import org.onap.vid.services.CloudOwnerService;
 import org.onap.vid.services.CloudOwnerServiceImpl;
@@ -49,14 +50,23 @@ public class MsoConfig {
     }
 
     @Bean
-    public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper,
-        HttpsAuthClient httpsAuthClient,
+    public MsoRestClientNew msoRestClientNew(ObjectMapper unirestObjectMapper,
         SystemPropertiesWrapper systemPropertiesWrapper,
         Logging loggingService){
         // Satisfy both interfaces -- MsoInterface and RestMsoImplementation
         return new MsoRestClientNew(
             new SyncRestClient(unirestObjectMapper, loggingService),
             SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL),
+            systemPropertiesWrapper
+        );
+    }
+
+    @Bean
+    public RestMsoImplementation restMsoImplementation(HttpsAuthClient httpsAuthClient,
+        SystemPropertiesWrapper systemPropertiesWrapper,
+        Logging loggingService){
+        // Satisfy both interfaces -- MsoInterface and RestMsoImplementation
+        return new RestMsoImplementation(
             httpsAuthClient,
             systemPropertiesWrapper,
             loggingService
index 535c97c..da66e89 100644 (file)
@@ -38,7 +38,6 @@ import org.onap.vid.mso.MsoResponseWrapper;
 import org.onap.vid.mso.MsoResponseWrapper2;
 import org.onap.vid.mso.RestMsoImplementation;
 import org.onap.vid.mso.RestObject;
-import org.onap.vid.mso.rest.MsoRestClientNew;
 import org.onap.vid.mso.rest.Request;
 import org.onap.vid.mso.rest.RequestDetails;
 import org.onap.vid.mso.rest.RequestDetailsWrapper;
@@ -90,7 +89,7 @@ public class MsoController extends RestrictedBaseController {
     private final CloudOwnerService cloudOwnerService;
 
     @Autowired
-    public MsoController(MsoBusinessLogic msoBusinessLogic, MsoRestClientNew msoClientInterface, CloudOwnerService cloudOwnerService) {
+    public MsoController(MsoBusinessLogic msoBusinessLogic, RestMsoImplementation msoClientInterface, CloudOwnerService cloudOwnerService) {
         this.msoBusinessLogic = msoBusinessLogic;
         this.restMso = msoClientInterface;
         this.cloudOwnerService = cloudOwnerService;
index 9c8902d..3497b4a 100644 (file)
@@ -87,7 +87,7 @@ public class RestMsoImplementation implements RestInterface {
      */
 
     @Autowired
-    protected RestMsoImplementation(HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemProperties, Logging loggingService){
+    public RestMsoImplementation(HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemProperties, Logging loggingService){
         this.httpsAuthClient=httpsAuthClient;
         this.systemProperties = systemProperties;
         this.loggingService = loggingService;
index 1d6dae9..6d7f74f 100644 (file)
@@ -39,7 +39,6 @@ import org.eclipse.jetty.util.security.Password;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.onap.vid.aai.HttpResponseWithRequestInfo;
-import org.onap.vid.aai.util.HttpsAuthClient;
 import org.onap.vid.changeManagement.MsoRequestDetails;
 import org.onap.vid.changeManagement.RequestDetailsWrapper;
 import org.onap.vid.changeManagement.WorkflowRequestDetail;
@@ -51,7 +50,6 @@ import org.onap.vid.mso.MsoProperties;
 import org.onap.vid.mso.MsoResponseWrapper;
 import org.onap.vid.mso.MsoResponseWrapperInterface;
 import org.onap.vid.mso.MsoUtil;
-import org.onap.vid.mso.RestMsoImplementation;
 import org.onap.vid.mso.RestObject;
 import org.onap.vid.utils.Logging;
 import org.onap.vid.utils.SystemPropertiesWrapper;
@@ -61,7 +59,7 @@ import org.springframework.http.HttpMethod;
 /**
  * Created by pickjonathan on 21/06/2017.
  */
-public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface {
+public class MsoRestClientNew implements MsoInterface {
 
     /**
      * The Constant dateFormat.
@@ -71,16 +69,18 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
     private static final String START = " start";
     private final SyncRestClient client;
     private final String baseUrl;
+    private final SystemPropertiesWrapper systemProperties;
     private final Map<String, String> commonHeaders;
+
     /**
      * The logger.
      */
     EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class);
 
-    public MsoRestClientNew(SyncRestClient client, String baseUrl, HttpsAuthClient authClient, SystemPropertiesWrapper systemPropertiesWrapper, Logging loggingService) {
-        super(authClient,systemPropertiesWrapper, loggingService);
+    public MsoRestClientNew(SyncRestClient client, String baseUrl, SystemPropertiesWrapper systemPropertiesWrapper) {
         this.client = client;
         this.baseUrl = baseUrl;
+        this.systemProperties = systemPropertiesWrapper;
         this.commonHeaders = initCommonHeaders();
     }
 
index 43edeeb..03a6c40 100644 (file)
@@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletRequest;
 import org.junit.Test;
 import org.onap.vid.mso.MsoBusinessLogicImpl;
 import org.onap.vid.mso.MsoInterface;
-import org.onap.vid.mso.rest.MsoRestClientNew;
+import org.onap.vid.mso.RestMsoImplementation;
 import org.onap.vid.mso.rest.RequestDetails;
 import org.onap.vid.mso.rest.RequestDetailsWrapper;
 import org.onap.vid.services.CloudOwnerServiceImpl;
@@ -36,7 +36,7 @@ public class MsoControllerNewTest {
 
     private MsoController createTestSubject() {
         try {
-            return new MsoController(new MsoBusinessLogicImpl(mock(MsoInterface.class)), mock(MsoRestClientNew.class),
+            return new MsoController(new MsoBusinessLogicImpl(mock(MsoInterface.class)), mock(RestMsoImplementation.class),
                 new CloudOwnerServiceImpl(null, null));
         } catch (Exception e) {
             return null;
index 5aa6505..09f0fd3 100644 (file)
@@ -50,8 +50,8 @@ import org.onap.vid.model.RequestReferencesContainer;
 import org.onap.vid.mso.MsoBusinessLogic;
 import org.onap.vid.mso.MsoResponseWrapper;
 import org.onap.vid.mso.MsoResponseWrapper2;
+import org.onap.vid.mso.RestMsoImplementation;
 import org.onap.vid.mso.RestObject;
-import org.onap.vid.mso.rest.MsoRestClientNew;
 import org.onap.vid.mso.rest.Request;
 import org.onap.vid.mso.rest.RequestDetails;
 import org.onap.vid.mso.rest.RequestDetailsWrapper;
@@ -73,13 +73,13 @@ public class MsoControllerTest {
     private MockMvc mockMvc;
     private MsoBusinessLogic msoBusinessLogic;
     private CloudOwnerService cloudService;
-    private MsoRestClientNew msoRestClient;
+    private RestMsoImplementation msoRestClient;
 
     @Before
     public void setUp() {
         msoBusinessLogic = mock(MsoBusinessLogic.class);
         cloudService = mock(CloudOwnerService.class);
-        msoRestClient = mock(MsoRestClientNew.class);
+        msoRestClient = mock(RestMsoImplementation.class);
         MsoController msoController = new MsoController(msoBusinessLogic, msoRestClient, cloudService);
 
         mockMvc = MockMvcBuilders.standaloneSetup(msoController).build();
index 4570075..aaaa324 100644 (file)
@@ -410,7 +410,7 @@ public class MsoRestClientNewTest {
         String sourceId = "";
         String endpoint = "";
         final SyncRestClient client = mock(SyncRestClient.class);
-        MsoRestClientNew testSubject = new MsoRestClientNew(client, "", null, new SystemPropertiesWrapper(), mock(Logging.class));
+        MsoRestClientNew testSubject = new MsoRestClientNew(client, "", new SystemPropertiesWrapper());
 
         // setup
         final HttpResponse<String> response = mock(HttpResponse.class);
@@ -474,10 +474,10 @@ public class MsoRestClientNewTest {
 
     private MsoRestClientNew msoRestClient() {
         return new MsoRestClientNew(new SyncRestClient(JOSHWORKS_JACKSON_OBJECT_MAPPER, mock(Logging.class)),
-            baseUrl(), null, new SystemPropertiesWrapper(), mock(Logging.class));
+            baseUrl(), new SystemPropertiesWrapper());
     }
 
     private MsoRestClientNew createTestSubject() {
-        return new MsoRestClientNew(null, "", null, new SystemPropertiesWrapper(), mock(Logging.class));
+        return new MsoRestClientNew(null, "", new SystemPropertiesWrapper());
     }
 }
index 63c17df..dd05a62 100644 (file)
@@ -99,7 +99,7 @@ public class MsoRestClientTest {
         initMocks(this);
         when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz");
         when(systemProperties.getProperty("app_display_name")).thenReturn("vid");
-        restClient = new MsoRestClientNew(client,baseUrl,null,systemProperties,loggingService);
+        restClient = new MsoRestClientNew(client, baseUrl, systemProperties);
     }
 
     @Test