velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1779031 - in /velocity/tools/trunk: velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/
Date Mon, 16 Jan 2017 13:56:17 GMT
Author: cbrisson
Date: Mon Jan 16 13:56:17 2017
New Revision: 1779031

URL: http://svn.apache.org/viewvc?rev=1779031&view=rev
Log:
review XmlTool/JsonTool commits - again

Modified:
    velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java
    velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/JsonToolTests.java
    velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/XmlToolTests.java

Modified: velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java?rev=1779031&r1=1779030&r2=1779031&view=diff
==============================================================================
--- velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java
(original)
+++ velocity/tools/trunk/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/ImportTool.java
Mon Jan 16 13:56:17 2017
@@ -78,14 +78,8 @@ public class ImportTool extends SafeConf
      */
     public String read(String resource)
     {
-        if (resource == null)
+        if (resource == null || resource.length() == 0)
         {
-            getLog().warn("resource is null!");
-            return null;
-        }
-        if (resource.length() == 0)
-        {
-            getLog().warn("resource is empty string!");
             return null;
         }
         try
@@ -107,14 +101,8 @@ public class ImportTool extends SafeConf
      */
     public String fetch(String url)
     {
-        if (url == null)
-        {
-            getLog().warn("URL is null!");
-            return null;
-        }
-        if (url.length() == 0)
+        if (url == null || url.length() == 0)
         {
-            getLog().warn("URL is empty string!");
             return null;
         }
         try

Modified: velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/JsonToolTests.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/JsonToolTests.java?rev=1779031&r1=1779030&r2=1779031&view=diff
==============================================================================
--- velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/JsonToolTests.java
(original)
+++ velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/JsonToolTests.java
Mon Jan 16 13:56:17 2017
@@ -23,6 +23,7 @@ import org.apache.velocity.tools.view.Js
 import static org.junit.Assert.*;
 
 import org.apache.velocity.tools.view.ViewContext;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import javax.servlet.RequestDispatcher;
@@ -172,7 +173,12 @@ public class JsonToolTests
         assertEquals(json.get("hey"), "bro");
     }
 
-    public @Test void testConfigFetchRemoteSource()
+    /*
+      TODO - Test is ignored because it would fail while offline. We need to set up a local
web server using Jetty to properly test it.
+      Michael Obispov suggested this example:
+      https://github.com/apache/maven-wagon/blob/master/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
+    */
+    public @Ignore @Test void testConfigFetchRemoteSource()
     {
         Map config = new HashMap();
         config.put("url", "http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/test/resources/foo.json?revision=1776916&view=co&pathrev=1776916");

Modified: velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/XmlToolTests.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/XmlToolTests.java?rev=1779031&r1=1779030&r2=1779031&view=diff
==============================================================================
--- velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/XmlToolTests.java
(original)
+++ velocity/tools/trunk/velocity-tools-view/src/test/java/org/apache/velocity/tools/test/blackbox/XmlToolTests.java
Mon Jan 16 13:56:17 2017
@@ -21,6 +21,7 @@ package org.apache.velocity.tools.test.b
 
 import org.apache.velocity.tools.view.ViewContext;
 import org.apache.velocity.tools.view.XmlTool;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import javax.servlet.RequestDispatcher;
@@ -173,7 +174,12 @@ public class XmlToolTests
         assertEquals("bro", xml.getText());
     }
 
-    public @Test void testConfigFetchRemoteSource()
+    /*
+      TODO - Test is ignored because it would fail while offline. We need to set up a local
web server using Jetty to properly test it.
+      Michael Obispov suggested this example:
+      https://github.com/apache/maven-wagon/blob/master/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
+    */
+    public @Ignore @Test void testConfigFetchRemoteSource()
     {
         Map config = new HashMap();
         config.put("url", "http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/test/resources/file.xml?revision=1776916&view=co&pathrev=1776916");



Mime
View raw message