orderDTO.initDate = DateConverter.toXMLGregorianCalendar(new Date());
String name = PredefinedCriterionTypes.LOCATION.getPredefined().get(0);
String type = PredefinedCriterionTypes.LOCATION.getName();
CriterionRequirementDTO criterionRequirementDTO = new DirectCriterionRequirementDTO(
name, type);
orderDTO.criterionRequirements.add(criterionRequirementDTO);
OrderListDTO orderListDTO = createOrderListDTO(orderDTO);
List<InstanceConstraintViolationsDTO> instanceConstraintViolationsList = orderElementService
.addOrders(orderListDTO).instanceConstraintViolationsList;
assertThat(instanceConstraintViolationsList.size(), equalTo(0));
final OrderElement orderElement = transactionService
.runOnTransaction(new IOnTransaction<OrderElement>() {
@Override
public OrderElement execute() {
try {
OrderElement element = orderElementDAO
.findUniqueByCode(code);
element.getCriterionRequirements().size();
return element;
} catch (InstanceNotFoundException e) {
throw new RuntimeException(e);
}
}
});
assertNotNull(orderElement);
assertThat(orderElement.getCriterionRequirements().size(), equalTo(1));
String name2 = PredefinedCriterionTypes.LOCATION.getPredefined().get(1);
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
orderElementDAO.flush();
sessionFactory.getCurrentSession().evict(orderElement);
return null;
}
});
CriterionRequirementDTO criterionRequirementDTO2 = new DirectCriterionRequirementDTO(
name2, type);
orderDTO.criterionRequirements.add(criterionRequirementDTO2);
orderListDTO = createOrderListDTO(orderDTO);
instanceConstraintViolationsList = orderElementService