Package ign.middleman.helpers

Examples of ign.middleman.helpers.Rule


        HttpServletResponse response = createMock(HttpServletResponse.class);
        Middleman middleman = createMock(Middleman.class);
        expect(request.getParameter("url")).andReturn(null).anyTimes();
        expect(request.getParameter("regex")).andReturn(".*tags=foo.*").anyTimes();
        expect(middleman.addRefreshRule(".*tags=foo.*")).andReturn(Collections.singleton(new Rule(".*tags=foo.*")));

        Refresher r = new Refresher();
        r.setMiddleman(middleman);
        replay(request, response, middleman);
        r.doGet(request, response);
View Full Code Here


                    CASMutation<Collection<Rule>> mutation = new CASMutation<Collection<Rule>>() {
                        public Collection<Rule> getNewValue(Collection<Rule> current) {

                            ArrayList<Rule> currentRules = new ArrayList<Rule>(current);
                            for (Iterator<Rule> iterator = currentRules.iterator(); iterator.hasNext();) {
                                Rule rule = iterator.next();
                                if (rule.getTimestamp() < System.currentTimeMillis() - refreshTimeout) {
                                    iterator.remove();
                                }
                            }
                            return currentRules;
                        }
View Full Code Here

        return cachedRules;
    }


    public Collection<Rule> addRefreshRule(String regex) {
        final Rule rule = new Rule(regex);

        try {
// This is how we modify a list when we find one in the cache.
            CASMutation<Collection<Rule>> mutation = new CASMutation<Collection<Rule>>() {
View Full Code Here

TOP

Related Classes of ign.middleman.helpers.Rule

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.