Search in sources :

Example 26 with TeamFilter

use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.

the class LdapAdapterIntegrationTest method testGetTeamByGroupCode.

@Test
public void testGetTeamByGroupCode() {
    Project project = new Project();
    TeamFilter teamFilter = new TeamFilter(TeamFilter.Type.PROJECT_CODES, "projectGroup1");
    project.setTeamFilter(teamFilter);
    when(workdaysCalendarRepository.findDefaultCalendar(any())).thenReturn(null);
    List<Employee> team = ldapAdapter.getTeamByGroupCode(teamFilter.getValue());
    assertEquals(1, team.size());
    Employee employee = team.get(0);
    assertEquals(employee.getUserName(), "testuser1");
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Test(org.junit.Test) IntegrationTest(com.artezio.arttime.markers.IntegrationTest)

Example 27 with TeamFilter

use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.

the class ProjectRepositoryTest method testUpdateProject_masterIsChanged.

@Test
public void testUpdateProject_masterIsChanged() throws NoSuchFieldException {
    projectRepository = new ProjectRepository();
    Map<String, String> properties = new HashMap<String, String>();
    properties.put("javax.persistence.validation.mode", "none");
    entityManagerFactory = Persistence.createEntityManagerFactory("test-pu", properties);
    entityManager = entityManagerFactory.createEntityManager();
    setField(projectRepository, "entityManager", entityManager);
    setField(projectRepository, "employeeRepository", employeeRepository);
    entityManager.getTransaction().begin();
    Employee manager = new Employee("userName", "firstName", "lastName", "e@mail.com");
    manager.setDepartment("department");
    HourType hourType = new HourType("type");
    TeamFilter teamFilter = new TeamFilter(TeamFilter.Type.DISABLED, "");
    Project master = createProject("master", manager, hourType, teamFilter);
    Project newMaster = createProject("newMaster", manager, hourType, teamFilter);
    Project subProject = createProject("subProject", master, manager, hourType, teamFilter);
    entityManager.persist(hourType);
    entityManager.persist(manager);
    entityManager.persist(master);
    entityManager.persist(newMaster);
    entityManager.persist(subProject);
    entityManager.flush();
    entityManager.clear();
    setField(subProject, "master", newMaster);
    Project actual = projectRepository.update(subProject);
    entityManager.clear();
    actual = entityManager.find(Project.class, actual.getId());
    assertEquals(master.getCode(), actual.getMaster().getCode());
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) HourType(com.artezio.arttime.datamodel.HourType) HashMap(java.util.HashMap) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Test(org.junit.Test)

Aggregations

TeamFilter (com.artezio.arttime.datamodel.TeamFilter)27 Project (com.artezio.arttime.datamodel.Project)26 Employee (com.artezio.arttime.datamodel.Employee)24 Test (org.junit.Test)24 ProjectRepository (com.artezio.arttime.repositories.ProjectRepository)6 Logger (java.util.logging.Logger)6 IntegrationTest (com.artezio.arttime.markers.IntegrationTest)2 HourType (com.artezio.arttime.datamodel.HourType)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Collections.emptyList (java.util.Collections.emptyList)1 HashMap (java.util.HashMap)1