Fix nexus-iq issues 27/36427/1
authoryufei_zhou <yufei.zhou@nokia-sbell.com>
Mon, 19 Mar 2018 06:52:33 +0000 (14:52 +0800)
committeryufei_zhou <yufei.zhou@nokia-sbell.com>
Mon, 19 Mar 2018 06:56:16 +0000 (14:56 +0800)
Change-Id: I5735a9706ab07a1820a863f50e9a9ab8ffefc52d
Issue-ID: VFC-724
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
12 files changed:
nokia/vnfmdriver/pom.xml
nokia/vnfmdriver/vfcadaptorservice/pom.xml
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/ServletInitializer.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorInf.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java
nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java

index 03cbd89..7982c89 100644 (file)
@@ -37,7 +37,7 @@
             <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.19</version>
+                    <version>2.21.0</version>
                     <configuration>
                         <testFailureIgnore>true</testFailureIgnore>
                         <includes>
index 0b45e53..13110a7 100644 (file)
@@ -39,7 +39,7 @@
             <!-- Import dependency management from Spring Boot -->
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-dependencies</artifactId>
-            <version>1.5.7.RELEASE</version>
+            <version>2.0.0.RELEASE</version>
             <type>pom</type>
             <scope>import</scope>
         </dependency>
index b7887a6..52ebd0e 100644 (file)
     <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>2.5</version>
+            <version>2.6</version>
     </dependency>
         
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
+                       <version>4.5.5</version>
                </dependency>
+               <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
                <dependency>
                        <groupId>com.google.code.gson</groupId>
                        <artifactId>gson</artifactId>
+                       <version>2.8.2</version>
                </dependency>
                <dependency>
                        <groupId>org.json</groupId>
                        <artifactId>json</artifactId>
+                       <version>20180130</version>
                </dependency>
                <dependency>
                        <groupId>io.dropwizard</groupId>
                        <artifactId>dropwizard-core</artifactId>
-                       <version>0.8.0</version>
+                       <version>1.3.0</version>
                </dependency>
                
                <dependency>
         <dependency>
             <groupId>org.mybatis.spring.boot</groupId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
-            <version>1.3.1</version>
+            <version>1.3.2</version>
         </dependency>
 
 <dependency>
     <groupId>ca.juliusdavies</groupId>
     <artifactId>not-yet-commons-ssl</artifactId>
-    <version>0.3.9</version>
+    <version>0.3.11</version>
 </dependency>
        </dependencies>
     <build>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>1.5.7.RELEASE</version>
+                <version>2.0.0.RELEASE</version>
             </plugin>
             <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
-             <version>3.5</version>
+             <version>3.7.0</version>
              <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.21.0</version>
             </plugin>
             <!-- 
             <plugin>
index b51f7cf..b580887 100644 (file)
@@ -17,7 +17,7 @@
 package org.onap.vfc.nfvo.driver.vnfm.svnfm;
 
 import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 
 public class ServletInitializer extends SpringBootServletInitializer {
 
index 4fa74d5..feebf5c 100644 (file)
@@ -49,7 +49,8 @@ public class CatalogMgmrImpl implements CatalogMgmrInf{
                
                String url=adaptorEnv.getCatalogApiUriFront() + String.format(CommonConstants.RetrieveVnfPackagePath, vnfPackageId);
                
-               String responseStr = httpClientProcessor.process(url, RequestMethod.GET, null, null).getContent();
+//             String responseStr = httpClientProcessor.process(url, RequestMethod.GET, null, null).getContent();
+               String responseStr = httpClientProcessor.process(url).getContent();
                
                logger.info("CatalogMgmrImpl -> queryVnfPackage, responseStr is " + responseStr);
                
index 7878a00..34ed785 100644 (file)
@@ -134,4 +134,9 @@ public class HttpClientProcessorImpl implements HttpClientProcessorInf{
         return bos.toByteArray();  
        }
     }
+
+       @Override
+       public HttpResult process(String url) throws ClientProtocolException, IOException {
+               return process(url, RequestMethod.GET, null, null);
+       }
 }
index ffcb68b..980f036 100644 (file)
@@ -25,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 public interface HttpClientProcessorInf {
        public HttpResult process(String url, RequestMethod methodType, HashMap<String, String> headerMap, String bodyString) throws ClientProtocolException, IOException;
 
-       public HttpResult processBytes(String url, RequestMethod method, HashMap<String, String> map, byte[] fileBytes) throws ClientProtocolException, IOException; 
+       public HttpResult processBytes(String url, RequestMethod method, HashMap<String, String> map, byte[] fileBytes) throws ClientProtocolException, IOException;
+
+       public HttpResult process(String url) throws ClientProtocolException, IOException; 
 
 }
index cd4c7e3..7f3f7e8 100644 (file)
@@ -18,10 +18,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.impl;
 
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
-import org.apache.http.client.ClientProtocolException;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.util.CommonUtil;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
@@ -37,9 +34,6 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestMethod;
 
 import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
 
 @Component
 public class MsbMgmrImpl implements IMsbMgmr {
@@ -119,7 +113,8 @@ public class MsbMgmrImpl implements IMsbMgmr {
                try{
                        String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version);
 
-                       HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null);
+//                     HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null);
+                       HttpResult httpResult = httpClientProcessor.process(url);
 
                        String responseStr = httpResult.getContent();
                        logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr);
index 1810820..8a2090f 100644 (file)
@@ -145,7 +145,8 @@ public class VnfmDriverMgmrImplTest {
                execInfo.setJobId(100L);
                execInfo.setVnfmExecutionId("executionId_001");
                execInfo.setVnfInstanceId(vnfInstanceId);
-               
+               execInfo.setOperateStartTime(1234567);
+               execInfo.setOperateEndTime(2345678);
                when(jobDbManager.findNewestJobInfo()).thenReturn(execInfo);
        }
        
@@ -212,6 +213,8 @@ public class VnfmDriverMgmrImplTest {
                execInfo.setJobId(1L);
                execInfo.setVnfmExecutionId("executionId_001");
                execInfo.setStatus("finished");
+               execInfo.setVnfInstanceId(vnfInstanceId);
+               execInfo.toString();
                when(jobDbManager.findOne(Mockito.anyLong())).thenReturn(execInfo);
                
                CBAMQueryOperExecutionResponse cbamResponse = new CBAMQueryOperExecutionResponse();
@@ -222,7 +225,12 @@ public class VnfmDriverMgmrImplTest {
 //             when(cbamMgmr.queryOperExecution(Mockito.anyString())).thenReturn(cbamResponse);
                OperStatusVnfResponse response = vnfmDriverMgmr.getOperStatus(vnfmId, "1");
 //             
-//             Assert.assertEquals("executionId_001", response.getJobId());
+               Assert.assertEquals(0, execInfo.getOperateStartTime());
+               Assert.assertEquals(0, execInfo.getOperateEndTime());
+               Assert.assertEquals(1, execInfo.getJobId());
+               Assert.assertEquals("executionId_001", execInfo.getVnfmExecutionId());
+               Assert.assertEquals("finished", execInfo.getStatus());
+               Assert.assertEquals(vnfInstanceId, execInfo.getVnfInstanceId());
        }
        
        @Test
index f732099..d222b1f 100644 (file)
@@ -20,7 +20,6 @@ import static org.mockito.Mockito.when;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import org.apache.http.client.ClientProtocolException;
@@ -40,7 +39,6 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum.Deletionpending;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
 import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
-import org.springframework.web.bind.annotation.RequestMethod;
 
 import com.google.gson.Gson;
 
@@ -55,17 +53,18 @@ public class CatalogMgmrImplTest {
        
        private Gson gson = new Gson();
        
+       private HttpResult httpResult = new HttpResult();
+       
        @Before
        public void setUp() throws Exception {
-               MockitoAnnotations.initMocks(this);
-               AdaptorEnv env = new AdaptorEnv();
-               catalogMgmr.setAdaptorEnv(env);
-               MockitoAnnotations.initMocks(this);
        }
        
        @Test
        public void testQueryVnfPackage() throws ClientProtocolException, IOException
        {
+               MockitoAnnotations.initMocks(this);
+               AdaptorEnv env = new AdaptorEnv();
+               catalogMgmr.setAdaptorEnv(env);
                CatalogQueryVnfResponse response = new CatalogQueryVnfResponse();
                List<VnfInstanceInfo> vnfInstanceInfos = new ArrayList<VnfInstanceInfo>();
                VnfInstanceInfo vnfInstanceInfo = new VnfInstanceInfo();
@@ -101,14 +100,15 @@ public class CatalogMgmrImplTest {
                Deletionpending deletionPending = CommonEnum.Deletionpending.fALSE;
                packageInfo.setDeletionPending(deletionPending );
                
-               response.setPackageInfo(packageInfo );
+               response.setPackageInfo(packageInfo);
                
                String json = gson.toJson(packageInfo);
                
-               HttpResult httpResult = new HttpResult();
                httpResult.setContent(json);
                
-               when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
+//             when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
+               when(httpClientProcessor.process(Mockito.anyString())).thenReturn(httpResult);
+               
                VnfPackageInfo packageInfo1 = catalogMgmr.queryVnfPackage(vnfPackageId);
                Assert.assertEquals("1.3.5.6", packageInfo.getDownloadUri());
                Assert.assertEquals("name", packageInfo.getName());
index 9256196..9a05e23 100644 (file)
@@ -420,6 +420,19 @@ public class CbamMgmrImplTest {
        {
                String execId = "execId_001";
                CBAMQueryOperExecutionResponse response = cbamMgmr.queryOperExecution(execId);
+               Assert.assertEquals("id", response.getId());
+               Assert.assertEquals(null, response.getGrantId());
+               Assert.assertEquals(null, response.get_links());
+               Assert.assertEquals(null, response.getAdditionalData());
+               Assert.assertEquals(null, response.getCancelMode());
+               Assert.assertEquals(false, response.isCancelPending());
+               Assert.assertEquals(null, response.getMetadata());
+               Assert.assertEquals(null, response.getOperationName());
+               Assert.assertEquals(null, response.getOperationParams());
+               Assert.assertEquals(null, response.getOperationType());
+               Assert.assertEquals(null, response.getStartTime());
+               Assert.assertEquals(null, response.getStatus());
+               Assert.assertEquals(null, response.getVnfInstanceId());
        }
        
        @Test
index 1b9be3b..50a32fa 100644 (file)
@@ -55,6 +55,7 @@ public class MsbMgmrImplTest {
                httpResult.setStatusCode(200);
                
                when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
+               when(httpClientProcessor.process(Mockito.anyString())).thenReturn(httpResult);
        }
 
        @Test