Search in sources :

Example 11 with OptionElement

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());
}
Also used : Referential(org.asqatasun.webapp.entity.referential.Referential) Functionality(org.asqatasun.webapp.entity.functionality.Functionality) OptionElement(org.asqatasun.webapp.entity.option.OptionElement) Contract(org.asqatasun.webapp.entity.contract.Contract) Date(java.util.Date) HashSet(java.util.HashSet) Scenario(org.asqatasun.webapp.entity.scenario.Scenario)

Example 12 with OptionElement

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());
}
Also used : User(org.asqatasun.webapp.entity.user.User) OptionElement(org.asqatasun.webapp.entity.option.OptionElement)

Example 13 with OptionElement

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;
}
Also used : OptionElementImpl(org.asqatasun.webapp.entity.option.OptionElementImpl) OptionElement(org.asqatasun.webapp.entity.option.OptionElement)

Aggregations

OptionElement (org.asqatasun.webapp.entity.option.OptionElement)13 HashSet (java.util.HashSet)2 Parameter (org.asqatasun.entity.parameterization.Parameter)2 User (org.asqatasun.webapp.entity.user.User)2 NumberFormat (java.text.NumberFormat)1 Date (java.util.Date)1 Set (java.util.Set)1 NoResultException (javax.persistence.NoResultException)1 NonUniqueResultException (javax.persistence.NonUniqueResultException)1 Query (javax.persistence.Query)1 ParameterElement (org.asqatasun.entity.parameterization.ParameterElement)1 Test (org.asqatasun.entity.reference.Test)1 ChangeTestWeightCommand (org.asqatasun.webapp.command.ChangeTestWeightCommand)1 Contract (org.asqatasun.webapp.entity.contract.Contract)1 Functionality (org.asqatasun.webapp.entity.functionality.Functionality)1 Option (org.asqatasun.webapp.entity.option.Option)1 OptionElementImpl (org.asqatasun.webapp.entity.option.OptionElementImpl)1 Referential (org.asqatasun.webapp.entity.referential.Referential)1 Scenario (org.asqatasun.webapp.entity.scenario.Scenario)1 NumericalFormField (org.asqatasun.webapp.form.NumericalFormField)1