use of org.asqatasun.webapp.entity.option.OptionElement in project Asqatasun by Asqatasun.
the class ContractDAOImplTest method testSaveOrUpdate.
/**
* Test of saveOrUpdate method, of class ContractDAOImpl.
*/
public void testSaveOrUpdate() {
System.out.println("saveOrUpdate");
Date beginDate = new Date();
Date endDate = new Date();
Date renewalDate = new Date();
int nbOfContract = contractDAO.findAll().size();
Set<Functionality> functionalitySet = new HashSet<Functionality>();
Set<OptionElement> optionElementSet = new HashSet<OptionElement>();
Set<Referential> referenceSet = new HashSet<Referential>();
Set<Scenario> scenarioSet = new HashSet<Scenario>();
Contract contract = contractFactory.createContract("Contract-test", beginDate, endDate, renewalDate, Float.valueOf(200), functionalitySet, optionElementSet, referenceSet, scenarioSet, null);
contractDAO.saveOrUpdate(contract);
assertEquals(nbOfContract + 1, contractDAO.findAll().size());
}
use of org.asqatasun.webapp.entity.option.OptionElement in project Asqatasun by Asqatasun.
the class OptionElementDAOImplTest method testFindOptionElementFromUserAndFamilyCode.
/**
* Test of findOptionElementFromUserAndFamilyCode method, of class OptionElementDAOImpl.
*/
public void testFindOptionElementFromUserAndFamilyCode() {
User user1 = userDAO.findUserFromEmail("test1@test.com");
User user2 = userDAO.findUserFromEmail("test2@test.com");
User user3 = userDAO.findUserFromEmail("test3@test.com");
Collection<OptionElement> oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user1, "USER_OPTION");
assertEquals(2, oec.size());
oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user1, "ANOTHER_OPTION");
assertTrue(oec.isEmpty());
oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user2, "USER_OPTION");
assertEquals(1, oec.size());
oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user2, "ANOTHER_OPTION");
assertTrue(oec.isEmpty());
oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user3, "USER_OPTION");
assertTrue(oec.isEmpty());
oec = optionElementDAO.findOptionElementFromUserAndFamilyCode(user3, "ANOTHER_OPTION");
assertTrue(oec.isEmpty());
}
use of org.asqatasun.webapp.entity.option.OptionElement in project Asqatasun by Asqatasun.
the class OptionElementFactoryImpl method createOptionElement.
@Override
public OptionElement createOptionElement(Option option, String value) {
OptionElement optionElement = new OptionElementImpl();
optionElement.setOption(option);
optionElement.setValue(value);
return optionElement;
}
Aggregations