use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.
the class ProjectUtilsTest method excludeProjectRecipientsTest.
@Test
public void excludeProjectRecipientsTest() {
Project project = project();
excludeProjectRecipients(usersToExclude(), project);
EmailSenderCase emailSenderCase = project.getConfiguration().getEmailConfig().getEmailCases().get(0);
Assert.assertEquals(1, emailSenderCase.getRecipients().size());
Assert.assertEquals(aliveUser, emailSenderCase.getRecipients().get(0));
}
use of com.epam.ta.reportportal.database.entity.Project in project service-authorization by reportportal.
the class AbstractUserReplicator method generatePersonalProject.
/**
* Generates personal project if does NOT exists
*
* @param user Owner of personal project
* @return Created project name
*/
protected String generatePersonalProject(User user) {
Optional<String> projectName = projectRepository.findPersonalProjectName(user.getLogin());
return projectName.orElseGet(() -> {
Project personalProject = personalProjectService.generatePersonalProject(user);
projectRepository.save(personalProject);
return personalProject.getId();
});
}
use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.
the class ProjectRepositoryCustomImpl method findAllProjectNames.
@Override
public List<String> findAllProjectNames() {
Query query = new Query();
query.fields().include("_id");
return mongoTemplate.find(query, Project.class).stream().map(Project::getId).collect(Collectors.toList());
}
use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.
the class ProjectRepositoryCustomImpl method findProjectUsers.
@Override
public List<String> findProjectUsers(String projectName, String value) {
Query query = projectById(projectName);
query.fields().include("users");
Project p = mongoTemplate.findOne(query, Project.class);
return p == null ? null : p.getUsers().stream().map(UserConfig::getLogin).filter(userNameContains(value)).collect(Collectors.toList());
}
use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.
the class NormalizeProjectTrigger method onBeforeConvert.
/**
* Username only in lower-case
*/
@Override
public void onBeforeConvert(BeforeConvertEvent<Project> event) {
Project source = event.getSource();
source.setName(normalizeId(source.getName()));
super.onBeforeConvert(event);
}
Aggregations