import java.io.IOException;
import org.onap.usecaseui.server.service.intent.IntentAaiService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
}
@Bean
- AAIService aaiService(Retrofit retrofit) {
- return retrofit.create(AAIService.class);
+ AAIClient aaiClient(Retrofit retrofit) {
+ return retrofit.create(AAIClient.class);
}
@Bean
import org.onap.usecaseui.server.constant.Constant;
import org.onap.usecaseui.server.service.customer.CcvpnCustomerService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger logger = LoggerFactory.getLogger(CcvpnCustomerServiceImpl.class);
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public ServiceInstances getServiceInstances(String customerId, String serviceType) {
ObjectMapper mapper = new ObjectMapper();
ServiceInstances serviceInstances = null;
try {
- Response<ResponseBody> response = this.aaiService.getAllServiceInformation(customerId, serviceType).execute();
+ Response<ResponseBody> response = this.aaiClient.getAllServiceInformation(customerId, serviceType).execute();
if (response.isSuccessful()) {
logger.info("Execute get all service for customer : End");
String result = new String(response.body().bytes());
try {
logger.info("aai querySubscriptionType is starting!");
- Response<ResponseBody> response = this.aaiService.getServiceSubscription(customerId).execute();
+ Response<ResponseBody> response = this.aaiClient.getServiceSubscription(customerId).execute();
logger.info("aai querySubscriptionType has finished!");
if (response.isSuccessful()) {
result = new String(response.body().bytes());
import retrofit2.http.Path;
import retrofit2.http.Query;
-public interface AAIService {
+public interface AAIClient {
// @GET("/api/aai-business/v11/customers")
package org.onap.usecaseui.server.service.lcm.impl;
import org.onap.usecaseui.server.service.lcm.CustomerService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
@RequiredArgsConstructor
public class DefaultCustomerService implements CustomerService {
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public List<AAICustomer> listCustomer() {
try {
- Response<AAICustomerRsp> response = this.aaiService.listCustomer().execute();
+ Response<AAICustomerRsp> response = this.aaiClient.listCustomer().execute();
if (response.isSuccessful()) {
return response.body().getCustomer();
} else {
try {
log.info("aai createOrUpdateCustomer is starting!");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = this.aaiService.createOrUpdateCustomer(customerId,requestBody).execute();
+ Response<ResponseBody> response = this.aaiClient.createOrUpdateCustomer(customerId,requestBody).execute();
log.info("aai createOrUpdateCustomer is finished!");
if(response.isSuccessful()){
result.put("status", "SUCCESS");
JSONObject result = new JSONObject();
try {
log.info("aai getCustomerById is starting!");
- Response<AAICustomer> response = this.aaiService.getCustomerById(customerId).execute();
+ Response<AAICustomer> response = this.aaiClient.getCustomerById(customerId).execute();
log.info("aai getCustomerById is finished!");
if(response.isSuccessful()){
result.put("status", "SUCCESS");
JSONObject result = new JSONObject();
try {
log.info("aai deleteCustomer is starting!");
- Response<ResponseBody> response = this.aaiService.deleteCustomer(customerId,resourceVersion).execute();
+ Response<ResponseBody> response = this.aaiClient.deleteCustomer(customerId,resourceVersion).execute();
log.info("aai deleteCustomer is finished!");
if(response.isSuccessful()){
result.put("status", "SUCCESS");
@Override
public List<AAIServiceSubscription> listServiceSubscriptions(String serviceType) {
try {
- Response<ServiceSubscriptionRsp> response = this.aaiService.listServiceSubscriptions(serviceType).execute();
+ Response<ServiceSubscriptionRsp> response = this.aaiClient.listServiceSubscriptions(serviceType).execute();
if (response.isSuccessful()) {
return response.body().getServiceSubscriptions();
} else {
try {
log.info("aai createOrUpdateServiceType is starting!");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = this.aaiService.createOrUpdateServiceType(customerId,serviceType,requestBody).execute();
+ Response<ResponseBody> response = this.aaiClient.createOrUpdateServiceType(customerId,serviceType,requestBody).execute();
log.info("aai createOrUpdateServiceType is finished!");
if(response.isSuccessful()){
result.put("status", "SUCCESS");
JSONObject result = new JSONObject();
try {
log.info("aai deleteServiceType is starting!");
- Response<ResponseBody> response = this.aaiService.deleteServiceType(customerId,serviceType,resourceVersion).execute();
+ Response<ResponseBody> response = this.aaiClient.deleteServiceType(customerId,serviceType,resourceVersion).execute();
log.info("aai deleteServiceType is finished!");
if(response.isSuccessful()){
result.put("status", "SUCCESS");
try {
log.info("aai getServiceTypeById is starting!");
Response<AAIServiceSubscription> response =
- this.aaiService.getServiceTypeById(customerId, serviceType).execute();
+ this.aaiClient.getServiceTypeById(customerId, serviceType).execute();
log.info("aai getServiceTypeById is finished!");
if (response.isSuccessful()) {
result.put("status", "SUCCESS");
+ networkInterfaceType + "\"\r\n" + "}";
log.info("request body {} for Interface type {}" , body,networkInterfaceType);
RequestBody request = RequestBody.create(MediaType.parse("application/json"), body);
- Response<ResponseBody> response = this.aaiService.querynNetworkResourceList(request).execute();
+ Response<ResponseBody> response = this.aaiClient.querynNetworkResourceList(request).execute();
if (response.isSuccessful()) {
String jsonResponse = response.body().string();
log.info("response json returned {}", jsonResponse);
import java.util.List;
import org.onap.usecaseui.server.service.lcm.OrchestratorService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.*;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import org.slf4j.Logger;
private static final Logger logger = LoggerFactory.getLogger(DefaultOrchestratorService.class);
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public List<AAIEsrNfvo> listOrchestrator() {
try {
- Response<AAIOrchestratorRsp> response = this.aaiService.listOrchestrator().execute();
+ Response<AAIOrchestratorRsp> response = this.aaiClient.listOrchestrator().execute();
if (response.isSuccessful()) {
List<AAIEsrNfvo> nfvoList = response.body().getEsrNfvo();
for(AAIEsrNfvo nfvo: nfvoList){
String nfvoId = nfvo.getNfvoId();
Response<AAISingleOrchestratorRsp> response_orch =
- this.aaiService.getOrchestrator(nfvoId).execute();
+ this.aaiClient.getOrchestrator(nfvoId).execute();
EsrSystemInfoList esrSystemInfoList = response_orch.body().getEsrSystemInfoList();
List<EsrSystemInfo> esrSystemInfo = esrSystemInfoList.getEsrSystemInfo();
nfvo.setName(esrSystemInfo.get(0).getSystemName());
import org.onap.usecaseui.server.service.lcm.CustomerService;
import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
import org.onap.usecaseui.server.util.UuiCommonUtil;
private static final Logger logger = LoggerFactory.getLogger(DefaultServiceInstanceService.class);
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Resource(name = "ServiceLcmService")
private ServiceLcmService serviceLcmService;
public List<String> listServiceInstances(String customerId, String serviceType) {
List<String> result = new ArrayList<>();
try {
- Response<ResponseBody> response = aaiService.listServiceInstances(customerId, serviceType).execute();
+ Response<ResponseBody> response = aaiClient.listServiceInstances(customerId, serviceType).execute();
if (response.isSuccessful()) {
String resultStr = new String(response.body().bytes());
JSONObject object = JSONObject.parseObject(resultStr);
@Override
public String getRelationShipData(String customerId, String serviceType, String serviceId) {
try {
- Response<ResponseBody> response = aaiService.getAAIServiceInstance(customerId, serviceType, serviceId).execute();
+ Response<ResponseBody> response = aaiClient.getAAIServiceInstance(customerId, serviceType, serviceId).execute();
if (response.isSuccessful()) {
String result = new String(response.body().bytes());
return result;
List<Map<String, Object>> list = new ArrayList<>();
ObjectMapper omAlarm = new ObjectMapper();
- for (AAIServiceSubscription aaiServiceSubscription : serviceTypes) {
+ for (AAIServiceSubscription aaiClientSubscription : serviceTypes) {
Map<String, Object> serviceTypeMap = new HashMap<String, Object>();
- List<String> serviceInstances = this.listServiceInstances(customerId, aaiServiceSubscription.getServiceType());
+ List<String> serviceInstances = this.listServiceInstances(customerId, aaiClientSubscription.getServiceType());
- // serviceTypeMap.put(aaiServiceSubscription.getServiceType(),serviceInstances.size());
- serviceTypeMap.put("name", aaiServiceSubscription.getServiceType());
+ // serviceTypeMap.put(aaiClientSubscription.getServiceType(),serviceInstances.size());
+ serviceTypeMap.put("name", aaiClientSubscription.getServiceType());
serviceTypeMap.put("value", serviceInstances.size());
list.add(serviceTypeMap);
import org.onap.usecaseui.server.bean.lcm.TemplateInput;
import org.onap.usecaseui.server.constant.CommonConstant;
import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCControllerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
import org.openecomp.sdc.toscaparser.api.common.JToscaException;
import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
import retrofit2.Response;
public class DefaultServiceTemplateService implements ServiceTemplateService {
private final SDCCatalogService sdcCatalog;
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public List<SDCServiceTemplate> listDistributedServiceTemplate() {
@Override
public List<VimInfo> listVim() {
try {
- Response<VimInfoRsp> response = aaiService.listVimInfo().execute();
+ Response<VimInfoRsp> response = aaiClient.listVimInfo().execute();
if (response.isSuccessful()) {
return response.body().getCloudRegion();
} else {
@Override
public List<SDNCController> listSDNCControllers() {
try {
- Response<SDNCControllerRsp> response = aaiService.listSdncControllers().execute();
+ Response<SDNCControllerRsp> response = aaiClient.listSdncControllers().execute();
if (response.isSuccessful()) {
return response.body().getEsrThirdpartySdncList();
} else {
import org.onap.usecaseui.server.bean.lcm.sotne2eservicemonitor.ServiceInstanceList;
import org.onap.usecaseui.server.bean.lcm.sotne2eservicemonitor.ServiceInstanceListWrapper;
import org.onap.usecaseui.server.service.lcm.SotnServiceQryService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
private static final Logger logger = LoggerFactory.getLogger(SotnServiceQryServiceImpl.class);
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public String getServiceInstances(String serviceType) {
ObjectMapper mapper = new ObjectMapper();
try {
- Response<ResponseBody> response = aaiService.listServiceInstances(customerid, serviceType).execute();
+ Response<ResponseBody> response = aaiClient.listServiceInstances(customerid, serviceType).execute();
if (response.isSuccessful()) {
String resultStr=new String(response.body().bytes());
ServiceInstanceListWrapper serviceInstances = mapper.readValue(resultStr, new TypeReference<ServiceInstanceListWrapper>() {
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.onap.usecaseui.server.service.lcm.impl;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
-//import org.onap.usecaseui.server.bean.lcm.sotne2eservice.*;
-//import org.onap.usecaseui.server.bean.lcm.sotne2eservice.Connectivity;
-//import org.onap.usecaseui.server.bean.sotn.Pinterface;
import org.onap.usecaseui.server.bean.orderservice.ServiceEstimationBean;
import org.onap.usecaseui.server.service.lcm.SotnServiceTemplateService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.Relationship;
-//import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
import org.onap.usecaseui.server.bean.activateEdge.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import retrofit2.Response;
private static final Logger logger = LoggerFactory.getLogger(SotnServiceTemplateServiceImpl.class);
private SOService soService;
- private AAIService aaiService;
-
-
-
+ private AAIClient aaiClient;
private Map<String, Model> readConfigToMap(ModelConfig modelConfig) {
public ServiceInstance getServiceInstancesInfo(String customerId, String serviceType, String serviceInstanceId) throws Exception {
logger.info("Fire getServiceInstances : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getServiceInstancesForEdge(customerId, serviceType, serviceInstanceId).execute();
+ Response<ResponseBody> response = this.aaiClient.getServiceInstancesForEdge(customerId, serviceType, serviceInstanceId).execute();
if (response.isSuccessful()) {
logger.info("Fire getServiceInstances : End");
String result = new String(response.body().bytes());
private Connectivity getConnectivityInfo(String connectivityinstanceid) throws IOException {
logger.info("Fire getServiceInstancesForEdge : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getConnectivityInformation(connectivityinstanceid).execute();
+ Response<ResponseBody> response = this.aaiClient.getConnectivityInformation(connectivityinstanceid).execute();
if (response.isSuccessful()) {
logger.info("Fire getServiceInstancesForEdge : End");
String result = new String(response.body().bytes());
public Pinterface getTerminationPoint(String pnfName, String tpId) throws Exception {
logger.info("Fire getTerminationPoint : Begin");
ObjectMapper mapper = new ObjectMapper();
- // Response<ResponseBody> response = this.aaiService.getPinterfaceByPnfName(pnfName,tpId).execute();
- Response<ResponseBody> response = this.aaiService.getTerminationPoint(pnfName, tpId).execute();
+ // Response<ResponseBody> response = this.aaiClient.getPinterfaceByPnfName(pnfName,tpId).execute();
+ Response<ResponseBody> response = this.aaiClient.getTerminationPoint(pnfName, tpId).execute();
if (response.isSuccessful()) {
logger.info("Fire getTerminationPoint : End");
String result = new String(response.body().bytes());
private AllottedResource getAllottedResource(String globalCustomerId, String serviceType, String siteserviceinstanceid, String allottedResourceId) throws IOException {
logger.info("Fire getServiceInstancesForEdge : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getAllotedResourceFor5G(globalCustomerId, serviceType, siteserviceinstanceid, allottedResourceId).execute();
+ Response<ResponseBody> response = this.aaiClient.getAllotedResourceFor5G(globalCustomerId, serviceType, siteserviceinstanceid, allottedResourceId).execute();
if (response.isSuccessful()) {
logger.info("Fire getServiceInstancesForEdge : End");
String result = new String(response.body().bytes());
private SiteResource getSiteResource(String siteResourceID) throws IOException {
logger.info("Fire get site resource : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getSiteResourceInfo(siteResourceID).execute();
+ Response<ResponseBody> response = this.aaiClient.getSiteResourceInfo(siteResourceID).execute();
if (response.isSuccessful()) {
logger.info("Fire get site resource : End");
String result = new String(response.body().bytes());
private ComplexObj getComplexData(String complexID) throws IOException {
logger.info("Fire get complex Object : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getComplexObject(complexID).execute();
+ Response<ResponseBody> response = this.aaiClient.getComplexObject(complexID).execute();
if (response.isSuccessful()) {
logger.info("Fire get complex Object : End");
String result = new String(response.body().bytes());
logger.info("Fire getSOTNPinterfaceByVpnId : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getPinterfaceByVpnId(vpnId).execute();
+ Response<ResponseBody> response = this.aaiClient.getPinterfaceByVpnId(vpnId).execute();
- //Response<ResponseBody> response = this.aaiService.getSOTNPinterfaceByVpnId(vpnId).execute();
+ //Response<ResponseBody> response = this.aaiClient.getSOTNPinterfaceByVpnId(vpnId).execute();
if (response.isSuccessful()) {
logger.info("Fire getSOTNPinterfaceByVpnId : End");
String result = new String(response.body().bytes());
public Pnf getSOTNPnf(String pnfname) throws Exception {
logger.info("Fire getSOTNPnf : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getPnfInfo(pnfname).execute();
+ Response<ResponseBody> response = this.aaiClient.getPnfInfo(pnfname).execute();
if (response.isSuccessful()) {
logger.info("Fire getSOTNPnf : End");
String result = new String(response.body().bytes());
public LogicalLink getSOTNLinkbyName(String linkName) throws Exception {
logger.info("Fire getSOTNLinkbyName : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getSpecificLogicalLink(linkName).execute();
+ Response<ResponseBody> response = this.aaiClient.getSpecificLogicalLink(linkName).execute();
if (response.isSuccessful()) {
logger.info("Fire getSOTNLinkbyName : End");
String result = new String(response.body().bytes());
public Uni getUNIInfo(String uniId) throws Exception {
logger.info("Fire getUNIInfo : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getUNIInfo(uniId).execute();
+ Response<ResponseBody> response = this.aaiClient.getUNIInfo(uniId).execute();
if (response.isSuccessful()) {
logger.info("Fire getUNIInfo : Begin");
String result = new String(response.body().bytes());
public Vnfs getVnfs(String vnfId) throws Exception {
logger.info("Fire getVnfs : Begin");
ObjectMapper mapper = new ObjectMapper();
- Response<ResponseBody> response = this.aaiService.getVNFsDetail(vnfId).execute();
+ Response<ResponseBody> response = this.aaiClient.getVNFsDetail(vnfId).execute();
if (response.isSuccessful()) {
logger.info("Fire getVnfs : End");
String result = new String(response.body().bytes());
import org.onap.usecaseui.server.bean.sotn.Pinterface;
import org.onap.usecaseui.server.bean.sotn.PinterfaceRsp;
import org.onap.usecaseui.server.constant.CommonConstant;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
import org.onap.usecaseui.server.service.sotn.SOTNService;
private static final Logger logger = LoggerFactory.getLogger(SOTNServiceImpl.class);
- private final AAIService aaiService;
+ private final AAIClient aaiClient;
@Override
public String getNetWorkResources() {
String result="";
try {
logger.info("aai getNetWorkResources is starting!");
- Response<ResponseBody> response = this.aaiService.listNetWorkResources().execute();
+ Response<ResponseBody> response = this.aaiClient.listNetWorkResources().execute();
logger.info("aai getNetWorkResources has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
public List<Pinterface> getPinterfaceByPnfName(String pnfName) {
try {
logger.info("aai getPinterfaceByPnfName is starting!");
- Response<PinterfaceRsp> response = this.aaiService.getPinterfaceByPnfName(pnfName).execute();
+ Response<PinterfaceRsp> response = this.aaiClient.getPinterfaceByPnfName(pnfName).execute();
logger.info(String.format("excute aai interface:/api/aai-network/v13/pnfs/pnf/%s/p-interfaces",pnfName));
logger.info("aai getPinterfaceByPnfName has finished!");
if (response.isSuccessful()) {
String result="";
try {
logger.info("aai getLogicalLinks is starting!");
- Response<ResponseBody> response = this.aaiService.getLogicalLinks().execute();
+ Response<ResponseBody> response = this.aaiClient.getLogicalLinks().execute();
logger.info("aai getLogicalLinks has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getSpecificLogicalLink is starting!");
- Response<ResponseBody> response = this.aaiService.getSpecificLogicalLink(linkName).execute();
+ Response<ResponseBody> response = this.aaiClient.getSpecificLogicalLink(linkName).execute();
logger.info("aai getSpecificLogicalLink has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getHostUrl is starting!");
- Response<ResponseBody> response = this.aaiService.getHostUrl(aaiId).execute();
+ Response<ResponseBody> response = this.aaiClient.getHostUrl(aaiId).execute();
logger.info("aai getHostUrl has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getExtAaiId is starting!");
- Response<ResponseBody> response = this.aaiService.getExtAaiId(aaiId).execute();
+ Response<ResponseBody> response = this.aaiClient.getExtAaiId(aaiId).execute();
logger.info("aai getExtAaiId has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
logger.info("aai createHostUrl is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = aaiService.createHostUrl(requestBody,aaiId).execute();
+ Response<ResponseBody> response = aaiClient.createHostUrl(requestBody,aaiId).execute();
logger.info("aai createHostUrl has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
try {
logger.info("aai createTopoNetwork is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = aaiService.createTopoNetwork(requestBody,networkId).execute();
+ Response<ResponseBody> response = aaiClient.createTopoNetwork(requestBody,networkId).execute();
logger.info("aai createTopoNetwork has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
try {
logger.info("aai createTerminationPoint is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = aaiService.createTerminationPoint(requestBody,pnfName,tpId).execute();
+ Response<ResponseBody> response = aaiClient.createTerminationPoint(requestBody,pnfName,tpId).execute();
logger.info("aai createTerminationPoint has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
try {
logger.info("aai createLink is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = aaiService.createLink(requestBody,linkName).execute();
+ Response<ResponseBody> response = aaiClient.createLink(requestBody,linkName).execute();
logger.info("aai createLink has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
try {
logger.info("aai createPnf is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = aaiService.createPnf(requestBody,pnfName).execute();
+ Response<ResponseBody> response = aaiClient.createPnf(requestBody,pnfName).execute();
logger.info("aai createPnf has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result = "";
try {
logger.info("aai deleteLink is starting");
- Response<ResponseBody> response = aaiService.deleteLink(linkName,resourceVersion).execute();
+ Response<ResponseBody> response = aaiClient.deleteLink(linkName,resourceVersion).execute();
logger.info("aai deleteLink has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
logger.info("aai getServiceInstances is starting");
- Response<ResponseBody> response = aaiService.getServiceInstances(customerId, serviceType).execute();
+ Response<ResponseBody> response = aaiClient.getServiceInstances(customerId, serviceType).execute();
logger.info("aai getServiceInstances has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
public String serviceInstanceInfo(String customerId, String serviceType, String serviceInstanceId) {
try {
logger.info("aai serviceInstanceInfo is starting");
- Response<ResponseBody> response = aaiService.serviceInstaneInfo(customerId, serviceType, serviceInstanceId).execute();
+ Response<ResponseBody> response = aaiClient.serviceInstaneInfo(customerId, serviceType, serviceInstanceId).execute();
logger.info("aai serviceInstanceInfo has finished");
if (response.isSuccessful()) {
String result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getPnfInfo is starting!");
- Response<ResponseBody> response = this.aaiService.getPnfInfo(pnfName).execute();
+ Response<ResponseBody> response = this.aaiClient.getPnfInfo(pnfName).execute();
logger.info("aai getPnfInfo has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getAllottedResources is starting!");
- Response<ResponseBody> response = this.aaiService.getAllottedResources(customerId, serviceType, serviceId).execute();
+ Response<ResponseBody> response = this.aaiClient.getAllottedResources(customerId, serviceType, serviceId).execute();
logger.info("aai getAllottedResources has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getConnectivityInfo is starting!");
- Response<ResponseBody> response = this.aaiService.getConnectivityInfo(connectivityId).execute();
+ Response<ResponseBody> response = this.aaiClient.getConnectivityInfo(connectivityId).execute();
logger.info("aai getConnectivityInfo has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getVpnBindingInfo is starting!");
- Response<ResponseBody> response = this.aaiService.getVpnBindingInfo(vpnId).execute();
+ Response<ResponseBody> response = this.aaiClient.getVpnBindingInfo(vpnId).execute();
logger.info("aai getVpnBindingInfo has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getNetworkRouteInfo is starting!");
- Response<ResponseBody> response = this.aaiService.getNetworkRouteInfo(routeId).execute();
+ Response<ResponseBody> response = this.aaiClient.getNetworkRouteInfo(routeId).execute();
logger.info("aai getNetworkRouteInfo has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getUniInfo is starting!");
- Response<ResponseBody> response = this.aaiService.getUniInfo(id).execute();
+ Response<ResponseBody> response = this.aaiClient.getUniInfo(id).execute();
logger.info("aai getUniInfo has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
logger.info("aai getPinterfaceByVpnId is starting!");
- Response<ResponseBody> response = this.aaiService.getPinterfaceByVpnId(vpnId).execute();
+ Response<ResponseBody> response = this.aaiClient.getPinterfaceByVpnId(vpnId).execute();
logger.info("aai getPinterfaceByVpnId has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result = "";
try {
logger.info("aai deleteExtNetwork is starting");
- Response<ResponseBody> response = aaiService.deleteExtNetwork(networkId,resourceVersion).execute();
+ Response<ResponseBody> response = aaiClient.deleteExtNetwork(networkId,resourceVersion).execute();
logger.info("aai deleteExtNetwork has finished");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.server.service.customer.impl.CcvpnCustomerServiceImpl;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
public class CcvpnCustomerServiceImplTest {
CcvpnCustomerServiceImpl dsts = null;
- AAIService aaiService = null;
+ AAIClient aaiClient = null;
@Before
public void before() throws Exception {
- aaiService= mock(AAIService.class);
- dsts = new CcvpnCustomerServiceImpl(aaiService);
+ aaiClient= mock(AAIClient.class);
+ dsts = new CcvpnCustomerServiceImpl(aaiClient);
}
@Test
public void itCanGetAllServiceInformation(){
ResponseBody result=null;
- when(aaiService.getAllServiceInformation("abc", "123")).thenReturn(successfulCall(result));
+ when(aaiClient.getAllServiceInformation("abc", "123")).thenReturn(successfulCall(result));
dsts.getAllServiceInstances("abc", "123");
}
@Test
public void getQuerySubscriptionWithThrowsEexception(){
- when(aaiService.getServiceSubscription("123")).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getServiceSubscription("123")).thenReturn(failedCall("aai is not exist!"));
dsts.querySubscriptionType();
}
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.usecaseui.server.service.lcm.CustomerService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
import retrofit2.Call;
public class DefaultCustomerServiceTest {
-
+
@Test
public void itCanRetrieveCustomersFromAAI() {
List<AAICustomer> customers = singletonList(new AAICustomer("1", "name", "type","version"));
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
AAICustomerRsp rsp = new AAICustomerRsp();
rsp.setCustomer(customers);
Call<AAICustomerRsp> call = successfulCall(rsp);
- when(aaiService.listCustomer()).thenReturn(call);
+ when(aaiClient.listCustomer()).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
Assert.assertSame(customers, customerService.listCustomer());
}
@Test(expected = AAIException.class)
public void itWillThrowExceptionWhenAAIIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
Call<AAICustomerRsp> call = failedCall("AAI is not available!");
- when(aaiService.listCustomer()).thenReturn(call);
+ when(aaiClient.listCustomer()).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
customerService.listCustomer();
}
@Test
public void itWillRetrieveEmptyListWhenNoCustomerInAAI() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
Call<AAICustomerRsp> call = emptyBodyCall();
- when(aaiService.listCustomer()).thenReturn(call);
+ when(aaiClient.listCustomer()).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
List<AAICustomer> customers = customerService.listCustomer();
Assert.assertTrue("customers should be empty list.", customers.isEmpty());
public void itCanRetrieveServiceSubscriptionsFromAAI() {
List<AAIServiceSubscription> serviceSubscriptions = singletonList(new AAIServiceSubscription("service type","resourceVersion"));
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
ServiceSubscriptionRsp rsp = new ServiceSubscriptionRsp();
rsp.setServiceSubscriptions(serviceSubscriptions);
Call<ServiceSubscriptionRsp> call = successfulCall(rsp);
- when(aaiService.listServiceSubscriptions("1")).thenReturn(call);
+ when(aaiClient.listServiceSubscriptions("1")).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
Assert.assertSame(serviceSubscriptions, customerService.listServiceSubscriptions("1"));
}
@Test(expected = AAIException.class)
public void listServiceSubscriptionsWillThrowExceptionWhenAAIIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
Call<ServiceSubscriptionRsp> call = failedCall("AAI is not available!");
- when(aaiService.listServiceSubscriptions("1")).thenReturn(call);
+ when(aaiClient.listServiceSubscriptions("1")).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
customerService.listServiceSubscriptions("1");
}
@Test
public void itWillRetrieveEmptyListWhenNoServiceSubscriptionsInAAI() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
Call<ServiceSubscriptionRsp> call = emptyBodyCall();
- when(aaiService.listServiceSubscriptions("1")).thenReturn(call);
+ when(aaiClient.listServiceSubscriptions("1")).thenReturn(call);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
List<AAIServiceSubscription> serviceSubscriptions = customerService.listServiceSubscriptions("1");
Assert.assertTrue("service subscription should be empty list.", serviceSubscriptions.isEmpty());
}
-
+
@Test
public void itCanCreateOrUpdateCustomer(){
HttpServletRequest request = mock(HttpServletRequest.class);
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
ResponseBody result=null;
- when(aaiService.createOrUpdateCustomer(eq(customerId), Mockito.any())).thenReturn(successfulCall(result));
+ when(aaiClient.createOrUpdateCustomer(eq(customerId), Mockito.any())).thenReturn(successfulCall(result));
customerService.createOrUpdateCustomer(request, customerId);
}
-
+
@Test
public void createOrUpdateCustomerWillThrowExceptionWhenVFCIsNotAvailable(){
HttpServletRequest request = mock(HttpServletRequest.class);
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
- when(aaiService.createOrUpdateCustomer(eq(customerId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ when(aaiClient.createOrUpdateCustomer(eq(customerId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
customerService.createOrUpdateCustomer(request, customerId);
}
-
+
@Test
public void createOrUpdateCustomerWillThrowExceptionWhenVFCResponseError(){
HttpServletRequest request = mock(HttpServletRequest.class);
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
- when(aaiService.createOrUpdateCustomer(eq(customerId),Mockito.any())).thenReturn(emptyBodyCall());
+ when(aaiClient.createOrUpdateCustomer(eq(customerId),Mockito.any())).thenReturn(emptyBodyCall());
customerService.createOrUpdateCustomer(request, customerId);
}
@Test
public void itCanGetCustomerById(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
AAICustomer customer = new AAICustomer(customerId, customerId, customerId,customerId);
- when(aaiService.getCustomerById(eq(customerId))).thenReturn(successfulCall(customer));
+ when(aaiClient.getCustomerById(eq(customerId))).thenReturn(successfulCall(customer));
customerService.getCustomerById(customerId);
}
@Test
public void getCustomerByIdWillThrowExceptionWhenVFCIsNotAvailable(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
AAICustomer aaiCustomer = new AAICustomer("","","","");
Call<AAICustomer> call = successfulCall(aaiCustomer);
- when(aaiService.getCustomerById(eq(customerId))).thenReturn(call);
+ when(aaiClient.getCustomerById(eq(customerId))).thenReturn(call);
customerService.getCustomerById(customerId);
}
@Test
public void getCustomerByIdWillThrowExceptionWhenVFCResponseError(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
- when(aaiService.getCustomerById(eq(customerId))).thenReturn(emptyBodyCall());
+ when(aaiClient.getCustomerById(eq(customerId))).thenReturn(emptyBodyCall());
customerService.getCustomerById(customerId);
}
-
+
@Test
public void itCanDeleteCustomerById(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String customerId="1";
String resourceVersion="1412934";
ResponseBody result= null;
- when(aaiService.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(successfulCall(result));
+ when(aaiClient.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(successfulCall(result));
customerService.deleteCustomer(customerId,resourceVersion);
}
-
+
@Test
public void deleteCustomerByIdWillThrowExceptionWhenVFCIsNotAvailable(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String resourceVersion="1412934";
String customerId="1";
- when(aaiService.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
+ when(aaiClient.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
customerService.deleteCustomer(customerId,resourceVersion);
}
-
+
@Test
public void deleteCustomerByIdWillThrowExceptionWhenVFCResponseError(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String resourceVersion="1412934";
String customerId="1";
- when(aaiService.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(emptyBodyCall());
+ when(aaiClient.deleteCustomer(eq(customerId),eq(resourceVersion))).thenReturn(emptyBodyCall());
customerService.deleteCustomer(customerId,resourceVersion);
}
-
+
@Test
public void itCreateOrUpdateServiceType(){
HttpServletRequest request2 = mock(HttpServletRequest.class);
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceType="1";
String customerId="demo";
ResponseBody result=null;
- when(aaiService.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(successfulCall(result));
+ when(aaiClient.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(successfulCall(result));
customerService.createOrUpdateServiceType(request2, serviceType,customerId);
}
-
+
@Test
public void createOrUpdateServiceTypeWillThrowExceptionWhenVFCIsNotAvailable(){
HttpServletRequest request2 = mock(HttpServletRequest.class);
String serviceType="1";
String customerId="demo";
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
- when(aaiService.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
+ when(aaiClient.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
customerService.createOrUpdateServiceType(request2, serviceType,customerId);
}
-
+
@Test
public void createOrUpdateServiceTypeWillThrowExceptionWhenVFCResponseError(){
HttpServletRequest request2 = mock(HttpServletRequest.class);
String serviceType="1";
String customerId="demo";
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
- when(aaiService.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(emptyBodyCall());
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
+ when(aaiClient.createOrUpdateServiceType(eq(customerId),eq(serviceType),Mockito.any())).thenReturn(emptyBodyCall());
customerService.createOrUpdateServiceType(request2, serviceType,customerId);
}
-
+
@Test
public void itCanDeleteServiceType(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
String coustomerId="1";
ResponseBody result=null;
- when(aaiService.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(successfulCall(result));
+ when(aaiClient.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(successfulCall(result));
customerService.deleteServiceType(coustomerId,serviceTypeName,resourceVersion);
}
-
+
@Test
public void deleteServiceTypeWillThrowExceptionWhenVFCIsNotAvailable(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
String coustomerId="1";
- when(aaiService.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
+ when(aaiClient.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
customerService.deleteServiceType(coustomerId,serviceTypeName,resourceVersion);
}
-
+
@Test
public void deleteServiceTypeByIdWillThrowExceptionWhenVFCResponseError(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
String coustomerId="1";
- when(aaiService.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(emptyBodyCall());
+ when(aaiClient.deleteServiceType(eq(coustomerId),eq(serviceTypeName),eq(resourceVersion))).thenReturn(emptyBodyCall());
customerService.deleteServiceType(coustomerId,serviceTypeName,resourceVersion);
}
-
+
@Test
public void itCanGetServiceTypeById(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
AAIServiceSubscription aaIServiceSubscription = new AAIServiceSubscription(serviceTypeName,resourceVersion);
- when(aaiService.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(successfulCall(aaIServiceSubscription));
+ when(aaiClient.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(successfulCall(aaIServiceSubscription));
customerService.getServiceTypeById(serviceTypeName,resourceVersion);
}
-
+
@Test
public void getServiceTypeByIdWillThrowExceptionWhenVFCIsNotAvailable(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
- when(aaiService.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
+ when(aaiClient.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(failedCall("VFC is not available!"));
customerService.getServiceTypeById(serviceTypeName,resourceVersion);
}
-
+
@Test
public void getServiceTypeByIdWillThrowExceptionWhenVFCResponseError(){
- AAIService aaiService = mock(AAIService.class);
- CustomerService customerService = new DefaultCustomerService(aaiService);
+ AAIClient aaiClient = mock(AAIClient.class);
+ CustomerService customerService = new DefaultCustomerService(aaiClient);
String serviceTypeName="1";
String resourceVersion="214341235";
- when(aaiService.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(emptyBodyCall());
+ when(aaiClient.getServiceTypeById(eq(serviceTypeName),eq(resourceVersion))).thenReturn(emptyBodyCall());
customerService.getServiceTypeById(serviceTypeName,resourceVersion);
}
-}
\ No newline at end of file
+}
import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo;
import org.onap.usecaseui.server.service.lcm.PackageDistributionService;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.nsServiceRsp;
SDCCatalogService sdcService = newSDCService(serviceTemplate, vnf);
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "regionId"));
- AAIService aaiService = newAAIService(vim);
+ AAIClient aaiClient = newAAIService(vim);
PackageDistributionService service = new DefaultPackageDistributionService(sdcService, null, null);
Assert.assertThat(service.retrievePackageInfo(), equalTo(new VfNsPackageInfo(serviceTemplate, vnf)));
}
- private AAIService newAAIService(List<VimInfo> vim) {
- AAIService aaiService = mock(AAIService.class);
+ private AAIClient newAAIService(List<VimInfo> vim) {
+ AAIClient aaiClient = mock(AAIClient.class);
VimInfoRsp rsp = new VimInfoRsp();
rsp.setCloudRegion(vim);
Call<VimInfoRsp> vimCall = successfulCall(rsp);
- when(aaiService.listVimInfo()).thenReturn(vimCall);
- return aaiService;
+ when(aaiClient.listVimInfo()).thenReturn(vimCall);
+ return aaiClient;
}
private SDCCatalogService newSDCService(List<SDCServiceTemplate> serviceTemplate, List<Vnf> vnf) {
when(sdcService.listResources(RESOURCETYPE_VF)).thenReturn(serviceCall);
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "regionId"));
- AAIService aaiService = newAAIService(vim);
+ AAIClient aaiClient = newAAIService(vim);
PackageDistributionService service = new DefaultPackageDistributionService(sdcService, null, null);
service.retrievePackageInfo();
*/
package org.onap.usecaseui.server.service.lcm.impl;
-import jakarta.annotation.Resource;
import org.junit.Assert;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.usecaseui.server.service.lcm.CustomerService;
import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
-import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstanceRsp;
-import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
-import org.onap.usecaseui.server.util.CallStub;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.onap.usecaseui.server.util.CallStub.emptyBodyCall;
import static org.onap.usecaseui.server.util.CallStub.failedCall;
-import static org.onap.usecaseui.server.util.CallStub.successfulCall;
public class DefaultServiceInstanceServiceTest {
@Test
public void itCanRetrieveServiceInstanceFromAAI() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
String customerId = "1";
String serviceType = "service";
List<String> instances = Collections.singletonList("{\"service-instance-id\":\"35e88f8e-473f-4d88-92f8-6739a42baa23\",\"service-instance-name\":\"SDWANVPNInfra1\",\"service-type\":\"E2E Service\",\"service-role\":\"E2E Service\",\"model-invariant-id\":\"88dcb2f0-085b-4548-8b93-0882e37d25d8\",\"model-version-id\":\"462f84e5-f0e5-44c5-ab95-38fb4bf77064\",\"resource-version\":\"1535687551051\",\"input-parameters\":\"{\\n \\\"service\\\":{\\n \\\"name\\\":\\\"SDWANVPNInfra\\\",\\n \\\"description\\\":\\\"SDWANVPNInfra\\\",\\n \\\"serviceInvariantUuid\\\":\\\"88dcb2f0-085b-4548-8b93-0882e37d25d8\\\",\\n \\\"serviceUuid\\\":\\\"462f84e5-f0e5-44c5-ab95-38fb4bf77064\\\",\\n \\\"globalSubscriberId\\\":\\\"Demonstration\\\",\\n \\\"serviceType\\\":\\\"CCVPN\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n {\\n \\\"resourceName\\\":\\\"SDWANConnectivity 0\\\",\\n \\\"resourceInvariantUuid\\\":\\\"f99a9a23-c88e-44ff-a4dc-22b88675d278\\\",\\n \\\"resourceUuid\\\":\\\"7baa7742-3a13-4288-8330-868015adc340\\\",\\n \\\"resourceCustomizationUuid\\\":\\\"94ec574b-2306-4cbd-8214-09662b040f73\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n\\n ],\\n \\\"requestInputs\\\":{\\n\\n }\\n }\\n },\\n {\\n \\\"resourceName\\\":\\\"SPPartnerVF 0\\\",\\n \\\"resourceInvariantUuid\\\":\\\"072f9238-15b0-4bc5-a5f5-f18548739470\\\",\\n \\\"resourceUuid\\\":\\\"81b9430b-8abe-45d6-8bf9-f41a8f5c735f\\\",\\n \\\"resourceCustomizationUuid\\\":\\\"a7baba5d-6ac3-42b5-b47d-070841303ab1\\\",\\n \\\"parameters\\\":{\\n \\\"locationConstraints\\\":[\\n\\n ],\\n \\\"resources\\\":[\\n\\n ],\\n \\\"requestInputs\\\":{\\n\\n }\\n }\\n }\\n ],\\n \\\"requestInputs\\\":{\\n \\\"sdwanconnectivity0_name\\\":\\\"CMCCVPN\\\",\\n \\\"sdwanconnectivity0_topology\\\":\\\"hub-spoke\\\"\\n }\\n }\\n }\\n}\",\"relationship-list\":{\"relationship\":[{\"related-to\":\"sdwan-vpn\",\"relationship-label\":\"org.onap.relationships.inventory.PartOf\",\"related-link\":\"/aai/v13/network/sdwan-vpns/sdwan-vpn/4efe6dff-acfc-4d13-a3fd-1177d3c08e89\",\"relationship-data\":[{\"relationship-key\":\"sdwan-vpn.sdwan-vpn-id\",\"relationship-value\":\"4efe6dff-acfc-4d13-a3fd-1177d3c08e89\"}],\"related-to-property\":[{\"property-key\":\"sdwan-vpn.sdwan-vpn-name\",\"property-value\":\"vdfvpn\"}]},{\"related-to\":\"sp-partner\",\"relationship-label\":\"org.onap.relationships.inventory.PartOf\",\"related-link\":\"/aai/v13/business/sp-partners/sp-partner/1b9c677d-fddf-4b70-938b-925a7fa57d00\",\"relationship-data\":[{\"relationship-key\":\"sp-partner.sp-partner-id\",\"relationship-value\":\"1b9c677d-fddf-4b70-938b-925a7fa57d00\"}],\"related-to-property\":[{\"property-key\":\"sp-partner.sp-partner-id\",\"property-value\":\"1b9c677d-fddf-4b70-938b-925a7fa57d00\"}]},{\"related-to\":\"allotted-resource\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"related-link\":\"/aai/v13/business/customers/customer/Democcy/service-subscriptions/service-subscription/CCVPN/service-instances/service-instance/189b87a5-72fe-4197-a307-6929c3831f81/allotted-resources/allotted-resource/2214feec-1aef-4890-abba-f8f3a906935f\",\"relationship-data\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"Democcy\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"CCVPN\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"189b87a5-72fe-4197-a307-6929c3831f81\"},{\"relationship-key\":\"allotted-resource.id\",\"relationship-value\":\"2214feec-1aef-4890-abba-f8f3a906935f\"}],\"related-to-property\":[{\"property-key\":\"allotted-resource.description\",\"property-value\":\"2214feec-1aef-4890-abba-f8f3a906935f\"},{\"property-key\":\"allotted-resource.allotted-resource-name\",\"property-value\":\"sdwan ar\"}]},{\"related-to\":\"allotted-resource\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"related-link\":\"/aai/v13/business/customers/customer/Democcy/service-subscriptions/service-subscription/CCVPN/service-instances/service-instance/089b87a5-72fe-4197-a307-6929c3831f80/allotted-resources/allotted-resource/1114feec-1aef-4890-abba-f8f3a906935f\",\"relationship-data\":[{\"relationship-key\":\"customer.global-customer-id\",\"relationship-value\":\"Democcy\"},{\"relationship-key\":\"service-subscription.service-type\",\"relationship-value\":\"CCVPN\"},{\"relationship-key\":\"service-instance.service-instance-id\",\"relationship-value\":\"089b87a5-72fe-4197-a307-6929c3831f80\"},{\"relationship-key\":\"allotted-resource.id\",\"relationship-value\":\"1114feec-1aef-4890-abba-f8f3a906935f\"}],\"related-to-property\":[{\"property-key\":\"allotted-resource.description\",\"property-value\":\"1114feec-1aef-4890-abba-f8f3a906935f\"},{\"property-key\":\"allotted-resource.allotted-resource-name\",\"property-value\":\"sdwan ar\"}]}]}}");
ServiceInstanceRsp rsp = new ServiceInstanceRsp();
rsp.setServiceInstances(instances);
- when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(emptyBodyCall());
+ when(aaiClient.listServiceInstances(customerId, serviceType)).thenReturn(emptyBodyCall());
- ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
+ ServiceInstanceService service = new DefaultServiceInstanceService(aaiClient);
Assert.assertTrue(service.listServiceInstances(customerId, serviceType).isEmpty());
}
@Test
public void retrieveServiceInstancesWillThrowExceptionWhenAAIIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
String customerId = "1";
String serviceType = "service";
- when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(failedCall("AAI is not available!"));
+ when(aaiClient.listServiceInstances(customerId, serviceType)).thenReturn(failedCall("AAI is not available!"));
- ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
+ ServiceInstanceService service = new DefaultServiceInstanceService(aaiClient);
service.listServiceInstances(customerId, serviceType);
}
@Test
public void retrieveServiceInstancesWillThrowExceptionWhenNoServiceInstancesInAAI() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
String customerId = "1";
String serviceType = "service";
- when(aaiService.listServiceInstances(customerId, serviceType)).thenReturn(emptyBodyCall());
+ when(aaiClient.listServiceInstances(customerId, serviceType)).thenReturn(emptyBodyCall());
- ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
+ ServiceInstanceService service = new DefaultServiceInstanceService(aaiClient);
List<String> serviceInstances = service.listServiceInstances(customerId, serviceType);
Assert.assertTrue("service instances should be empty.", serviceInstances.isEmpty());
@Test
public void getRelationShipDataWillThrowExceptionWhenAAIIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
String customerId = "1";
String serviceType = "service";
String result="result";
- when(aaiService.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(failedCall("AAI is not available!"));
+ when(aaiClient.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(failedCall("AAI is not available!"));
- ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
+ ServiceInstanceService service = new DefaultServiceInstanceService(aaiClient);
service.getRelationShipData(customerId, serviceType,result);
}
@Test
public void getRelationShipDataWillThrowExceptionWhenNoServiceInstancesInAAI() {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
String customerId = "1";
String serviceType = "service";
String result="result";
- when(aaiService.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(emptyBodyCall());
+ when(aaiClient.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(emptyBodyCall());
- ServiceInstanceService service = new DefaultServiceInstanceService(aaiService);
+ ServiceInstanceService service = new DefaultServiceInstanceService(aaiClient);
String aa = service.getRelationShipData(customerId, serviceType,result);
Assert.assertTrue("service instances should be empty.", aa.isEmpty());
}
-}
\ No newline at end of file
+}
import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
import org.onap.usecaseui.server.bean.lcm.TemplateInput;
import org.onap.usecaseui.server.service.lcm.ServiceTemplateService;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCControllerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo;
import java.io.IOException;
import java.util.*;
-import static org.hamcrest.Matchers.equalTo;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.onap.usecaseui.server.util.CallStub.successfulCall;
public class DefaultServiceTemplateServiceTest {
-
+
@Test
public void itCanListDistributedServiceTemplate() {
List<SDCServiceTemplate> templates = Collections.singletonList(new SDCServiceTemplate("uuid", "uuid", "name", "V1","url", "category"));
SDCCatalogService sdcService = newSdcCatalogService(nodeUUID);
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "regionId"));
- AAIService aaiService = newAAIService(vim);
+ AAIClient aaiClient = newAAIService(vim);
- ServiceTemplateService service = newServiceTemplateService(uuid, nodeUUID, sdcService, aaiService);
+ ServiceTemplateService service = newServiceTemplateService(uuid, nodeUUID, sdcService, aaiClient);
Assert.assertNotNull(service.fetchServiceTemplateInput(uuid, modelPath)); }
- private DefaultServiceTemplateService newServiceTemplateService(String uuid, String nodeUUID, SDCCatalogService sdcService, AAIService aaiService) {
- return new DefaultServiceTemplateService(sdcService, aaiService) {
+ private DefaultServiceTemplateService newServiceTemplateService(String uuid, String nodeUUID, SDCCatalogService sdcService, AAIClient aaiClient) {
+ return new DefaultServiceTemplateService(sdcService, aaiClient) {
@Override
protected void downloadFile(String templateUrl, String toPath) throws IOException {
return toscaTemplate;
}
- private AAIService newAAIService(List<VimInfo> vim) {
- AAIService aaiService = mock(AAIService.class);
+ private AAIClient newAAIService(List<VimInfo> vim) {
+ AAIClient aaiClient = mock(AAIClient.class);
VimInfoRsp rsp = new VimInfoRsp();
rsp.setCloudRegion(vim);
Call<VimInfoRsp> vimCall = successfulCall(rsp);
- when(aaiService.listVimInfo()).thenReturn(vimCall);
- return aaiService;
+ when(aaiClient.listVimInfo()).thenReturn(vimCall);
+ return aaiClient;
}
@Test(expected = SDCCatalogException.class)
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "region"));
VimInfoRsp rsp = new VimInfoRsp();
rsp.setCloudRegion(vim);
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listVimInfo()).thenReturn(successfulCall(rsp));
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listVimInfo()).thenReturn(successfulCall(rsp));
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
Assert.assertSame(vim, service.listVim());
}
@Test
public void itCanRetrieveEmptyListWhenNoVimInfoInAAI() {
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listVimInfo()).thenReturn(emptyBodyCall());
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listVimInfo()).thenReturn(emptyBodyCall());
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
List<VimInfo> vimInfos = service.listVim();
Assert.assertTrue("vim should be empty.", vimInfos.isEmpty());
@Test(expected = AAIException.class)
public void itCanThrowExceptionWhenAAIServiceIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listVimInfo()).thenReturn(failedCall("AAI is not available!"));
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listVimInfo()).thenReturn(failedCall("AAI is not available!"));
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
service.listVim();
}
List<SDNCController> controllers = Collections.singletonList(new SDNCController());
SDNCControllerRsp rsp = new SDNCControllerRsp();
rsp.setEsrThirdpartySdncList(controllers);
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listSdncControllers()).thenReturn(successfulCall(rsp));
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listSdncControllers()).thenReturn(successfulCall(rsp));
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
Assert.assertSame(controllers, service.listSDNCControllers());
}
@Test
public void itCanRetrieveEmptyListWhenNoSDNControllerInAAI() {
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listSdncControllers()).thenReturn(emptyBodyCall());
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listSdncControllers()).thenReturn(emptyBodyCall());
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
List<SDNCController> controllers = service.listSDNCControllers();
Assert.assertTrue("sdn controller should be empty.", controllers.isEmpty());
@Test(expected = AAIException.class)
public void itListSDNControllerThrowExceptionWhenAAIServiceIsNotAvailable() {
- AAIService aaiService = mock(AAIService.class);
- when(aaiService.listSdncControllers()).thenReturn(failedCall("AAI is not available!"));
+ AAIClient aaiClient = mock(AAIClient.class);
+ when(aaiClient.listSdncControllers()).thenReturn(failedCall("AAI is not available!"));
- ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiService);
+ ServiceTemplateService service = new DefaultServiceTemplateService(null,aaiClient);
service.listSDNCControllers();
}
@Test
when(sdcService.downloadCsar(anyString())).thenReturn(successfulCall(result));
dsts.downloadFile("toscaModelPath", "toPath");
}
-}
\ No newline at end of file
+}
import org.mockito.Mockito;
import org.onap.usecaseui.server.bean.sotn.Pinterface;
import org.onap.usecaseui.server.bean.sotn.PinterfaceRsp;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
import org.onap.usecaseui.server.service.sotn.impl.SOTNServiceImpl;
import okhttp3.ResponseBody;
public class SOTNServiceImplTest {
-
+
SOTNServiceImpl dsts = null;
- AAIService aaiService = null;
+ AAIClient aaiClient = null;
ResponseBody result;
@Before
public void before() throws Exception {
- aaiService= mock(AAIService.class);
- dsts = new SOTNServiceImpl(aaiService);
+ aaiClient= mock(AAIClient.class);
+ dsts = new SOTNServiceImpl(aaiClient);
result= new ResponseBody() {
@Nullable
@Override
}
};
}
-
+
private HttpServletRequest mockRequest() throws IOException {
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getContentLength()).thenReturn(0);
when(request.getInputStream()).thenReturn(inStream);
return request;
}
-
+
@Test
public void itCanGetNetWorkResources(){
- when(aaiService.listNetWorkResources()).thenReturn(successfulCall(result));
+ when(aaiClient.listNetWorkResources()).thenReturn(successfulCall(result));
dsts.getNetWorkResources();
}
-
+
@Test
public void getNetWorkResourcesWithThrowsEexception(){
- when(aaiService.listNetWorkResources()).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.listNetWorkResources()).thenReturn(failedCall("aai is not exist!"));
dsts.getNetWorkResources();
}
-
+
@SuppressWarnings("unchecked")
@Test
public void itCanGetPinterfaceByPnfName(){
Pinterface pinterface = new Pinterface("interfaceName");
pinterfaces.add(pinterface);
rsp.setPinterfaces(pinterfaces);
- when(aaiService.getPinterfaceByPnfName(pnfName)).thenReturn(successfulCall(rsp));
+ when(aaiClient.getPinterfaceByPnfName(pnfName)).thenReturn(successfulCall(rsp));
dsts.getPinterfaceByPnfName(pnfName);
}
-
+
@Test(expected = AAIException.class)
public void getPinterfaceByPnfNameWithThrowsEexception(){
String pnfName="test";
- when(aaiService.getPinterfaceByPnfName(pnfName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getPinterfaceByPnfName(pnfName)).thenReturn(failedCall("aai is not exist!"));
dsts.getPinterfaceByPnfName(pnfName);
}
-
+
@Test
public void itCanGetLogicalLinks(){
- when(aaiService.getLogicalLinks()).thenReturn(successfulCall(result));
+ when(aaiClient.getLogicalLinks()).thenReturn(successfulCall(result));
dsts.getLogicalLinks();
}
-
+
@Test
public void getLogicalLinksWithThrowsEexception(){
- when(aaiService.getLogicalLinks()).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getLogicalLinks()).thenReturn(failedCall("aai is not exist!"));
dsts.getLogicalLinks();
}
-
+
@Test
public void itCanGetSpecificLogicalLink(){
String linkName="linkName";
- when(aaiService.getSpecificLogicalLink(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getSpecificLogicalLink(linkName)).thenReturn(successfulCall(result));
dsts.getSpecificLogicalLink(linkName);
}
-
+
@Test
public void getSpecificLogicalLinkWithThrowsEexception(){
String linkName="linkName";
- when(aaiService.getSpecificLogicalLink(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getSpecificLogicalLink(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getSpecificLogicalLink(linkName);
}
-
+
@Test
public void itCanGetHostUrl(){
String linkName="linkName";
- when(aaiService.getHostUrl(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getHostUrl(linkName)).thenReturn(successfulCall(result));
dsts.getHostUrl(linkName);
}
-
+
@Test
public void getHostUrlWithThrowsEexception(){
String linkName="linkName";
- when(aaiService.getHostUrl(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getHostUrl(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getHostUrl(linkName);
}
-
+
@Test
public void itCanGetExtAaiId(){
String linkName="linkName";
- when(aaiService.getExtAaiId(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getExtAaiId(linkName)).thenReturn(successfulCall(result));
dsts.getExtAaiId(linkName);
}
-
+
@Test
public void getExtAaiIdWithThrowsEexception(){
String linkName="linkName";
- when(aaiService.getExtAaiId(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getExtAaiId(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getExtAaiId(linkName);
}
-
+
@Test
public void itCanCreateHostUrl() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createHostUrl(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
+ when(aaiClient.createHostUrl(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
Assert.assertSame("{\"status\":\"SUCCESS\"}",dsts.createHostUrl(request,linkName));
}
-
+
@Test
public void createHostUrlWithThrowsEexception() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createHostUrl(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.createHostUrl(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
Assert.assertSame("{\"status\":\"FAILED\"}",dsts.createHostUrl(request,linkName));
}
-
+
@Test
public void itCanCreateTopoNetwork() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createTopoNetwork(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
+ when(aaiClient.createTopoNetwork(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
Assert.assertSame("{\"status\":\"SUCCESS\"}",dsts.createTopoNetwork(request,linkName));
}
-
+
@Test
public void createTopoNetworkWithThrowsEexception() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createTopoNetwork(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.createTopoNetwork(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
Assert.assertSame("{\"status\":\"FAILED\"}",dsts.createTopoNetwork(request,linkName));
}
-
+
@Test
public void itCanCreateTerminationPoint() throws IOException{
String linkName="linkName";
String tpid="tpId";
HttpServletRequest request = mockRequest();
- when(aaiService.createTerminationPoint(Mockito.any(),eq(linkName),eq(linkName))).thenReturn(successfulCall(result));
+ when(aaiClient.createTerminationPoint(Mockito.any(),eq(linkName),eq(linkName))).thenReturn(successfulCall(result));
Assert.assertSame("{\"status\":\"FAILED\"}",dsts.createTerminationPoint(request,linkName,tpid));
}
-
+
@Test
public void createTerminationPointWithThrowsEexception() throws IOException{
String linkName="linkName";
String tpid="tpId";
HttpServletRequest request = mockRequest();
- when(aaiService.createTerminationPoint(Mockito.any(),eq(linkName),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.createTerminationPoint(Mockito.any(),eq(linkName),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
Assert.assertSame("{\"status\":\"FAILED\"}",dsts.createTerminationPoint(request,linkName,tpid));
}
-
+
@Test
public void itCanCreateLink() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createLink(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
+ when(aaiClient.createLink(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
dsts.createLink(request,linkName);
}
-
+
@Test
public void createLinkWithThrowsEexception() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createLink(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.createLink(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
dsts.createLink(request,linkName);
}
-
+
@Test
public void itCanCreatePnf() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createPnf(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
+ when(aaiClient.createPnf(Mockito.any(),eq(linkName))).thenReturn(successfulCall(result));
dsts.createPnf(request,linkName);
}
-
+
@Test
public void createPnfWithThrowsEexception() throws IOException{
String linkName="linkName";
HttpServletRequest request = mockRequest();
- when(aaiService.createPnf(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.createPnf(Mockito.any(),eq(linkName))).thenReturn(failedCall("aai is not exist!"));
dsts.createPnf(request,linkName);
}
-
+
@Test
public void itCanDeleteLink() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.deleteLink(linkName,resourceVersion)).thenReturn(successfulCall(result));
+ when(aaiClient.deleteLink(linkName,resourceVersion)).thenReturn(successfulCall(result));
dsts.deleteLink(linkName,resourceVersion);
}
-
+
@Test
public void deleteLinkWithThrowsEexception() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.deleteLink(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.deleteLink(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
dsts.deleteLink(linkName,resourceVersion);
}
-
+
@Test
public void itCanGetServiceInstances() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.getServiceInstances(linkName,resourceVersion)).thenReturn(successfulCall(result));
+ when(aaiClient.getServiceInstances(linkName,resourceVersion)).thenReturn(successfulCall(result));
dsts.getServiceInstances(linkName,resourceVersion);
}
-
+
@Test
public void getServiceInstancesWithThrowsEexception() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.getServiceInstances(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getServiceInstances(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
dsts.getServiceInstances(linkName,resourceVersion);
}
-
+
@Test
public void itCanGerviceInstanceInfo() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
String serviceId="serviceId";
- when(aaiService.serviceInstaneInfo(linkName,resourceVersion,serviceId)).thenReturn(successfulCall(result));
+ when(aaiClient.serviceInstaneInfo(linkName,resourceVersion,serviceId)).thenReturn(successfulCall(result));
dsts.serviceInstanceInfo(linkName,resourceVersion,serviceId);
}
-
+
@Test(expected = SOException.class)
public void serviceInstanceInfoWithThrowsEexception() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
String serviceId="serviceId";
- when(aaiService.serviceInstaneInfo(linkName,resourceVersion,serviceId)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.serviceInstaneInfo(linkName,resourceVersion,serviceId)).thenReturn(failedCall("aai is not exist!"));
dsts.serviceInstanceInfo(linkName,resourceVersion,serviceId);
}
-
+
@Test
public void itCanGetPnfInfo() throws IOException{
String linkName="linkName";
- when(aaiService.getPnfInfo(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getPnfInfo(linkName)).thenReturn(successfulCall(result));
dsts.getPnfInfo(linkName);
}
-
+
@Test
public void getPnfInfoWithThrowsEexception() throws IOException{
String linkName="linkName";
- when(aaiService.getPnfInfo(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getPnfInfo(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getPnfInfo(linkName);
}
-
+
@Test
public void itCangetAllottedResources() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
String serviceId="serviceId";
- when(aaiService.getAllottedResources(linkName,resourceVersion,serviceId)).thenReturn(successfulCall(result));
+ when(aaiClient.getAllottedResources(linkName,resourceVersion,serviceId)).thenReturn(successfulCall(result));
dsts.getAllottedResources(linkName,resourceVersion,serviceId);
}
-
+
@Test
public void getAllottedResourcesWithThrowsEexception() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
String serviceId="serviceId";
- when(aaiService.getAllottedResources(linkName,resourceVersion,serviceId)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getAllottedResources(linkName,resourceVersion,serviceId)).thenReturn(failedCall("aai is not exist!"));
dsts.getAllottedResources(linkName,resourceVersion,serviceId);
}
-
+
@Test
public void itCangetConnectivityInfo() throws IOException{
String linkName="linkName";
- when(aaiService.getConnectivityInfo(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getConnectivityInfo(linkName)).thenReturn(successfulCall(result));
dsts.getConnectivityInfo(linkName);
}
-
+
@Test
public void getConnectivityInfoWithThrowsEexception() throws IOException{
String linkName="linkName";
- when(aaiService.getConnectivityInfo(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getConnectivityInfo(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getConnectivityInfo(linkName);
}
-
+
@Test
public void itCangetPinterfaceByVpnId() throws IOException{
String linkName="linkName";
- when(aaiService.getPinterfaceByVpnId(linkName)).thenReturn(successfulCall(result));
+ when(aaiClient.getPinterfaceByVpnId(linkName)).thenReturn(successfulCall(result));
dsts.getPinterfaceByVpnId(linkName);
}
-
+
@Test
public void getPinterfaceByVpnIdWithThrowsEexception() throws IOException{
String linkName="linkName";
- when(aaiService.getPinterfaceByVpnId(linkName)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.getPinterfaceByVpnId(linkName)).thenReturn(failedCall("aai is not exist!"));
dsts.getPinterfaceByVpnId(linkName);
}
-
+
@Test
public void itCandeleteExtNetwork() throws IOException{
ResponseBody result=null;
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.deleteExtNetwork(linkName,resourceVersion)).thenReturn(successfulCall(result));
+ when(aaiClient.deleteExtNetwork(linkName,resourceVersion)).thenReturn(successfulCall(result));
dsts.deleteExtNetwork(linkName,resourceVersion);
}
-
+
@Test
public void deleteExtNetworkWithThrowsEexception() throws IOException{
String linkName="linkName";
String resourceVersion="resourceVersion";
- when(aaiService.deleteExtNetwork(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.deleteExtNetwork(linkName,resourceVersion)).thenReturn(failedCall("aai is not exist!"));
dsts.deleteExtNetwork(linkName,resourceVersion);
}
}
import org.jetbrains.annotations.Nullable;
import org.junit.Before;
import org.junit.Test;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
public class SotnServiceQryServiceImplTest {
- AAIService aaiService = mock(AAIService.class);
+ AAIClient aaiClient = mock(AAIClient.class);
- SotnServiceQryServiceImpl sotnServiceQryService = new SotnServiceQryServiceImpl(aaiService);
+ SotnServiceQryServiceImpl sotnServiceQryService = new SotnServiceQryServiceImpl(aaiClient);
ResponseBody result;
@Before
}
@Test
public void getServiceInstancesTest() {
- when(aaiService.listServiceInstances(eq("SOTN-CUST"),eq("SOTN"))).thenReturn(successfulCall(result));
+ when(aaiClient.listServiceInstances(eq("SOTN-CUST"),eq("SOTN"))).thenReturn(successfulCall(result));
sotnServiceQryService.getServiceInstances("SOTN");
}
@Test
public void getServiceInstancesWithThrowException() {
- when(aaiService.listServiceInstances(eq("SOTN-CUST"),eq("SOTN"))).thenReturn(failedCall("aai is not exist!"));
+ when(aaiClient.listServiceInstances(eq("SOTN-CUST"),eq("SOTN"))).thenReturn(failedCall("aai is not exist!"));
sotnServiceQryService.getServiceInstances("SOTN");
}
import org.junit.Test;
import org.onap.usecaseui.server.bean.lcm.sotne2eservice.E2EServiceInstanceRequest;
import org.onap.usecaseui.server.bean.lcm.sotne2eservice.ModelConfig;
-import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
public class SotnServiceTemplateServiceImplTest {
- AAIService aaiService;
+ AAIClient aaiClient;
SOService soService;
ServiceOperation serviceOperation;
SotnServiceTemplateServiceImpl sotnServiceTemplateService;
@Before
public void before() throws Exception {
- aaiService = mock(AAIService.class);
+ aaiClient = mock(AAIClient.class);
soService = mock(SOService.class);
sotnServiceTemplateService = new SotnServiceTemplateServiceImpl();
sotnServiceTemplateService.setSoService(soService);
- sotnServiceTemplateService.setAaiService(aaiService);
+ sotnServiceTemplateService.setAaiClient(aaiClient);
}
@Test
@Test
public void getServiceInstancesInfoTest() throws Exception {
Call<ResponseBody> call = getAaiCall("ServiceInstance");
- when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
+ when(aaiClient.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC");
}
@Test
public void getServiceInstancesInfoWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("ServiceInstance");
- when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
+ when(aaiClient.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC");
}
@Test
public void getTerminationPointTest() throws Exception {
Call<ResponseBody> call = getAaiCall("Pinterface");
- when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(call);
+ when(aaiClient.getTerminationPoint("SOTN","123")).thenReturn(call);
sotnServiceTemplateService.getTerminationPoint("SOTN", "123");
}
@Test
public void getTerminationPointWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("Pinterface");
- when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(call);
+ when(aaiClient.getTerminationPoint("SOTN","123")).thenReturn(call);
sotnServiceTemplateService.getTerminationPoint("SOTN", "123");
}
public void getSOTNPinterfaceByVpnIdTest() throws Exception {
Call<ResponseBody> call = getAaiCall("VpnBinding");
- when(aaiService.getPinterfaceByVpnId("1")).thenReturn(call);
+ when(aaiClient.getPinterfaceByVpnId("1")).thenReturn(call);
sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1");
}
@Test
public void getSOTNPinterfaceByVpnIdWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("VpnBinding");
- when(aaiService.getPinterfaceByVpnId("1")).thenReturn(call);
+ when(aaiClient.getPinterfaceByVpnId("1")).thenReturn(call);
sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1");
}
@Test
public void getSOTNPnfTest() throws Exception {
Call<ResponseBody> call = getAaiCall("Pnf");
- when(aaiService.getPnfInfo("test")).thenReturn(call);
+ when(aaiClient.getPnfInfo("test")).thenReturn(call);
sotnServiceTemplateService.getSOTNPnf("test");
}
@Test
public void getSOTNPnfWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("Pnf");
- when(aaiService.getPnfInfo("test")).thenReturn(call);
+ when(aaiClient.getPnfInfo("test")).thenReturn(call);
sotnServiceTemplateService.getSOTNPnf("test");
}
@Test
public void getSOTNLinkbyNameTest() throws Exception {
Call<ResponseBody> call = getAaiCall("LogicalLink");
- when(aaiService.getSpecificLogicalLink("link")).thenReturn(call);
+ when(aaiClient.getSpecificLogicalLink("link")).thenReturn(call);
sotnServiceTemplateService.getSOTNLinkbyName("link");
}
@Test
public void getSOTNLinkbyNameWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("LogicalLink");
- when(aaiService.getSpecificLogicalLink("link")).thenReturn(call);
+ when(aaiClient.getSpecificLogicalLink("link")).thenReturn(call);
sotnServiceTemplateService.getSOTNLinkbyName("link");
}
@Test
public void getUNIInfoTest() throws Exception {
Call<ResponseBody> call = getAaiCall("Uni");
- when(aaiService.getUNIInfo("uni-id")).thenReturn(call);
+ when(aaiClient.getUNIInfo("uni-id")).thenReturn(call);
sotnServiceTemplateService.getUNIInfo("uni-id");
}
@Test
public void getUNIInfoWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("Uni");
- when(aaiService.getUNIInfo("uni-id")).thenReturn(call);
+ when(aaiClient.getUNIInfo("uni-id")).thenReturn(call);
sotnServiceTemplateService.getUNIInfo("uni-id");
}
@Test
public void getVnfsTest() throws Exception {
Call<ResponseBody> call = getAaiCall("Vnfs");
- when(aaiService.getVNFsDetail("vnf-id")).thenReturn(call);
+ when(aaiClient.getVNFsDetail("vnf-id")).thenReturn(call);
sotnServiceTemplateService.getVnfs("vnf-id");
}
@Test
public void getVnfsWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("Vnfs");
- when(aaiService.getVNFsDetail("vnf-id")).thenReturn(call);
+ when(aaiClient.getVNFsDetail("vnf-id")).thenReturn(call);
sotnServiceTemplateService.getVnfs("vnf-id");
}
@Test
sotnServiceTemplateService.readFile();
}
- // TODO: 2021/1/22
+ // TODO: 2021/1/22
@Test
public void getSOTNSiteInformationTopologyTest() throws Exception {
Call<ResponseBody> call = getAaiCall("ServiceInstance");
Call<ResponseBody> call3 = getAaiCall("Connectivity");
Call<ResponseBody> call4 = getAaiCall("ComplexObj");
Call<ResponseBody> call5 = getAaiCall("Pinterface");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
- when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
- when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
- when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
- when(aaiService.getComplexObject(anyString())).thenReturn(call4);
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getSiteResourceInfo(anyString())).thenReturn(call2);
+ when(aaiClient.getConnectivityInformation(anyString())).thenReturn(call3);
+ when(aaiClient.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
+ when(aaiClient.getComplexObject(anyString())).thenReturn(call4);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
}
@Test
Call<ResponseBody> call3 = getAaiCall("Connectivity");
Call<ResponseBody> call4 = getAaiCall("ComplexObj");
Call<ResponseBody> call5 = getAaiCall("Pinterface");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
- when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
- when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
- when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
- when(aaiService.getComplexObject(anyString())).thenReturn(call4);
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getSiteResourceInfo(anyString())).thenReturn(call2);
+ when(aaiClient.getConnectivityInformation(anyString())).thenReturn(call3);
+ when(aaiClient.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
+ when(aaiClient.getComplexObject(anyString())).thenReturn(call4);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
}
@Test
Call<ResponseBody> call2 = getAaiCall("SiteResource");
Call<ResponseBody> call3 = getAaiCall("Connectivity");
Call<ResponseBody> call4 = getAaiCall("ComplexObj");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
- when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
- when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
- when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
- when(aaiService.getComplexObject(anyString())).thenReturn(call4);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getSiteResourceInfo(anyString())).thenReturn(call2);
+ when(aaiClient.getConnectivityInformation(anyString())).thenReturn(call3);
+ when(aaiClient.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
+ when(aaiClient.getComplexObject(anyString())).thenReturn(call4);
sotnServiceTemplateService.getService("SOTN", "ISAAC");
}
@Test
public void getServiceWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("ServiceInstance");
ResponseBody result = null;
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
ResponseBody result1 = null;
- when(aaiService.getConnectivityInformation("1")).thenReturn(failedCall("Failed to get connectivity"));
+ when(aaiClient.getConnectivityInformation("1")).thenReturn(failedCall("Failed to get connectivity"));
ResponseBody result2 = null;
- when(aaiService.getAllotedResourceFor5G("1", "SONT", "ISAAC", "2")).thenReturn(failedCall("failed to get allocated resource"));
+ when(aaiClient.getAllotedResourceFor5G("1", "SONT", "ISAAC", "2")).thenReturn(failedCall("failed to get allocated resource"));
sotnServiceTemplateService.getService("SOTN", "ISAAC");
}
@Test
Call<ResponseBody> call3 = getAaiCall("Connectivity");
Call<ResponseBody> call4 = getAaiCall("Pinterface");
Call<ResponseBody> call5 = getAaiCall("VpnBinding");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
- when(aaiService.getUNIInfo(anyString())).thenReturn(call1);
- when(aaiService.getVNFsDetail(anyString())).thenReturn(call2);
- when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
- when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call5);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getUNIInfo(anyString())).thenReturn(call1);
+ when(aaiClient.getVNFsDetail(anyString())).thenReturn(call2);
+ when(aaiClient.getConnectivityInformation(anyString())).thenReturn(call3);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
+ when(aaiClient.getPinterfaceByVpnId(anyString())).thenReturn(call5);
sotnServiceTemplateService.getServiceInformationTopology("example-service-type-val-52265", "NNI-001");
}
@Test
Call<ResponseBody> call3 = getAaiCall("Connectivity");
Call<ResponseBody> call4 = getAaiCall("Pinterface");
Call<ResponseBody> call5 = getAaiCall("VpnBinding");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
- when(aaiService.getUNIInfo(anyString())).thenReturn(call1);
- when(aaiService.getVNFsDetail(anyString())).thenReturn(call2);
- when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
- when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call5);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
+ when(aaiClient.getUNIInfo(anyString())).thenReturn(call1);
+ when(aaiClient.getVNFsDetail(anyString())).thenReturn(call2);
+ when(aaiClient.getConnectivityInformation(anyString())).thenReturn(call3);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
+ when(aaiClient.getPinterfaceByVpnId(anyString())).thenReturn(call5);
sotnServiceTemplateService.getServiceInformationTopology("SOTN", "ISAAC");
}
@Test
public void getVPNBindingInformationTopologyTest() throws Exception {
Call<ResponseBody> call = getAaiCall("VpnBinding");
- when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call);
+ when(aaiClient.getPinterfaceByVpnId(anyString())).thenReturn(call);
Call<ResponseBody> call1 = getAaiCall("Pinterface");
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
}
@Test
public void getVPNBindingInformationTopologyWithThrowException() throws Exception {
Call<ResponseBody> call = getAaiCall("VpnBinding");
- when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call);
+ when(aaiClient.getPinterfaceByVpnId(anyString())).thenReturn(call);
Call<ResponseBody> call1 = getAaiCall("Pinterface");
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
}
Call<DeleteOperationRsp> sosCall = getDeleteSosCall();
Response result = null;
RequestBody requestBody = null;
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
when(soService.terminateService(anyString(),any(RequestBody.class))).thenReturn(sosCall);
sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
}
Call<ServiceOperation> sosCall = getSosCall();
Response result = null;
RequestBody requestBody = null;
- when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(aaiCall);
+ when(aaiClient.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(aaiCall);
when(soService.terminateService("serviceId",requestBody)).thenReturn(failedCall("failed to delete the server."));
sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
}
Call<ResponseBody> aaiCall3 = getAaiCall("Pinterface");
Call<ResponseBody> aaiCall4 = getAaiCall("VpnBinding");
Call<ResponseBody> aaiCall5 = getAaiCall("LogicalLink");
- when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
- when(aaiService.getConnectivityInformation( anyString())).thenReturn(aaiCall1);
- when(aaiService.getPnfInfo(anyString())).thenReturn(aaiCall2);
- when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(aaiCall3);
- when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(aaiCall4);
- when(aaiService.getSpecificLogicalLink(anyString())).thenReturn(aaiCall5);
+ when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
+ when(aaiClient.getConnectivityInformation( anyString())).thenReturn(aaiCall1);
+ when(aaiClient.getPnfInfo(anyString())).thenReturn(aaiCall2);
+ when(aaiClient.getTerminationPoint(anyString(),anyString())).thenReturn(aaiCall3);
+ when(aaiClient.getPinterfaceByVpnId(anyString())).thenReturn(aaiCall4);
+ when(aaiClient.getSpecificLogicalLink(anyString())).thenReturn(aaiCall5);
sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
}
@Test
public void getSOTNResourceInformationTopologyWithThrowException() throws Exception {
ResponseBody result = null;
- when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(failedCall("failed to get sotn resource topology."));
+ when(aaiClient.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(failedCall("failed to get sotn resource topology."));
sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
}
return call;
}
}
-