Search in sources :

Example 11 with Project

use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.

the class ProjectRepositoryTest method testAddNewMetadataPostfix.

@Test
public void testAddNewMetadataPostfix() {
    String projectName = "metadata_test";
    Project p = new Project();
    p.setName(projectName);
    projectRepository.save(p);
    projectRepository.addDemoDataPostfix(projectName, "metadataPostfix");
    List<String> postfixes = projectRepository.findOne(projectName).getMetadata().getDemoDataPostfix();
    Assert.assertThat("Exception during saving demo data postfix", postfixes, CoreMatchers.hasItem("metadataPostfix"));
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) BaseDaoTest(com.epam.ta.reportportal.BaseDaoTest) Test(org.junit.Test)

Example 12 with Project

use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.

the class ProjectUtilsTest method project.

private Project project() {
    final Project project = new Project();
    final Project.Configuration configuration = new Project.Configuration();
    final ProjectEmailConfig emailConfig = new ProjectEmailConfig();
    emailConfig.setEmailCases(singletonList(new EmailSenderCase(asList("user1", "user1@fake.com", "user2@fake.com", aliveUser), "ALWAYS", asList("launch"), asList("tag"))));
    configuration.setEmailConfig(emailConfig);
    project.setConfiguration(configuration);
    return project;
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) ProjectEmailConfig(com.epam.ta.reportportal.database.entity.project.email.ProjectEmailConfig) EmailSenderCase(com.epam.ta.reportportal.database.entity.project.email.EmailSenderCase)

Example 13 with Project

use of com.epam.ta.reportportal.database.entity.Project in project commons-dao by reportportal.

the class PersonalProjectServiceTest method generatePersonalProject.

@Test
public void generatePersonalProject() throws Exception {
    User user = new User();
    String login = "johnny";
    user.setLogin(login);
    user.setFullName("John");
    Project project = new PersonalProjectService(mockProjectRepo()).generatePersonalProject(user);
    Project.UserConfig userConfig = project.getUsers().stream().filter(it -> login.equals(it.getLogin())).findFirst().get();
    Assert.assertThat("Project doesn't have user", userConfig.getLogin(), Matchers.equalTo(login));
    Assert.assertThat("Incorrect role", userConfig.getProjectRole(), Matchers.is(ProjectRole.PROJECT_MANAGER));
    Assert.assertThat("Incorrect role", userConfig.getProposedRole(), Matchers.is(ProjectRole.PROJECT_MANAGER));
    Assert.assertThat("Incorrect date", project.getCreationDate(), Matchers.notNullValue());
    Assert.assertThat("Incorrect configuration", project.getConfiguration(), Matchers.notNullValue());
    Assert.assertThat("Incorrect additional info", project.getAddInfo(), Matchers.notNullValue());
}
Also used : Project(com.epam.ta.reportportal.database.entity.Project) User(com.epam.ta.reportportal.database.entity.user.User) Test(org.junit.Test)

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