This is an automated email from the ASF dual-hosted git repository.

cbrisson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git


The following commit(s) were added to refs/heads/master by this push:
     new 0de2e65  Add .travis.yml for testing the PRs at 
https://travis-ci.com/apache/velocity-engine
     new 15429af  Merge pull request #18 from martin-g/feature/use-travis-ci
0de2e65 is described below

commit 0de2e6511b02ce7aa35a9d569b4a1dd3ba2cb602
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Fri Nov 20 14:32:04 2020 +0200

    Add .travis.yml for testing the PRs at 
https://travis-ci.com/apache/velocity-engine
---
 .travis.yml                                        | 47 ++++++++++++++++++++++
 .../org/apache/velocity/test/BaseTestCase.java     |  2 +-
 .../velocity/test/OldPropertiesTestCase.java       | 12 ------
 .../velocity/test/SpaceGobblingTestCase.java       |  8 ++--
 4 files changed, 52 insertions(+), 17 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..9d4faff
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,47 @@
+# 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.
+
+os: linux
+dist: focal
+
+arch:
+  - amd64
+  - arm64
+
+cache:
+  directories:
+    - $HOME/.m2/repository
+
+
+install:
+  - lscpu
+  - ARCH=`uname -p`
+  - echo $ARCH
+  - 
JDK_X64="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz";
+  - 
JDK_ARM64="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_aarch64_linux_hotspot_8u275b01.tar.gz";
+  - if test "X$ARCH" = "Xaarch64"; then JDK_URL=$JDK_ARM64; else 
JDK_URL=$JDK_X64; fi
+  - wget -q $JDK_URL && tar xzf OpenJDK*.tar.gz
+  - mv jdk8* jdk
+  - export JAVA_HOME=`pwd`/jdk
+  - wget -q 
https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
 && tar xzf apache-maven-*-bin.tar.gz
+  - export M2_HOME=`pwd`/apache-maven-3.6.3
+  - export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"
+  - java -version
+  - mvn -version 
+
+script: 
+  - mvn clean verify
\ No newline at end of file
diff --git 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
index 5466782..f2eb297 100644
--- 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
+++ 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
@@ -48,7 +48,7 @@ public abstract class BaseTestCase extends TestCase 
implements TemplateTestBase
 {
     protected VelocityEngine engine;
     protected VelocityContext context;
-    protected boolean DEBUG = false;
+    protected boolean DEBUG = Boolean.getBoolean("test.debug");
     protected TestLogger log;
     protected String stringRepoName = "string.repo";
 
diff --git 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
index 43b58ee..4bbcbe2 100644
--- 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
+++ 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
@@ -19,31 +19,19 @@ package org.apache.velocity.test;
  * under the License.
  */
 
-import com.sun.org.apache.bcel.internal.classfile.Deprecated;
-import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.runtime.DeprecatedRuntimeConstants;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.RuntimeInstance;
 import org.apache.velocity.test.misc.TestLogger;
 import org.apache.velocity.util.DeprecationAwareExtProperties;
-import org.apache.velocity.util.ExtProperties;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.InputStream;
 import java.lang.reflect.Field;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
diff --git 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
index ac5a4ee..69f8869 100644
--- 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
+++ 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
@@ -88,7 +88,6 @@ public class SpaceGobblingTestCase extends BaseTestCase
 
     private void testMode(SpaceGobbling mode) throws Exception
     {
-        VelocityEngine ve = createEngine(mode);
         File dir = new File(TEST_COMPARE_DIR + "/gobbling");
         File[] directoryListing = dir.listFiles();
         if (directoryListing != null)
@@ -97,7 +96,7 @@ public class SpaceGobblingTestCase extends BaseTestCase
             {
                 if (child.isFile())
                 {
-                    testTemplate(ve, child.getName(), mode);
+                    testTemplate(child.getName(), mode);
                 }
             }
         }
@@ -107,14 +106,15 @@ public class SpaceGobblingTestCase extends BaseTestCase
         }
     }
 
-    private void testTemplate(VelocityEngine engine, String templateFile, 
SpaceGobbling mode) throws Exception
+    private void testTemplate(String templateFile, SpaceGobbling mode) throws 
Exception
     {
         assureResultsDirectoryExists(RESULT_DIR);
         FileOutputStream fos = new FileOutputStream (getFileName(RESULT_DIR, 
templateFile, mode.toString()));
         VelocityContext context = new VelocityContext();
         Writer writer = new BufferedWriter(new OutputStreamWriter(fos));
 
-        Template template = engine.getTemplate(templateFile);
+        VelocityEngine ve = createEngine(mode);
+        Template template = ve.getTemplate(templateFile);
         template.merge(context, writer);
 
         /**

Reply via email to