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));
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
orderElementDAO.flush();
sessionFactory.getCurrentSession().evict(orderElement);
return null;
}
});
final OrderElement orderElement2 = transactionService
.runOnTransaction(new IOnTransaction<OrderElement>() {
@Override
public OrderElement execute() {
try {
OrderElement element = orderElementDAO
.findUniqueByCode("order-line-code-RR");
for (CriterionRequirement requirement : element
.getCriterionRequirements()) {
requirement.isValid();
}
return element;
} catch (InstanceNotFoundException e) {
throw new RuntimeException(e);
}
}
});
assertNotNull(orderElement2);
assertThat(orderElement2.getCriterionRequirements().size(), equalTo(1));
assertTrue(((IndirectCriterionRequirement) orderElement2
.getCriterionRequirements().iterator().next()).isValid());
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
orderElementDAO.flush();
sessionFactory.getCurrentSession().evict(orderElement2);
return null;
}
});
IndirectCriterionRequirementDTO indirectCriterionRequirementDTO = new IndirectCriterionRequirementDTO(
name, type, false);
orderLineDTO.criterionRequirements.add(indirectCriterionRequirementDTO);
orderListDTO = createOrderListDTO(orderDTO);
instanceConstraintViolationsList = orderElementService
.addOrders(orderListDTO).instanceConstraintViolationsList;
assertThat(instanceConstraintViolationsList.size(), equalTo(0));
OrderElement orderElement3 = 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(orderElement3);
assertThat(orderElement3.getCriterionRequirements().size(), equalTo(1));
orderElement3 = transactionService
.runOnTransaction(new IOnTransaction<OrderElement>() {
@Override
public OrderElement execute() {
try {
OrderElement element = orderElementDAO
.findUniqueByCode("order-line-code-RR");
for (CriterionRequirement requirement : element
.getCriterionRequirements()) {
requirement.isValid();
}
return element;
} catch (InstanceNotFoundException e) {