Search in sources :

Example 1 with YFlowCreatePayload

use of org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload in project open-kilda by telstra.

the class YFlowControllerV2Test method shouldPassCreateRequestWhenPayloadIsValid.

@Test
@WithMockUser(username = TestConfig.USERNAME, password = TestConfig.PASSWORD, roles = TestConfig.ROLE)
public void shouldPassCreateRequestWhenPayloadIsValid() throws Exception {
    YFlowCreatePayload payload = buildTestYFlowCreatePayload().build();
    String body = objectMapper.writeValueAsString(payload);
    mvc.perform(post("/y-flows").contentType("application/json").header("correlation_id", "test").content(body)).andExpect(status().isOk());
}
Also used : YFlowCreatePayload(org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test) WebMvcTest(org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)

Example 2 with YFlowCreatePayload

use of org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload in project open-kilda by telstra.

the class YFlowControllerV2Test method shouldReturnsStatus400WhenPathComputationStrategyNull.

@Ignore
@Test
@WithMockUser(username = TestConfig.USERNAME, password = TestConfig.PASSWORD, roles = TestConfig.ROLE)
public void shouldReturnsStatus400WhenPathComputationStrategyNull() throws Exception {
    YFlowCreatePayload payload = buildTestYFlowCreatePayload().pathComputationStrategy(null).build();
    String body = objectMapper.writeValueAsString(payload);
    mvc.perform(post("/y-flows").contentType("application/json").header("correlation_id", "test").content(body)).andExpect(status().isBadRequest());
}
Also used : YFlowCreatePayload(org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Ignore(org.junit.Ignore) Test(org.junit.Test) WebMvcTest(org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)

Example 3 with YFlowCreatePayload

use of org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload in project open-kilda by telstra.

the class YFlowControllerV2Test method shouldReturnsStatus400WhenEncapsulationTypeNull.

@Ignore
@Test
@WithMockUser(username = TestConfig.USERNAME, password = TestConfig.PASSWORD, roles = TestConfig.ROLE)
public void shouldReturnsStatus400WhenEncapsulationTypeNull() throws Exception {
    YFlowCreatePayload payload = buildTestYFlowCreatePayload().encapsulationType(null).build();
    String body = objectMapper.writeValueAsString(payload);
    mvc.perform(post("/y-flows").contentType("application/json").header("correlation_id", "test").content(body)).andExpect(status().isBadRequest());
}
Also used : YFlowCreatePayload(org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Ignore(org.junit.Ignore) Test(org.junit.Test) WebMvcTest(org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)

Aggregations

Test (org.junit.Test)3 YFlowCreatePayload (org.openkilda.northbound.dto.v2.yflows.YFlowCreatePayload)3 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 Ignore (org.junit.Ignore)2