Search in sources :

Example 1 with Deleteelement

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

the class NamingRequestObjectBuilder method deleteElementMapper.

public Deleteelement deleteElementMapper(String instanceGroupId) {
    Deleteelement deleteElement = new Deleteelement();
    deleteElement.setExternalKey(instanceGroupId);
    return deleteElement;
}
Also used : Deleteelement(org.onap.namingservice.model.Deleteelement)

Example 2 with Deleteelement

use of org.onap.namingservice.model.Deleteelement 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 3 with Deleteelement

use of org.onap.namingservice.model.Deleteelement 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 4 with Deleteelement

use of org.onap.namingservice.model.Deleteelement 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)

Example 5 with Deleteelement

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

the class NamingRequestObjectBuilderTest method deleteElementMapperTest.

@Test
public void deleteElementMapperTest() {
    // Expected Deleteelement
    Deleteelement expected = new Deleteelement();
    expected.setExternalKey(instanceGroupId);
    // Actual Deleteelement
    Deleteelement actual = mapper.deleteElementMapper(instanceGroupId);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Deleteelement(org.onap.namingservice.model.Deleteelement) Test(org.junit.Test)

Aggregations

Deleteelement (org.onap.namingservice.model.Deleteelement)7 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 NameGenDeleteRequest (org.onap.namingservice.model.NameGenDeleteRequest)3 List (java.util.List)1 NameGenDeleteResponse (org.onap.namingservice.model.NameGenDeleteResponse)1 ResponseEntity (org.springframework.http.ResponseEntity)1