Search in sources :

Example 1 with NameGenDeleteRequest

use of org.onap.namingservice.model.NameGenDeleteRequest in project so by onap.

the class NamingRequestObjectBuilder method nameGenDeleteRequestMapper.

public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements) {
    NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
    nameGenDeleteRequest.setElements(deleteElements);
    return nameGenDeleteRequest;
}
Also used : NameGenDeleteRequest(org.onap.namingservice.model.NameGenDeleteRequest)

Example 2 with NameGenDeleteRequest

use of org.onap.namingservice.model.NameGenDeleteRequest in project so by onap.

the class NamingServiceResourcesTest method deleteInstanceGroupNameTest.

@Test
public void deleteInstanceGroupNameTest() throws Exception {
    NameGenDeleteResponse name = new NameGenDeleteResponse();
    ResponseEntity<NameGenDeleteResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
    Deleteelement deleteElement = new Deleteelement();
    deleteElement.setExternalKey(instanceGroup.getId());
    NameGenDeleteRequest req = new NameGenDeleteRequest();
    doReturn(deleteElement).when(MOCK_namingRequestObjectBuilder).deleteElementMapper(isA(String.class));
    doReturn("").when(MOCK_namingClient).deleteNameGenRequest(isA(NameGenDeleteRequest.class));
    doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
    namingServiceResources.deleteInstanceGroupName(instanceGroup);
    verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class));
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Deleteelement(org.onap.namingservice.model.Deleteelement) NameGenDeleteRequest(org.onap.namingservice.model.NameGenDeleteRequest) NameGenDeleteResponse(org.onap.namingservice.model.NameGenDeleteResponse) List(java.util.List) Test(org.junit.Test)

Example 3 with NameGenDeleteRequest

use of org.onap.namingservice.model.NameGenDeleteRequest in project so by onap.

the class NamingServiceResourcesTest method deleteServiceInstanceNameTest.

@Test
public void deleteServiceInstanceNameTest() throws Exception {
    NameGenDeleteRequest req = new NameGenDeleteRequest();
    doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
    NamingRequestObject nrObject = new NamingRequestObject();
    nrObject.setExternalKeyValue("testExternalKey");
    nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
    namingServiceResources.deleteServiceInstanceName(nrObject);
    verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class));
}
Also used : NameGenDeleteRequest(org.onap.namingservice.model.NameGenDeleteRequest) List(java.util.List) NamingRequestObject(org.onap.so.client.namingservice.NamingRequestObject) Test(org.junit.Test)

Example 4 with NameGenDeleteRequest

use of org.onap.namingservice.model.NameGenDeleteRequest in project so by onap.

the class NamingRequestObjectBuilderTest method nameGenDeleteRequestMapper.

@Test
public void nameGenDeleteRequestMapper() {
    // Expected NameGenDeleteRequest
    NameGenDeleteRequest expected = new NameGenDeleteRequest();
    List<Deleteelement> deleteElements = new ArrayList<>();
    Deleteelement deleteElement = new Deleteelement();
    deleteElement.setExternalKey(instanceGroupId);
    deleteElements.add(deleteElement);
    expected.setElements(deleteElements);
    // Actual NameGenDeleteRequest
    NameGenDeleteRequest actual = mapper.nameGenDeleteRequestMapper(deleteElements);
    assertThat(actual, sameBeanAs(expected));
}
Also used : NameGenDeleteRequest(org.onap.namingservice.model.NameGenDeleteRequest) Deleteelement(org.onap.namingservice.model.Deleteelement) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 5 with NameGenDeleteRequest

use of org.onap.namingservice.model.NameGenDeleteRequest in project so by onap.

the class NamingClientIT method unassignSetup.

public NameGenDeleteRequest unassignSetup() throws JsonProcessingException {
    NameGenDeleteRequest request = new NameGenDeleteRequest();
    List<Deleteelement> deleteElements = new ArrayList<>();
    Deleteelement testElement = new Deleteelement();
    testElement = requestBuilder.deleteElementMapper("instanceGroupId");
    deleteElements.add(testElement);
    request = requestBuilder.nameGenDeleteRequestMapper(deleteElements);
    return request;
}
Also used : NameGenDeleteRequest(org.onap.namingservice.model.NameGenDeleteRequest) Deleteelement(org.onap.namingservice.model.Deleteelement) ArrayList(java.util.ArrayList)

Aggregations

NameGenDeleteRequest (org.onap.namingservice.model.NameGenDeleteRequest)6 Test (org.junit.Test)3 Deleteelement (org.onap.namingservice.model.Deleteelement)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 NameGenDeleteResponse (org.onap.namingservice.model.NameGenDeleteResponse)2 BadResponseException (org.onap.so.client.exception.BadResponseException)1 NamingRequestObject (org.onap.so.client.namingservice.NamingRequestObject)1 HttpEntity (org.springframework.http.HttpEntity)1 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1 HttpStatusCodeException (org.springframework.web.client.HttpStatusCodeException)1