Package org.apache.turbine.util.parser

Examples of org.apache.turbine.util.parser.DefaultParameterParser


        // Sets the default cookie parser.
        data.setCookieParser(new DefaultCookieParser());

        // Contains all of the GET/POST parameters.
        data.setParameterParser(new DefaultParameterParser());

        // Get the HttpSession object.
        data.setSession(data.getRequest().getSession(true));

        // Set the servlet configuration in RunData for use in loading
View Full Code Here


        // Sets the default cookie parser.
        data.setCookieParser(new DefaultCookieParser());

        // Contains all of the GET/POST parameters.
        data.setParameterParser(new DefaultParameterParser());

        // Get the HttpSession object.
        data.setSession(data.getRequest().getSession(true));

        // Set the servlet configuration in RunData for use in loading
View Full Code Here

        assertTrue("An intake Field type boolean, which is required, should be required", booleanField.isRequired());
    }

    public void testDateRangeValidator() throws IntakeException
    {
        ParameterParser pp = new DefaultParameterParser();
        pp.add("rt_0dmin", "05/11/2007");
        pp.add("rt_0dmax", "05/12/2007");
        pp.add("rt_0dmax2", "05/11/2007");
        rangeTestGroup.init(Group.NEW, pp);

        Field dmax = rangeTestGroup.get("DateMax");
        Field dmax2 = rangeTestGroup.get("DateMax2");
View Full Code Here

        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }

    public void testAddEmptyParameterParser()
    {
        ParameterParser pp = new DefaultParameterParser();
        turi.add(1, pp); // 1 = query data
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }
View Full Code Here

        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }

    public void testAddParameterParser()
    {
        ParameterParser pp = new DefaultParameterParser();
        pp.add("test", "");
        turi.add(1, pp); // 1 = query data
        assertEquals("/context/servlet/turbine?test=", turi.getRelativeLink());
        turi.removeQueryData("test");
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());

        pp = new DefaultParameterParser();
        pp.add("test", (String) null);
        turi.add(1, pp); // 1 = query data
        // Should make the following work so as to be consistent with directly added values.
        //assertEquals("/context/servlet/turbine?test=null", turi.getRelativeLink());
        turi.removeQueryData("test");
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());

        // TRB-8
        pp = new DefaultParameterParser();
        DiskFileItemFactory factory = new DiskFileItemFactory(10240, null);
        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
        pp.add("upload-field", test);
        turi.add(1, pp); // 1 = query data
        assertEquals("/context/servlet/turbine?upload-field=", turi.getRelativeLink());
        turi.removeQueryData("upload-field");
        assertEquals("/context/servlet/turbine", turi.getRelativeLink());
    }
View Full Code Here

        assertFalse("The date range should not be valid", dmax2.isValid());
    }

    public void testIntegerRangeValidator() throws IntakeException
    {
        ParameterParser pp = new DefaultParameterParser();
        pp.add("irt_0imin", "1");
        pp.add("irt_0imax", "3");
        pp.add("irt_0imax2", "2");
        integerRangeTestGroup.init(Group.NEW, pp);

        Field imax = integerRangeTestGroup.get("IntMax");
        Field imax2 = integerRangeTestGroup.get("IntMax2");
View Full Code Here

     *
     * @throws IntakeException
     */
    public void testRequiredFalse() throws IntakeException
    {
        ParameterParser pp = new DefaultParameterParser();
        pp.add("rft_0stringrf", "");
        pp.add("rft_0integerrf", "");
        pp.add("rft_0intrf", "");
        pp.add("rft_0daterf", "");
        requiredFalseTestGroup.init(Group.NEW, pp);

        Field stringRF = requiredFalseTestGroup.get("StringRF");
        Field integerRF = requiredFalseTestGroup.get("IntegerRF");
        Field intRF = requiredFalseTestGroup.get("IntRF");
View Full Code Here

        rfgto.setIntegerRF(new Integer(5));
        rfgto.setIntRF(6);
        Date testDate = new Date();
        rfgto.setDateRF(testDate);

        ParameterParser pp = new DefaultParameterParser();
        pp.add("rft_0stringrf", "");
        pp.add("rft_0integerrf", "");
        pp.add("rft_0intrf", "");
        pp.add("rft_0daterf", "");
        requiredFalseTestGroup.init(Group.NEW, pp);

        requiredFalseTestGroup.setProperties(rfgto);
        assertNull("String value should have been cleared.", rfgto.getStringRF());
        assertNull("Date value should have been cleared.", rfgto.getDateRF());
View Full Code Here

        Date testDate = cal.getTime();
        // This is in dd/mm/yyyy format, as defined in the intake.xml for this group.
        String testDateString = cal.get(Calendar.DAY_OF_MONTH) + "/"
                + (cal.get(Calendar.MONTH) + 1) + "/" + (cal.get(Calendar.YEAR));

        ParameterParser pp = new DefaultParameterParser();
        pp.add("rft_0stringrf", "ABC"); // rules require 3 characters.
        pp.add("rft_0integerrf", new Integer(10));
        pp.add("rft_0intrf", 11);
        pp.add("rft_0daterf", testDateString);
        requiredFalseTestGroup.init(Group.NEW, pp);

        Field stringRF = requiredFalseTestGroup.get("StringRF");
        Field integerRF = requiredFalseTestGroup.get("IntegerRF");
        Field intRF = requiredFalseTestGroup.get("IntRF");
View Full Code Here

     *
     * @throws IntakeException
     */
    public void testRequiredTrue() throws IntakeException
    {
        ParameterParser pp = new DefaultParameterParser();
        pp.add("rtt_0stringrt", "");
        requiredTrueTestGroup.init(Group.NEW, pp);

        Field stringRT = requiredTrueTestGroup.get("StringRT");

        assertTrue("StringRT should be set", stringRT.isSet());
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.parser.DefaultParameterParser

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.