use of com.epam.ta.reportportal.ws.model.activity.ProjectAttributesActivityResource in project service-api by reportportal.
the class ProjectConfigEventTest method getProjectAttributes.
private static ProjectAttributesActivityResource getProjectAttributes(Map<String, String> config) {
ProjectAttributesActivityResource resource = new ProjectAttributesActivityResource();
resource.setProjectName("test_project");
resource.setProjectId(3L);
resource.setConfig(config);
return resource;
}
use of com.epam.ta.reportportal.ws.model.activity.ProjectAttributesActivityResource in project service-api by reportportal.
the class ProjectActivityConverterTest method toActivityResource.
@Test
void toActivityResource() {
final Project project = getProject();
final ProjectAttributesActivityResource resource = ProjectActivityConverter.TO_ACTIVITY_RESOURCE.apply(project);
assertEquals(resource.getProjectId(), project.getId());
assertEquals(resource.getProjectName(), project.getName());
assertThat(resource.getConfig()).containsOnlyKeys("attr.lol");
assertThat(resource.getConfig()).containsValue("value");
}
use of com.epam.ta.reportportal.ws.model.activity.ProjectAttributesActivityResource in project service-api by reportportal.
the class UpdateProjectHandlerImpl method updateProject.
@Override
public OperationCompletionRS updateProject(String projectName, UpdateProjectRQ updateProjectRQ, ReportPortalUser user) {
Project project = projectRepository.findByName(projectName).orElseThrow(() -> new ReportPortalException(ErrorType.PROJECT_NOT_FOUND, projectName));
ProjectAttributesActivityResource before = TO_ACTIVITY_RESOURCE.apply(project);
updateProjectConfiguration(updateProjectRQ.getConfiguration(), project);
ofNullable(updateProjectRQ.getUserRoles()).ifPresent(roles -> updateProjectUserRoles(roles, project, user));
projectRepository.save(project);
ProjectAttributesActivityResource after = TO_ACTIVITY_RESOURCE.apply(project);
applicationEventPublisher.publishEvent(new ProjectEvent(project.getId(), UPDATE_EVENT));
messageBus.publishActivity(new ProjectUpdatedEvent(before, after, user.getUserId(), user.getUsername()));
messageBus.publishActivity(new ProjectAnalyzerConfigEvent(before, after, user.getUserId(), user.getUsername()));
return new OperationCompletionRS("Project with name = '" + project.getName() + "' is successfully updated.");
}
Aggregations