Search in sources :

Example 6 with Project

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));
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) EmailSenderCase(com.epam.ta.reportportal.database.entity.project.email.EmailSenderCase) Test(org.junit.Test)

Example 7 with Project

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();
    });
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project)

Example 8 with Project

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());
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) Query(org.springframework.data.mongodb.core.query.Query)

Example 9 with Project

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());
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) Query(org.springframework.data.mongodb.core.query.Query)

Example 10 with Project

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);
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project)

Aggregations

Project (com.epam.ta.reportportal.database.entity.Project)13 Query (org.springframework.data.mongodb.core.query.Query)4 Test (org.junit.Test)3 EmailSenderCase (com.epam.ta.reportportal.database.entity.project.email.EmailSenderCase)2 BaseDaoTest (com.epam.ta.reportportal.BaseDaoTest)1 UserConfig (com.epam.ta.reportportal.database.entity.Project.UserConfig)1 ProjectRole (com.epam.ta.reportportal.database.entity.ProjectRole)1 EntryType (com.epam.ta.reportportal.database.entity.project.EntryType)1 ProjectEmailConfig (com.epam.ta.reportportal.database.entity.project.email.ProjectEmailConfig)1 User (com.epam.ta.reportportal.database.entity.user.User)1 PERSONAL_PROJECT_POSTFIX (com.epam.ta.reportportal.database.personal.PersonalProjectService.PERSONAL_PROJECT_POSTFIX)1 BasicDBObject (com.mongodb.BasicDBObject)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 MongoTemplate (org.springframework.data.mongodb.core.MongoTemplate)1