Decode URLs Returned From Class.getResource()

Fix ClassAd tests failing when there is a space in the path, by
properly decoding the URLs with URLDecoder.

Change-Id: Ib7fd5a4e33ba3e16c1b5124179a15ae78d08c18a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/725
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
index 2f23684..09e8001 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.external.classad.test;
 
+import java.net.URLDecoder;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -45,8 +47,8 @@
      */
     public void testApp() {
 
-        String[] args = { "", "-d", "-v", getClass().getResource("/functional_tests.txt").getPath() };
         try {
+            String[] args = { "", "-d", "-v", URLDecoder.decode(getClass().getResource("/functional_tests.txt").getPath(), "UTF-8") };
             FunctionalTester.test(args.length, args);
         } catch (Exception e) {
             e.printStackTrace();
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
index 1c135f5..d65fecc 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
@@ -19,16 +19,17 @@
 package org.apache.asterix.external.classad.test;
 
 import java.io.BufferedReader;
+import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
-import org.apache.asterix.external.classad.ClassAd;
-
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.asterix.external.classad.ClassAd;
+
 public class ClassAdParserTest extends TestCase {
     /**
      * Create the test case
@@ -58,7 +59,7 @@
             String[] files = new String[] { "/testdata.txt" };
             BufferedReader infile = null;
             for (String path : files) {
-                infile = Files.newBufferedReader(Paths.get(getClass().getResource(path).getPath()),
+                infile = Files.newBufferedReader(Paths.get(URLDecoder.decode(getClass().getResource(path).getPath(), "UTF-8")),
                         StandardCharsets.UTF_8);
                 szInput = infile.readLine();
                 while (szInput != null) {