<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>
<!-- 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>
<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>
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 {
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);
return bos.toByteArray();
}
}
+
+ @Override
+ public HttpResult process(String url) throws ClientProtocolException, IOException {
+ return process(url, RequestMethod.GET, null, null);
+ }
}
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;
}
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;
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 {
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);
execInfo.setJobId(100L);
execInfo.setVnfmExecutionId("executionId_001");
execInfo.setVnfInstanceId(vnfInstanceId);
-
+ execInfo.setOperateStartTime(1234567);
+ execInfo.setOperateEndTime(2345678);
when(jobDbManager.findNewestJobInfo()).thenReturn(execInfo);
}
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();
// 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
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.apache.http.client.ClientProtocolException;
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;
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();
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());
{
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
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