svn commit: r1804360 - in /velocity/tools/trunk: pom.xml velocity-tools-assembly/ velocity-tools-uberjar/
Author: cbrisson Date: Mon Aug 7 21:09:37 2017 New Revision: 1804360 URL: http://svn.apache.org/viewvc?rev=1804360&view=rev Log: [tools] Getting rid of uberjar and assembly modules Removed: velocity/tools/trunk/velocity-tools-assembly/ velocity/tools/trunk/velocity-tools-uberjar/ Modified: velocity/tools/trunk/pom.xml Modified: velocity/tools/trunk/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/pom.xml?rev=1804360&r1=1804359&r2=1804360&view=diff == --- velocity/tools/trunk/pom.xml (original) +++ velocity/tools/trunk/pom.xml Mon Aug 7 21:09:37 2017 @@ -130,9 +130,7 @@ velocity-tools-generic velocity-tools-view velocity-tools-view-jsp -velocity-tools-uberjar velocity-tools-examples -velocity-tools-assembly
svn commit: r1804359 - /velocity/tools/trunk/velocity-tools-generic/pom.xml
Author: cbrisson Date: Mon Aug 7 21:04:40 2017 New Revision: 1804359 URL: http://svn.apache.org/viewvc?rev=1804359&view=rev Log: [tools] Tools 3.0-SNAPSHOT can now rely on engine 2.0 Modified: velocity/tools/trunk/velocity-tools-generic/pom.xml Modified: velocity/tools/trunk/velocity-tools-generic/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/pom.xml?rev=1804359&r1=1804358&r2=1804359&view=diff == --- velocity/tools/trunk/velocity-tools-generic/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-generic/pom.xml Mon Aug 7 21:04:40 2017 @@ -70,7 +70,7 @@ org.apache.velocity velocity-engine-core - 2.0-SNAPSHOT + 2.0 commons-beanutils
svn commit: r1804358 - in /velocity/site/production/engine: 2.0/build.html devel/build.html
Author: cbrisson Date: Mon Aug 7 20:53:23 2017 New Revision: 1804358 URL: http://svn.apache.org/viewvc?rev=1804358&view=rev Log: [site] Fix deprecations in build page (production) Modified: velocity/site/production/engine/2.0/build.html velocity/site/production/engine/devel/build.html Modified: velocity/site/production/engine/2.0/build.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/2.0/build.html?rev=1804358&r1=1804357&r2=1804358&view=diff == --- velocity/site/production/engine/2.0/build.html (original) +++ velocity/site/production/engine/2.0/build.html Mon Aug 7 20:53:23 2017 @@ -224,13 +224,11 @@ h2:hover > .headerlink, h3:hover > .head } h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible } Installation¶ -Velocity runs on a variety of platforms that have installed the Java Virtual Machine. The Java Development Kit version 1.6 is required for users who want to compile Velocity from its source code. +Velocity runs on a variety of platforms that have installed the Java Virtual Machine. A Java Development Kit version 1.7+ is required to compile Velocity from its source code (as it is to run it). Everything required to build Velocity comes with the distribution, which can be obtained from http://svn.apache.org/repos/asf/velocity/engine/";>Subversion or from the main distribution. However, you will need to install http://maven.apache.org/";>Maven to build the Velocity sources. -http://maven.apache.org/";>Maven is also an Apache project. To build Apache Velocity, you need at least Version 2.2.1 of Apache Maven. +http://maven.apache.org/";>Maven is also an Apache project. To build Apache Velocity, you need at least Version 3.0.5 of Apache Maven. Required Tools¶ -To build Velocity we require http://maven.apache.org/";>Maven version 2.2.1 or higher (Maven 3 can be used too) to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. -Velocity requires JDK 1.6 or greater to compile. -Finally, if you wish to modify Velocity's grammar you will need to a tool called http://javacc.dev.java.net";>JavaCC. We recommend version 3.2 or greater. +To build Velocity we require http://maven.apache.org/";>Maven version 3.0.5 or higher to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. Building¶ In each case below, it is assumed that you were successful in getting the distribution from Subversion, and were successful in unpacking. Also, it is assumed that you are starting in the 'velocity' directory, the root of the distribution tree. All directory references will be relative to 'velocity'. Change to the build directory (cd build). Then, to build the jar file, simply type: Modified: velocity/site/production/engine/devel/build.html URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/build.html?rev=1804358&r1=1804357&r2=1804358&view=diff == --- velocity/site/production/engine/devel/build.html (original) +++ velocity/site/production/engine/devel/build.html Mon Aug 7 20:53:23 2017 @@ -224,13 +224,11 @@ h2:hover > .headerlink, h3:hover > .head } h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible } Installation¶ -Velocity runs on a variety of platforms that have installed the Java Virtual Machine. The Java Development Kit version 1.6 is required for users who want to compile Velocity from its source code. +Velocity runs on a variety of platforms that have installed the Java Virtual Machine. A Java Development Kit version 1.7+ is required to compile Velocity from its source code (as it is to run it). Everything required to build Velocity comes with the distribution, which can be obtained from http://svn.apache.org/repos/asf/velocity/engine/";>Subversion or from the main distribution. However, you will need to install http://maven.apache.org/";>Maven to build the Velocity sources. -http://maven.apache.org/";>Maven is also an Apache project. To build Apache Velocity, you need at least Version 2.2.1 of Apache Maven. +http://maven.apache.org/";>Maven is also an Apache project. To build Apache Velocity, you need at least Version 3.0.5 of Apache Maven. Required Tools¶ -To build Velocity we require http://maven.apache.org/";>Maven version 2.2.1 or higher (Maven 3 can be used too) to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. -Velocity requires JDK 1.6 or greater to comp
svn commit: r1804357 - in /velocity/site/cms/trunk/content/engine: 2.0/build.mdtext devel/build.mdtext
Author: cbrisson Date: Mon Aug 7 20:52:42 2017 New Revision: 1804357 URL: http://svn.apache.org/viewvc?rev=1804357&view=rev Log: [site] Fix deprecations in build page Modified: velocity/site/cms/trunk/content/engine/2.0/build.mdtext velocity/site/cms/trunk/content/engine/devel/build.mdtext Modified: velocity/site/cms/trunk/content/engine/2.0/build.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/2.0/build.mdtext?rev=1804357&r1=1804356&r2=1804357&view=diff == --- velocity/site/cms/trunk/content/engine/2.0/build.mdtext (original) +++ velocity/site/cms/trunk/content/engine/2.0/build.mdtext Mon Aug 7 20:52:42 2017 @@ -2,19 +2,15 @@ Title: Apache Velocity Engine - Building ## Installation -Velocity runs on a variety of platforms that have installed the Java Virtual Machine. The Java Development Kit version 1.6 is required for users who want to compile Velocity from its source code. +Velocity runs on a variety of platforms that have installed the Java Virtual Machine. A Java Development Kit version 1.7+ is required to compile Velocity from its source code (as it is to run it). Everything required to build Velocity comes with the distribution, which can be obtained from [Subversion](http://svn.apache.org/repos/asf/velocity/engine/) or from the [main distribution](/download.cgi#engine). However, you will need to install [Maven](http://maven.apache.org/) to build the Velocity sources. -[Maven](http://maven.apache.org/) is also an Apache project. To build Apache Velocity, you need at least Version 2.2.1 of Apache Maven. +[Maven](http://maven.apache.org/) is also an Apache project. To build Apache Velocity, you need at least Version 3.0.5 of Apache Maven. ## Required Tools -To build Velocity we require [Maven](http://maven.apache.org/) version 2.2.1 or higher (Maven 3 can be used too) to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. - -Velocity requires JDK 1.6 or greater to compile. - -Finally, if you wish to modify Velocity's grammar you will need to a tool called [JavaCC](http://javacc.dev.java.net). We recommend version 3.2 or greater. +To build Velocity we require [Maven](http://maven.apache.org/) version 3.0.5 or higher to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. ## Building @@ -30,4 +26,3 @@ Refer to Maven documentation for all pha If you find a problem, do not hesitate to ask the Velocity community via our [mail lists](/contact.html). - Modified: velocity/site/cms/trunk/content/engine/devel/build.mdtext URL: http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/engine/devel/build.mdtext?rev=1804357&r1=1804356&r2=1804357&view=diff == --- velocity/site/cms/trunk/content/engine/devel/build.mdtext (original) +++ velocity/site/cms/trunk/content/engine/devel/build.mdtext Mon Aug 7 20:52:42 2017 @@ -2,19 +2,15 @@ Title: Apache Velocity Engine - Building ## Installation -Velocity runs on a variety of platforms that have installed the Java Virtual Machine. The Java Development Kit version 1.6 is required for users who want to compile Velocity from its source code. +Velocity runs on a variety of platforms that have installed the Java Virtual Machine. A Java Development Kit version 1.7+ is required to compile Velocity from its source code (as it is to run it). Everything required to build Velocity comes with the distribution, which can be obtained from [Subversion](http://svn.apache.org/repos/asf/velocity/engine/) or from the [main distribution](/download.cgi#engine). However, you will need to install [Maven](http://maven.apache.org/) to build the Velocity sources. -[Maven](http://maven.apache.org/) is also an Apache project. To build Apache Velocity, you need at least Version 2.2.1 of Apache Maven. +[Maven](http://maven.apache.org/) is also an Apache project. To build Apache Velocity, you need at least Version 3.0.5 of Apache Maven. ## Required Tools -To build Velocity we require [Maven](http://maven.apache.org/) version 2.2.1 or higher (Maven 3 can be used too) to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. - -Velocity requires JDK 1.6 or greater to compile. - -Finally, if you wish to modify Velocity's grammar you will need to a tool called [JavaCC](http://javacc.dev.java.net). We recommend version 3.2 or greater. +To build Velocity we require [Maven](http://maven.apache.org/) version 3.0.5 or higher to perform the build process. We assume that you have followed Maven's installation instructions and have it properly installed. ## Building @@ -30,4 +26,3 @@ Refer to Maven documentation for all pha
svn commit: r1804318 - in /velocity/tools/trunk/velocity-tools-generic: pom.xml src/main/java/org/apache/velocity/tools/generic/JsonTool.java src/test/java/org/apache/velocity/tools/generic/JsonToolTe
Author: cbrisson Date: Mon Aug 7 10:11:20 2017 New Revision: 1804318 URL: http://svn.apache.org/viewvc?rev=1804318&view=rev Log: [tools] Switch JSON tool to org.json.simple Modified: velocity/tools/trunk/velocity-tools-generic/pom.xml velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/JsonToolTests.java Modified: velocity/tools/trunk/velocity-tools-generic/pom.xml URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/pom.xml?rev=1804318&r1=1804317&r2=1804318&view=diff == --- velocity/tools/trunk/velocity-tools-generic/pom.xml (original) +++ velocity/tools/trunk/velocity-tools-generic/pom.xml Mon Aug 7 10:11:20 2017 @@ -46,13 +46,17 @@ - org.json + com.googlecode.json-simple:json-simple - org.json - org.apache.velocity.tools.shaded.org.json + org.json.simple + org.apache.velocity.tools.shaded.org.json.simple + + + org.json.simple.parser + org.apache.velocity.tools.shaded.org.json.simple.parser true @@ -96,9 +100,9 @@ test - org.json - json - 20160810 + com.googlecode.json-simple + json-simple + 1.1.1 Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java?rev=1804318&r1=1804317&r2=1804318&view=diff == --- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java (original) +++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/JsonTool.java Mon Aug 7 10:11:20 2017 @@ -30,9 +30,9 @@ import java.util.Set; import org.apache.velocity.tools.ConversionUtils; import org.apache.velocity.tools.XmlUtils; -import org.json.JSONArray; -import org.json.JSONObject; -import org.json.JSONTokener; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; import org.apache.velocity.tools.Scope; import org.apache.velocity.tools.config.DefaultKey; @@ -139,11 +139,11 @@ public class JsonTool extends ImportSupp Object ret = null; if (jsonArray != null) { -ret = wrapIfNeeded(jsonArray.opt(index)); +ret = wrapIfNeeded(jsonArray.get(index)); } else if (jsonObject != null) { -ret = wrapIfNeeded(jsonObject.opt(String.valueOf(index))); +ret = wrapIfNeeded(jsonObject.get(String.valueOf(index))); } return ret; } @@ -166,7 +166,7 @@ public class JsonTool extends ImportSupp } else if (jsonObject != null) { -ret = wrapIfNeeded(jsonObject.opt(key)); +ret = wrapIfNeeded(jsonObject.get(key)); } return ret; } @@ -177,7 +177,7 @@ public class JsonTool extends ImportSupp */ public Iterator keys() { -return jsonObject == null ? null : jsonObject.keys(); +return jsonObject == null ? null : jsonObject.keySet().iterator(); } /** @@ -198,7 +198,7 @@ public class JsonTool extends ImportSupp { if (jsonObject != null) { -return jsonObject.keys(); +return jsonObject.keySet().iterator(); } else if (jsonArray != null) { @@ -211,28 +211,9 @@ public class JsonTool extends ImportSupp * Get size of root object or array. * @return size */ -public int length() +public int size() { -return jsonObject == null ? jsonArray == null ? null : jsonArray.length() : jsonObject.length(); -} - -/** - * Get array of root object keys. - * @return array of keys - */ -public JSONArray names() -{ -return
svn commit: r1804317 - /velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java
Author: cbrisson Date: Mon Aug 7 10:10:44 2017 New Revision: 1804317 URL: http://svn.apache.org/viewvc?rev=1804317&view=rev Log: [tools] Add tests for MathTool Added: velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java Added: velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java?rev=1804317&view=auto == --- velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java (added) +++ velocity/tools/trunk/velocity-tools-generic/src/test/java/org/apache/velocity/tools/generic/MathToolTests.java Mon Aug 7 10:10:44 2017 @@ -0,0 +1,44 @@ +package org.apache.velocity.tools.generic; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +import org.apache.velocity.VelocityContext; + +/** + * This + */ +public class MathToolTests extends BaseTestCase +{ +public MathToolTests(String name) +{ +super(name); +} + +protected void setUpContext(VelocityContext context) +{ +context.put("math", new MathTool()); +} + +public void testMax() +{ +assertEvalEquals("4.0", "$math.max(4,3.5)"); +assertEvalEquals("4.0", "$math.max(4,3.5,3)"); +} +}