commit 025531dea76ecaaa07b3194b2c83c7a8acf813c8 Author: gil puntogil@libero.it Date: Sun Jul 15 10:40:34 2012 +0200
Initial import (#826645)
.gitignore | 1 + sources | 1 + velocity-tools-2.0-depmap | 26 +++ velocity-tools-2.0-dont_copy_test_lib.patch | 38 +++++ velocity-tools-2.0-junit4.patch | 241 +++++++++++++++++++++++++++ velocity-tools-2.0-pom.patch | 17 ++ velocity-tools-2.0-servlet.patch | 11 ++ velocity-tools.spec | 129 ++++++++++++++ 8 files changed, 464 insertions(+), 0 deletions(-) --- diff --git a/.gitignore b/.gitignore index e69de29..b7a043b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/velocity-tools-2.0-src.tar.gz diff --git a/sources b/sources index e69de29..bcc705a 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +883ff873be49f55b53cae8eb0d115608 velocity-tools-2.0-src.tar.gz diff --git a/velocity-tools-2.0-depmap b/velocity-tools-2.0-depmap new file mode 100644 index 0000000..945ed7a --- /dev/null +++ b/velocity-tools-2.0-depmap @@ -0,0 +1,26 @@ +<dependencies> +<dependency> + <maven> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>7.0.27</version> + </maven> + <jpp> + <groupId>JPP</groupId> + <artifactId>tomcat-servlet-3.0-api</artifactId> + <version>7.0.27</version> + </jpp> +</dependency> +<dependency> + <maven> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-jsp-api</artifactId> + <version>7.0.27</version> + </maven> + <jpp> + <groupId>JPP</groupId> + <artifactId>tomcat-jsp-2.2-api</artifactId> + <version>7.0.27</version> + </jpp> +</dependency> +</dependencies> \ No newline at end of file diff --git a/velocity-tools-2.0-dont_copy_test_lib.patch b/velocity-tools-2.0-dont_copy_test_lib.patch new file mode 100644 index 0000000..4580c5b --- /dev/null +++ b/velocity-tools-2.0-dont_copy_test_lib.patch @@ -0,0 +1,38 @@ +diff -Nru velocity-tools-2.0-src/download.xml velocity-tools-2.0-src-gil/download.xml +--- velocity-tools-2.0-src/download.xml 2008-11-30 17:51:06.000000000 +0100 ++++ velocity-tools-2.0-src-gil/download.xml 2011-09-10 15:26:35.088480329 +0200 +@@ -352,8 +352,6 @@ + <property name="download.version" value="${jar.js.version}" /> + <property name="download.path" value="rhino/${download.groupId}/${download.version}" /> + <antcall target="http-test-m1-download"/> +- <!-- httpunit wants a file named 'js.jar' --> +- <copy file="${test.lib.dir}/${download.groupId}-${download.version}.jar" tofile="${test.lib.dir}/js.jar"/> + </target> + + <target name="junit-download"> +diff -Nru velocity-tools-2.0-src/examples.xml velocity-tools-2.0-src-gil/examples.xml +--- velocity-tools-2.0-src/examples.xml 2008-11-17 21:11:23.000000000 +0100 ++++ velocity-tools-2.0-src-gil/examples.xml 2011-09-10 15:26:35.089480329 +0200 +@@ -53,13 +53,6 @@ + </target> + <target name="simple-dependencies"> + <copy todir="${lib}" file="${dist.dir}/${view.id}.jar"/> +- <copy todir="${lib}" file="${commons-beanutils.jar}"/> +- <copy todir="${lib}" file="${commons-collections.jar}"/> +- <copy todir="${lib}" file="${commons-digester.jar}"/> +- <copy todir="${lib}" file="${commons-lang.jar}"/> +- <copy todir="${lib}" file="${commons-logging.jar}"/> +- <copy todir="${lib}" file="${oro.jar}"/> +- <copy todir="${lib}" file="${velocity.jar}"/> + </target> + + <target name="showcase-example"> +@@ -69,8 +62,6 @@ + <antcall target="example-${target}"/> + </target> + <target name="showcase-dependencies" depends="simple-dependencies"> +- <copy todir="${lib}" file="${dom4j.jar}"/> +- <copy todir="${lib}" file="${servlet.jar}"/> + </target> + + <target name="struts-example"> diff --git a/velocity-tools-2.0-junit4.patch b/velocity-tools-2.0-junit4.patch new file mode 100644 index 0000000..f7d1fb0 --- /dev/null +++ b/velocity-tools-2.0-junit4.patch @@ -0,0 +1,241 @@ +diff -Nru velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/DisplayToolTests.java velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/DisplayToolTests.java +--- velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/DisplayToolTests.java 2009-05-12 00:24:52.000000000 +0200 ++++ velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/DisplayToolTests.java 2011-09-10 15:29:12.534469474 +0200 +@@ -119,11 +119,11 @@ + display.configure(conf); + assertEquals(";", display.getListDelimiter()); + assertEquals(" und ", display.getListFinalDelimiter()); +- assertEquals(5, display.getTruncateLength()); ++ assertEquals((double)5, display.getTruncateLength()); + assertEquals(">", display.getTruncateSuffix()); + assertEquals(true, display.getTruncateAtWord()); + assertEquals("~", display.getCellSuffix()); +- assertEquals(4, display.getCellLength()); ++ assertEquals((double)4, display.getCellLength()); + assertEquals("n/a", display.getDefaultAlternate()); + String[] tags = display.getAllowedTags(); + assertNotNull(tags); +@@ -142,14 +142,14 @@ + assertNull(display.measure(null)); + DisplayTool.Measurements dims = display.measure(""); + assertNotNull(dims); +- assertEquals(1, dims.getHeight()); +- assertEquals(0, dims.getWidth()); ++ assertEquals((double)1, dims.getHeight()); ++ assertEquals((double)0, dims.getWidth()); + dims = display.measure("twelve chars"); +- assertEquals(12, dims.getWidth()); +- assertEquals(1, dims.getHeight()); ++ assertEquals((double)12, dims.getWidth()); ++ assertEquals((double)1, dims.getHeight()); + dims = display.measure("one\ntwo\nthree"); +- assertEquals(5, dims.getWidth()); +- assertEquals(3, dims.getHeight()); ++ assertEquals((double)5, dims.getWidth()); ++ assertEquals((double)3, dims.getHeight()); + } + + public @Test void methodMessage_StringObjectVarArgs() throws Exception +@@ -242,7 +242,7 @@ + { + DisplayTool display = new DisplayTool(); + display.setCellLength(10); +- assertEquals(10, display.getCellLength()); ++ assertEquals((double)10, display.getCellLength()); + } + + public @Test void methodSetCellSuffix_String() throws Exception +@@ -277,7 +277,7 @@ + { + DisplayTool display = new DisplayTool(); + display.setTruncateLength(5); +- assertEquals(5, display.getTruncateLength()); ++ assertEquals((double)5, display.getTruncateLength()); + } + + public @Test void methodSetTruncateSuffix_String() throws Exception +@@ -457,4 +457,4 @@ + } + } + +-} +\ Manca newline alla fine del file ++} +diff -Nru velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/LinkToolTests.java velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/LinkToolTests.java +--- velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/LinkToolTests.java 2009-05-12 00:24:52.000000000 +0200 ++++ velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/LinkToolTests.java 2011-09-10 15:29:12.535469474 +0200 +@@ -248,7 +248,7 @@ + LinkTool link = newInstance(); + assertNull(link.getPort()); + link = newInstance(LinkTool.PORT_KEY, 42); +- assertEquals(42, link.getPort()); ++ assertEquals(new Integer(42), link.getPort()); + } + + public @Test void methodPort_Object() throws Exception +@@ -256,15 +256,15 @@ + LinkTool link = newInstance(); + assertNull(link.port(null).getPort()); + assertNull(link.port(":asd").getPort()); +- assertEquals(1, link.port(1).getPort()); +- assertEquals(42, link.port("42").getPort()); ++ assertEquals(new Integer(1), link.port(1).getPort()); ++ assertEquals(new Integer(42), link.port("42").getPort()); + } + + public @Test void methodSetPort_Object() throws Exception + { + LinkTool link = newInstance(); + link.setPort(42); +- assertEquals(42, link.getPort()); ++ assertEquals(new Integer(42), link.getPort()); + } + + public @Test void methodGetPath() throws Exception +@@ -845,4 +845,4 @@ + } + + } +- +\ Manca newline alla fine del file ++ +diff -Nru velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/LoopToolTests.java velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/LoopToolTests.java +--- velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/generic/LoopToolTests.java 2009-05-12 00:24:52.000000000 +0200 ++++ velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/generic/LoopToolTests.java 2011-09-10 15:29:12.536469474 +0200 +@@ -323,45 +323,45 @@ + { + LoopTool loop = new LoopTool(); + Iterator i = loop.watch(ARRAY); +- assertEquals(0, loop.getCount()); ++ assertEquals(new Integer(0), loop.getCount()); + assertNull(loop.getIndex()); + i.next(); +- assertEquals(1, loop.getCount()); +- assertEquals(0, loop.getIndex()); ++ assertEquals(new Integer(1), loop.getCount()); ++ assertEquals(new Integer(0), loop.getIndex()); + i.next(); +- assertEquals(2, loop.getCount()); +- assertEquals(1, loop.getIndex()); ++ assertEquals(new Integer(2), loop.getCount()); ++ assertEquals(new Integer(1), loop.getIndex()); + i.next(); +- assertEquals(3, loop.getCount()); +- assertEquals(2, loop.getIndex()); ++ assertEquals(new Integer(3), loop.getCount()); ++ assertEquals(new Integer(2), loop.getIndex()); + loop.pop(); + // test that skipped iterations are still included + i = loop.watch(ARRAY); + loop.skip(2); +- assertEquals(2, loop.getCount()); +- assertEquals(1, loop.getIndex()); ++ assertEquals(new Integer(2), loop.getCount()); ++ assertEquals(new Integer(1), loop.getIndex()); + } + + public @Test void methodGetCountOrGetIndex_String() throws Exception + { + LoopTool loop = new LoopTool(); + Iterator i = loop.watch(ARRAY, "i"); +- assertEquals(0, loop.getCount("i")); ++ assertEquals(new Integer(0), loop.getCount("i")); + assertNull(loop.getIndex("i")); + i.next(); +- assertEquals(1, loop.getCount("i")); +- assertEquals(0, loop.getIndex("i")); ++ assertEquals(new Integer(1), loop.getCount("i")); ++ assertEquals(new Integer(0), loop.getIndex("i")); + Iterator j = loop.watch(ARRAY, "j"); + loop.skip(2); +- assertEquals(2, loop.getCount("j")); +- assertEquals(1, loop.getIndex("j")); +- assertEquals(1, loop.getCount("i")); +- assertEquals(0, loop.getIndex("i")); ++ assertEquals(new Integer(2), loop.getCount("j")); ++ assertEquals(new Integer(1), loop.getIndex("j")); ++ assertEquals(new Integer(1), loop.getCount("i")); ++ assertEquals(new Integer(0), loop.getIndex("i")); + // check short syntax too +- assertEquals(2, loop.get("count_j")); +- assertEquals(1, loop.get("index_j")); +- assertEquals(1, loop.get("count_i")); +- assertEquals(0, loop.get("index_i")); ++ assertEquals(new Integer(2), loop.get("count_j")); ++ assertEquals(new Integer(1), loop.get("index_j")); ++ assertEquals(new Integer(1), loop.get("count_i")); ++ assertEquals(new Integer(0), loop.get("index_i")); + } + + public @Test void aliasMethods() throws Exception +@@ -403,15 +403,15 @@ + public @Test void method_getDepth() throws Exception + { + LoopTool loop = new LoopTool(); +- assertEquals(0, loop.getDepth()); ++ assertEquals((double)0, loop.getDepth()); + loop.watch(ARRAY); +- assertEquals(1, loop.getDepth()); ++ assertEquals((double)1, loop.getDepth()); + loop.watch(ARRAY); +- assertEquals(2, loop.getDepth()); ++ assertEquals((double)2, loop.getDepth()); + loop.pop(); +- assertEquals(1, loop.getDepth()); ++ assertEquals((double)1, loop.getDepth()); + loop.pop(); +- assertEquals(0, loop.getDepth()); ++ assertEquals((double)0, loop.getDepth()); + } + + } +diff -Nru velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java +--- velocity-tools-2.0-src/src/test/java/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java 2008-12-02 17:45:13.000000000 +0100 ++++ velocity-tools-2.0-src-gil/src/test/java/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java 2011-09-10 15:29:12.533469474 +0200 +@@ -78,9 +78,9 @@ + assertEquals(disp,dateTool.format(date)); + assertEquals(disp2,dateTool.format("yyyy/MM/dd",date)); + /* test parsing */ +- assertEquals(2007,dateTool.getYear(disp)); +- assertEquals(0,dateTool.getMonth(disp)); +- assertEquals(2,dateTool.getDay(disp)); ++ assertEquals(new Integer(2007), dateTool.getYear(disp)); ++ assertEquals(new Integer(0), dateTool.getMonth(disp)); ++ assertEquals(new Integer(2), dateTool.getDay(disp)); + } + + public @Test void testEscapeTool() { +@@ -147,24 +147,24 @@ + assertNotNull(mathTool); + assertEquals(1,mathTool.abs(-1)); + assertEquals(2,mathTool.add(1,1)); +- assertEquals(3,mathTool.ceil(2.5)); ++ assertEquals(new Integer(3),mathTool.ceil(2.5)); + assertEquals(4,mathTool.div(8,2)); +- assertEquals(5,mathTool.floor(5.1)); ++ assertEquals(new Integer(5),mathTool.floor(5.1)); + assertEquals(6,mathTool.getAverage(new long[] {5,6,7})); + /* getTotal() watches the type of its first argument, so assertEquals needs a long */ + assertEquals((long)7,mathTool.getTotal(new long[] {2,2,3})); +- assertEquals(8,mathTool.idiv(130,16)); ++ assertEquals(new Integer(8),mathTool.idiv(130,16)); + assertEquals(9,mathTool.max(9,-10)); + assertEquals(10,mathTool.min(10,20)); +- assertEquals(11,mathTool.mod(37,13)); ++ assertEquals(new Integer(11),mathTool.mod(37,13)); + assertEquals(12,mathTool.mul(3,4)); +- assertEquals(13,mathTool.round(12.8)); +- assertEquals(14.2,mathTool.roundTo(1,14.18)); +- assertEquals(-5.0,mathTool.roundTo(2,-4.999)); ++ assertEquals(new Integer(13),mathTool.round(12.8)); ++ assertEquals(new Double(14.2),mathTool.roundTo(1,14.18)); ++ assertEquals(new Double(-5.0),mathTool.roundTo(2,-4.999)); + assertEquals(15,mathTool.sub(30,15)); + assertEquals(16,mathTool.pow(4,2)); +- assertEquals(17,mathTool.toInteger("17")); +- assertEquals(18.1,mathTool.toDouble("18.1")); ++ assertEquals(new Integer(17),mathTool.toInteger("17")); ++ assertEquals(new Double(18.1),mathTool.toDouble("18.1")); + } + + public @Test void testNumberTool() { diff --git a/velocity-tools-2.0-pom.patch b/velocity-tools-2.0-pom.patch new file mode 100644 index 0000000..5d223da --- /dev/null +++ b/velocity-tools-2.0-pom.patch @@ -0,0 +1,17 @@ +--- pom.xml 2010-04-12 19:07:00.000000000 +0200 ++++ pom.xml-gil 2012-05-27 05:46:03.422196231 +0200 +@@ -418,7 +418,13 @@ + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> +- <version>2.3</version> ++ <version>7.0.27</version> ++ <scope>provided</scope> ++ </dependency> ++ <dependency> ++ <groupId>org.apache.tomcat</groupId> ++ <artifactId>tomcat-jsp-api</artifactId> ++ <version>7.0.27</version> + <scope>provided</scope> + </dependency> + <dependency> diff --git a/velocity-tools-2.0-servlet.patch b/velocity-tools-2.0-servlet.patch new file mode 100644 index 0000000..a1f14c2 --- /dev/null +++ b/velocity-tools-2.0-servlet.patch @@ -0,0 +1,11 @@ +--- src/main/java/org/apache/velocity/tools/view/ParameterTool.java 2009-05-12 00:24:53.000000000 +0200 ++++ src/main/java/org/apache/velocity/tools/view/ParameterTool.java-gil 2012-05-30 17:19:25.741937122 +0200 +@@ -174,7 +174,7 @@ + Map source = super.getSource(); + if (source == null) + { +- source = expandSingletonArrays(getRequest().getParameterMap()); ++ source = expandSingletonArrays((Map<String,Object>)(Object)getRequest().getParameterMap()); + super.setSource(source); + } + return source; diff --git a/velocity-tools.spec b/velocity-tools.spec new file mode 100644 index 0000000..e429c22 --- /dev/null +++ b/velocity-tools.spec @@ -0,0 +1,129 @@ +Name: velocity-tools +Version: 2.0 +Release: 1%{?dist} +Summary: Collection of useful tools for Velocity template engine +Group: Development/Libraries +License: ASL 2.0 +Url: http://velocity.apache.org/tools/releases/2.0/ +Source0: http://www.apache.org/dist/velocity/tools/%%7Bversion%7D/%%7Bname%7D-%%7Bver... +# force tomcat 7.x apis +Source1: velocity-tools-2.0-depmap +Patch0: %{name}-%{version}-junit4.patch +# add org.apache.tomcat tomcat-jsp-api 7.0.27 +Patch1: %{name}-%{version}-pom.patch +Patch2: %{name}-%{version}-dont_copy_test_lib.patch +# servlet 3.0 support thanks to mizdebsk +Patch3: %{name}-%{version}-servlet.patch + +BuildRequires: java-devel +BuildRequires: jpackage-utils + +BuildRequires: apache-commons-beanutils +BuildRequires: apache-commons-chain +BuildRequires: apache-commons-collections +BuildRequires: apache-commons-digester +BuildRequires: apache-commons-lang +BuildRequires: apache-commons-logging +BuildRequires: apache-commons-validator +BuildRequires: jakarta-oro +BuildRequires: dom4j +BuildRequires: sslext +# core taglib tiles +BuildRequires: struts +BuildRequires: tomcat-jsp-2.2-api +BuildRequires: tomcat-servlet-3.0-api +BuildRequires: velocity + + +# test deps +# httpunit httpunit 1.6.1 +# org.mortbay.jetty jetty-embedded 6.0.1 +# nekohtml nekohtml 0.9.5 +# rhino js 1.6R5 +# xerces xercesImpl 2.8.1 +# xerces xmlParserAPIs 2.6.2 +BuildRequires: junit + +BuildRequires: maven +BuildRequires: maven-compiler-plugin +BuildRequires: maven-install-plugin +BuildRequires: maven-jar-plugin +BuildRequires: maven-javadoc-plugin +BuildRequires: maven-resources-plugin +BuildRequires: maven-surefire-plugin + +Requires: apache-commons-beanutils +Requires: apache-commons-chain +Requires: apache-commons-collections +Requires: apache-commons-digester +Requires: apache-commons-lang +Requires: apache-commons-logging +Requires: apache-commons-validator +Requires: jakarta-oro +Requires: dom4j +Requires: sslext +Requires: struts +Requires: tomcat-jsp-2.2-api +Requires: tomcat-servlet-3.0-api +Requires: velocity + +Requires: java +Requires: jpackage-utils +BuildArch: noarch + +%description +The VelocityTools project is a collection of useful Java classes (aka tools), +as well as infrastructure to easily, automatically and transparently +make these tools available to Velocity templates. + +Project include easy integration of Velocity into the view-layer of +web applications (via the VelocityViewTag and +VelocityViewServlet) and integration with Struts 1.x applications. + +%package javadoc +Group: Documentation +Summary: Javadoc for %{name} +Requires: jpackage-utils + +%description javadoc +This package contains javadoc for %{name}. + +%prep +%setup -q -n %{name}-%{version}-src +find . -name "*.jar" -delete +find . -name "*.class" -delete +%patch0 -p1 +%patch1 -p0 +%patch2 -p1 +%patch3 -p0 +sed -i 's/\r//' LICENSE NOTICE WHY_THREE_JARS.txt + +%build +# tests skipped. cause: missing dependencies +mvn-rpmbuild -Dproject.build.sourceEncoding=UTF-8 -Dmaven.local.depmap.file="%{SOURCE1}" -Dmaven.test.skip=true install javadoc:aggregate + +%install + +mkdir -p %{buildroot}%{_javadir} +install -pm 644 dist/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar + +mkdir -p %{buildroot}%{_mavenpomdir} +install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom +%add_maven_depmap JPP-%{name}.pom %{name}.jar -a "%{name}:%{name},org.apache.velocity:%{name}-generic,%{name}:%{name}-generic,%{name}:%{name}-view,org.apache.velocity:%{name}-view" + +mkdir -p %{buildroot}%{_javadocdir}/%{name} +cp -pr dist/site/apidocs/* %{buildroot}%{_javadocdir}/%{name} + +%files +%{_javadir}/%{name}.jar +%{_mavenpomdir}/JPP-%{name}.pom +%{_mavendepmapfragdir}/%{name} +%doc CONTRIBUTORS LICENSE NOTICE README.txt STATUS WHY_THREE_JARS.txt + +%files javadoc +%{_javadocdir}/%{name} +%doc LICENSE NOTICE + +%changelog +* Sun May 27 2012 gil cattaneo puntogil@libero.it 2.0-1 +- initial rpm \ No newline at end of file
java-sig-commits@lists.fedoraproject.org