Search in sources :

Example 1 with HoursRepository

use of com.artezio.arttime.services.repositories.HoursRepository in project ART-TIME by Artezio.

the class WorkTimeServiceTest method setUp.

@Before
public void setUp() throws Exception {
    workTimeService = new WorkTimeService();
    Map<String, String> properties = new HashMap<>();
    properties.put("javax.persistence.validation.mode", "none");
    entityManagerFactory = Persistence.createEntityManagerFactory("test", properties);
    entityManager = entityManagerFactory.createEntityManager();
    ProjectRepository projectRepository = new ProjectRepository();
    WorkdaysCalendarRepository workdaysCalendarRepository = new WorkdaysCalendarRepository();
    HoursRepository hoursRepository = new HoursRepository();
    setField(projectRepository, "entityManager", entityManager);
    setField(workdaysCalendarRepository, "entityManager", entityManager);
    setField(hoursRepository, "entityManager", entityManager);
    setField(workTimeService, "projectRepository", projectRepository);
    setField(workTimeService, "workdaysCalendarRepository", workdaysCalendarRepository);
    setField(workTimeService, "hoursRepository", hoursRepository);
    entityManager.getTransaction().begin();
}
Also used : ProjectRepository(com.artezio.arttime.services.repositories.ProjectRepository) WorkdaysCalendarRepository(com.artezio.arttime.services.repositories.WorkdaysCalendarRepository) HoursRepository(com.artezio.arttime.services.repositories.HoursRepository) Before(org.junit.Before)

Example 2 with HoursRepository

use of com.artezio.arttime.services.repositories.HoursRepository in project ART-TIME by Artezio.

the class ReportedHoursIndicatorTest method setUp.

@Before
public void setUp() throws Exception {
    hoursIndicator = createMockBuilder(ReportedHoursIndicator.class).addMockedMethod("getFilter").createMock();
    employee = new Employee("employee");
    period = new Period();
    hoursRepository = createMock(HoursRepository.class);
    workTimeService = createMock(WorkTimeService.class);
    employeeRepository = createMock(EmployeeRepository.class);
    filter = createMock(Filter.class);
    hourTypeRepository = createMock(HourTypeRepository.class);
    hoursIndicator.setEmployee(employee);
    setField(hoursIndicator, "hoursRepository", hoursRepository);
    setField(hoursIndicator, "workTimeService", workTimeService);
    setField(hoursIndicator, "employeeRepository", employeeRepository);
    setField(hoursIndicator, "hourTypeRepository", hourTypeRepository);
}
Also used : EmployeeRepository(com.artezio.arttime.services.repositories.EmployeeRepository) Employee(com.artezio.arttime.datamodel.Employee) WorkTimeService(com.artezio.arttime.services.WorkTimeService) Filter(com.artezio.arttime.filter.Filter) HourTypeRepository(com.artezio.arttime.services.repositories.HourTypeRepository) Period(com.artezio.arttime.datamodel.Period) HoursRepository(com.artezio.arttime.services.repositories.HoursRepository) Before(org.junit.Before)

Aggregations

HoursRepository (com.artezio.arttime.services.repositories.HoursRepository)2 Before (org.junit.Before)2 Employee (com.artezio.arttime.datamodel.Employee)1 Period (com.artezio.arttime.datamodel.Period)1 Filter (com.artezio.arttime.filter.Filter)1 WorkTimeService (com.artezio.arttime.services.WorkTimeService)1 EmployeeRepository (com.artezio.arttime.services.repositories.EmployeeRepository)1 HourTypeRepository (com.artezio.arttime.services.repositories.HourTypeRepository)1 ProjectRepository (com.artezio.arttime.services.repositories.ProjectRepository)1 WorkdaysCalendarRepository (com.artezio.arttime.services.repositories.WorkdaysCalendarRepository)1