Search in sources :

Example 1 with CreatePatternTemplateRQ

use of com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ in project service-api by reportportal.

the class ProjectSettingsControllerTest method createPatternTemplateWithDuplicateName.

@Test
void createPatternTemplateWithDuplicateName() throws Exception {
    CreatePatternTemplateRQ createPatternTemplateRQ = new CreatePatternTemplateRQ();
    createPatternTemplateRQ.setEnabled(true);
    createPatternTemplateRQ.setName("some_name");
    createPatternTemplateRQ.setType("string");
    createPatternTemplateRQ.setValue("qwe");
    mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + "/settings/pattern").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createPatternTemplateRQ))).andExpect(status().isConflict());
}
Also used : CreatePatternTemplateRQ(com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 2 with CreatePatternTemplateRQ

use of com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ in project service-api by reportportal.

the class ProjectSettingsControllerTest method createPatternTemplate.

@Test
void createPatternTemplate() throws Exception {
    CreatePatternTemplateRQ createPatternTemplateRQ = new CreatePatternTemplateRQ();
    createPatternTemplateRQ.setEnabled(true);
    createPatternTemplateRQ.setName("another_name");
    createPatternTemplateRQ.setType("string");
    createPatternTemplateRQ.setValue("qwe");
    mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + "/settings/pattern").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createPatternTemplateRQ))).andExpect(status().isCreated());
}
Also used : CreatePatternTemplateRQ(com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 3 with CreatePatternTemplateRQ

use of com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ in project service-api by reportportal.

the class ProjectSettingsControllerTest method createPatternTemplateWithWrongType.

@Test
void createPatternTemplateWithWrongType() throws Exception {
    CreatePatternTemplateRQ createPatternTemplateRQ = new CreatePatternTemplateRQ();
    createPatternTemplateRQ.setEnabled(true);
    createPatternTemplateRQ.setName("name");
    createPatternTemplateRQ.setType("dd");
    createPatternTemplateRQ.setValue("qwe");
    mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + "/settings/pattern").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(createPatternTemplateRQ))).andExpect(status().isBadRequest());
}
Also used : CreatePatternTemplateRQ(com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 4 with CreatePatternTemplateRQ

use of com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ in project service-api by reportportal.

the class PatternTemplateBuilderTest method patternTemplateBuilder.

@Test
void patternTemplateBuilder() {
    CreatePatternTemplateRQ createPatternTemplateRQ = new CreatePatternTemplateRQ();
    String name = "name";
    String type = "STRING";
    boolean enabled = true;
    String value = "qwe";
    createPatternTemplateRQ.setName(name);
    createPatternTemplateRQ.setType(type);
    createPatternTemplateRQ.setEnabled(enabled);
    createPatternTemplateRQ.setValue(value);
    PatternTemplate patternTemplate = new PatternTemplateBuilder().withCreateRequest(createPatternTemplateRQ).get();
    assertEquals(name, patternTemplate.getName());
    assertEquals(type, patternTemplate.getTemplateType().name());
    assertEquals(enabled, patternTemplate.isEnabled());
    assertEquals(value, patternTemplate.getValue());
}
Also used : CreatePatternTemplateRQ(com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ) PatternTemplate(com.epam.ta.reportportal.entity.pattern.PatternTemplate) Test(org.junit.jupiter.api.Test)

Aggregations

CreatePatternTemplateRQ (com.epam.ta.reportportal.ws.model.project.config.pattern.CreatePatternTemplateRQ)4 Test (org.junit.jupiter.api.Test)4 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)3 PatternTemplate (com.epam.ta.reportportal.entity.pattern.PatternTemplate)1