You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ch...@apache.org on 2020/03/26 21:48:12 UTC

[phoenix] branch 4.x updated: PHOENIX-5776 Phoenix pherf unit tests failing

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

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


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

commit 73a86be9b588353457cd2c9de41239211330e7a7
Author: Sandeep Guggilam <sg...@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 <ch...@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 df5dbf7..64ee6ee 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;
@@ -30,18 +25,32 @@ import java.net.URI;
 import java.net.URL;
 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;
@@ -165,6 +174,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 {
@@ -178,4 +188,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