[Jsptest-svn-commits] SF.net SVN: jsptest: [226] tags
Status: Alpha
Brought to you by:
lkoskela
From: <lko...@us...> - 2008-04-24 17:15:37
|
Revision: 226 http://jsptest.svn.sourceforge.net/jsptest/?rev=226&view=rev Author: lkoskela Date: 2008-04-24 10:15:35 -0700 (Thu, 24 Apr 2008) Log Message: ----------- [maven-release-plugin] copy for tag jsptest-0.17 Added Paths: ----------- tags/jsptest-0.17/ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml tags/jsptest-0.17/jsptest-acceptance/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Strings.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/StringsTest.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/XMLTest.java tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/HtmlTestCase.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/assertion/DOMAssertion.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TestHtmlTestCaseElementAssertions.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java tags/jsptest-0.17/jsptest-generic/pom.xml tags/jsptest-0.17/jsptest-jsp12/pom.xml tags/jsptest-0.17/jsptest-jsp20/pom.xml tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspExecutionImpl.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspImpl.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockHttpServletRequest.java tags/jsptest-0.17/jsptest-jsp20/src/test/java/net/sf/jsptest/compiler/jsp20/TestJspImpl.java tags/jsptest-0.17/jsptest-jsp21/pom.xml tags/jsptest-0.17/pom.xml Removed Paths: ------------- tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml tags/jsptest-0.17/jsptest-acceptance/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/HtmlTestCase.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/JspTestCase.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/assertion/DOMAssertion.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/TestHtmlTestCaseElementAssertions.java tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/test/java/net/sf/jsptest/compiler/dummy/FakeJspCompiler.java tags/jsptest-0.17/jsptest-generic/pom.xml tags/jsptest-0.17/jsptest-jsp12/pom.xml tags/jsptest-0.17/jsptest-jsp20/pom.xml tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JasperCompiler.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspExecutionImpl.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/JspImpl.java tags/jsptest-0.17/jsptest-jsp20/src/main/java/net/sf/jsptest/compiler/jsp20/mock/MockHttpServletRequest.java tags/jsptest-0.17/jsptest-jsp20/src/test/java/net/sf/jsptest/compiler/jsp20/TestJspImpl.java tags/jsptest-0.17/jsptest-jsp21/pom.xml tags/jsptest-0.17/pom.xml Copied: tags/jsptest-0.17 (from rev 217, trunk) Deleted: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-acceptance</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-acceptance-jsp12</artifactId> - <packaging>jar</packaging> - <name>Acceptance tests for the JspTest variant for the JSP 1.2 specification.</name> - <description /> - <dependencies> - <dependency> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-jsp12</artifactId> - </dependency> - </dependencies> -</project> Copied: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml (from rev 225, trunk/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp12/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-acceptance</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-acceptance-jsp12</artifactId> + <packaging>jar</packaging> + <name>Acceptance tests for the JspTest variant for the JSP 1.2 specification.</name> + <description /> + <dependencies> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-jsp12</artifactId> + </dependency> + </dependencies> +</project> Deleted: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-acceptance</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-acceptance-jsp20</artifactId> - <packaging>jar</packaging> - <name>Acceptance tests for the JspTest variant for the JSP 2.0 specification.</name> - <description /> - <dependencies> - <dependency> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-jsp20</artifactId> - </dependency> - </dependencies> -</project> Copied: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml (from rev 225, trunk/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-acceptance</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-acceptance-jsp20</artifactId> + <packaging>jar</packaging> + <name>Acceptance tests for the JspTest variant for the JSP 2.0 specification.</name> + <description /> + <dependencies> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-jsp20</artifactId> + </dependency> + </dependencies> +</project> Deleted: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,63 +0,0 @@ -/* - * Copyright 2007 Lasse Koskela. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.jsptest.acceptance.jsp; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.tagext.TagSupport; - -import net.sf.jsptest.JspTestCase; - -/** - * @author Lasse Koskela - */ -public class TestMockingTaglibs extends JspTestCase { - - protected String getJspPackageName() { - return "cust.om.tags"; - } - - protected String getWebRoot() { - return "src/test/resources/websrc"; - } - - /** - * This taglib class gets to replace the real thing. - */ - public static class MockCustomTag extends CustomTag { - public int doAfterBody() throws JspException { - try { - JspWriter out = pageContext.getOut(); - out.println("<pre>"); - out - .println("This content is coming from the mock CustomTag" - + " for timezone " + timezone); - out.println("</pre>"); - } catch (Exception e) { - throw new JspException(e); - } - return TagSupport.EVAL_PAGE; - } - } - - public void testRenderingJspUsingCustomTaglibs() throws Exception { - substituteTaglib("custom", MockCustomTag.class); - get("/taglibs/custom-taglib.jsp"); - output().shouldContain( - "This content is coming from the mock CustomTag"); - } -} Copied: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java (from rev 221, trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java) =================================================================== --- tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java (rev 0) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/java/net/sf/jsptest/acceptance/jsp/TestMockingTaglibs.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,62 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.acceptance.jsp; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import net.sf.jsptest.JspTestCase; + +/** + * @author Lasse Koskela + */ +public class TestMockingTaglibs extends JspTestCase { + + protected String getJspPackageName() { + return "cust.om.tags"; + } + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + /** + * This taglib class gets to replace the real thing. + */ + public static class MockCustomTag extends CustomTag { + public int doAfterBody() throws JspException { + try { + JspWriter out = pageContext.getOut(); + out.println("<pre>"); + out.println("This content is coming from the mock CustomTag" + + " for timezone " + timezone); + out.println("</pre>"); + } catch (Exception e) { + throw new JspException(e); + } + return TagSupport.EVAL_PAGE; + } + } + + public void testRenderingJspUsingCustomTaglibs() throws Exception { + substituteTaglib("custom", MockCustomTag.class); + get("/taglibs/custom-taglib.jsp"); + output() + .shouldContain("This content is coming from the mock CustomTag"); + } +} Deleted: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-acceptance</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-acceptance-jsp21</artifactId> - <version>0.16-SNAPSHOT</version> - <packaging>jar</packaging> - <name>Acceptance tests for the JspTest variant for the JSP 2.1 specification.</name> - <description /> - <dependencies> - <dependency> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-jsp21</artifactId> - </dependency> - </dependencies> -</project> Copied: tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml (from rev 225, trunk/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-acceptance/jsptest-acceptance-jsp21/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-acceptance</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-acceptance-jsp21</artifactId> + <version>0.17</version> + <packaging>jar</packaging> + <name>Acceptance tests for the JspTest variant for the JSP 2.1 specification.</name> + <description /> + <dependencies> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-jsp21</artifactId> + </dependency> + </dependencies> +</project> Deleted: tags/jsptest-0.17/jsptest-acceptance/pom.xml =================================================================== --- trunk/jsptest-acceptance/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-acceptance/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-acceptance</artifactId> - <name>JspTest root project for acceptance test modules</name> - <description>This POM acts as a virtual root for the acceptance test projects for different JSP specification variants of JspTest.</description> - <packaging>pom</packaging> - <modules> - <module>jsptest-acceptance-jsp12</module> - <module>jsptest-acceptance-jsp20</module> - <module>jsptest-acceptance-jsp21</module> - </modules> -</project> Copied: tags/jsptest-0.17/jsptest-acceptance/pom.xml (from rev 225, trunk/jsptest-acceptance/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-acceptance/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-acceptance/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-acceptance</artifactId> + <name>JspTest root project for acceptance test modules</name> + <description>This POM acts as a virtual root for the acceptance test projects for different JSP specification variants of JspTest.</description> + <packaging>pom</packaging> + <modules> + <module>jsptest-acceptance-jsp12</module> + <module>jsptest-acceptance-jsp20</module> + <module>jsptest-acceptance-jsp21</module> + </modules> +</project> Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml =================================================================== --- trunk/jsptest-generic/jsptest-common/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-generic</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-common</artifactId> - <version>0.16-SNAPSHOT</version> - <packaging>jar</packaging> - <name>Common utilities</name> - <description>Common utilities for the components of JspTest, including the JSP version-specific compiler implementations.</description> - <profiles> - <profile> - <id>default-tools.jar</id> - <activation> - <property> - <name>java.vendor</name> - <value>Sun Microsystems Inc.</value> - </property> - </activation> - <dependencies> - <dependency> - <groupId>com.sun</groupId> - <artifactId>tools</artifactId> - <version>1.4.2</version> - <scope>system</scope> - <systemPath>${java.home}/../lib/tools.jar</systemPath> - </dependency> - </dependencies> - </profile> - </profiles> -</project> Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml (from rev 225, trunk/jsptest-generic/jsptest-common/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-generic</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-common</artifactId> + <version>0.17</version> + <packaging>jar</packaging> + <name>Common utilities</name> + <description>Common utilities for the components of JspTest, including the JSP version-specific compiler implementations.</description> + <profiles> + <profile> + <id>default-tools.jar</id> + <activation> + <property> + <name>java.vendor</name> + <value>Sun Microsystems Inc.</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>com.sun</groupId> + <artifactId>tools</artifactId> + <version>1.4.2</version> + <scope>system</scope> + <systemPath>${java.home}/../lib/tools.jar</systemPath> + </dependency> + </dependencies> + </profile> + </profiles> +</project> Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,100 +0,0 @@ -/* - * Copyright 2007 Lasse Koskela. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.jsptest.compiler.java; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import net.sf.jsptest.utils.StreamConsumer; - -/** - * @author Lasse Koskela - */ -public class CommandLineJavac implements JavaCompiler { - - private static final String SEPARATOR = System - .getProperty("path.separator"); - - public boolean compile(String srcFile, String destDir, - String[] classpath) throws Exception { - srcFile = new File(srcFile).getCanonicalPath(); - String cp = join(classpath); - String[] command = buildCommandLine(srcFile, destDir, cp); - return execute(command); - } - - private String[] buildCommandLine(String pathToJavaSource, - String outputDirectory, String classpathString) { - return new String[] { "javac", "-classpath", classpathString, - "-d", outputDirectory, pathToJavaSource }; - } - - private String join(String[] classpath) { - StringBuffer s = new StringBuffer(); - for (int i = 0; i < classpath.length; i++) { - if (s.length() > 0) { - s.append(SEPARATOR); - } - s.append(classpath[i]); - } - return s.toString(); - } - - private boolean execute(String[] commandLine) throws IOException, - InterruptedException { - Process p = Runtime.getRuntime().exec(commandLine); - String processOutput = readOutput(p); - boolean success = (p.waitFor() == 0); - if (!success) { - System.err.println(processOutput); - } - return success; - } - - private String readOutput(final Process p) throws IOException { - try { - StringWriter output = new StringWriter(); - final PrintWriter ps = new PrintWriter(output); - Thread stderrThread = new Thread(new StreamConsumer( - "STDERR", p.getErrorStream(), ps)); - Thread stdoutThread = new Thread(new StreamConsumer( - "STDOUT", p.getInputStream(), ps)); - p.getOutputStream().close(); - stderrThread.start(); - stdoutThread.start(); - stderrThread.join(); - stdoutThread.join(); - return output.toString(); - } catch (Exception e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - return sw.toString(); - } - } - - public boolean isAvailable() { - try { - Process p = Runtime.getRuntime().exec("javac"); - String s = readOutput(p); - return s.indexOf("Usage: javac") != -1; - } catch (Exception e) { - return false; - } - } -} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java (from rev 223, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/CommandLineJavac.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,100 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.java; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import net.sf.jsptest.utils.StreamConsumer; + +/** + * @author Lasse Koskela + */ +public class CommandLineJavac implements JavaCompiler { + + private static final String SEPARATOR = System + .getProperty("path.separator"); + + public boolean compile(String srcFile, String destDir, String[] classpath) + throws Exception { + srcFile = new File(srcFile).getCanonicalPath(); + String cp = join(classpath); + String[] command = buildCommandLine(srcFile, destDir, cp); + return execute(command); + } + + private String[] buildCommandLine(String pathToJavaSource, + String outputDirectory, String classpathString) { + return new String[] { "javac", "-classpath", classpathString, "-d", + outputDirectory, pathToJavaSource }; + } + + private String join(String[] classpath) { + StringBuffer s = new StringBuffer(5000); + for (int i = 0; i < classpath.length; i++) { + if (s.length() > 0) { + s.append(SEPARATOR); + } + s.append(classpath[i]); + } + return s.toString(); + } + + private boolean execute(String[] commandLine) throws IOException, + InterruptedException { + Process p = Runtime.getRuntime().exec(commandLine); + String processOutput = readOutput(p); + boolean success = (p.waitFor() == 0); + if (!success) { + System.err.println(processOutput); + } + return success; + } + + private String readOutput(final Process p) throws IOException { + try { + StringWriter output = new StringWriter(); + final PrintWriter ps = new PrintWriter(output); + Thread stderrThread = new Thread(new StreamConsumer("STDERR", p + .getErrorStream(), ps)); + Thread stdoutThread = new Thread(new StreamConsumer("STDOUT", p + .getInputStream(), ps)); + p.getOutputStream().close(); + stderrThread.start(); + stdoutThread.start(); + stderrThread.join(); + stdoutThread.join(); + return output.toString(); + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + return sw.toString(); + } + } + + public boolean isAvailable() { + try { + Process p = Runtime.getRuntime().exec("javac"); + String s = readOutput(p); + return s.indexOf("Usage: javac") != -1; + } catch (Exception e) { + return false; + } + } +} Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,48 +0,0 @@ -/* - * Copyright 2007 Lasse Koskela. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.jsptest.compiler.java; - -/** - * The interface for Java compiler implementations. - * - * @author Lasse Koskela - */ -public interface JavaCompiler { - - /** - * Compiles the given .java source file into the given .class file using an - * explicitly set class path. - * - * @param pathToJavaSource - * Path to the source file to compile. - * @param outputDirectory - * Path to the output directory under which to generate the - * .class file - * @param classpath - * The class path to use for compilation. - */ - public abstract boolean compile(String pathToJavaSource, - String outputDirectory, String[] classpath) - throws Exception; - - /** - * Indicates whether this Java compiler implementation is available on the - * current system. - */ - public abstract boolean isAvailable(); - -} \ No newline at end of file Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java (from rev 223, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/JavaCompiler.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,47 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.java; + +/** + * The interface for Java compiler implementations. + * + * @author Lasse Koskela + */ +public interface JavaCompiler { + + /** + * Compiles the given .java source file into the given .class file using an + * explicitly set class path. + * + * @param pathToJavaSource + * Path to the source file to compile. + * @param outputDirectory + * Path to the output directory under which to generate the + * .class file + * @param classpath + * The class path to use for compilation. + */ + boolean compile(String pathToJavaSource, String outputDirectory, + String[] classpath) throws Exception; + + /** + * Indicates whether this Java compiler implementation is available on the + * current system. + */ + boolean isAvailable(); + +} \ No newline at end of file Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,70 +0,0 @@ -/** - * - */ -package net.sf.jsptest.compiler.java; - -import java.lang.reflect.Method; - -/** - * This implementation uses the java compiler from sun which ships with since the jdk since java 1.3. - * The code is inspired by the javac ant task implementation. - * - * @author mathias.broekelmann - * - */ -public class SunJavaC implements JavaCompiler { - - private static final String SEPARATOR = System.getProperty("path.separator"); - - public boolean compile(String pathToJavaSource, String outputDirectory, String[] classpath) throws Exception { - String classpathString = join(classpath); - String[] args = buildArgs(pathToJavaSource, outputDirectory, classpathString); - return compile(args); - } - - private boolean compile(String[] args) { - try { - Class compilerClass = getCompileClass(); - Method compilerMethod = resolveCompilerMethod(compilerClass); - return ((Integer)compilerMethod.invoke(compilerClass.newInstance(), new Object[] { args })).intValue() == 0; - } catch (Throwable e) { - System.err.println(e.getMessage()); - return false; - } - } - - private String[] buildArgs(String pathToJavaSource, String outputDirectory, String classpathString) { - return new String[] { "-classpath", classpathString, "-d", outputDirectory, pathToJavaSource }; - } - - private String join(String[] classpath) { - StringBuffer s = new StringBuffer(); - for (int i = 0; i < classpath.length; i++) { - if (s.length() > 0) { - s.append(SEPARATOR); - } - s.append(classpath[i]); - } - return s.toString(); - } - - public boolean isAvailable() { - try { - Class c = getCompileClass(); - resolveCompilerMethod(c); - return true; - } catch (Throwable ex) { - return false; - } - } - - private Method resolveCompilerMethod(Class compilerClass) throws NoSuchMethodException { - return compilerClass.getMethod("compile", new Class[] { (new String[] {}).getClass() }); - } - - private Class getCompileClass() throws ClassNotFoundException { - Class c = Class.forName("com.sun.tools.javac.Main"); - return c; - } - -} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java (from rev 223, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/compiler/java/SunJavaC.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,80 @@ +/** + * + */ +package net.sf.jsptest.compiler.java; + +import java.lang.reflect.Method; + +/** + * This implementation uses the java compiler from sun which ships with since + * the jdk since java 1.3. The code is inspired by the javac ant task + * implementation. + * + * @author mathias.broekelmann + * + */ +public class SunJavaC implements JavaCompiler { + + private static final String SEPARATOR = System + .getProperty("path.separator"); + + public boolean compile(String pathToJavaSource, String outputDirectory, + String[] classpath) throws Exception { + String classpathString = join(classpath); + String[] args = buildArgs(pathToJavaSource, outputDirectory, + classpathString); + return compile(args); + } + + private boolean compile(String[] args) { + try { + Class compilerClass = getCompileClass(); + Method compilerMethod = resolveCompilerMethod(compilerClass); + Object compilerInstance = compilerClass.newInstance(); + Object[] compilerArguments = new Object[] { args }; + int returnCode = ((Integer) compilerMethod.invoke(compilerInstance, + compilerArguments)).intValue(); + return returnCode == 0; + } catch (Throwable e) { + System.err.println(e.getMessage()); + return false; + } + } + + private String[] buildArgs(String pathToJavaSource, String outputDirectory, + String classpathString) { + return new String[] { "-classpath", classpathString, "-d", + outputDirectory, pathToJavaSource }; + } + + private String join(String[] classpath) { + StringBuffer s = new StringBuffer(5000); + for (int i = 0; i < classpath.length; i++) { + if (s.length() > 0) { + s.append(SEPARATOR); + } + s.append(classpath[i]); + } + return s.toString(); + } + + public boolean isAvailable() { + try { + resolveCompilerMethod(getCompileClass()); + return true; + } catch (Throwable ex) { + return false; + } + } + + private Method resolveCompilerMethod(Class compilerClass) + throws NoSuchMethodException { + return compilerClass.getMethod("compile", new Class[] { (new String[0]) + .getClass() }); + } + + private Class getCompileClass() throws ClassNotFoundException { + return Class.forName("com.sun.tools.javac.Main"); + } + +} Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,82 +0,0 @@ -package net.sf.jsptest.utils; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Enumeration; - -public class Path extends ArrayList { - - private static final String SEPARATOR = System - .getProperty("path.separator"); - - public void addSystemProperty(String name) { - String property = System.getProperty(name); - if (property != null) { - String[] systemClasspath = property.split(SEPARATOR); - for (int i = 0; i < systemClasspath.length; i++) { - String entry = systemClasspath[i]; - File file = new File(entry); - if (file.exists()) { - add(file.getAbsolutePath()); - } else { - add(entry); - } - } - } - } - - public boolean add(Object pathElement) { - if (contains(pathElement)) { - return false; - } - return super.add(pathElement); - } - - public boolean add(File file) { - return add(file.getAbsolutePath()); - } - - public String[] toStringArray() { - return (String[]) toArray(new String[size()]); - } - - public void addContainer(Class klass) { - String resource = resourcePathFor(klass); - addJarFile(klass.getResource(resource)); - try { - ClassLoader context = klass.getClassLoader(); - if (context != null) { - Enumeration en = context.getResources(resource); - while (en.hasMoreElements()) { - addJarFile((URL) en.nextElement()); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - private String resourcePathFor(Class klass) { - String resource = klass.getName().replaceAll("\\.", "/"); - return "/" + resource + ".class"; - } - - private void addJarFile(URL url) { - if (url != null) { - addJarFile(url.toExternalForm()); - } - } - - private void addJarFile(String url) { - String prefix = "jar:file:"; - if (url.startsWith(prefix)) { - String file = url.substring(prefix.length()); - if (file.contains("!")) { - file = file.substring(0, file.indexOf('!')); - } - add(new File(file)); - } - } -} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java (from rev 224, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Path.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,82 @@ +package net.sf.jsptest.utils; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; + +public class Path extends ArrayList { + + private static final String SEPARATOR = System + .getProperty("path.separator"); + + public void addSystemProperty(String name) { + String property = System.getProperty(name); + if (property != null) { + String[] systemClasspath = property.split(SEPARATOR); + for (int i = 0; i < systemClasspath.length; i++) { + String entry = systemClasspath[i]; + File file = new File(entry); + if (file.exists()) { + add(file.getAbsolutePath()); + } else { + add(entry); + } + } + } + } + + public boolean add(Object pathElement) { + if (contains(pathElement)) { + return false; + } + return super.add(pathElement); + } + + public boolean add(File file) { + return add(file.getAbsolutePath()); + } + + public String[] toStringArray() { + return (String[]) toArray(new String[size()]); + } + + public void addContainer(Class klass) { + String resource = resourcePathFor(klass); + addJarFile(klass.getResource(resource)); + try { + ClassLoader context = klass.getClassLoader(); + if (context != null) { + Enumeration en = context.getResources(resource); + while (en.hasMoreElements()) { + addJarFile((URL) en.nextElement()); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + private String resourcePathFor(Class klass) { + String resource = klass.getName().replaceAll("\\.", "/"); + return "/" + resource + ".class"; + } + + private void addJarFile(URL url) { + if (url != null) { + addJarFile(url.toExternalForm()); + } + } + + private void addJarFile(String url) { + String prefix = "jar:file:"; + if (url.startsWith(prefix)) { + String file = url.substring(prefix.length()); + if (file.indexOf("!") > -1) { + file = file.substring(0, file.indexOf('!')); + } + add(new File(file)); + } + } +} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Strings.java (from rev 224, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Strings.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Strings.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/Strings.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,18 @@ +package net.sf.jsptest.utils; + +public class Strings { + + public static String replace(String fromWhere, String what, String withWhat) { + if (what.length() > 0) { + int indexOfWhat = fromWhere.indexOf(what); + if (indexOfWhat != -1) { + String beforeMatch = fromWhere.substring(0, indexOfWhat); + String afterMatch = fromWhere.substring(indexOfWhat + + what.length()); + fromWhere = beforeMatch + withWhat + + replace(afterMatch, what, withWhat); + } + } + return fromWhere; + } +} Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java =================================================================== --- trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,32 +0,0 @@ -package net.sf.jsptest.utils; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Node; - -public class XML { - - private static final String APACHE_INDENTATION = "{http://xml.apache.org/xslt}indent-amount"; - - public static String toString(Node xml) { - try { - TransformerFactory f = TransformerFactory.newInstance(); - Transformer t = f.newTransformer(); - t.setOutputProperty(OutputKeys.INDENT, "yes"); - t.setOutputProperty(APACHE_INDENTATION, "2"); - OutputStream out = new ByteArrayOutputStream(); - t.transform(new DOMSource(xml), new StreamResult(out)); - return out.toString(); - } catch (TransformerException e) { - throw new RuntimeException(e); - } - } -} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java (from rev 224, trunk/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/main/java/net/sf/jsptest/utils/XML.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,48 @@ +package net.sf.jsptest.utils; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class XML { + + private static final String APACHE_INDENTATION = "{http://xml.apache.org/xslt}indent-amount"; + + public static String toString(Node xml) { + try { + TransformerFactory f = TransformerFactory.newInstance(); + Transformer t = f.newTransformer(); + t.setOutputProperty(OutputKeys.INDENT, "yes"); + t.setOutputProperty(APACHE_INDENTATION, "2"); + OutputStream out = new ByteArrayOutputStream(); + t.transform(new DOMSource(xml), new StreamResult(out)); + return out.toString(); + } catch (TransformerException e) { + throw new RuntimeException(e); + } + } + + public static String textContentOf(Element element) { + StringBuffer textContent = new StringBuffer(100); + NodeList children = element.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + textContent.append(textContentOf((Element) child)); + } else { + textContent.append(child.getNodeValue().trim()); + } + } + return textContent.toString(); + } +} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/StringsTest.java (from rev 224, trunk/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/StringsTest.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/StringsTest.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/StringsTest.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,35 @@ +package net.sf.jsptest.utils; + +import junit.framework.TestCase; + +public class StringsTest extends TestCase { + + public void testReplacingNonexistentNeedle() throws Exception { + assertEquals("no such thing here", Strings.replace( + "no such thing here", "needle", "foo")); + } + + public void testReplacingOneInstance() throws Exception { + assertEquals("Macs are cool", Strings.replace("what are cool", "what", + "Macs")); + } + + public void testReplacingMultipleInstances() throws Exception { + assertEquals("Macs and Macs are cool", Strings.replace( + "what and what are cool", "what", "Macs")); + } + + public void testReplacingWithTheSameValue() throws Exception { + assertEquals("abcabcabc", Strings.replace("abcabcabc", "bc", "bc")); + } + + public void testReplacingWithSomethingThatContainsTheSameValue() + throws Exception { + assertEquals("a_bc_a_bc_a_bc_", Strings.replace("abcabcabc", "bc", + "_bc_")); + } + + public void testReplacingEmptyStrings() throws Exception { + assertEquals("", Strings.replace("", "", "")); + } +} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/XMLTest.java (from rev 224, trunk/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/XMLTest.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/XMLTest.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-common/src/test/java/net/sf/jsptest/utils/XMLTest.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,43 @@ +package net.sf.jsptest.utils; + +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import junit.framework.TestCase; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + +public class XMLTest extends TestCase { + + public void testCollectingTextContentForEmptyElement() throws Exception { + Element element = parse("<root></root>"); + assertEquals("", XML.textContentOf(element)); + } + + public void testCollectingTextContentForNonEmptyElement() throws Exception { + Element element = parse("<parent>text</parent>"); + assertEquals("text", XML.textContentOf(element)); + } + + public void testCollectingTextContentElementWithChildren() throws Exception { + Element element = parse("<parent>parent<child>child</child></parent>"); + assertEquals("parentchild", XML.textContentOf(element)); + } + + public void testWhitespaceBetweenTextNodesIsRemoved() throws Exception { + Element element = parse("<parent>\n parent\n <child>\n child\n </child>\n</parent>"); + assertEquals("parentchild", XML.textContentOf(element)); + } + + private Element parse(String xmlSnippet) throws Exception { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder parser = dbf.newDocumentBuilder(); + String xml = "<?xml version='1.0'?>\n" + xmlSnippet; + Document doc = parser.parse(new InputSource(new StringReader(xml))); + return doc.getDocumentElement(); + } +} Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml =================================================================== --- trunk/jsptest-generic/jsptest-compiler-api/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-generic</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-compiler-api</artifactId> - <version>0.16-SNAPSHOT</version> - <packaging>jar</packaging> - <name>Internal compiler API</name> - <description>A common internal API for the different versions of JSP version-specific compilers.</description> -</project> Copied: tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml (from rev 225, trunk/jsptest-generic/jsptest-compiler-api/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-generic</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-compiler-api</artifactId> + <version>0.17</version> + <packaging>jar</packaging> + <name>Internal compiler API</name> + <description>A common internal API for the different versions of JSP version-specific compilers.</description> +</project> Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java =================================================================== --- trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java 2008-04-24 17:15:35 UTC (rev 226) @@ -1,8 +0,0 @@ -package net.sf.jsptest.compiler.api; - -import java.io.File; - -public interface JspExecution { - - File getRenderedResponse(); -} Copied: tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java (from rev 222, trunk/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-compiler-api/src/main/java/net/sf/jsptest/compiler/api/JspExecution.java 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,6 @@ +package net.sf.jsptest.compiler.api; + +public interface JspExecution { + + String getRenderedResponse(); +} Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml =================================================================== --- trunk/jsptest-generic/jsptest-framework/pom.xml 2008-04-14 12:41:31 UTC (rev 217) +++ tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-generic</artifactId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>jsptest-framework</artifactId> - <version>0.16-SNAPSHOT</version> - <packaging>jar</packaging> - <name>Core framework</name> - <description>The core framework functionality for JspTest.</description> - <dependencies> - <dependency> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-compiler-api</artifactId> - <version>0.16-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>net.sf.jsptest</groupId> - <artifactId>jsptest-common</artifactId> - <version>0.16-SNAPSHOT</version> - </dependency> - </dependencies> -</project> Copied: tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml (from rev 225, trunk/jsptest-generic/jsptest-framework/pom.xml) =================================================================== --- tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml (rev 0) +++ tags/jsptest-0.17/jsptest-generic/jsptest-framework/pom.xml 2008-04-24 17:15:35 UTC (rev 226) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-generic</artifactId> + <version>0.17</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>jsptest-framework</artifactId> + <version>0.17</version> + <packaging>jar</packaging> + <name>Core framework</name> + <description>The core framework functionality for JspTest.</description> + <dependencies> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-compiler-api</artifactId> + <version>0.17</version> + </dependency> + <dependency> + <groupId>net.sf.jsptest</groupId> + <artifactId>jsptest-common</artifactId> + <version>0.17</version> + </dependency> + </dependencies> +</project> Deleted: tags/jsptest-0.17/jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest... [truncated message content] |