Search in sources :

Example 6 with ActivitySpec

use of org.onap.so.asdc.activity.beans.ActivitySpec 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

ActivitySpec (org.onap.so.asdc.activity.beans.ActivitySpec)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Test (org.junit.Test)4 BaseTest (org.onap.so.asdc.BaseTest)3 ActivitySpecCreateResponse (org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse)3 Transactional (org.springframework.transaction.annotation.Transactional)1