}
});
order.add(container);
container.setName("bla");
container.setCode("code-" + UUID.randomUUID());
OrderLine leaf = OrderLine.create();
leaf.setName("leaf");
leaf.setCode("code-" + UUID.randomUUID());
container.add(leaf);
HoursGroup hoursGroup = HoursGroup.create(leaf);
hoursGroup.setCode("hoursGroupName");
hoursGroup.setWorkingHours(3);
leaf.addHoursGroup(hoursGroup);
orderModel.save();
adHocTransaction.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
try {
Order reloaded = orderDAO.find(order.getId());
assertFalse(order == reloaded);
assertThat(reloaded.getOrderElements().size(), equalTo(1));
OrderLineGroup containerReloaded = (OrderLineGroup) reloaded
.getOrderElements().get(0);
assertThat(containerReloaded.getHoursGroups().size(),
equalTo(1));
assertThat(containerReloaded.getChildren().size(),
equalTo(1));
OrderElement leaf = containerReloaded.getChildren().get(0);
assertThat(leaf.getHoursGroups().size(), equalTo(1));
orderModel.remove(order);
} catch (InstanceNotFoundException e) {
throw new RuntimeException(e);
}
return null;