use of org.openkilda.messaging.payload.flow.FlowResponsePayload in project open-kilda by telstra.
the class FlowControllerTest method deleteFlow.
@Test
@WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE)
public void deleteFlow() throws Exception {
MvcResult mvcResult = mockMvc.perform(delete("/v1/flows/{flow-id}", TestMessageMock.FLOW_ID).header(CORRELATION_ID, testCorrelationId()).contentType(APPLICATION_JSON_VALUE)).andReturn();
MvcResult result = mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().contentType(APPLICATION_JSON_VALUE)).andReturn();
FlowResponsePayload response = MAPPER.readValue(result.getResponse().getContentAsString(), FlowResponsePayload.class);
assertEquals(TestMessageMock.flowResponsePayload, response);
}
use of org.openkilda.messaging.payload.flow.FlowResponsePayload in project open-kilda by telstra.
the class FlowControllerTest method createFlow.
@Test
@WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE)
public void createFlow() throws Exception {
MvcResult mvcResult = mockMvc.perform(put("/v1/flows").header(CORRELATION_ID, testCorrelationId()).contentType(APPLICATION_JSON_VALUE).content(MAPPER.writeValueAsString(TestMessageMock.flow))).andReturn();
MvcResult result = mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().contentType(APPLICATION_JSON_VALUE)).andReturn();
System.out.println("RESPONSE: " + result.getResponse().getContentAsString());
FlowResponsePayload response = MAPPER.readValue(result.getResponse().getContentAsString(), FlowResponsePayload.class);
assertEquals(TestMessageMock.flowResponsePayload, response);
}
use of org.openkilda.messaging.payload.flow.FlowResponsePayload in project open-kilda by telstra.
the class FlowControllerTest method deleteFlows.
@Test
@WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE)
public void deleteFlows() throws Exception {
MvcResult mvcResult = mockMvc.perform(delete("/v1/flows").header(CORRELATION_ID, testCorrelationId()).header(EXTRA_AUTH, System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(119)).contentType(APPLICATION_JSON_VALUE)).andReturn();
MvcResult result = mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().contentType(APPLICATION_JSON_VALUE)).andReturn();
FlowResponsePayload[] response = MAPPER.readValue(result.getResponse().getContentAsString(), FlowResponsePayload[].class);
assertEquals(TestMessageMock.flowResponsePayload, response[0]);
}
use of org.openkilda.messaging.payload.flow.FlowResponsePayload in project open-kilda by telstra.
the class FlowMapper method toFlowResponseOutput.
/**
* Map {@link FlowDto} into {@link FlowResponsePayload}.
*/
public FlowResponsePayload toFlowResponseOutput(FlowDto f) {
FlowResponsePayload result = new FlowResponsePayload();
generatedMap(result, f);
generatedFlowResponsePayloadMap(result, f);
mapFlowResponseEndpoints(result, f);
return result;
}
use of org.openkilda.messaging.payload.flow.FlowResponsePayload in project open-kilda by telstra.
the class FlowControllerTest method getFlows.
@Test
@WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE)
public void getFlows() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/v1/flows", TestMessageMock.FLOW_ID).header(CORRELATION_ID, testCorrelationId()).contentType(APPLICATION_JSON_VALUE)).andReturn();
MvcResult result = mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().contentType(APPLICATION_JSON_VALUE)).andReturn();
List<FlowResponsePayload> response = MAPPER.readValue(result.getResponse().getContentAsString(), new TypeReference<List<FlowResponsePayload>>() {
});
assertEquals(Collections.singletonList(TestMessageMock.flowResponsePayload), response);
}
Aggregations