assertEquals(previous + 1, list.size());
}
@Test
public void testSaveConfigurationUnits() throws InstanceNotFoundException {
final Machine machine = createValidMachine();
MachineWorkersConfigurationUnit configurationUnit = MachineWorkersConfigurationUnit
.create(machine, "Operation", new BigDecimal(1));
final Criterion criterion = CriterionDAOTest.createValidCriterion();
configurationUnit.addRequiredCriterion(criterion);
machine.addMachineWorkersConfigurationUnit(configurationUnit);
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
criterionTypeDAO.save(criterion.getType());
criterionDAO.save(criterion);
machineDAO.save(machine);
return null;
}
});
assertTrue(machine.getId() != null);
assertTrue(machine.getConfigurationUnits().size() != 0);
assertTrue(machine.getConfigurationUnits().iterator().next()
.getRequiredCriterions().size() != 0);
}