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

chinmayskulkarni pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new d04ba4e  PHOENIX-5776 Phoenix pherf unit tests failing
d04ba4e is described below

commit d04ba4eb945ba502652888220097ebca44f4a4dd
Author: Sandeep Guggilam <sguggi...@sandeepg-ltm.internal.salesforce.com>
AuthorDate: Thu Mar 12 21:35:21 2020 -0700

    PHOENIX-5776 Phoenix pherf unit tests failing
    
    Signed-off-by: Chinmay Kulkarni <chinmayskulka...@apache.org>
---
 .../apache/phoenix/pherf/util/ResourceList.java    | 29 +++++++++++++++++-----
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java
index cec12d1..ef1aa0e 100644
--- 
a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java
+++ 
b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java
@@ -18,11 +18,6 @@
 
 package org.apache.phoenix.pherf.util;
 
-import org.apache.commons.lang3.StringUtils;
-import org.apache.phoenix.pherf.exception.PherfException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -31,18 +26,32 @@ import java.net.URL;
 import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.phoenix.pherf.exception.PherfException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+
 /**
  * list resources available from the classpath @ *
  */
 public class ResourceList {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(ResourceList.class);
     private final String rootResourceDir;
+    // Lists the directories to ignore meant for testing something else
+    // when getting the resources from classpath
+    private List<String> dirsToIgnore = Lists.newArrayList("sql_files");
 
     public ResourceList(String rootResourceDir) {
         this.rootResourceDir = rootResourceDir;
@@ -166,6 +175,7 @@ public class ResourceList {
         final ArrayList<String> retval = new ArrayList<String>();
         final File[] fileList = directory.listFiles();
         for (final File file : fileList) {
+            if (isIgnoredDir(file.getAbsolutePath())) continue;
             if (file.isDirectory()) {
                 retval.addAll(getResourcesFromDirectory(file, pattern));
             } else {
@@ -179,4 +189,11 @@ public class ResourceList {
         }
         return retval;
     }
+    
+    private boolean isIgnoredDir(String path) {
+        for (String dir : dirsToIgnore) {
+            if (path.contains(dir)) return true;
+        }
+        return false;
+    }
 }
\ No newline at end of file

Reply via email to