use of org.onap.so.serviceinstancebeans.SubscriberInfo in project so by onap.
the class SubscriberInfoValidation method validate.
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
String requestScope = info.getRequestScope();
int reqVersion = info.getReqVersion();
Actions action = info.getAction();
if (reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance || action == Action.assignInstance) {
SubscriberInfo subscriberInfo = info.getSir().getRequestDetails().getSubscriberInfo();
if (subscriberInfo == null) {
throw new ValidationException("subscriberInfo");
}
if (empty(subscriberInfo.getGlobalSubscriberId())) {
throw new ValidationException("globalSubscriberId");
}
}
return info;
}
use of org.onap.so.serviceinstancebeans.SubscriberInfo in project so by onap.
the class E2EServiceInstances method mapReqJsonToSvcInstReq.
/**
* Converting E2EServiceInstanceRequest to ServiceInstanceRequest and passing it to camunda engine.
*
* @param e2eSir
* @return
*/
private ServiceInstancesRequest mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir, String requestJSON) {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
// ModelInvariantId
modelInfo.setModelInvariantId(e2eSir.getService().getServiceInvariantUuid());
// modelNameVersionId
modelInfo.setModelNameVersionId(e2eSir.getService().getServiceUuid());
// String modelInfoValue =
// e2eSir.getService().getParameters().getNodeTemplateName();
// String[] arrayOfInfo = modelInfoValue.split(":");
// String modelName = arrayOfInfo[0];
// String modelVersion = arrayOfInfo[1];
// TODO: To ensure, if we dont get the values from the UUI
String modelName = "voLTE";
String modelVersion = "1.0";
// modelName
modelInfo.setModelName(modelName);
// modelVersion
modelInfo.setModelVersion(modelVersion);
// modelType
modelInfo.setModelType(ModelType.service);
// setting modelInfo to requestDetails
requestDetails.setModelInfo(modelInfo);
SubscriberInfo subscriberInfo = new SubscriberInfo();
// globalsubscriberId
subscriberInfo.setGlobalSubscriberId(e2eSir.getService().getGlobalSubscriberId());
// setting subscriberInfo to requestDetails
requestDetails.setSubscriberInfo(subscriberInfo);
RequestInfo requestInfo = new RequestInfo();
// instanceName
requestInfo.setInstanceName(e2eSir.getService().getName());
// source
requestInfo.setSource("UUI");
// suppressRollback
requestInfo.setSuppressRollback(true);
// setting requestInfo to requestDetails
requestDetails.setRequestInfo(requestInfo);
RequestParameters requestParameters = new RequestParameters();
// subscriptionServiceType
requestParameters.setSubscriptionServiceType("MOG");
List<Map<String, Object>> userParamList = new ArrayList<>();
Map<String, Object> userParamMap = new HashMap<>();
// complete json request updated in the camunda
userParamMap.put("UUIRequest", requestJSON);
userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
userParamList.add(userParamMap);
requestParameters.setUserParams(userParamList);
// setting requestParameters to requestDetails
requestDetails.setRequestParameters(requestParameters);
sir.setRequestDetails(requestDetails);
return sir;
}
use of org.onap.so.serviceinstancebeans.SubscriberInfo in project so by onap.
the class AaiResourceIdValidatorTest method setupRequestDetails.
private RequestDetails setupRequestDetails() {
RequestDetails reqDetails = new RequestDetails();
SubscriberInfo subInfo = new SubscriberInfo();
subInfo.setGlobalSubscriberId("id123");
reqDetails.setSubscriberInfo(subInfo);
RequestParameters reqParams = new RequestParameters();
reqParams.setSubscriptionServiceType("subServiceType123");
reqDetails.setRequestParameters(reqParams);
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId("1234567");
reqDetails.setModelInfo(modelInfo);
return reqDetails;
}
use of org.onap.so.serviceinstancebeans.SubscriberInfo in project so by onap.
the class BBInputSetupTest method testGetCustomerAndServiceSubscription.
@Test
public void testGetCustomerAndServiceSubscription() throws JsonParseException, JsonMappingException, IOException {
RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
SubscriberInfo subscriberInfo = new SubscriberInfo();
subscriberInfo.setGlobalSubscriberId("globalSubscriberId");
RequestParameters requestParams = new RequestParameters();
requestParams.setSubscriptionServiceType("subscriptionServiceType");
requestDetails.setRequestParameters(requestParams);
requestDetails.setSubscriberInfo(subscriberInfo);
String resourceId = "resourceId";
Customer expected = new Customer();
expected.setGlobalCustomerId("globalCustomerId");
ServiceSubscription serviceSubscription = new ServiceSubscription();
serviceSubscription.setServiceType("subscriptionServiceType");
doReturn(expected).when(this.SPY_bbInputSetup).getCustomerFromRequest(requestDetails);
doReturn(serviceSubscription).when(this.SPY_bbInputSetup).getServiceSubscription(requestDetails, expected);
Customer actual = this.SPY_bbInputSetup.getCustomerAndServiceSubscription(requestDetails, resourceId);
assertThat(actual, sameBeanAs(expected));
requestDetails.setSubscriberInfo(null);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.serviceinstancebeans.SubscriberInfo in project so by onap.
the class BBInputSetupTest method testGetCustomer.
@Test
public void testGetCustomer() throws IOException {
Customer expected = new Customer();
RequestDetails requestDetails = new RequestDetails();
SubscriberInfo subscriberInfo = new SubscriberInfo();
subscriberInfo.setGlobalSubscriberId("globalSubscriberId");
requestDetails.setSubscriberInfo(subscriberInfo);
org.onap.aai.domain.yang.Customer aaiCustomer = new org.onap.aai.domain.yang.Customer();
doReturn(aaiCustomer).when(SPY_bbInputSetupUtils).getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId());
doReturn(expected).when(bbInputSetupMapperLayer).mapAAICustomer(aaiCustomer);
Customer actual = SPY_bbInputSetup.getCustomerFromRequest(requestDetails);
assertThat(actual, sameBeanAs(expected));
}
Aggregations