Search in sources :

Example 1 with ListFlowsPayload

use of org.openkilda.server42.control.stormstub.api.ListFlowsPayload in project open-kilda by telstra.

the class StubApplicationTests method clearFlows.

@BeforeEach
public void clearFlows() throws Exception {
    mockMvc.perform(delete("/kafka/flow/").param("switchId", switchId)).andExpect(status().isOk());
    MvcResult result = mockMvc.perform(get("/kafka/flow/").param("switchId", switchId)).andReturn();
    ListFlowsPayload emptyPayload = new ListFlowsPayload();
    mockMvc.perform(asyncDispatch(result)).andExpect(status().isOk()).andExpect(content().json(objectWriter.writeValueAsString(emptyPayload)));
}
Also used : ListFlowsPayload(org.openkilda.server42.control.stormstub.api.ListFlowsPayload) MvcResult(org.springframework.test.web.servlet.MvcResult) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ListFlowsPayload

use of org.openkilda.server42.control.stormstub.api.ListFlowsPayload in project open-kilda by telstra.

the class StubApplicationTests method deleteFlow.

@Test
public void deleteFlow() throws Exception {
    pushFlow(testFlowVlan1001);
    pushFlow(testFlowVxlan2002);
    pushFlow(testFlowVxlan3003);
    mockMvc.perform(delete("/kafka/flow/{id}", testFlowVxlan2002.getFlowId()).param("switchId", switchId)).andExpect(status().isOk());
    MvcResult result = mockMvc.perform(get("/kafka/flow/").param("switchId", switchId)).andReturn();
    ListFlowsPayload listFlowsPayload = new ListFlowsPayload();
    listFlowsPayload.getFlowIds().add(testFlowVlan1001.getFlowId());
    listFlowsPayload.getFlowIds().add(testFlowVxlan3003.getFlowId());
    mockMvc.perform(asyncDispatch(result)).andExpect(status().isOk()).andExpect(content().json(objectWriter.writeValueAsString(listFlowsPayload)));
}
Also used : ListFlowsPayload(org.openkilda.server42.control.stormstub.api.ListFlowsPayload) MvcResult(org.springframework.test.web.servlet.MvcResult) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with ListFlowsPayload

use of org.openkilda.server42.control.stormstub.api.ListFlowsPayload in project open-kilda by telstra.

the class StubApplicationTests method addFlows.

@Test
public void addFlows() throws Exception {
    pushFlow(testFlowVlan1001);
    pushFlow(testFlowVxlan2002);
    ListFlowsPayload listFlowsPayload = new ListFlowsPayload();
    listFlowsPayload.getFlowIds().add(testFlowVlan1001.getFlowId());
    listFlowsPayload.getFlowIds().add(testFlowVxlan2002.getFlowId());
    MvcResult result = mockMvc.perform(get("/kafka/flow/").param("switchId", switchId)).andReturn();
    mockMvc.perform(asyncDispatch(result)).andDo(print()).andExpect(status().isOk()).andExpect(content().json(objectWriter.writeValueAsString(listFlowsPayload)));
}
Also used : ListFlowsPayload(org.openkilda.server42.control.stormstub.api.ListFlowsPayload) MvcResult(org.springframework.test.web.servlet.MvcResult) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ListFlowsPayload (org.openkilda.server42.control.stormstub.api.ListFlowsPayload)3 MvcResult (org.springframework.test.web.servlet.MvcResult)3 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1