Package org.araneaframework.uilib.form.constraint

Examples of org.araneaframework.uilib.form.constraint.AfterTodayConstraint


   
    request.addParameter("testForm.__present", "true");
    request.addParameter("testForm.myDateTime.date", "11.10.1015");
    request.addParameter("testForm.myDateTime.time", "01:01")

    testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(false));

    StandardServletInputData input = new StandardServletInputData(request);
    input.pushScope("testForm");
    testForm._getWidget().update(input);
    input.popScope();
   
    assertTrue("Test form must not be valid after reading from request", !testForm.convertAndValidate());
           
    request = new MockHttpServletRequest();
   
    //invalid
    request.addParameter("testForm.__present", "true");
    request.addParameter("testForm.myDateTime.date", sdf.format(new Date()));
    request.addParameter("testForm.myDateTime.time", "00:00")

    testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(false));
   
    input = new StandardServletInputData(request);
    input.pushScope("testForm");
    testForm._getWidget().update(input);
    input.popScope();
   
    assertTrue("Test form must not be valid after reading from request", !testForm.convertAndValidate());

    request = new MockHttpServletRequest();
   
    //invalid   
    request.addParameter("testForm.__present", "true");
    request.addParameter("testForm.myDateTime.date", "11.10.2015");
    request.addParameter("testForm.myDateTime.time", "01:01")

    //Testing primitive constraint
    testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(true));

    input = new StandardServletInputData(request);
    input.pushScope("testForm");
    testForm._getWidget().update(input);
    input.popScope();
   
    assertTrue("Test form must be valid after reading from request", testForm.convertAndValidate());
   
    request = new MockHttpServletRequest();
   
    //valid
    request.addParameter("testForm.__present", "true");
    request.addParameter("testForm.myDateTime.date", sdf.format(new Date()));
    request.addParameter("testForm.myDateTime.time", "00:01")

    //Testing primitive constraint
    testForm.getElement("myDateTime").setConstraint(new AfterTodayConstraint(true));

    input = new StandardServletInputData(request);
    input.pushScope("testForm");
    testForm._getWidget().update(input)
    input.popScope();
View Full Code Here

TOP

Related Classes of org.araneaframework.uilib.form.constraint.AfterTodayConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.