use of org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters in project so by onap.
the class ActivateVnfOperationalEnvironmentTest method executionTest.
@Test
public void executionTest() throws Exception {
List<ServiceModelList> serviceModelVersionIdList = new ArrayList<>();
ServiceModelList serviceModelList1 = new ServiceModelList();
serviceModelList1.setRecoveryAction(RecoveryAction.retry);
serviceModelList1.setServiceModelVersionId(serviceModelVersionId);
serviceModelVersionIdList.add(serviceModelList1);
RequestDetails requestDetails = new RequestDetails();
RequestParameters requestParameters = new RequestParameters();
Manifest manifest = new Manifest();
manifest.setServiceModelList(serviceModelVersionIdList);
requestParameters.setManifest(manifest);
requestParameters.setWorkloadContext(workloadContext);
requestDetails.setRequestParameters(requestParameters);
request.setOperationalEnvironmentId(vnfOperationalEnvironmentId);
request.setRequestDetails(requestDetails);
JSONObject jsonObject = new JSONObject();
jsonObject.put("statusCode", "202");
jsonObject.put("message", "Success");
jsonObject.put("distributionId", sdcDistributionId);
wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
activateVnf.execute(requestId, request);
}
use of org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters in project so by onap.
the class CreateEcompOperationalEnvironmentTest method getCloudOrchestrationRequest.
public CloudOrchestrationRequest getCloudOrchestrationRequest() {
CloudOrchestrationRequest request = new CloudOrchestrationRequest();
RequestDetails reqDetails = new RequestDetails();
RequestInfo reqInfo = new RequestInfo();
RequestParameters reqParams = new RequestParameters();
reqParams.setTenantContext("TEST");
reqParams.setWorkloadContext("ECOMP_TEST");
reqParams.setOperationalEnvironmentType(OperationalEnvironment.ECOMP);
reqInfo.setInstanceName("TEST_ECOMP_ENVIRONMENT");
reqDetails.setRequestInfo(reqInfo);
reqDetails.setRequestParameters(reqParams);
request.setRequestDetails(reqDetails);
request.setOperationalEnvironmentId("operationalEnvId");
return request;
}
use of org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters in project so by onap.
the class TenantIsolationRequest method parse.
void parse(CloudOrchestrationRequest request, HashMap<String, String> instanceIdMap, Action action) throws ValidationException {
this.cor = request;
this.requestInfo = request.getRequestDetails().getRequestInfo();
try {
ObjectMapper mapper = new ObjectMapper();
requestJSON = mapper.writeValueAsString(request.getRequestDetails());
} catch (JsonProcessingException e) {
logger.error("Exception in JSON processing", e);
throw new ValidationException("Parse ServiceInstanceRequest to JSON string", true);
}
String envId = null;
if (instanceIdMap != null) {
envId = instanceIdMap.get("operationalEnvironmentId");
if (envId != null && !UUIDChecker.isValidUUID(envId)) {
throw new ValidationException("operationalEnvironmentId", true);
}
cor.setOperationalEnvironmentId(envId);
}
this.operationalEnvironmentId = envId;
RequestDetails requestDetails = request.getRequestDetails();
RequestParameters requestParameters = requestDetails.getRequestParameters();
requestInfoValidation(action, requestInfo);
requestParamsValidation(action, requestParameters);
relatedInstanceValidation(action, requestDetails, requestParameters);
}
use of org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters in project so by onap.
the class AAIClientObjectBuilderTest method getCloudOrchestrationRequest.
public CloudOrchestrationRequest getCloudOrchestrationRequest() {
CloudOrchestrationRequest cor = new CloudOrchestrationRequest();
RequestDetails reqDetails = new RequestDetails();
RequestInfo reqInfo = new RequestInfo();
RequestParameters reqParams = new RequestParameters();
reqParams.setTenantContext("TEST");
reqParams.setWorkloadContext("ECOMP_TEST");
reqParams.setOperationalEnvironmentType(OperationalEnvironment.ECOMP);
reqInfo.setInstanceName("TEST_ECOMP_ENVIRONMENT");
reqDetails.setRequestInfo(reqInfo);
reqDetails.setRequestParameters(reqParams);
cor.setRequestDetails(reqDetails);
return cor;
}
Aggregations