Package org.apache.catalina.filters.ExpiresFilter

Examples of org.apache.catalina.filters.ExpiresFilter.ExpiresConfiguration


    }

    @Test
    public void testParseExpiresConfigurationMonoDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(1, actualConfiguration.getDurations().size());
        Assert.assertEquals(2,
                actualConfiguration.getDurations().get(0).getAmount());
        Assert.assertEquals(DurationUnit.HOUR,
                actualConfiguration.getDurations().get(0).getUnit());

    }
View Full Code Here


                Assert.assertEquals(503, excludedResponseStatusCodes[1]);
            }

            // VERIFY DEFAULT CONFIGURATION
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getDefaultExpiresConfiguration();
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());
                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());
                Assert.assertEquals(DurationUnit.MONTH,
                        expiresConfiguration.getDurations().get(0).getUnit());
                Assert.assertEquals(1, expiresConfiguration.getDurations().get(
                        0).getAmount());
            }

            // VERIFY TEXT/HTML
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "text/html");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(3,
                        expiresConfiguration.getDurations().size());

                Duration oneMonth = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.MONTH, oneMonth.getUnit());
                Assert.assertEquals(1, oneMonth.getAmount());

                Duration fifteenDays = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.DAY, fifteenDays.getUnit());
                Assert.assertEquals(15, fifteenDays.getAmount());

                Duration twoHours = expiresConfiguration.getDurations().get(2);
                Assert.assertEquals(DurationUnit.HOUR, twoHours.getUnit());
                Assert.assertEquals(2, twoHours.getAmount());
            }
            // VERIFY IMAGE/GIF
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/gif");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(2,
                        expiresConfiguration.getDurations().size());

                Duration fiveHours = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.HOUR, fiveHours.getUnit());
                Assert.assertEquals(5, fiveHours.getAmount());

                Duration threeMinutes = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.MINUTE, threeMinutes.getUnit());
                Assert.assertEquals(3, threeMinutes.getAmount());

            }
            // VERIFY IMAGE/JPG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/jpg");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration tenThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        tenThousandSeconds.getUnit());
                Assert.assertEquals(10000, tenThousandSeconds.getAmount());

            }
            // VERIFY VIDEO/MPEG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "video/mpeg");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration twentyThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        twentyThousandSeconds.getUnit());
                Assert.assertEquals(20000, twentyThousandSeconds.getAmount());
            }
View Full Code Here

        validate(servlet, Integer.valueOf(7 * 60));
    }

    public void testParseExpiresConfigurationCombinedDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 1 month 15 days 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(3, actualConfiguration.getDurations().size());

    }
View Full Code Here

    }

    public void testParseExpiresConfigurationMonoDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(1, actualConfiguration.getDurations().size());
        Assert.assertEquals(2,
                actualConfiguration.getDurations().get(0).getAmount());
        Assert.assertEquals(DurationUnit.HOUR,
                actualConfiguration.getDurations().get(0).getUnit());

    }
View Full Code Here

                Assert.assertEquals(503, excludedResponseStatusCodes[1]);
            }

            // VERIFY DEFAULT CONFIGURATION
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getDefaultExpiresConfiguration();
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());
                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());
                Assert.assertEquals(DurationUnit.MONTH,
                        expiresConfiguration.getDurations().get(0).getUnit());
                Assert.assertEquals(1, expiresConfiguration.getDurations().get(
                        0).getAmount());
            }

            // VERIFY TEXT/HTML
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "text/html");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(3,
                        expiresConfiguration.getDurations().size());

                Duration oneMonth = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.MONTH, oneMonth.getUnit());
                Assert.assertEquals(1, oneMonth.getAmount());

                Duration fifteenDays = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.DAY, fifteenDays.getUnit());
                Assert.assertEquals(15, fifteenDays.getAmount());

                Duration twoHours = expiresConfiguration.getDurations().get(2);
                Assert.assertEquals(DurationUnit.HOUR, twoHours.getUnit());
                Assert.assertEquals(2, twoHours.getAmount());
            }
            // VERIFY IMAGE/GIF
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/gif");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(2,
                        expiresConfiguration.getDurations().size());

                Duration fiveHours = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.HOUR, fiveHours.getUnit());
                Assert.assertEquals(5, fiveHours.getAmount());

                Duration threeMinutes = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.MINUTE, threeMinutes.getUnit());
                Assert.assertEquals(3, threeMinutes.getAmount());

            }
            // VERIFY IMAGE/JPG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/jpg");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration tenThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        tenThousandSeconds.getUnit());
                Assert.assertEquals(10000, tenThousandSeconds.getAmount());

            }
            // VERIFY VIDEO/MPEG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "video/mpeg");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration twentyThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        twentyThousandSeconds.getUnit());
                Assert.assertEquals(20000, twentyThousandSeconds.getAmount());
            }
View Full Code Here

        validate(servlet, Integer.valueOf(7 * 60));
    }

    public void testParseExpiresConfigurationCombinedDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 1 month 15 days 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(3, actualConfiguration.getDurations().size());

    }
View Full Code Here

    }

    public void testParseExpiresConfigurationMonoDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(1, actualConfiguration.getDurations().size());
        Assert.assertEquals(2,
                actualConfiguration.getDurations().get(0).getAmount());
        Assert.assertEquals(DurationUnit.HOUR,
                actualConfiguration.getDurations().get(0).getUnit());

    }
View Full Code Here

                Assert.assertEquals(503, excludedResponseStatusCodes[1]);
            }

            // VERIFY DEFAULT CONFIGURATION
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getDefaultExpiresConfiguration();
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());
                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());
                Assert.assertEquals(DurationUnit.MONTH,
                        expiresConfiguration.getDurations().get(0).getUnit());
                Assert.assertEquals(1, expiresConfiguration.getDurations().get(
                        0).getAmount());
            }

            // VERIFY TEXT/HTML
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "text/html");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(3,
                        expiresConfiguration.getDurations().size());

                Duration oneMonth = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.MONTH, oneMonth.getUnit());
                Assert.assertEquals(1, oneMonth.getAmount());

                Duration fifteenDays = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.DAY, fifteenDays.getUnit());
                Assert.assertEquals(15, fifteenDays.getAmount());

                Duration twoHours = expiresConfiguration.getDurations().get(2);
                Assert.assertEquals(DurationUnit.HOUR, twoHours.getUnit());
                Assert.assertEquals(2, twoHours.getAmount());
            }
            // VERIFY IMAGE/GIF
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/gif");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(2,
                        expiresConfiguration.getDurations().size());

                Duration fiveHours = expiresConfiguration.getDurations().get(0);
                Assert.assertEquals(DurationUnit.HOUR, fiveHours.getUnit());
                Assert.assertEquals(5, fiveHours.getAmount());

                Duration threeMinutes = expiresConfiguration.getDurations().get(
                        1);
                Assert.assertEquals(DurationUnit.MINUTE, threeMinutes.getUnit());
                Assert.assertEquals(3, threeMinutes.getAmount());

            }
            // VERIFY IMAGE/JPG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "image/jpg");
                Assert.assertEquals(StartingPoint.ACCESS_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration tenThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        tenThousandSeconds.getUnit());
                Assert.assertEquals(10000, tenThousandSeconds.getAmount());

            }
            // VERIFY VIDEO/MPEG
            {
                ExpiresConfiguration expiresConfiguration = expiresFilter.getExpiresConfigurationByContentType().get(
                        "video/mpeg");
                Assert.assertEquals(StartingPoint.LAST_MODIFICATION_TIME,
                        expiresConfiguration.getStartingPoint());

                Assert.assertEquals(1,
                        expiresConfiguration.getDurations().size());

                Duration twentyThousandSeconds = expiresConfiguration.getDurations().get(
                        0);
                Assert.assertEquals(DurationUnit.SECOND,
                        twentyThousandSeconds.getUnit());
                Assert.assertEquals(20000, twentyThousandSeconds.getAmount());
            }
View Full Code Here

    }

    @Test
    public void testParseExpiresConfigurationCombinedDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 1 month 15 days 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(3, actualConfiguration.getDurations().size());

    }
View Full Code Here

    }

    @Test
    public void testParseExpiresConfigurationMonoDuration() {
        ExpiresFilter expiresFilter = new ExpiresFilter();
        ExpiresConfiguration actualConfiguration = expiresFilter.parseExpiresConfiguration("access plus 2 hours");

        Assert.assertEquals(StartingPoint.ACCESS_TIME,
                actualConfiguration.getStartingPoint());

        Assert.assertEquals(1, actualConfiguration.getDurations().size());
        Assert.assertEquals(2,
                actualConfiguration.getDurations().get(0).getAmount());
        Assert.assertEquals(DurationUnit.HOUR,
                actualConfiguration.getDurations().get(0).getUnit());

    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.filters.ExpiresFilter.ExpiresConfiguration

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.