import java.io.IOException;
-import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
-import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogClient;
+import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
}
@Bean
- SDCCatalogService sdcCatalogService() {
- return retrofit().create(SDCCatalogService.class);
+ SDCCatalogClient sdcCatalogClient() {
+ return retrofit().create(SDCCatalogClient.class);
}
@Bean
- VfcService vfcService() {
- return retrofit().create(VfcService.class);
+ VfcClient vfcClient() {
+ return retrofit().create(VfcClient.class);
}
}
import java.io.IOException;
-import org.onap.usecaseui.server.service.intent.IntentSoService;
-import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
-import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.intent.IntentSoClient;
+import org.onap.usecaseui.server.service.lcm.domain.so.SOClient;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceClient;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
}
@Bean
- SOService soService() {
- return retrofit().create(SOService.class);
+ SOClient soClient() {
+ return retrofit().create(SOClient.class);
}
@Bean
- SOSliceService soSliceService() {
- return retrofit().create(SOSliceService.class);
+ SOSliceClient soSliceClient() {
+ return retrofit().create(SOSliceClient.class);
}
@Bean
- IntentSoService intentSoService() {
- return retrofit().create(IntentSoService.class);
+ IntentSoClient intentSoClient() {
+ return retrofit().create(IntentSoClient.class);
}
@Bean
// not at all clear whether this service should interface with SO
- KpiSliceService kpiSliceService() {
- return retrofit().create(KpiSliceService.class);
+ KpiSliceClient kpiSliceClient() {
+ return retrofit().create(KpiSliceClient.class);
}
}
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceInstance;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil;
import org.springframework.stereotype.Service;
private static final Gson gson = new Gson();
private final ServiceLcmService serviceLcmService;
private final AAISliceClient aaiSliceClient;
- private final SOSliceService soSliceService;
+ private final SOSliceClient soSliceClient;
private final SlicingProperties slicingProperties;
@Override
String jsonstr = gson.toJson(creationRequest);
log.info("createSlicingService:creationRequest request is:{}", jsonstr);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
- Response<CreateResponse> updateResponse = soSliceService
+ Response<CreateResponse> updateResponse = soSliceClient
.submitOrders(requestBody).execute();
if (updateResponse.isSuccessful()) {
String operationId = serviceInstanceOperations.getOperationId();
Response<SOOperation> response = null;
try {
- response = this.soSliceService.queryOperationProgress(businessId, operationId)
+ response = this.soSliceClient.queryOperationProgress(businessId, operationId)
.execute();
if (response.isSuccessful()) {
SOOperation soOperation = response.body();
import retrofit2.http.POST;
import retrofit2.http.Path;
-public interface IntentSoService {
+public interface IntentSoClient {
@POST("/so/infra/serviceIntent/v1/create")
Call<JSONObject> createIntentInstance(@Body RequestBody body);
import org.onap.usecaseui.server.service.csmf.SlicingService;
import org.onap.usecaseui.server.service.intent.IntentAaiClient;
import org.onap.usecaseui.server.service.intent.IntentInstanceService;
-import org.onap.usecaseui.server.service.intent.IntentSoService;
+import org.onap.usecaseui.server.service.intent.IntentSoClient;
import org.onap.usecaseui.server.service.intent.config.IntentProperties;
import org.onap.usecaseui.server.service.nsmf.ResourceMgtService;
import org.onap.usecaseui.server.util.ExportUtil;
private final SlicingService slicingService;
private final IntentAaiClient intentAaiClient;
- private final IntentSoService intentSoService;
+ private final IntentSoClient intentSoClient;
private final SessionFactory sessionFactory;
private final ResourceMgtService resourceMgtService;
private final IntentProperties intentProperties;
- public IntentInstanceServiceImpl(SlicingService slicingService, IntentAaiClient intentAaiClient, IntentSoService intentSoService, SessionFactory sessionFactory, ResourceMgtService resourceMgtService, IntentProperties intentProperties) {
+ public IntentInstanceServiceImpl(SlicingService slicingService, IntentAaiClient intentAaiClient, IntentSoClient intentSoClient, SessionFactory sessionFactory, ResourceMgtService resourceMgtService, IntentProperties intentProperties) {
this.slicingService = slicingService;
this.intentAaiClient = intentAaiClient;
- this.intentSoService = intentSoService;
+ this.intentSoClient = intentSoClient;
this.sessionFactory = sessionFactory;
this.resourceMgtService = resourceMgtService;
this.intentProperties = defaultPropertiesFromFile(intentProperties);
params.put("additionalProperties",additionalProperties);
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
- Response<JSONObject> response = intentSoService.createIntentInstance(requestBody).execute();
+ Response<JSONObject> response = intentSoClient.createIntentInstance(requestBody).execute();
if (response.isSuccessful()) {
return response.body().getString("jobId");
}
}
private int getProgressByJobId(CCVPNInstance instance) throws IOException {
- Response<JSONObject> response = intentSoService.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
+ Response<JSONObject> response = intentSoClient.queryOperationProgress(instance.getResourceInstanceId(), instance.getJobId()).execute();
logger.debug(response.toString());
if (response.isSuccessful()) {
if (response.body().containsKey("operation")) {
additionalProperties.put("enableSdnc", "true");
params.put("additionalProperties", additionalProperties);
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
- intentSoService.deleteIntentInstance(requestBody).execute();
+ intentSoClient.deleteIntentInstance(requestBody).execute();
}
private String deleteInstance(CCVPNInstance instance) {
Transaction tx = null;
import java.util.List;
-public interface SDCCatalogService {
+public interface SDCCatalogClient {
- @GET("/api/sdc/v1/catalog/services")
+ @GET("v1/catalog/services")
Call<List<SDCServiceTemplate>> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus);
- @GET("/api/sdc/v1/catalog/services/{uuid}/metadata")
+ @GET("v1/catalog/services/{uuid}/metadata")
Call<SDCServiceTemplate> getService(@Path("uuid") String uuid);
@GET
Call<ResponseBody> downloadCsar(@Url String fileUrl);
- @GET("/api/sdc/v1/catalog/resources")
+ @GET("v1/catalog/resources")
Call<List<Vnf>> listResources(@Query("resourceType") String resourceType);
}
import retrofit2.Call;
import retrofit2.http.*;
-public interface SOService {
+public interface SOClient {
@POST("/api/so-serviceInstances/v3")
Call<ServiceOperation> instantiateService(@Body RequestBody body);
import retrofit2.Call;
import retrofit2.http.*;
-public interface VfcService {
+public interface VfcClient {
- @POST("/api/catalog/v1/nspackages")
+ @POST("catalog/v1/nspackages")
Call<DistributionResult> distributeNsPackage(@Body Csar csar);
- @POST("/api/catalog/v1/vnfpackages")
+ @POST("catalog/v1/vnfpackages")
Call<Job> distributeVnfPackage(@Body Csar csar);
- @GET("/api/catalog/v1/jobs/{jobId}")
+ @GET("catalog/v1/jobs/{jobId}")
Call<JobStatus> getJobStatus(@Path("jobId") String jobId, @Query("responseId") String responseId);
-
+
@GET("/api/nslcm/v1/jobs/{jobId}")
Call<JobStatus> getNsLcmJobStatus(@Path("jobId") String jobId, @Query("responseId") String responseId);
- @DELETE("/api/catalog/v1/nspackages/{csarId}")
+ @DELETE("catalog/v1/nspackages/{csarId}")
Call<DistributionResult> deleteNsPackage(@Path("csarId") String csarId);
- @DELETE("/api/catalog/v1/vnfpackages/{csarId}")
+ @DELETE("catalog/v1/vnfpackages/{csarId}")
Call<Job> deleteVnfPackage(@Path("csarId") String csarId);
-
- @GET("/api/catalog/v1/nspackages")
+
+ @GET("catalog/v1/nspackages")
Call<ResponseBody> listNsTemplates();
-
+
@POST("/api/parser/v1/parsernsd")
Call<ResponseBody> fetchNsTemplateData(@Body RequestBody body);
-
+
@POST("/api/parser/v1/parser")
Call<ResponseBody> fetchTemplateInfo(@Body RequestBody body);
-
+
@GET("/api/nslcm/v1/ns")
Call<nsServiceRsp> getNetworkServiceInfo();
-
+
@POST("/api/nslcm/v1/ns")
Call<ResponseBody> createNetworkServiceInstance(@Body RequestBody body);
-
+
@POST("/api/nslcm/v1/ns/{ns_instance_id}/instantiate")
Call<ResponseBody> instantiateNetworkServiceInstance(@Body RequestBody body,@Path("ns_instance_id") String nsInstanceId);
-
+
@DELETE("/api/nslcm/v1/ns/{ns_instance_id}")
Call<ResponseBody> deleteNetworkServiceInstance(@Path("ns_instance_id") String nsInstanceId);
-
+
@POST("/api/nslcm/v1/ns/{ns_instance_id}/terminate")
Call<ResponseBody> terminateNetworkServiceInstance(@Path("ns_instance_id") String nsInstanceId,@Body RequestBody body);
-
+
@POST("/api/nslcm/v1/ns/{ns_instance_id}/heal")
Call<ResponseBody> healNetworkServiceInstance(@Path("ns_instance_id") String nsInstanceId,@Body RequestBody body);
-
+
@POST("/api/nslcm/v1/ns/{ns_instance_id}/scale")
Call<ResponseBody> scaleNetworkServiceInstance(@Path("ns_instance_id") String nsInstanceId,@Body RequestBody body);
-
+
@GET("/api/nsd/v1/ns_descriptors")
Call<ResponseBody> getNetworkServicePackages();
-
+
@GET("/api/vnfpkgm/v1/vnf_packages")
Call<ResponseBody> getVnfPackages();
-
+
@GET("/api/nsd/v1/pnf_descriptors")
Call<ResponseBody> getPnfPackages();
-
+
@POST("/api/nsd/v1/ns_descriptors")
Call<ResponseBody> createNetworkServiceData(@Body RequestBody body);
-
+
@POST("/api/vnfpkgm/v1/vnf_packages")
Call<ResponseBody> createVnfData(@Body RequestBody body);
-
+
@POST("/api/nsd/v1/pnf_descriptors")
Call<ResponseBody> createPnfData(@Body RequestBody body);
-
+
@GET("/api/nsd/v1/ns_descriptors/{nsdInfoId}/nsd_content")
Call<ResponseBody> downLoadNsPackage(@Path("nsdInfoId") String nsdInfoId);
-
+
@GET("/api/nsd/v1/ns_descriptors/{nsdInfoId}")
Call<ResponseBody> getNsdInfo(@Path("nsdInfoId") String nsdInfoId);
-
+
@GET("/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}")
Call<ResponseBody> getVnfInfo(@Path("vnfPkgId") String vnfPkgId);
-
+
@GET("/api/nsd/v1/pnf_descriptors/{pnfdInfoId}")
Call<ResponseBody> getPnfInfo(@Path("pnfdInfoId") String pnfdInfoId);
-
+
@GET("/api/nsd/v1/pnf_descriptors/{pnfdInfoId}/pnfd_content")
Call<ResponseBody> downLoadPnfPackage(@Path("pnfdInfoId") String pnfdInfoId);
-
+
@GET("/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}/package_content")
Call<ResponseBody> downLoadVnfPackage(@Path("vnfPkgId") String vnfPkgId);
-
+
@DELETE("/api/nsd/v1/ns_descriptors/{nsdInfoId}")
Call<ResponseBody> deleteNsdPackage(@Path("nsdInfoId") String nsdInfoId);
-
+
@DELETE("/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}")
Call<ResponseBody> deleteVnfdPackage(@Path("vnfPkgId") String vnfPkgId);
-
+
@DELETE("/api/nsd/v1/pnf_descriptors/{pnfdInfoId}")
Call<ResponseBody> deletePnfdPackage(@Path("pnfdInfoId") String pnfdInfoId);
-
+
@GET("/api/nslcm/v1/ns/vnfs/{vnfinstid}")
Call<ResponseBody> getVnfInfoById(@Path("vnfinstid") String vnfinstid);
- @GET("/api/catalog/v1/service_packages")
+ @GET("catalog/v1/service_packages")
Call<ResponseBody> servicePackages();
-
- @GET("/api/catalog/v1/service_packages/{csarId}")
+
+ @GET("catalog/v1/service_packages/{csarId}")
Call<ResponseBody> servicePackages(@Path("csarId") String csarId);
-
- @POST("/api/catalog/v1/service_packages")
+
+ @POST("catalog/v1/service_packages")
Call<ResponseBody> servicePackages(@Body RequestBody body);
-
- @DELETE("/api/catalog/v1/service_packages/{csarId}")
+
+ @DELETE("catalog/v1/service_packages/{csarId}")
Call<ResponseBody> deleteServicePackages(@Path("csarId") String csarId);
}
import java.util.Collections;
import java.util.List;
-import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.bean.nsServiceRsp;
-import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogClient;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf;
-import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcService;
+import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcClient;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Csar;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus;
import org.onap.usecaseui.server.service.lcm.domain.vfc.exceptions.VfcException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
@Service("PackageDistributionService")
public class DefaultPackageDistributionService implements PackageDistributionService {
- private final SDCCatalogService sdcCatalogService;
- private final VfcService vfcService;
+ private final SDCCatalogClient sdcCatalogClient;
+ private final VfcClient vfcClient;
private final ServiceLcmService serviceLcmService;
@Override
@Override
public List<Vnf> sdcVfPackageInfo() {
try {
- Response<List<Vnf>> response = sdcCatalogService.listResources(RESOURCETYPE_VF).execute();
+ Response<List<Vnf>> response = sdcCatalogClient.listResources(RESOURCETYPE_VF).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public List<SDCServiceTemplate> sdcNsPackageInfo() {
try {
- Response<List<SDCServiceTemplate>> response = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute();
+ Response<List<SDCServiceTemplate>> response = sdcCatalogClient.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public DistributionResult postNsPackage(Csar csar) {
try {
- Response<DistributionResult> response = vfcService.distributeNsPackage(csar).execute();
+ Response<DistributionResult> response = vfcClient.distributeNsPackage(csar).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public Job postVfPackage(Csar csar) {
try {
- Response<Job> response = vfcService.distributeVnfPackage(csar).execute();
+ Response<Job> response = vfcClient.distributeVnfPackage(csar).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public JobStatus getJobStatus(String jobId, String responseId) {
try {
- Response<JobStatus> response = vfcService.getJobStatus(jobId, responseId).execute();
+ Response<JobStatus> response = vfcClient.getJobStatus(jobId, responseId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public JobStatus getNsLcmJobStatus(String serviceInstanceId,String jobId, String responseId,String operationType) { try {
- Response<JobStatus> response = vfcService.getNsLcmJobStatus(jobId, responseId).execute();
+ Response<JobStatus> response = vfcClient.getNsLcmJobStatus(jobId, responseId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public DistributionResult deleteNsPackage(String csarId) {
try {
- Response<DistributionResult> response = vfcService.deleteNsPackage(csarId).execute();
+ Response<DistributionResult> response = vfcClient.deleteNsPackage(csarId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
@Override
public Job deleteVfPackage(String csarId) {
try {
- Response<Job> response = vfcService.deleteVnfPackage(csarId).execute();
+ Response<Job> response = vfcClient.deleteVnfPackage(csarId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
String result="";
try {
log.info("vfc getVnfPackages is starting!");
- Response<ResponseBody> response = this.vfcService.getVnfPackages().execute();
+ Response<ResponseBody> response = this.vfcClient.getVnfPackages().execute();
log.info("vfc getVnfPackages has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc getNetworkServicePackages is starting!");
- Response<ResponseBody> response = this.vfcService.getNetworkServicePackages().execute();
+ Response<ResponseBody> response = this.vfcClient.getNetworkServicePackages().execute();
log.info("vfc getNetworkServicePackages has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc getPnfPackages is starting!");
- Response<ResponseBody> response = this.vfcService.getPnfPackages().execute();
+ Response<ResponseBody> response = this.vfcClient.getPnfPackages().execute();
log.info("vfc getPnfPackages has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc downLoadNsPackage is starting!");
- Response<ResponseBody> response = this.vfcService.downLoadNsPackage(nsdInfoId).execute();
+ Response<ResponseBody> response = this.vfcClient.downLoadNsPackage(nsdInfoId).execute();
log.info("vfc downLoadNsPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc downLoadPnfPackage is starting!");
- Response<ResponseBody> response = this.vfcService.downLoadNsPackage(pnfdInfoId).execute();
+ Response<ResponseBody> response = this.vfcClient.downLoadNsPackage(pnfdInfoId).execute();
log.info("vfc downLoadPnfPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc downLoadVnfPackage is starting!");
- Response<ResponseBody> response = this.vfcService.downLoadNsPackage(vnfPkgId).execute();
+ Response<ResponseBody> response = this.vfcClient.downLoadNsPackage(vnfPkgId).execute();
log.info("vfc downLoadVnfPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc deleteNsdPackage is starting!");
- response = this.vfcService.deleteNsdPackage(nsdInfoId).execute();
+ response = this.vfcClient.deleteNsdPackage(nsdInfoId).execute();
log.info("vfc deleteNsdPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc deleteVnfPackage is starting!");
- response = this.vfcService.deleteVnfdPackage(vnfPkgId).execute();
+ response = this.vfcClient.deleteVnfdPackage(vnfPkgId).execute();
log.info("vfc deleteVnfPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc deletePnfPackage is starting!");
- response = this.vfcService.deletePnfdPackage(pnfdInfoId).execute();
+ response = this.vfcClient.deletePnfdPackage(pnfdInfoId).execute();
log.info("vfc deletePnfPackage has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
List<String> result = new ArrayList<>();
try {
log.info("vfc getNetworkServiceInfo is starting!");
- Response<nsServiceRsp> response = this.vfcService.getNetworkServiceInfo().execute();
+ Response<nsServiceRsp> response = this.vfcClient.getNetworkServiceInfo().execute();
log.info("vfc getNetworkServiceInfo has finished!");
if (response.isSuccessful()) {
List<String> nsServices = response.body().nsServices;
try {
log.info("aai createNetworkServiceInstance is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.createNetworkServiceInstance(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.createNetworkServiceInstance(requestBody).execute();
log.info("aai createNetworkServiceInstance has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc deleteNetworkServiceInstance is starting!");
- response = this.vfcService.deleteNetworkServiceInstance(nsInstanceId).execute();
+ response = this.vfcClient.deleteNetworkServiceInstance(nsInstanceId).execute();
log.info("vfc deleteNetworkServiceInstance has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
try {
log.info("aai terminateNetworkServiceInstance is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.terminateNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
+ Response<ResponseBody> response = vfcClient.terminateNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
log.info("aai terminateNetworkServiceInstance has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai healNetworkServiceInstance is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.healNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
+ Response<ResponseBody> response = vfcClient.healNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
log.info("aai healNetworkServiceInstance has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai scaleNetworkServiceInstance is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.scaleNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
+ Response<ResponseBody> response = vfcClient.scaleNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
log.info("aai scaleNetworkServiceInstance has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai createNetworkServiceData is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.createNetworkServiceData(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.createNetworkServiceData(requestBody).execute();
log.info("aai createNetworkServiceData has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai createVnfData is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.createVnfData(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.createVnfData(requestBody).execute();
log.info("aai createVnfData has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai createPnfData is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.createPnfData(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.createPnfData(requestBody).execute();
log.info("aai createPnfData has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc getNsdInfo is starting!");
- Response<ResponseBody> response = this.vfcService.getNsdInfo(nsdInfoId).execute();
+ Response<ResponseBody> response = this.vfcClient.getNsdInfo(nsdInfoId).execute();
log.info("vfc getNsdInfo has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc getVnfInfo is starting!");
- Response<ResponseBody> response = this.vfcService.getVnfInfo(vnfPkgId).execute();
+ Response<ResponseBody> response = this.vfcClient.getVnfInfo(vnfPkgId).execute();
log.info("vfc getVnfInfo has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc getPnfInfo is starting!");
- Response<ResponseBody> response = this.vfcService.getPnfInfo(pnfdInfoId).execute();
+ Response<ResponseBody> response = this.vfcClient.getPnfInfo(pnfdInfoId).execute();
log.info("vfc getPnfInfo has finished!");
if (response.isSuccessful()) {
result= CommonConstant.CONSTANT_SUCCESS;
String result="";
try {
log.info("vfc listNsTemplates is starting!");
- Response<ResponseBody> response = this.vfcService.listNsTemplates().execute();
+ Response<ResponseBody> response = this.vfcClient.listNsTemplates().execute();
log.info("vfc listNsTemplates has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
log.info("aai fetchNsTemplateData is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.fetchNsTemplateData(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.fetchNsTemplateData(requestBody).execute();
log.info("aai fetchNsTemplateData has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
try {
RequestBody requestBody = extractBody(request);
// search template from vfc catalog
- Response<ResponseBody> getResponse = this.vfcService.servicePackages(csarId).execute();
+ Response<ResponseBody> getResponse = this.vfcClient.servicePackages(csarId).execute();
if (getResponse.isSuccessful()) {
// call vfc template parser
log.info("calling ccvpn template file parser is starting");
- Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.fetchTemplateInfo(requestBody).execute();
log.info("calling ccvpn template file parser has finished");
if (response.isSuccessful()) {
result.put("status", CommonConstant.CONSTANT_SUCCESS);
}
} else {
// distribute template files to vfc catalog
- Response<ResponseBody> postResponse = this.vfcService.servicePackages(requestBody).execute();
+ Response<ResponseBody> postResponse = this.vfcClient.servicePackages(requestBody).execute();
if (postResponse.isSuccessful()) {
// call vfc template parser
log.info("calling ccvpn template file parser is starting");
- Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute();
+ Response<ResponseBody> response = vfcClient.fetchTemplateInfo(requestBody).execute();
log.info("calling ccvpn template file parser has finished");
if (response.isSuccessful()) {
result.put("status", CommonConstant.CONSTANT_SUCCESS);
try {
log.info("aai instantiateNetworkServiceInstance is starting");
RequestBody requestBody = extractBody(request);
- Response<ResponseBody> response = vfcService.instantiateNetworkServiceInstance(requestBody,serviceInstanceId).execute();
+ Response<ResponseBody> response = vfcClient.instantiateNetworkServiceInstance(requestBody,serviceInstanceId).execute();
log.info("aai instantiateNetworkServiceInstance has finished");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
String result="";
try {
log.info("vfc getVnfInfoById is starting!");
- Response<ResponseBody> response = this.vfcService.getVnfInfoById(vnfinstid).execute();
+ Response<ResponseBody> response = this.vfcClient.getVnfInfoById(vnfinstid).execute();
log.info("vfc getVnfInfoById has finished!");
if (response.isSuccessful()) {
result=new String(response.body().bytes());
import org.onap.usecaseui.server.bean.ServiceBean;
import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
-import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
+import org.onap.usecaseui.server.service.lcm.domain.so.SOClient;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.SaveOrUpdateOperationRsp;
public class DefaultServiceLcmService implements ServiceLcmService {
private final EntityManagerFactory entityManagerFactory;
- private final SOService soService;
+ private final SOClient soClient;
public Session getSession() {
return entityManagerFactory.unwrap(SessionFactory.class).getCurrentSession();}
try {
log.info("so instantiate is starting");
RequestBody requestBody = extractBody(request);
- Response<ServiceOperation> response = soService.instantiateService(requestBody).execute();
+ Response<ServiceOperation> response = soClient.instantiateService(requestBody).execute();
log.info("so instantiate has finished");
if (response.isSuccessful()) {
return response.body();
public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) {
try {
Response<OperationProgressInformation> response =
- soService.queryOperationProgress(serviceId, operationId).execute();
+ soClient.queryOperationProgress(serviceId, operationId).execute();
if (response.isSuccessful()) {
return response.body();
} else {
try {
log.info("so terminate is starting");
RequestBody requestBody = extractBody(request);
- Response<DeleteOperationRsp> response = soService.terminateService(serviceId, requestBody).execute();
+ Response<DeleteOperationRsp> response = soClient.terminateService(serviceId, requestBody).execute();
log.info("so terminate has finished");
if (response.isSuccessful()) {
return response.body();
try {
log.info("so scale is finished");
RequestBody requestBody = extractBody(request);
- Response<SaveOrUpdateOperationRsp> response = soService.scaleService(serviceId, requestBody).execute();
+ Response<SaveOrUpdateOperationRsp> response = soClient.scaleService(serviceId, requestBody).execute();
log.info("so scale has finished");
if (response.isSuccessful()) {
log.info("scaleService response content is :" + response.body().toString());
try {
log.info("so update is starting");
RequestBody requestBody = extractBody(request);
- Response<SaveOrUpdateOperationRsp> response = soService.updateService(serviceId, requestBody).execute();
+ Response<SaveOrUpdateOperationRsp> response = soClient.updateService(serviceId, requestBody).execute();
log.info("so update has finished");
if (response.isSuccessful()) {
return response.body();
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.exceptions.AAIException;
-import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogClient;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
import org.onap.usecaseui.server.util.RestfulServices;
@Service("ServiceTemplateService")
public class DefaultServiceTemplateService implements ServiceTemplateService {
- private final SDCCatalogService sdcCatalog;
+ private final SDCCatalogClient sdcCatalog;
private final AAIClient aaiClient;
@Override
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.Relationship;
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.service.lcm.domain.so.SOClient;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.Operation;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
import org.onap.usecaseui.server.bean.lcm.sotne2eservice.*;
private static final Logger logger = LoggerFactory.getLogger(SotnServiceTemplateServiceImpl.class);
- private SOService soService;
+ private SOClient soClient;
private AAIClient aaiClient;
private Map<String, Model> readConfigToMap(ModelConfig modelConfig) {
Operation result = new Operation();
try {
logger.info("SO instantiate SOTN service is starting");
- Response<ServiceOperation> sotnserviceresponse = soService.instantiateSOTNService(requestBody).execute();
+ Response<ServiceOperation> sotnserviceresponse = soClient.instantiateSOTNService(requestBody).execute();
logger.info("SO instantiate SOTN service has finished");
if (sotnserviceresponse.isSuccessful()) {
logger.info("SO instantiate SOTN service is successful");
try {
logger.info("so begin terminate site service " + siteserviceId);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestStr);
- Response<DeleteOperationRsp> response = soService.terminateService(siteserviceId, requestBody).execute();
+ Response<DeleteOperationRsp> response = soClient.terminateService(siteserviceId, requestBody).execute();
logger.info("so terminate has finished");
if (response.isSuccessful()) {
logger.info("so terminated site service " + siteserviceId + "successfully...");
try {
logger.info("so begin terminate Connectivity service " + serviceId);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestStr);
- Response<DeleteOperationRsp> response = soService.terminateService(serviceId, requestBody).execute();
+ Response<DeleteOperationRsp> response = soClient.terminateService(serviceId, requestBody).execute();
logger.info("so terminate has finished");
if (response.isSuccessful()) {
logger.info("so terminated connectivity service " + serviceId + "successfully...");
import org.onap.usecaseui.server.bean.nsmf.resource.ConnectionLinkInfo;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.SliceProfileInfo;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.SliceProfileList;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.ActivateService;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
import org.onap.usecaseui.server.util.DateUtils;
private static final Gson gson = new Gson();
private final AAISliceClient aaiSliceClient;
- private final SOSliceService soSliceService;
+ private final SOSliceClient soSliceClient;
@Resource(name = "ServiceLcmService")
private ServiceLcmService serviceLcmService;
String operationId = serviceInstanceOperations.getOperationId();
Response<SOOperation> response = null;
try {
- response = this.soSliceService.queryOperationProgress(businessId, operationId)
+ response = this.soSliceClient.queryOperationProgress(businessId, operationId)
.execute();
if (response.isSuccessful()) {
SOOperation soOperation = response.body();
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<ActivateService> activeResponse = this.soSliceService.activeService(serviceId, requestBody)
+ Response<ActivateService> activeResponse = this.soSliceClient.activeService(serviceId, requestBody)
.execute();
if (activeResponse.isSuccessful()) {
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
- Response<ActivateService> activeResponse = this.soSliceService.deactiveService(serviceId, requestBody)
+ Response<ActivateService> activeResponse = this.soSliceClient.deactiveService(serviceId, requestBody)
.execute();
if (activeResponse.isSuccessful()) {
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<ActivateService> activeResponse = this.soSliceService.terminateService(serviceId, requestBody)
+ Response<ActivateService> activeResponse = this.soSliceClient.terminateService(serviceId, requestBody)
.execute();
if (activeResponse.isSuccessful()) {
if (serviceInstanceOperations != null) {
String operationId = serviceInstanceOperations.getOperationId();
logger.info("queryOperationProgress: operationId is:{}", operationId);
- Response<SOOperation> response = this.soSliceService.queryOperationProgress(serviceId, operationId)
+ Response<SOOperation> response = this.soSliceClient.queryOperationProgress(serviceId, operationId)
.execute();
if (response.isSuccessful()) {
SOOperation soOperation = response.body();
import org.onap.usecaseui.server.constant.nsmf.NsmfCodeConstant;
import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
import org.onap.usecaseui.server.service.nsmf.ResourceMonitorService;
-import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber;
private static final Logger logger = LoggerFactory.getLogger(ResourceMonitorServiceImpl.class);
private static final Gson gson = new Gson();
- private final KpiSliceService kpiSliceService;
+ private final KpiSliceClient kpiSliceClient;
@Autowired
private ResourceMonitorServiceConvert resourceMonitorServiceConvert;
.buildTrafficReqInfo(serviceInfo, newTimestamp);
String jsonstr = JSON.toJSONString(trafficReqInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<KpiTotalTraffic> response = this.kpiSliceService.listTotalTraffic(requestBody).execute();
+ Response<KpiTotalTraffic> response = this.kpiSliceClient.listTotalTraffic(requestBody).execute();
if (response.isSuccessful()) {
KpiTotalTraffic kpiTotalTraffic = response.body();
logger.info("querySlicingUsageTraffic: listTotalTraffic reponse is:{}",
.buildSlicingKpiReqInfo(serviceInfo, newTimestamp, kpiHours);
String jsonstr = JSON.toJSONString(slicingKpiReqInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<KpiUserNumber> response = this.kpiSliceService.listUserNumber(requestBody).execute();
+ Response<KpiUserNumber> response = this.kpiSliceClient.listUserNumber(requestBody).execute();
if (response.isSuccessful()) {
KpiUserNumber kpiUserNumber = response.body();
.buildSlicingKpiReqInfo(serviceInfo, newTimestamp, kpiHours);
String jsonstr = JSON.toJSONString(slicingKpiReqInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<KpiTotalBandwidth> response = this.kpiSliceService.listTotalBandwidth(requestBody).execute();
+ Response<KpiTotalBandwidth> response = this.kpiSliceClient.listTotalBandwidth(requestBody).execute();
if (response.isSuccessful()) {
KpiTotalBandwidth kpiTotalBandwidth = response.body();
.buildSlicingPDUSessionEstSRKpiReqInfo(serviceInfo, queryTimestamp, kpiHours);
String jsonstr = JSON.toJSONString(slicingKpiReqInfo);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<KpiPDUSessionEstSR> response =this.kpiSliceService.listPDUSessionEstSR(requestBody).execute();
+ Response<KpiPDUSessionEstSR> response =this.kpiSliceClient.listPDUSessionEstSR(requestBody).execute();
if (response.isSuccessful()) {
KpiPDUSessionEstSR kpiPDUSessionEstSR = response.body();
logger.info("querySlicingPDUSessionEstSR: listPDUSessionEstSR reponse is:{}",
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.ConnectionVo;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.EndPointInfoListVo;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.PropertiesVo;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTaskRsp;
import org.onap.usecaseui.server.util.RestfulServices;
private static final Logger logger = LoggerFactory.getLogger(TaskMgtServiceImpl.class);
- private final SOSliceService soSliceService;
+ private final SOSliceClient soSliceClient;
private final AAISliceClient aaiSliceClient;
@Resource(name = "TaskMgtConvertService")
String resultMsg;
try {
- Response<JSONArray> response = this.soSliceService.listTask().execute();
+ Response<JSONArray> response = this.soSliceClient.listTask().execute();
if (response.isSuccessful()) {
Gson gson = new Gson();
Type type = new TypeToken<List<SOTask>>() {
SOTaskRsp soTaskRsp = new SOTaskRsp();
String resultMsg;
try {
- Response<JSONArray> response = this.soSliceService.listTaskByStage(status).execute();
+ Response<JSONArray> response = this.soSliceClient.listTaskByStage(status).execute();
if (response.isSuccessful()) {
Gson gson = new Gson();
Type type = new TypeToken<List<SOTask>>() {
try {
// TODO
- Response<SOTask> response = this.soSliceService.getTaskById(taskId).execute();
+ Response<SOTask> response = this.soSliceClient.getTaskById(taskId).execute();
if (response.isSuccessful()) {
SOTask soTaskInfo = response.body();
Gson gson = new Gson();
ResultHeader resultHeader = new ResultHeader();
String resultMsg;
try {
- Response<SOTask> response = this.soSliceService.getTaskById(slicingTaskAuditInfo.getTaskId()).execute();
+ Response<SOTask> response = this.soSliceClient.getTaskById(slicingTaskAuditInfo.getTaskId()).execute();
if (response.isSuccessful()) {
SOTask soTaskInfo = response.body();
Gson gson = new Gson();
String jsonstr = JSON.toJSONString(soTaskInfo);
logger.info("updateTaskAuditInfo: the requestBody body is:{}", jsonstr);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- Response<ResponseBody> updateResponse = soSliceService
+ Response<ResponseBody> updateResponse = soSliceClient
.updateService(slicingTaskAuditInfo.getTaskId(), requestBody).execute();
if (updateResponse.isSuccessful()) {
- Response<ResponseBody> commitResponse = this.soSliceService
+ Response<ResponseBody> commitResponse = this.soSliceClient
.commitTask(slicingTaskAuditInfo.getTaskId()).execute();
if (commitResponse.isSuccessful()) {
resultMsg = "5G slicing task submit result.";
String resultMsg;
try {
- Response<SOTask> response = this.soSliceService.getTaskByIdD(taskId).execute();
+ Response<SOTask> response = this.soSliceClient.getTaskByIdD(taskId).execute();
if (response.isSuccessful()) {
Gson gson = new Gson();
SOTask soTask = response.body();
String resultMsg;
try {
- Response<SOTask> response = this.soSliceService.getTaskByIdD(taskId).execute();
+ Response<SOTask> response = this.soSliceClient.getTaskByIdD(taskId).execute();
if (response.isSuccessful()) {
SOTask soTask = response.body();
Gson gson = new Gson();
import retrofit2.http.Body;
import retrofit2.http.POST;
-public interface KpiSliceService {
+public interface KpiSliceClient {
@POST("/api/datalake/v1/exposure/userNumber")
Call<KpiUserNumber> listUserNumber(@Body RequestBody body);
import retrofit2.http.Path;
import retrofit2.http.Query;
-public interface SOSliceService {
+public interface SOSliceClient {
@GET("/api/so-serviceInstances/v3/{serviceId}/operations/{operationId}")
Call<SOOperation> queryOperationProgress(@Path("serviceId") String serviceId,
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.impl.DefaultServiceLcmService;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@MockBean ServiceLcmService serviceLcmService;
@Autowired AAISliceClient aaiSliceClient;
- @Autowired SOSliceService soSliceService;
+ @Autowired SOSliceClient soSliceClient;
@Autowired SlicingProperties slicingProperties;
SlicingService slicingService;
@BeforeEach
void setup() {
- slicingService = new SlicingServiceImpl(serviceLcmService,aaiSliceClient,soSliceService, slicingProperties);
+ slicingService = new SlicingServiceImpl(serviceLcmService,aaiSliceClient,soSliceClient, slicingProperties);
}
@Test
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.impl.DefaultServiceLcmService;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
import org.powermock.api.support.membermodification.MemberModifier;
import retrofit2.Call;
public class SlicingServiceImplTest {
SlicingServiceImpl slicingService = null;
- SOSliceService soSliceService;
+ SOSliceClient soSliceClient;
AAISliceClient aaiSliceClient;
ServiceLcmService serviceLcmService;
SlicingProperties slicingProperties;
@Before
public void before() throws Exception {
aaiSliceClient = mock(AAISliceClient.class);
- soSliceService = mock(SOSliceService.class);
+ soSliceClient = mock(SOSliceClient.class);
serviceLcmService = mock(DefaultServiceLcmService.class);
slicingProperties = mock(SlicingProperties.class);
- slicingService = new SlicingServiceImpl(serviceLcmService, aaiSliceClient, soSliceService, slicingProperties);
+ slicingService = new SlicingServiceImpl(serviceLcmService, aaiSliceClient, soSliceClient, slicingProperties);
MemberModifier.field(SlicingServiceImpl.class, "serviceLcmService").set(slicingService , serviceLcmService);
}
CreateResponse createResponse = new CreateResponse();
RequestBody requestBody = null;
- when(soSliceService
+ when(soSliceClient
.submitOrders(requestBody))
.thenReturn(successfulCall(createResponse));
slicingService.createSlicingService(slicingOrder);
SlicingOrder slicingOrder = new SlicingOrder();
RequestBody requestBody = null;
- when(soSliceService
+ when(soSliceClient
.submitOrders(requestBody))
.thenReturn(failedCall("so is not exist!"));
slicingService.createSlicingService(slicingOrder);
String businessId = "test123";
String operationId = "opera123";
when(serviceLcmService.getServiceInstanceOperationById(businessId)).thenReturn(new ServiceInstanceOperations());
- when(soSliceService.queryOperationProgress(businessId, operationId))
+ when(soSliceClient.queryOperationProgress(businessId, operationId))
.thenReturn(successfulCall(soOperation));
slicingService.addProgressToOrder(orderList);
}
String businessId = "test123";
String operationId = "opera123";
- when(soSliceService.queryOperationProgress(businessId, operationId))
+ when(soSliceClient.queryOperationProgress(businessId, operationId))
.thenReturn(failedCall("so is not exist!"));
slicingService.addProgressToOrder(orderList);
}
import org.onap.usecaseui.server.constant.IntentConstant;
import org.onap.usecaseui.server.service.csmf.SlicingService;
import org.onap.usecaseui.server.service.intent.IntentAaiClient;
-import org.onap.usecaseui.server.service.intent.IntentSoService;
+import org.onap.usecaseui.server.service.intent.IntentSoClient;
import org.onap.usecaseui.server.service.intent.config.IntentProperties;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgress;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
private IntentAaiClient intentAaiClient;
@Mock
- private IntentSoService intentSoService;
+ private IntentSoClient intentSoClient;
@Mock
private IntentProperties intentProperties;
MemberModifier.field(IntentInstanceServiceImpl.class, "resourceMgtService").set(intentInstanceService , resourceMgtService);
MemberModifier.field(IntentInstanceServiceImpl.class, "slicingService").set(intentInstanceService , slicingService);
MemberModifier.field(IntentInstanceServiceImpl.class, "intentAaiClient").set(intentInstanceService , intentAaiClient);
- MemberModifier.field(IntentInstanceServiceImpl.class, "intentSoService").set(intentInstanceService , intentSoService);
+ MemberModifier.field(IntentInstanceServiceImpl.class, "intentSoClient").set(intentInstanceService , intentSoClient);
when(sessionFactory.openSession()).thenReturn(session);
when(intentProperties.getGlobalCustomerId()).thenReturn("someCustomer");
Call mockCall = PowerMockito.mock(Call.class);
JSONObject body = JSONObject.parseObject("{\"jobId\":\"123\"}");
Response<JSONObject> response = Response.success(body);
- Mockito.when(intentSoService.createIntentInstance(any())).thenReturn(mockCall);
+ Mockito.when(intentSoClient.createIntentInstance(any())).thenReturn(mockCall);
Mockito.when(mockCall.execute()).thenReturn(response);
IntentInstanceServiceImpl spy = PowerMockito.spy(intentInstanceService);
Call mockCall = PowerMockito.mock(Call.class);
JSONObject body = JSONObject.parseObject("{\"jobId\":\"123\"}");
Response<JSONObject> response = Response.success(body);
- Mockito.when(intentSoService.createIntentInstance(any())).thenReturn(mockCall);
+ Mockito.when(intentSoClient.createIntentInstance(any())).thenReturn(mockCall);
Mockito.when(mockCall.execute()).thenReturn(response);
IntentInstanceServiceImpl spy = PowerMockito.spy(intentInstanceService);
jsonObject.put("operation", operation);
Call mockCall = PowerMockito.mock(Call.class);
Response<JSONObject> response = Response.success(jsonObject);
- Mockito.when(intentSoService.queryOperationProgress(anyString(),anyString())).thenReturn(mockCall);
+ Mockito.when(intentSoClient.queryOperationProgress(anyString(),anyString())).thenReturn(mockCall);
Mockito.when(mockCall.execute()).thenReturn(response);
IntentInstanceServiceImpl spy = PowerMockito.spy(intentInstanceService);
when(query.uniqueResult()).thenReturn(instance);
Call mockCall = PowerMockito.mock(Call.class);
- when(intentSoService.deleteIntentInstance(any())).thenReturn(mockCall);
+ when(intentSoClient.deleteIntentInstance(any())).thenReturn(mockCall);
when(mockCall.execute()).thenReturn(null);
Transaction tx = PowerMockito.mock(Transaction.class);
when(query.uniqueResult()).thenReturn(instance);
Call mockCall = PowerMockito.mock(Call.class);
- when(intentSoService.deleteIntentInstance(any())).thenReturn(mockCall);
+ when(intentSoClient.deleteIntentInstance(any())).thenReturn(mockCall);
when(mockCall.execute()).thenReturn(null);
Transaction tx = PowerMockito.mock(Transaction.class);
Call mockCall = PowerMockito.mock(Call.class);
JSONObject body = JSONObject.parseObject("{\"jobId\":\"123\"}");
Response<JSONObject> response = Response.success(body);
- Mockito.when(intentSoService.createIntentInstance(any())).thenReturn(mockCall);
+ Mockito.when(intentSoClient.createIntentInstance(any())).thenReturn(mockCall);
Mockito.when(mockCall.execute()).thenReturn(response);
Transaction tx = Mockito.mock(Transaction.class);
import org.onap.usecaseui.server.service.csmf.config.SlicingProperties;
import org.onap.usecaseui.server.service.csmf.impl.SlicingServiceImpl;
import org.onap.usecaseui.server.service.intent.IntentAaiClient;
-import org.onap.usecaseui.server.service.intent.IntentSoService;
+import org.onap.usecaseui.server.service.intent.IntentSoClient;
import org.onap.usecaseui.server.service.intent.config.IntentProperties;
import org.onap.usecaseui.server.service.lcm.impl.DefaultServiceLcmService;
import org.onap.usecaseui.server.service.nsmf.impl.ResourceMgtServiceImpl;
IntentAaiClient intentAaiClient;
@Autowired
- IntentSoService intentSoService;
+ IntentSoClient intentSoClient;
@Autowired
IntentProperties intentProperties;
Transaction transaction = mock(Transaction.class);
when(sessionFactory.openSession()).thenReturn(session);
when(session.beginTransaction()).thenReturn(transaction);
- this.intentService = new IntentInstanceServiceImpl(slicingService, intentAaiClient, intentSoService, sessionFactory,
+ this.intentService = new IntentInstanceServiceImpl(slicingService, intentAaiClient, intentSoClient, sessionFactory,
resourceMgtServiceImpl, intentProperties);
}
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;
-import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogClient;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.Vnf;
-import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcService;
+import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcClient;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Csar;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job;
o.setUuid("2");
o.setName("vnf");
List<Vnf> vnf = Collections.singletonList(o);
- SDCCatalogService sdcService = newSDCService(serviceTemplate, vnf);
+ SDCCatalogClient sdcService = newSDCService(serviceTemplate, vnf);
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "regionId"));
AAIClient aaiClient = newAAIService(vim);
return aaiClient;
}
- private SDCCatalogService newSDCService(List<SDCServiceTemplate> serviceTemplate, List<Vnf> vnf) {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ private SDCCatalogClient newSDCService(List<SDCServiceTemplate> serviceTemplate, List<Vnf> vnf) {
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
Call<List<SDCServiceTemplate>> serviceCall = successfulCall(serviceTemplate);
when(sdcService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(serviceCall);
@Test
public void retrievePackageWillThrowExceptionWhenSDCIsNotAvailable() {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
Call<List<Vnf>> serviceCall = failedCall("SDC is not available!");
Call<List<SDCServiceTemplate>> serviceCall1 = failedCall("SDC is not available!");
when(sdcService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(serviceCall1);
@Test
public void retrievePackageWillBeEmptyWhenNoNsServiceAndVfInSDC() {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
Call<List<SDCServiceTemplate>> serviceCall = emptyBodyCall();
when(sdcService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(serviceCall);
@Test
public void itCanPostNsPackageToVFC() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
DistributionResult result = new DistributionResult();
result.setStatus("status");
result.setStatusDescription("description");
result.setErrorCode("errorcode");
- when(vfcService.distributeNsPackage(csar)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeNsPackage(csar)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(result, service.postNsPackage(csar));
}
@Test(expected = VfcException.class)
public void postNsPackageWillThrowExceptionWhenVFCIsNotAvailable() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
- when(vfcService.distributeNsPackage(csar)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeNsPackage(csar)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.postNsPackage(csar);
}
@Test(expected = VfcException.class)
public void postNsPackageWillThrowExceptionWhenVFCResponseError() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
- when(vfcService.distributeNsPackage(csar)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeNsPackage(csar)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.postNsPackage(csar);
}
@Test
public void itCanPostVnfPackageToVFC() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
Job job = new Job();
- when(vfcService.distributeVnfPackage(csar)).thenReturn(successfulCall(job));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeVnfPackage(csar)).thenReturn(successfulCall(job));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(job, service.postVfPackage(csar));
}
@Test(expected = VfcException.class)
public void postVnfPackageWillThrowExceptionWhenVFCIsNotAvailable() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
- when(vfcService.distributeVnfPackage(csar)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeVnfPackage(csar)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.postVfPackage(csar);
}
@Test(expected = VfcException.class)
public void postVnfPackageWillThrowExceptionWhenVFCResponseError() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
Csar csar = new Csar();
- when(vfcService.distributeVnfPackage(csar)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.distributeVnfPackage(csar)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.postVfPackage(csar);
}
@Test
public void itCanGetJobStatusFromVFC() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
JobStatus jobStatus = new JobStatus();
- when(vfcService.getJobStatus(jobId, responseId)).thenReturn(successfulCall(jobStatus));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getJobStatus(jobId, responseId)).thenReturn(successfulCall(jobStatus));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(jobStatus, service.getJobStatus(jobId, responseId));
}
@Test(expected = VfcException.class)
public void getJobStatusWillThrowExceptionWhenVFCIsNotAvailable() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
- when(vfcService.getJobStatus(jobId, responseId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getJobStatus(jobId, responseId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getJobStatus(jobId, responseId);
}
@Test(expected = VfcException.class)
public void getJobStatusWillThrowExceptionWhenVFCResponseError() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
- when(vfcService.getJobStatus(jobId, responseId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getJobStatus(jobId, responseId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getJobStatus(jobId, responseId);
}
@Test
public void itCanGetNsLcmJobStatusFromVFC() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
String serviceId= "1";
String operationType= "1";
JobStatus jobStatus = new JobStatus();
- when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(successfulCall(jobStatus));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getNsLcmJobStatus(jobId, responseId)).thenReturn(successfulCall(jobStatus));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(jobStatus, service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType));
}
@Test(expected = VfcException.class)
public void getNsLcmJobStatusWillThrowExceptionWhenVFCIsNotAvailable() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
String serviceId= "1";
String operationType= "1";
- when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getNsLcmJobStatus(jobId, responseId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType);
}
@Test(expected = VfcException.class)
public void getNsLcmJobStatusWillThrowExceptionWhenVFCResponseError() {
- VfcService vfcService = mock(VfcService.class);
+ VfcClient vfcClient = mock(VfcClient.class);
String jobId = "1";
String responseId = "1";
String serviceId= "1";
String operationType= "1";
- when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ when(vfcClient.getNsLcmJobStatus(jobId, responseId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType);
}
public void itCanDeleteNsPackage() {
String csarId = "1";
DistributionResult result = new DistributionResult();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsPackage(csarId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsPackage(csarId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(result, service.deleteNsPackage(csarId));
}
@Test(expected = VfcException.class)
public void deleteNsPackageWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNsPackage(csarId);
}
@Test(expected = VfcException.class)
public void deleteNsPackageWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsPackage(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsPackage(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNsPackage(csarId);
}
@Test
public void itCanGetVnfPackages(){
//ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfPackages()).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfPackages()).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
// Assert.assertSame(result, service.getVnfPackages());
Assert.assertNotNull(service.getVnfPackages());
@Test
public void getVnfPackagesThrowExceptionWhenVFCResponseError(){
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfPackages ()).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfPackages ()).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfPackages();
}
@Test
public void getVnfPackagesThrowException(){
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfPackages ()).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfPackages ()).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfPackages();
}
public void itCanDeleteVFPackage() {
String csarId = "1";
Job job = new Job();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfPackage(csarId)).thenReturn(successfulCall(job));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfPackage(csarId)).thenReturn(successfulCall(job));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame(job, service.deleteVfPackage(csarId));
}
@Test
public void deleteVfPackageWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"FAILED\"}",service.deleteVnfPackage(csarId));
}
@Test
public void deleteVnfPackageWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfdPackage(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfdPackage(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteVnfPackage(csarId);
}
@Test
public void itCanGetNetworkServicePackages() {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServicePackages()).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServicePackages()).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertNotNull(service.getNetworkServicePackages());
}
@Test
public void getNetworkServicePackagesWillThrowExceptionWhenVFCIsNotAvailable() {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServicePackages()).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServicePackages()).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNetworkServicePackages();
}
@Test
public void getNetworkServicePackagesWillThrowExceptionWhenVFCResponseError() {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServicePackages()).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServicePackages()).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNetworkServicePackages();
}
@Test
public void itCanGetPnfPackages(){
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfPackages()).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfPackages()).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertNotNull(service.getPnfPackages());
}
@Test
public void getPnfPackagesThrowExceptionWhenVFCResponseError(){
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfPackages ()).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfPackages ()).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getPnfPackages();
}
@Test
public void getPnfPackagesThrowException(){
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfPackages ()).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfPackages ()).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getPnfPackages();
}
public void itDownLoadNsPackage(){
String nsdInfoId="1";
ResponseBody successResponse=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage(nsdInfoId)).thenReturn(successfulCall(successResponse));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage(nsdInfoId)).thenReturn(successfulCall(successResponse));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
String result = service.downLoadNsPackage(nsdInfoId);
assertNotNull(result);
@Test
public void downLoadNsPackagehrowExceptionWhenVFCResponseError(){
String nsdInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (nsdInfoId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (nsdInfoId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadNsPackage(nsdInfoId);
}
@Test
public void downLoadNsPackageThrowException(){
String nsdInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (nsdInfoId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (nsdInfoId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadNsPackage(nsdInfoId);
}
@Test
public void itDownLoadPnfPackage(){
String pnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage(pnfInfoId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage(pnfInfoId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.downLoadPnfPackage(pnfInfoId));
}
@Test
public void downLoadPnfPackagehrowExceptionWhenVFCResponseError(){
String pnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (pnfInfoId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (pnfInfoId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadPnfPackage(pnfInfoId);
}
@Test
public void downLoadPnfPackageThrowException(){
String pnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (pnfInfoId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (pnfInfoId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadPnfPackage(pnfInfoId);
}
@Test
public void itDownLoadVnfPackage(){
String vnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage(vnfInfoId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage(vnfInfoId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.downLoadVnfPackage(vnfInfoId));
}
@Test
public void downLoadVnfPackagehrowExceptionWhenVFCResponseError(){
String vnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (vnfInfoId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (vnfInfoId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadVnfPackage(vnfInfoId);
}
@Test
public void downLoadVnfPackageThrowException(){
String vnfInfoId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage (vnfInfoId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.downLoadNsPackage (vnfInfoId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.downLoadVnfPackage(vnfInfoId);
}
public void itCanDeleteNsdPackage() {
String csarId = "1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsdPackage(csarId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsdPackage(csarId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.deleteNsdPackage(csarId));
}
@Test
public void deleteNsdPackageWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNsdPackage(csarId);
}
@Test
public void deleteNsdPackageWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNsdPackage(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNsdPackage(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNsdPackage(csarId);
}
@Test
public void itCanDeleteVnfPackage() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfdPackage(csarId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfdPackage(csarId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertNotNull(service.deleteVnfPackage(csarId));
}
@Test
public void deleteVnfPackageWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteVnfPackage(csarId);
}
@Test
public void deleteVnfNsdPackageWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteVnfdPackage(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteVnfdPackage(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteVnfPackage(csarId);
Assert.assertSame("{\"status\":\"FAILED\"}", service.deleteVnfPackage(csarId));
}
String csarId = "1";
ResponseBody result=null;
Job job = new Job();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deletePnfdPackage(csarId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deletePnfdPackage(csarId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.deletePnfPackage(csarId));
}
@Test
public void deletePnfPackageWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deletePnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deletePnfdPackage(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deletePnfPackage(csarId);
}
@Test
public void deletePnfPackageWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deletePnfdPackage(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deletePnfdPackage(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deletePnfPackage(csarId);
}
String csarId = "1";
ResponseBody result=null;
Job job = new Job();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNetworkServiceInstance(csarId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNetworkServiceInstance(csarId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.deleteNetworkServiceInstance(csarId));
}
@Test
public void deleteNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNetworkServiceInstance(csarId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNetworkServiceInstance(csarId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNetworkServiceInstance(csarId);
}
@Test
public void deleteNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() {
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.deleteNetworkServiceInstance(csarId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.deleteNetworkServiceInstance(csarId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.deleteNetworkServiceInstance(csarId);
}
public void itCanCreateNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceInstance(Mockito.any())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceInstance(Mockito.any())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"FAILED\"}", service.createNetworkServiceInstance(request));
}
@Test
public void createNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceInstance(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceInstance(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createNetworkServiceInstance(request);
}
@Test
public void createNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceInstance(Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceInstance(Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createNetworkServiceInstance(request);
}
String s = "{\"nsInstanceId\":\"nsInstanceId\"}";
list.add(s);
ns.setNsServices(list);
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServiceInfo()).thenReturn(successfulCall(ns));
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServiceInfo()).thenReturn(successfulCall(ns));
ServiceLcmService serviceLcmService = mock(ServiceLcmService.class);
- DefaultPackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, serviceLcmService);
+ DefaultPackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, serviceLcmService);
when(serviceLcmService.getServiceBeanByServiceInStanceId("nsInstanceId")).thenReturn(new ServiceBean());
Assert.assertNotNull( service.getNetworkServiceInfo());
}
@Test
public void getNetworkServiceInfoWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServiceInfo()).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServiceInfo()).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNetworkServiceInfo();
}
@Test
public void getNetworkServiceInfoWillThrowExceptionWhenVFCResponseError() throws IOException {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNetworkServiceInfo()).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNetworkServiceInfo()).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNetworkServiceInfo();
}
HttpServletRequest request = mockRequest();
String csarId = "1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- //when(vfcService.healNetworkServiceInstance(csarId,anyObject())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ //when(vfcClient.healNetworkServiceInstance(csarId,anyObject())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
//Assert.assertSame(result, service.healNetworkServiceInstance(request,csarId));
service.healNetworkServiceInstance(request,csarId);
public void healNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.healNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.healNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.healNetworkServiceInstance(request,csarId);
}
public void healNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.healNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.healNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.healNetworkServiceInstance(request,csarId);
}
public void itCanScaleNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
String result = service.scaleNetworkServiceInstance(request,csarId);
assertNotNull(result);
public void scaleNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.scaleNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.scaleNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.scaleNetworkServiceInstance(request,csarId);
}
public void scaleNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.scaleNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.scaleNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.scaleNetworkServiceInstance(request,csarId);
}
HttpServletRequest request = mockRequest();
String serviceInstanceId="1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- //when(vfcService.instantiateNetworkServiceInstance(anyObject(),serviceInstanceId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ //when(vfcClient.instantiateNetworkServiceInstance(anyObject(),serviceInstanceId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.instantiateNetworkServiceInstance(request,serviceInstanceId);
}
public void instantiateNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
String serviceInstanceId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.instantiateNetworkServiceInstance(Mockito.any(),eq(serviceInstanceId))).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.instantiateNetworkServiceInstance(Mockito.any(),eq(serviceInstanceId))).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.instantiateNetworkServiceInstance(request,serviceInstanceId);
}
public void instantiateNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
String serviceInstanceId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.instantiateNetworkServiceInstance(Mockito.any(),eq(serviceInstanceId))).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.instantiateNetworkServiceInstance(Mockito.any(),eq(serviceInstanceId))).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.instantiateNetworkServiceInstance(request,serviceInstanceId);
}
String csarId = "1";
ResponseBody result=null;
Job job = new Job();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.terminateNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.terminateNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.terminateNetworkServiceInstance(request,csarId);
}
public void terminateNetworkServiceInstanceWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- //when(vfcService.terminateNetworkServiceInstance(csarId,anyObject())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ //when(vfcClient.terminateNetworkServiceInstance(csarId,anyObject())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.terminateNetworkServiceInstance(request,csarId);
}
public void terminateNetworkServiceInstanceWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.terminateNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.terminateNetworkServiceInstance(eq(csarId),Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.terminateNetworkServiceInstance(request,csarId);
}
public void itCreateNetworkServiceData() throws IOException {
HttpServletRequest request = mockRequest();
ResponseBody responseBody = null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceData(Mockito.any())).thenReturn(successfulCall(responseBody));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceData(Mockito.any())).thenReturn(successfulCall(responseBody));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
String result = service.createNetworkServiceData(request);
assertNotNull(result);
@Test
public void createNetworkServiceDataWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createNetworkServiceData(request);
}
@Test
public void createNetworkServiceDataWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceData(Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createNetworkServiceData(Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createNetworkServiceData(request);
}
public void itCreateVnfData() throws IOException {
HttpServletRequest request = mockRequest();
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createVnfData(Mockito.any())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createVnfData(Mockito.any())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"FAILED\"}", service.createVnfData(request));
}
@Test
public void createVnfDataWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createVnfData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createVnfData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createVnfData(request);
}
@Test
public void createVnfDataWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createVnfData(Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createVnfData(Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createVnfData(request);
}
public void itCreatePnfData() throws IOException {
HttpServletRequest request = mockRequest();
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createPnfData(Mockito.any())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createPnfData(Mockito.any())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"FAILED\"}", service.createPnfData(request));
}
@Test
public void createPnfDataWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createPnfData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createPnfData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createPnfData(request);
}
@Test
public void createPnfDataWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.createPnfData(Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.createPnfData(Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.createPnfData(request);
}
public void itGetNsdInfo() throws IOException {
String nsdId="1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNsdInfo(nsdId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNsdInfo(nsdId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.getNsdInfo(nsdId));
}
@Test
public void getNsdInfoWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNsdInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNsdInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNsdInfo(nsdId);
}
@Test
public void getNsdInfoWillThrowExceptionWhenVFCResponseError() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getNsdInfo(nsdId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getNsdInfo(nsdId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getNsdInfo(nsdId);
}
public void itGetVnfInfo() throws IOException {
String nsdId="1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfo(nsdId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfo(nsdId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.getVnfInfo(nsdId));
}
@Test
public void getVnfInfoWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfInfo(nsdId);
}
@Test
public void getVnfInfoWillThrowExceptionWhenVFCResponseError() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfo(nsdId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfo(nsdId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfInfo(nsdId);
}
public void itGetPnfInfo() throws IOException {
String nsdId="1";
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfInfo(nsdId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfInfo(nsdId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.getPnfInfo(nsdId));
}
@Test
public void getPnfInfoWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfInfo(nsdId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getPnfInfo(nsdId);
}
@Test
public void getPnfInfoWillThrowExceptionWhenVFCResponseError() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getPnfInfo(nsdId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getPnfInfo(nsdId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getPnfInfo(nsdId);
}
@Test
public void itCanListNsTemplates() throws IOException {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.listNsTemplates()).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.listNsTemplates()).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertNotNull( service.listNsTemplates());
}
@Test
public void listNsTemplatesWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.listNsTemplates()).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.listNsTemplates()).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.listNsTemplates();
}
@Test
public void listNsTemplatesWillThrowExceptionWhenVFCResponseError() throws IOException {
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.listNsTemplates()).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.listNsTemplates()).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.listNsTemplates();
}
@Test
public void itCanGetVnfInfoById() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfoById(nsdId)).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfoById(nsdId)).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertNotNull(service.getVnfInfoById(nsdId));
}
@Test
public void getVnfInfoByIdWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfoById(nsdId)).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfoById(nsdId)).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfInfoById(nsdId);
}
@Test
public void getVnfInfoByIdWillThrowExceptionWhenVFCResponseError() throws IOException {
String nsdId="1";
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.getVnfInfoById(nsdId)).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.getVnfInfoById(nsdId)).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.getVnfInfoById(nsdId);
}
public void itCanFetchNsTemplateData() throws IOException {
HttpServletRequest request = mockRequest();
ResponseBody result=null;
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.fetchNsTemplateData(Mockito.any())).thenReturn(successfulCall(result));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.fetchNsTemplateData(Mockito.any())).thenReturn(successfulCall(result));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
Assert.assertSame("{\"status\":\"FAILED\"}", service.fetchNsTemplateData(request));
}
@Test
public void fetchNsTemplateDataWillThrowExceptionWhenVFCIsNotAvailable() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.fetchNsTemplateData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.fetchNsTemplateData(Mockito.any())).thenReturn(failedCall("VFC is not available!"));
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.fetchNsTemplateData(request);
}
@Test
public void fetchNsTemplateDataWillThrowExceptionWhenVFCResponseError() throws IOException {
HttpServletRequest request = mockRequest();
- VfcService vfcService = mock(VfcService.class);
- when(vfcService.fetchNsTemplateData(Mockito.any())).thenReturn(emptyBodyCall());
- PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService, null);
+ VfcClient vfcClient = mock(VfcClient.class);
+ when(vfcClient.fetchNsTemplateData(Mockito.any())).thenReturn(emptyBodyCall());
+ PackageDistributionService service = new DefaultPackageDistributionService(null, vfcClient, null);
service.fetchNsTemplateData(request);
}
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
-import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
+import org.onap.usecaseui.server.service.lcm.domain.so.SOClient;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.Operation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
@Before
public void before() throws Exception {
- SOService soService = mock(SOService.class);
- service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ SOClient soClient = mock(SOClient.class);
+ service = new DefaultServiceLcmService(entityManagerFactory, soClient);
}
@Test
public void itCanInstantiateService() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
Operation op = new Operation();
op.setOperationId("1");
op.setServiceId("1");
ServiceOperation operation = new ServiceOperation();
operation.setService(op);
- when(soService.instantiateService(Mockito.any())).thenReturn(successfulCall(operation));
+ when(soClient.instantiateService(Mockito.any())).thenReturn(successfulCall(operation));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
Assert.assertSame(operation, service.instantiateService(request));
}
@Test(expected = SOException.class)
public void instantiateServiceWillThrowExceptionWhenSOIsNotAvailable() throws IOException {
- SOService soService = mock(SOService.class);
- when(soService.instantiateService(Mockito.any())).thenReturn(failedCall("SO is not available!"));
+ SOClient soClient = mock(SOClient.class);
+ when(soClient.instantiateService(Mockito.any())).thenReturn(failedCall("SO is not available!"));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.instantiateService(request);
}
@Test(expected = SOException.class)
public void instantiateServiceWillThrowExceptionWhenSOResponseError() throws IOException {
- SOService soService = mock(SOService.class);
- when(soService.instantiateService(Mockito.any())).thenReturn(emptyBodyCall());
+ SOClient soClient = mock(SOClient.class);
+ when(soClient.instantiateService(Mockito.any())).thenReturn(emptyBodyCall());
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.instantiateService(request);
}
@Test
public void itCanTerminateService() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
DeleteOperationRsp rsp = new DeleteOperationRsp();
rsp.setOperationId("1");
- when(soService.terminateService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
+ when(soClient.terminateService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
Assert.assertSame(rsp, service.terminateService(serviceId, request));
}
@Test(expected = SOException.class)
public void terminateServiceWillThrowExceptionWhenSOIsNotAvailable() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.terminateService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
+ when(soClient.terminateService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.terminateService(serviceId, request);
}
@Test(expected = SOException.class)
public void terminateServiceWillThrowExceptionWhenSOResponseError() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.terminateService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
+ when(soClient.terminateService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.terminateService(serviceId, request);
}
@Test
public void itCanQueryOperationProgress() {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
String operationId = "1";
OperationProgressInformation progress = new OperationProgressInformation();
- when(soService.queryOperationProgress(serviceId, operationId)).thenReturn(successfulCall(progress));
+ when(soClient.queryOperationProgress(serviceId, operationId)).thenReturn(successfulCall(progress));
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
Assert.assertSame(progress, service.queryOperationProgress(serviceId, operationId));
}
@Test(expected = SOException.class)
public void queryOperationProgressWillThrowExceptionWhenSOIsNotAvailable() {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
String operationId = "1";
- when(soService.queryOperationProgress(serviceId, operationId)).thenReturn(failedCall("SO is not available!"));
+ when(soClient.queryOperationProgress(serviceId, operationId)).thenReturn(failedCall("SO is not available!"));
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.queryOperationProgress(serviceId, operationId);
}
@Test(expected = SOException.class)
public void queryOperationProgressWillThrowExceptionWhenSOResponseError() {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
String operationId = "1";
- when(soService.queryOperationProgress(serviceId, operationId)).thenReturn(emptyBodyCall());
+ when(soClient.queryOperationProgress(serviceId, operationId)).thenReturn(emptyBodyCall());
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.queryOperationProgress(serviceId, operationId);
}
@Test(expected = SOException.class)
public void scaleServiceWillThrowExceptionWhenSOIsNotAvailable() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.scaleService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
+ when(soClient.scaleService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.scaleService(serviceId, request);
}
@Test(expected = SOException.class)
public void scaleServiceWillThrowExceptionWhenSOResponseError() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.scaleService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
+ when(soClient.scaleService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.scaleService(serviceId, request);
}
@Test
public void itCanScaleService() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
SaveOrUpdateOperationRsp rsp = new SaveOrUpdateOperationRsp();
rsp.setOperationId("1");
- when(soService.scaleService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
+ when(soClient.scaleService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
Assert.assertSame(rsp, service.scaleService(serviceId, request));
}
@Test(expected = SOException.class)
public void updateServiceWillThrowExceptionWhenSOIsNotAvailable() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.updateService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
+ when(soClient.updateService(eq(serviceId), Mockito.any())).thenReturn(failedCall("SO is not available!"));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.updateService(serviceId, request);
}
@Test(expected = SOException.class)
public void updateServiceWillThrowExceptionWhenSOResponseError() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
String serviceId = "1";
- when(soService.updateService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
+ when(soClient.updateService(eq(serviceId), Mockito.any())).thenReturn(emptyBodyCall());
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
service.updateService(serviceId, request);
}
@Test
public void itCanUpdateService() throws IOException {
- SOService soService = mock(SOService.class);
+ SOClient soClient = mock(SOClient.class);
EntityManagerFactory entityManagerFactory = mock(EntityManagerFactory.class);
String serviceId = "1";
SaveOrUpdateOperationRsp rsp = new SaveOrUpdateOperationRsp();
rsp.setOperationId("1");
- when(soService.updateService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
+ when(soClient.updateService(eq(serviceId), Mockito.any())).thenReturn(successfulCall(rsp));
HttpServletRequest request = mockRequest();
- ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soService);
+ ServiceLcmService service = new DefaultServiceLcmService(entityManagerFactory, soClient);
Assert.assertSame(rsp, service.updateService(serviceId, request));
}
@SneakyThrows
void thatSDCCatalogRequestsAreCorrect() {
stubFor(
- get(urlPathEqualTo("/api/sdc/v1/catalog/services"))
+ get(urlPathEqualTo("/v1/catalog/services"))
.withQueryParam("category", equalTo("E2E Service"))
.withQueryParam("distributionStatus", equalTo("DISTRIBUTED"))
.withBasicAuth(username, password)
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.exceptions.AAIException;
-import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
+import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogClient;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
@Test
public void itCanListDistributedServiceTemplate() {
List<SDCServiceTemplate> templates = Collections.singletonList(new SDCServiceTemplate("uuid", "uuid", "name", "V1","url", "category"));
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
when(sdcService.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(successfulCall(templates));
ServiceTemplateService service = new DefaultServiceTemplateService(sdcService,null);
@Test(expected = SDCCatalogException.class)
public void retrieveServiceWillThrowExceptionWhenSDCIsNotAvailable() {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
when(sdcService.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(failedCall("SDC is not available!"));
ServiceTemplateService service = new DefaultServiceTemplateService(sdcService,null);
@Test
public void itWillRetrieveEmptyWhenNoServiceTemplateCanGet() {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
when(sdcService.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED)).thenReturn(emptyBodyCall());
ServiceTemplateService service = new DefaultServiceTemplateService(sdcService,null);
String modelPath = "model_path";
String nodeUUID = "2";
- SDCCatalogService sdcService = newSdcCatalogService(nodeUUID);
+ SDCCatalogClient sdcService = newSdcCatalogService(nodeUUID);
List<VimInfo> vim = Collections.singletonList(new VimInfo("owner", "regionId"));
AAIClient aaiClient = newAAIService(vim);
Assert.assertNotNull(service.fetchServiceTemplateInput(uuid, modelPath)); }
- private DefaultServiceTemplateService newServiceTemplateService(String uuid, String nodeUUID, SDCCatalogService sdcService, AAIClient aaiClient) {
+ private DefaultServiceTemplateService newServiceTemplateService(String uuid, String nodeUUID, SDCCatalogClient sdcService, AAIClient aaiClient) {
return new DefaultServiceTemplateService(sdcService, aaiClient) {
@Override
};
}
- private SDCCatalogService newSdcCatalogService(String nodeUUID) throws IOException {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ private SDCCatalogClient newSdcCatalogService(String nodeUUID) throws IOException {
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
when(sdcService.getService(nodeUUID)).thenReturn(successfulCall(new SDCServiceTemplate(nodeUUID, nodeUUID, "node", "V1", "nodeModelUrl", "service")));
return sdcService;
}
}
@Test
public void testDownloadFile() throws IOException {
- SDCCatalogService sdcService = mock(SDCCatalogService.class);
+ SDCCatalogClient sdcService = mock(SDCCatalogClient.class);
ResponseBody result= new ResponseBody() {
@Nullable
@Override
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.AAIClient;
-import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
+import org.onap.usecaseui.server.service.lcm.domain.so.SOClient;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import retrofit2.Call;
public class SotnServiceTemplateServiceImplTest {
AAIClient aaiClient;
- SOService soService;
+ SOClient soClient;
ServiceOperation serviceOperation;
SotnServiceTemplateServiceImpl sotnServiceTemplateService;
@Before
public void before() throws Exception {
aaiClient = mock(AAIClient.class);
- soService = mock(SOService.class);
+ soClient = mock(SOClient.class);
sotnServiceTemplateService = new SotnServiceTemplateServiceImpl();
- sotnServiceTemplateService.setSoService(soService);
+ sotnServiceTemplateService.setSoClient(soClient);
sotnServiceTemplateService.setAaiClient(aaiClient);
}
map.put("l2vpn","34");
map.put("sotnUni","45");
Call<ServiceOperation> call = getSosCall();
- when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
+ when(soClient.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
sotnServiceTemplateService.instantiate_CCVPN_Service(map);
}
map.put("l2vpn","34");
map.put("sotnUni","45");
Call<ServiceOperation> call = getSosCall();
- when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
+ when(soClient.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
sotnServiceTemplateService.instantiate_CCVPN_Service(map);
}
@Test
public void createSotnServiceTest() {
Call<ServiceOperation> call = getSosCall();
- when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
+ when(soClient.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest());
}
@Test
public void createSotnServiceWithThrowException() {
Call<ServiceOperation> call = getSosCall();
- when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
+ when(soClient.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest());
}
Response result = null;
RequestBody requestBody = null;
when(aaiClient.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
- when(soService.terminateService(anyString(),any(RequestBody.class))).thenReturn(sosCall);
+ when(soClient.terminateService(anyString(),any(RequestBody.class))).thenReturn(sosCall);
sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
}
@Test
Response result = null;
RequestBody requestBody = null;
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."));
+ when(soClient.terminateService("serviceId",requestBody)).thenReturn(failedCall("failed to delete the server."));
sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
}
@Test
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceRsp;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.Relationship;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.RelationshipData;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.powermock.api.support.membermodification.MemberModifier;
public class ResourceMgtServiceConvertTest {
ResourceMgtServiceConvert resourceMgtServiceConvert = null;
- SOSliceService soSliceService = null;
+ SOSliceClient soSliceClient = null;
AAISliceClient aaiSliceClient = null;
GeneralConvertImpl generalConvert;
import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.NetworkInfo;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.ActivateService;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOOperation;
import retrofit2.Call;
public class ResourceMgtServiceImplTest {
ResourceMgtServiceImpl resourceMgtService = null;
- SOSliceService soSliceService;
+ SOSliceClient soSliceClient;
AAISliceClient aaiSliceClient;
@Before
public void before() throws Exception {
aaiSliceClient = mock(AAISliceClient.class);
- soSliceService = mock(SOSliceService.class);
- resourceMgtService = new ResourceMgtServiceImpl(aaiSliceClient, soSliceService);
+ soSliceClient = mock(SOSliceClient.class);
+ resourceMgtService = new ResourceMgtServiceImpl(aaiSliceClient, soSliceClient);
}
@Test
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
ActivateService activateService = new ActivateService();
- when(soSliceService.activeService(serviceId, requestBody))
+ when(soSliceClient.activeService(serviceId, requestBody))
.thenReturn(successfulCall(activateService));
resourceMgtService.activateSlicingService(serviceId);
}
String serviceId = "23er-56ty-4567-rgdf5";
String jsonstr = "testJson";
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
- when(soSliceService.activeService(serviceId, requestBody))
+ when(soSliceClient.activeService(serviceId, requestBody))
.thenReturn(failedCall("so is not exist!"));
resourceMgtService.activateSlicingService(serviceId);
}
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
Call<ActivateService> call = emptyBodyCall();
- when(soSliceService.activeService(serviceId, requestBody)).thenReturn(call);
+ when(soSliceClient.activeService(serviceId, requestBody)).thenReturn(call);
resourceMgtService.activateSlicingService(serviceId);
}
ActivateService activateService = new ActivateService();
RequestBody requestBody = null;
- when(soSliceService.deactiveService(serviceId, requestBody))
+ when(soSliceClient.deactiveService(serviceId, requestBody))
.thenReturn(successfulCall(activateService));
resourceMgtService.deactivateSlicingService(serviceId);
}
String serviceId = "23er-56ty-4567-rgdf5";
RequestBody requestBody = null;
- when(soSliceService.deactiveService(serviceId, requestBody))
+ when(soSliceClient.deactiveService(serviceId, requestBody))
.thenReturn(failedCall("so is not exist!"));
resourceMgtService.deactivateSlicingService(serviceId);
}
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
Call<ActivateService> call = emptyBodyCall();
- when(soSliceService.deactiveService(serviceId, requestBody)).thenReturn(call);
+ when(soSliceClient.deactiveService(serviceId, requestBody)).thenReturn(call);
resourceMgtService.deactivateSlicingService(serviceId);
}
ActivateService activateService = new ActivateService();
RequestBody requestBody = null;
- when(soSliceService.terminateService(serviceId, requestBody))
+ when(soSliceClient.terminateService(serviceId, requestBody))
.thenReturn(successfulCall(activateService));
resourceMgtService.terminateSlicingService(serviceId);
}
String serviceId = "23er-56ty-4567-rgdf5";
RequestBody requestBody = null;
- when(soSliceService.terminateService(serviceId, requestBody))
+ when(soSliceClient.terminateService(serviceId, requestBody))
.thenReturn(failedCall("so is not exist!"));
resourceMgtService.terminateSlicingService(serviceId);
}
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr.toString());
Call<ActivateService> call = emptyBodyCall();
- when(soSliceService.terminateService(serviceId, requestBody)).thenReturn(call);
+ when(soSliceClient.terminateService(serviceId, requestBody)).thenReturn(call);
resourceMgtService.terminateSlicingService(serviceId);
}
String operationId = "2345-5675-3456-er45";
SOOperation soOperation = new SOOperation();
- when(soSliceService.queryOperationProgress(serviceId, operationId))
+ when(soSliceClient.queryOperationProgress(serviceId, operationId))
.thenReturn(successfulCall(soOperation));
resourceMgtService.queryOperationProgress(serviceId);
}
String serviceId = "23er-56ty-4567-rgdf5";
String operationId = "2345-5675-3456-er45";
- when(soSliceService.queryOperationProgress(serviceId, operationId))
+ when(soSliceClient.queryOperationProgress(serviceId, operationId))
.thenReturn(failedCall("so is not exist!"));
resourceMgtService.queryOperationProgress(serviceId);
}
String operationId = "2345-5675-3456-er45";
Call<SOOperation> call = emptyBodyCall();
- when(soSliceService.queryOperationProgress(serviceId, operationId)).thenReturn(call);
+ when(soSliceClient.queryOperationProgress(serviceId, operationId)).thenReturn(call);
resourceMgtService.queryOperationProgress(serviceId);
}
}
import org.junit.Test;
import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceInfo;
import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceList;
-import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic;
import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber;
public class ResourceMonitorServiceImplTest {
ResourceMonitorServiceImpl resourceMonitorService = null;
- KpiSliceService kpiSliceService = null;
+ KpiSliceClient kpiSliceClient = null;
@Before
public void before() throws Exception {
- kpiSliceService = mock(KpiSliceService.class);
- resourceMonitorService = new ResourceMonitorServiceImpl(kpiSliceService);
+ kpiSliceClient = mock(KpiSliceClient.class);
+ resourceMonitorService = new ResourceMonitorServiceImpl(kpiSliceClient);
}
@Test
KpiTotalTraffic kpiTotalTraffic = new KpiTotalTraffic();
RequestBody body = null;
- when(kpiSliceService.listTotalTraffic(body)).thenReturn(successfulCall(kpiTotalTraffic));
+ when(kpiSliceClient.listTotalTraffic(body)).thenReturn(successfulCall(kpiTotalTraffic));
resourceMonitorService.querySlicingUsageTraffic(queryTimestamp, serviceList);
}
String queryTimestamp = "1577071879000";
RequestBody body = null;
- when(kpiSliceService.listTotalTraffic(body)).thenReturn(failedCall("kpi is not exist!"));
+ when(kpiSliceClient.listTotalTraffic(body)).thenReturn(failedCall("kpi is not exist!"));
resourceMonitorService.querySlicingUsageTraffic(queryTimestamp, serviceList);
}
KpiUserNumber kpiUserNumber = new KpiUserNumber();
RequestBody body = null;
- when(kpiSliceService.listUserNumber(body)).thenReturn(successfulCall(kpiUserNumber));
+ when(kpiSliceClient.listUserNumber(body)).thenReturn(successfulCall(kpiUserNumber));
resourceMonitorService.querySlicingOnlineUserNumber(queryTimestamp, serviceList);
}
String queryTimestamp = "1577071879000";
RequestBody body = null;
- when(kpiSliceService.listUserNumber(body)).thenReturn(failedCall("kpi is not exist!"));
+ when(kpiSliceClient.listUserNumber(body)).thenReturn(failedCall("kpi is not exist!"));
resourceMonitorService.querySlicingOnlineUserNumber(queryTimestamp, serviceList);
}
KpiTotalBandwidth kpiTotalBandwidth = new KpiTotalBandwidth();
RequestBody body = null;
- when(kpiSliceService.listTotalBandwidth(body)).thenReturn(successfulCall(kpiTotalBandwidth));
+ when(kpiSliceClient.listTotalBandwidth(body)).thenReturn(successfulCall(kpiTotalBandwidth));
resourceMonitorService.querySlicingTotalBandwidth(queryTimestamp, serviceList);
}
String queryTimestamp = "1577071879000";
RequestBody body = null;
- when(kpiSliceService.listTotalBandwidth(body)).thenReturn(failedCall("kpi is not exist!"));
+ when(kpiSliceClient.listTotalBandwidth(body)).thenReturn(failedCall("kpi is not exist!"));
resourceMonitorService.querySlicingTotalBandwidth(queryTimestamp, serviceList);
}
String queryTimestamp = "1577071879000";
RequestBody body = null;
- when(kpiSliceService.listPDUSessionEstSR(body)).thenReturn(failedCall("kpi is not exist!"));
+ when(kpiSliceClient.listPDUSessionEstSR(body)).thenReturn(failedCall("kpi is not exist!"));
resourceMonitorService.querySlicingPDUSessionEstSR(queryTimestamp, serviceList);
}
}
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.Relationship;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipData;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipList;
-import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService;
+import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceClient;
import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask;
import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient;
import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList;
public class TaskMgtServiceImplTest {
TaskMgtServiceImpl taskMgtService = null;
- SOSliceService soSliceService = null;
+ SOSliceClient soSliceClient = null;
AAISliceClient aaiSliceClient = null;
TaskMgtServiceConvert taskMgtServiceConvert = null;
@Before
public void before() throws Exception {
- soSliceService = mock(SOSliceService.class);
+ soSliceClient = mock(SOSliceClient.class);
aaiSliceClient = mock(AAISliceClient.class);
- taskMgtService = new TaskMgtServiceImpl(soSliceService,aaiSliceClient);
+ taskMgtService = new TaskMgtServiceImpl(soSliceClient,aaiSliceClient);
taskMgtServiceConvert = mock(TaskMgtServiceConvert.class);
taskMgtService.taskMgtServiceConvert = taskMgtServiceConvert;
}
@Test
public void itCanQuerySlicingTask() {
JSONArray jsonArray = new JSONArray();
- when(soSliceService.listTask()).thenReturn(successfulCall(jsonArray));
+ when(soSliceClient.listTask()).thenReturn(successfulCall(jsonArray));
taskMgtService.querySlicingTask(1, 100);
}
@Test
public void querySlicingTaskWithThrowsException() {
- when(soSliceService.listTask()).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.listTask()).thenReturn(failedCall("so is not exist!"));
taskMgtService.querySlicingTask(1, 100);
}
public void itCanQuerySlicingTaskByStatus() {
JSONArray jsonArray = new JSONArray();
String status = "Planning";
- when(soSliceService.listTaskByStage(status)).thenReturn(successfulCall(jsonArray));
+ when(soSliceClient.listTaskByStage(status)).thenReturn(successfulCall(jsonArray));
taskMgtService.querySlicingTaskByStatus(status, 1, 100);
}
@Test
public void querySlicingTaskByStatusWithThrowsException() {
String status = "Planning";
- when(soSliceService.listTaskByStage(status)).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.listTaskByStage(status)).thenReturn(failedCall("so is not exist!"));
taskMgtService.querySlicingTaskByStatus(status, 1, 100);
}
public void itCanQueryTaskAuditInfo() {
String taskId = "we23-345r-45ty-5687";
SOTask soTask = new SOTask();
- when(soSliceService.getTaskById(taskId)).thenReturn(successfulCall(soTask));
+ when(soSliceClient.getTaskById(taskId)).thenReturn(successfulCall(soTask));
taskMgtService.queryTaskAuditInfo(taskId);
}
@Test
public void queryTaskAuditInfoWithThrowsException() {
String taskId = "we23-345r-45ty-5687";
- when(soSliceService.getTaskById(taskId)).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.getTaskById(taskId)).thenReturn(failedCall("so is not exist!"));
taskMgtService.queryTaskAuditInfo(taskId);
}
soTask.setParams(params);
String jsonstr = JSON.toJSONString(soTask);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonstr);
- when(soSliceService.getTaskById(taskId)).thenReturn(successfulCall(soTask));
- when(soSliceService.updateService(taskId, requestBody)).thenReturn(successfulCall(responseBody));
+ when(soSliceClient.getTaskById(taskId)).thenReturn(successfulCall(soTask));
+ when(soSliceClient.updateService(taskId, requestBody)).thenReturn(successfulCall(responseBody));
taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo);
}
}
};
- when(soSliceService.updateService(taskId, requestBody)).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.updateService(taskId, requestBody)).thenReturn(failedCall("so is not exist!"));
taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo);
}
public void itCanQueryTaskCreationInfo() {
String taskId = "we23-345r-45ty-5687";
SOTask soTask = new SOTask();
- when(soSliceService.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
+ when(soSliceClient.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
taskMgtService.queryTaskCreationInfo(taskId);
}
@Test
public void queryTaskCreationInfoWithThrowsException() {
String taskId = "we23-345r-45ty-5687";
- when(soSliceService.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
taskMgtService.queryTaskCreationInfo(taskId);
}
public void itCanQueryTaskCreationProgress() {
String taskId = "we23-345r-45ty-5687";
SOTask soTask = new SOTask();
- when(soSliceService.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
+ when(soSliceClient.getTaskByIdD(taskId)).thenReturn(successfulCall(soTask));
taskMgtService.queryTaskCreationProgress(taskId);
}
@Test
public void queryTaskCreationProgressWithThrowsException() {
String taskId = "we23-345r-45ty-5687";
- when(soSliceService.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
+ when(soSliceClient.getTaskByIdD(taskId)).thenReturn(failedCall("so is not exist!"));
taskMgtService.queryTaskCreationProgress(taskId);
}