/*
* Create a resource DTOs. Each resource contains one cost assignment
* overlapping.
*/
MachineDTO m1 = createMachineDTOWithTwoCostsAssignments("m1",
costCategory.getName(), getDate(2000, 1, 1), null, getDate(
2000, 2, 1), null);
MachineDTO m2 = createMachineDTOWithTwoCostsAssignments("m2",
costCategory.getName(), getDate(2000, 2, 1), null, getDate(
2000, 1, 1), getDate(2000, 3, 1));
MachineDTO m3 = createMachineDTOWithTwoCostsAssignments("m3",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 4, 1), getDate(2000, 3, 1), null);
MachineDTO m4 = createMachineDTOWithTwoCostsAssignments("m4",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 1, 1), getDate(2000, 3, 1));
MachineDTO m5 = createMachineDTOWithTwoCostsAssignments("m5",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 3, 1), getDate(2000, 4, 1));
MachineDTO m6 = createMachineDTOWithTwoCostsAssignments("m6",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 4, 1), getDate(2000, 6, 1));
MachineDTO m7 = createMachineDTOWithTwoCostsAssignments("m7",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 1, 1), getDate(2000, 2, 1));
MachineDTO m8 = createMachineDTOWithTwoCostsAssignments("m8",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 5, 1), getDate(2000, 6, 1));
MachineDTO m9 = createMachineDTOWithTwoCostsAssignments("m9",
costCategory.getName(), getDate(2000, 2, 1),
getDate(2000, 5, 1), getDate(2000, 2, 1), getDate(2000, 5, 1));
/* Test. */
ResourceListDTO resourceDTOs = createResourceListDTO(m1, m2, m3, m4,
m5, m6, m7, m8, m9);
assertOneConstraintViolationPerInstance(resourceService
.addResources(resourceDTOs), resourceDTOs.resources.size());
for (ResourceDTO r : resourceDTOs.resources) {
MachineDTO m = (MachineDTO) r;
assertFalse("Machine " + m.name + " not expected", resourceDAO
.existsByCode(((MachineDTO) r).code));
}
}