taylor 2003/10/01 22:40:55 Modified: cps project.xml cps/src/test/org/apache/jetspeed/cps/rewriter TestRewriterRules.java cps/test/rewriter test-001-output.html Added: cps/src/test/org/apache/jetspeed/cps/rewriter UnitTestRewriter.java Removed: cps/src/test/org/apache/jetspeed/cps/rewriter TestRewriter.java Log: cleaning up unit tests. excluded UnitTestRewriter from unit test list Revision Changes Path 1.3 +1 -0 jakarta-jetspeed-2/cps/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/cps/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- project.xml 2 Oct 2003 05:30:27 -0000 1.2 +++ project.xml 2 Oct 2003 05:40:55 -0000 1.3 @@ -70,6 +70,7 @@ <unitTest> <excludes> <exclude>org/apache/jetspeed/cps/CPSTest.java</exclude> + <exclude>org/apache/jetspeed/cps/rewriter/UnitTestRewriter.java</exclude> </excludes> </unitTest> 1.2 +2 -2 jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter/TestRewriterRules.java Index: TestRewriterRules.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter/TestRewriterRules.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestRewriterRules.java 2 Oct 2003 05:30:28 -0000 1.1 +++ TestRewriterRules.java 2 Oct 2003 05:40:55 -0000 1.2 @@ -246,7 +246,7 @@ // validate result FileReader testReader = new FileReader("./test/rewriter/test-001-output.html"); - TestRewriter testRewriter = new TestRewriter(); + UnitTestRewriter testRewriter = new UnitTestRewriter(); testRewriter.parse(service.createParserAdaptor("text/html"), testReader); assertTrue("1st rewritten anchor: " + testRewriter.getAnchorValue("1"), testRewriter.getAnchorValue("1").equals("http://www.bluesunrise.com/suffix")); 1.1 jakarta-jetspeed-2/cps/src/test/org/apache/jetspeed/cps/rewriter/UnitTestRewriter.java Index: UnitTestRewriter.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache Jetspeed" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * "Apache Jetspeed", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package org.apache.jetspeed.cps.rewriter; import java.util.HashMap; import java.util.Map; /** * TestRewriter * * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a> * @version $Id: UnitTestRewriter.java,v 1.1 2003/10/02 05:40:55 taylor Exp $ */ public class UnitTestRewriter extends BasicRewriter { private Map anchors = new HashMap(); private String paragraph = null; private boolean inParagraph = false; public String getAnchorValue(String name) { return (String)anchors.get(name); } public String getParagraph() { return paragraph; } public boolean enterStartTagEvent(String tag, MutableAttributes attrs) { if (tag.equalsIgnoreCase("a")) { anchors.put(attrs.getValue("name"), attrs.getValue("href")); } if (tag.equalsIgnoreCase("p")) { inParagraph = true; } return true; } public boolean enterText(char[] values, int param) { if (inParagraph) { paragraph = new String(values); } return true; } public String exitEndTagEvent(String tag) { inParagraph = false; return ""; } } 1.2 +3 -3 jakarta-jetspeed-2/cps/test/rewriter/test-001-output.html Index: test-001-output.html =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/cps/test/rewriter/test-001-output.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- test-001-output.html 2 Oct 2003 05:30:28 -0000 1.1 +++ test-001-output.html 2 Oct 2003 05:40:55 -0000 1.2 @@ -1,8 +1,8 @@ <p> This is a test</p> -<a target="_BLANK" name="1" href="http://www.bluesunrise.com/suffix">keep this</a> - <a target="_BLANK" name="2" href="http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix">junk</a> - <a target="_BLANK" name="3" href="http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix">junk2</a> +<a name="1" href="http://www.bluesunrise.com/suffix" target="_BLANK">keep this</a> + <a name="2" href="http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix" target="_BLANK">junk</a> + <a name="3" href="http://www.rewriter.com/stuff/junk/stuffedjunk.html/suffix" target="_BLANK">junk2</a> <a name="4" href="javascript:whatever()">script</a> <a name="5" href="mailto:[EMAIL PROTECTED]">script</a>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]