use of com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate in project service-api by reportportal.
the class ProjectControllerTest method updateProjectConfigInterruptLaunchesNegativeTest.
@Test
void updateProjectConfigInterruptLaunchesNegativeTest() throws Exception {
UpdateProjectRQ rq = new UpdateProjectRQ();
ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
HashMap<String, String> projectAttributes = new HashMap<>();
projectAttributes.put("notifications.enabled", "false");
projectAttributes.put("job.interruptJobTime", "incorrect");
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());
}
use of com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate in project service-api by reportportal.
the class ProjectControllerTest method updateProjectPositive.
@Test
void updateProjectPositive() 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));
// 1 week in seconds
projectAttributes.put("job.keepScreenshots", String.valueOf(3600 * 24 * 7));
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().isOk());
Project project = projectRepository.findByName("test_project").get();
projectAttributes.forEach((key, value) -> {
Optional<ProjectAttribute> pa = project.getProjectAttributes().stream().filter(it -> it.getAttribute().getName().equalsIgnoreCase(key)).findAny();
assertTrue(pa.isPresent());
assertEquals(value, pa.get().getValue());
});
}
use of com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate in project service-api by reportportal.
the class ProjectControllerTest method updateProjectConfigurationIncorrectAttributeTest.
@Test
void updateProjectConfigurationIncorrectAttributeTest() throws Exception {
UpdateProjectRQ rq = new UpdateProjectRQ();
ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
HashMap<String, String> projectAttributes = new HashMap<>();
projectAttributes.put("incorrect", "false");
projectAttributes.put("job.keepLogs", "2 weeks");
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());
}
use of com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate in project service-api by reportportal.
the class ProjectControllerTest method updateProjectConfigKeepLaunchesNegativeTest.
@Test
void updateProjectConfigKeepLaunchesNegativeTest() throws Exception {
UpdateProjectRQ rq = new UpdateProjectRQ();
ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
HashMap<String, String> projectAttributes = new HashMap<>();
projectAttributes.put("notifications.enabled", "false");
projectAttributes.put("job.keepLaunches", "110000f");
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());
}
use of com.epam.ta.reportportal.ws.model.project.config.ProjectConfigurationUpdate in project service-api by reportportal.
the class ProjectControllerTest method updateProjectConfigurationNullValueTest.
@Test
void updateProjectConfigurationNullValueTest() throws Exception {
UpdateProjectRQ rq = new UpdateProjectRQ();
ProjectConfigurationUpdate configuration = new ProjectConfigurationUpdate();
HashMap<String, String> projectAttributes = new HashMap<>();
projectAttributes.put("job.keepLogs", null);
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());
}
Aggregations