Search in sources :

Example 1 with VfModuleExceptionResponse

use of org.onap.so.adapters.vnfrest.VfModuleExceptionResponse in project so by onap.

the class VnfAdapterClientIT method updateVfModuleTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void updateVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
    UpdateVfModuleRequest request = new UpdateVfModuleRequest();
    request.setCloudSiteId(TESTING_ID);
    request.setVfModuleId("test1");
    VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
    mockResponse.setMessage("Error in update Vf module");
    wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
    client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
}
Also used : UpdateVfModuleRequest(org.onap.so.adapters.vnfrest.UpdateVfModuleRequest) VfModuleExceptionResponse(org.onap.so.adapters.vnfrest.VfModuleExceptionResponse) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 2 with VfModuleExceptionResponse

use of org.onap.so.adapters.vnfrest.VfModuleExceptionResponse in project so by onap.

the class VnfAdapterClientIT method rollbackVfModuleTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void rollbackVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
    RollbackVfModuleRequest request = new RollbackVfModuleRequest();
    VfModuleRollback rollback = new VfModuleRollback();
    rollback.setCloudSiteId(TESTING_ID);
    request.setVfModuleRollback(rollback);
    VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
    mockResponse.setMessage("Error in rollback Vf module");
    wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
    client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
}
Also used : RollbackVfModuleRequest(org.onap.so.adapters.vnfrest.RollbackVfModuleRequest) VfModuleRollback(org.onap.so.adapters.vnfrest.VfModuleRollback) VfModuleExceptionResponse(org.onap.so.adapters.vnfrest.VfModuleExceptionResponse) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 3 with VfModuleExceptionResponse

use of org.onap.so.adapters.vnfrest.VfModuleExceptionResponse in project so by onap.

the class VnfAdapterClientIT method queryVfModuleTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void queryVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
    VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
    mockResponse.setMessage("Error in update Vf module");
    wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)).withQueryParam("tenantId", equalTo(TESTING_ID)).withQueryParam("vfModuleName", equalTo("someName")).withQueryParam("skipAAI", equalTo("true")).withQueryParam("msoRequest.requestId", equalTo("testRequestId")).withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
    client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, "someName", true, "testRequestId", "serviceInstanceId");
}
Also used : VfModuleExceptionResponse(org.onap.so.adapters.vnfrest.VfModuleExceptionResponse) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 4 with VfModuleExceptionResponse

use of org.onap.so.adapters.vnfrest.VfModuleExceptionResponse in project so by onap.

the class VnfAdapterClientIT method createVfModuleTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void createVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
    CreateVfModuleRequest request = new CreateVfModuleRequest();
    request.setCloudSiteId(TESTING_ID);
    VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
    mockResponse.setMessage("Error in create Vf module");
    wireMockServer.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
    client.createVfModule(AAI_VNF_ID, request);
}
Also used : CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) VfModuleExceptionResponse(org.onap.so.adapters.vnfrest.VfModuleExceptionResponse) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 5 with VfModuleExceptionResponse

use of org.onap.so.adapters.vnfrest.VfModuleExceptionResponse in project so by onap.

the class VnfAdapterClientIT method deleteVfModuleTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void deleteVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException {
    DeleteVfModuleRequest request = new DeleteVfModuleRequest();
    request.setCloudSiteId(TESTING_ID);
    VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
    mockResponse.setMessage("Error in delete Vf module");
    wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
    client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
}
Also used : VfModuleExceptionResponse(org.onap.so.adapters.vnfrest.VfModuleExceptionResponse) DeleteVfModuleRequest(org.onap.so.adapters.vnfrest.DeleteVfModuleRequest) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)5 VfModuleExceptionResponse (org.onap.so.adapters.vnfrest.VfModuleExceptionResponse)5 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)1 DeleteVfModuleRequest (org.onap.so.adapters.vnfrest.DeleteVfModuleRequest)1 RollbackVfModuleRequest (org.onap.so.adapters.vnfrest.RollbackVfModuleRequest)1 UpdateVfModuleRequest (org.onap.so.adapters.vnfrest.UpdateVfModuleRequest)1 VfModuleRollback (org.onap.so.adapters.vnfrest.VfModuleRollback)1