use of org.onap.namingservice.model.Element in project so by onap.
the class NamingRequestObjectTest method namingWanTransportRequestObjectTest.
@Test
public void namingWanTransportRequestObjectTest() {
Element expected = new Element();
expected.put(NamingServiceConstants.NS_EXTERNAL_KEY, externalKey);
expected.put(NamingServiceConstants.NS_POLICY_INSTANCE_NAME, policyInstanceName);
expected.put(NamingServiceConstants.NS_NAMING_TYPE, namingType);
expected.put(NamingServiceConstants.NS_RESOURCE_NAME, resourceName);
expected.put(NamingServiceConstants.NS_SERVICE_MODEL_NAME, serviceModelName);
expected.put(NamingServiceConstants.NS_MODEL_VERSION, modelVersion);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(externalKey);
namingRequestObject.setPolicyInstanceNameValue(policyInstanceName);
namingRequestObject.setNamingTypeValue(namingType);
namingRequestObject.setResourceNameValue(resourceName);
namingRequestObject.setModelVersionValue(modelVersion);
namingRequestObject.setServiceModelNameValue(serviceModelName);
HashMap<String, String> actual = namingRequestObject.getNamingRequestObjectMap();
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.namingservice.model.Element in project so by onap.
the class NamingServiceResources method generateServiceInstanceName.
public String generateServiceInstanceName(NamingRequestObject namingRequestObject) throws BadResponseException, IOException {
HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
Element element = new Element();
nsRequestObject.forEach(element::put);
List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
use of org.onap.namingservice.model.Element in project so by onap.
the class NamingServiceResources method generateInstanceGroupName.
public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException {
Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
use of org.onap.namingservice.model.Element in project so by onap.
the class NamingRequestObjectBuilder method elementMapper.
public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName) {
Element element = new Element();
element.put("external-key", instanceGroupId);
element.put("policy-instance-name", policyInstanceName);
element.put("naming-type", namingType);
element.put("resource-name", instanceGroupName);
element.put("nf-naming-code", nfNamingCode);
return element;
}
Aggregations