diff options
author | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2018-03-19 14:52:33 +0800 |
---|---|---|
committer | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2018-03-19 14:56:16 +0800 |
commit | 8f3f7712090cee0fb44382082fa572d174b052b1 (patch) | |
tree | b34e4401ed2d757e5c126ac1c46b722c578f4376 /nokia/vnfmdriver/vfcadaptorservice | |
parent | 2f2580564d4afdbe16529142af68a53f24368441 (diff) |
Fix nexus-iq issues
Change-Id: I5735a9706ab07a1820a863f50e9a9ab8ffefc52d
Issue-ID: VFC-724
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice')
11 files changed, 62 insertions, 28 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/pom.xml index 0b45e531..13110a76 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/pom.xml +++ b/nokia/vnfmdriver/vfcadaptorservice/pom.xml @@ -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> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml index b7887a61..52ebd0e5 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml @@ -110,25 +110,33 @@ <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> @@ -151,13 +159,13 @@ <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> @@ -218,12 +226,12 @@ <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> @@ -232,6 +240,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>2.21.0</version> </plugin> <!-- <plugin> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/ServletInitializer.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/ServletInitializer.java index b51f7cf4..b5808879 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/ServletInitializer.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/ServletInitializer.java @@ -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 { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java index 4fa74d5e..feebf5c0 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java @@ -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); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java index 7878a00c..34ed7850 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorImpl.java @@ -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); + } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorInf.java index ffcb68b5..980f0365 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorInf.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientProcessorInf.java @@ -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; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java index cd4c7e31..7f3f7e8b 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java @@ -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); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java index 1810820e..8a2090fd 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java @@ -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 diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java index f7320998..d222b1ff 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java @@ -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()); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java index 92561966..9a05e23b 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java @@ -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 diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java index 1b9be3b4..50a32fae 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java @@ -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 |