Search in sources :

Example 6 with UpdateProjectRQ

use of com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ in project service-api by reportportal.

the class ProjectControllerTest method updateProjectConfigKeepScreenshotsNegativeTest.

@Test
void updateProjectConfigKeepScreenshotsNegativeTest() throws Exception {
    UpdateProjectRQ rq = new UpdateProjectRQ();
    ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
    HashMap<String, String> projectAttributes = new HashMap<>();
    projectAttributes.put("notifications.enabled", "false");
    projectAttributes.put("job.keepScreenshots", "123123.2");
    configuration.setProjectAttributes(projectAttributes);
    rq.setConfiguration(configuration);
    HashMap<String, String> userRoles = new HashMap<>();
    userRoles.put("test_user", "PROJECT_MANAGER");
    rq.setUserRoles(userRoles);
    mockMvc.perform(put("/v1/project/test_project").content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON).with(token(oAuthHelper.getSuperadminToken()))).andExpect(status().isBadRequest());
}
Also used : ProjectConfigurationUpdate(com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate) UpdateProjectRQ(com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 7 with UpdateProjectRQ

use of com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ in project service-api by reportportal.

the class ProjectControllerTest method updateProjectConfigKeepLogsNegativeTest.

@Test
void updateProjectConfigKeepLogsNegativeTest() throws Exception {
    UpdateProjectRQ rq = new UpdateProjectRQ();
    ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
    HashMap<String, String> projectAttributes = new HashMap<>();
    projectAttributes.put("notifications.enabled", "false");
    projectAttributes.put("job.keepLogs", "110000d");
    configuration.setProjectAttributes(projectAttributes);
    rq.setConfiguration(configuration);
    HashMap<String, String> userRoles = new HashMap<>();
    userRoles.put("test_user", "PROJECT_MANAGER");
    rq.setUserRoles(userRoles);
    mockMvc.perform(put("/v1/project/test_project").content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON).with(token(oAuthHelper.getSuperadminToken()))).andExpect(status().isBadRequest());
}
Also used : ProjectConfigurationUpdate(com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate) UpdateProjectRQ(com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 8 with UpdateProjectRQ

use of com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ in project service-api by reportportal.

the class ProjectControllerTest method updateProjectNegativeWithWrongBounds.

@Test
void updateProjectNegativeWithWrongBounds() throws Exception {
    final UpdateProjectRQ rq = new UpdateProjectRQ();
    ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
    HashMap<String, String> projectAttributes = new HashMap<>();
    projectAttributes.put("notifications.enabled", "false");
    // 2 weeks in seconds
    projectAttributes.put("job.keepLaunches", String.valueOf(3600 * 24 * 14));
    // 2 weeks in seconds
    projectAttributes.put("job.keepLogs", String.valueOf(3600 * 24 * 14));
    // 1 week in seconds
    projectAttributes.put("job.interruptJobTime", String.valueOf(3600 * 24 * 7));
    // 3 weeks in seconds
    projectAttributes.put("job.keepScreenshots", String.valueOf(3600 * 24 * 21));
    projectAttributes.put("analyzer.autoAnalyzerMode", "CURRENT_LAUNCH");
    projectAttributes.put("analyzer.minShouldMatch", "5");
    projectAttributes.put("analyzer.numberOfLogLines", "5");
    projectAttributes.put("analyzer.isAutoAnalyzerEnabled", "false");
    configuration.setProjectAttributes(projectAttributes);
    rq.setConfiguration(configuration);
    HashMap<String, String> userRoles = new HashMap<>();
    userRoles.put("test_user", "PROJECT_MANAGER");
    rq.setUserRoles(userRoles);
    mockMvc.perform(put("/v1/project/test_project").content(objectMapper.writeValueAsBytes(rq)).contentType(APPLICATION_JSON).with(token(oAuthHelper.getSuperadminToken()))).andExpect(status().isBadRequest());
}
Also used : ProjectConfigurationUpdate(com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate) UpdateProjectRQ(com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Aggregations

BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)8 UpdateProjectRQ (com.epam.ta.reportportal.ws.model.project.UpdateProjectRQ)8 ProjectConfigurationUpdate (com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate)8 Test (org.junit.jupiter.api.Test)8 ProjectRepository (com.epam.ta.reportportal.dao.ProjectRepository)1 Project (com.epam.ta.reportportal.entity.project.Project)1 ProjectAttribute (com.epam.ta.reportportal.entity.project.ProjectAttribute)1 DeleteBulkRQ (com.epam.ta.reportportal.ws.model.DeleteBulkRQ)1 ItemAttributeResource (com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource)1 AssignUsersRQ (com.epam.ta.reportportal.ws.model.project.AssignUsersRQ)1 CreateProjectRQ (com.epam.ta.reportportal.ws.model.project.CreateProjectRQ)1 UnassignUsersRQ (com.epam.ta.reportportal.ws.model.project.UnassignUsersRQ)1 ProjectNotificationConfigDTO (com.epam.ta.reportportal.ws.model.project.email.ProjectNotificationConfigDTO)1 SenderCaseDTO (com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 Client (com.rabbitmq.http.client.Client)1 ExchangeInfo (com.rabbitmq.http.client.domain.ExchangeInfo)1 java.util (java.util)1