Search in sources :

Example 6 with ActivitySpecCreateResponse

use of org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse in project so by onap.

the class ActivitySpecsActionsTest method CreateActivitySpecReturnsExists_Test.

@Test
public void CreateActivitySpecReturnsExists_Test() throws Exception {
    String HOSTNAME = createURLWithPort("");
    ActivitySpec activitySpec = new ActivitySpec();
    activitySpec.setName("testActivitySpec");
    activitySpec.setDescription("Test Activity Spec");
    ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
    activitySpecCreateResponse.setId("testActivityId");
    ObjectMapper mapper = new ObjectMapper();
    String body = mapper.writeValueAsString(activitySpecCreateResponse);
    wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY.value()).withBody(body)));
    String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec);
    assertEquals(null, activitySpecId);
}
Also used : ActivitySpecCreateResponse(org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse) ActivitySpec(org.onap.so.asdc.activity.beans.ActivitySpec) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test)

Example 7 with ActivitySpecCreateResponse

use of org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse in project so by onap.

the class ActivitySpecsActionsTest method CreateActivitySpec_Test.

@Test
public void CreateActivitySpec_Test() throws Exception {
    String HOSTNAME = createURLWithPort("");
    ActivitySpec activitySpec = new ActivitySpec();
    activitySpec.setName("testActivitySpec");
    activitySpec.setDescription("Test Activity Spec");
    ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
    activitySpecCreateResponse.setId("testActivityId");
    ObjectMapper mapper = new ObjectMapper();
    String body = mapper.writeValueAsString(activitySpecCreateResponse);
    wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body)));
    String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec);
    assertEquals("testActivityId", activitySpecId);
}
Also used : ActivitySpecCreateResponse(org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse) ActivitySpec(org.onap.so.asdc.activity.beans.ActivitySpec) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 ActivitySpecCreateResponse (org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse)7 Test (org.junit.Test)6 BaseTest (org.onap.so.asdc.BaseTest)5 ActivitySpec (org.onap.so.asdc.activity.beans.ActivitySpec)4 HttpHeaders (org.springframework.http.HttpHeaders)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Response (javax.ws.rs.core.Response)1 HttpClient (org.onap.so.client.HttpClient)1