Search in sources :

Example 6 with Element

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));
}
Also used : Element(org.onap.namingservice.model.Element) Test(org.junit.Test)

Example 7 with Element

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)));
}
Also used : Element(org.onap.namingservice.model.Element) ArrayList(java.util.ArrayList) Deleteelement(org.onap.namingservice.model.Deleteelement)

Example 8 with Element

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)));
}
Also used : Element(org.onap.namingservice.model.Element) ArrayList(java.util.ArrayList)

Example 9 with Element

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;
}
Also used : Element(org.onap.namingservice.model.Element)

Aggregations

Element (org.onap.namingservice.model.Element)9 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 NameGenRequest (org.onap.namingservice.model.NameGenRequest)3 List (java.util.List)1 Deleteelement (org.onap.namingservice.model.Deleteelement)1 NameGenResponse (org.onap.namingservice.model.NameGenResponse)1 ResponseEntity (org.springframework.http.ResponseEntity)1