diff options
author | 2018-03-19 14:52:33 +0800 | |
---|---|---|
committer | 2018-03-19 14:56:16 +0800 | |
commit | 8f3f7712090cee0fb44382082fa572d174b052b1 (patch) | |
tree | b34e4401ed2d757e5c126ac1c46b722c578f4376 /nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src | |
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/vfcadaptor/src')
9 files changed, 46 insertions, 21 deletions
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 |