public Set getQueryFiles()

in phoenix5-hive4/src/it/java/org/apache/hadoop/hive/cli/control/AbstractCliConfig.java [210:256]


  public Set<File> getQueryFiles() throws Exception {
    prepareDirs();

    Set<String> includeOnly = includeQueryFileNames;

    // queryDirectory should not be null
    File queryDir = new File(queryDirectory);

    // dedup file list
    Set<File> testFiles = new TreeSet<>();
    if (isQFileSpecified()) {
      // The user may have passed a list of files - comma separated
      for (String qFile : TEST_SPLITTER.split(queryFile)) {
        File qF;
        if (null != queryDir) {
          qF = new File(queryDir, qFile);
        } else {
          qF = new File(qFile);
        }
        if (excludedQueryFileNames.contains(qFile) && !isQFileSpecified()) {
          LOG.warn(qF.getAbsolutePath() + " is among the excluded query files for this driver."
              + " Please update CliConfigs.java or testconfiguration.properties file to"
              + " include the qfile or specify qfile through command line explicitly: -Dqfile=test.q");
        }
        testFiles.add(qF);
      }
    } else if (queryFileRegex != null && !queryFileRegex.equals("")) {
      for (String regex : TEST_SPLITTER.split(queryFileRegex)) {
        testFiles.addAll(Arrays.asList(queryDir.listFiles(new QFileRegexFilter(regex))));
      }
    } else if (runDisabled != null && runDisabled.equals("true")) {
      testFiles.addAll(Arrays.asList(queryDir.listFiles(new DisabledQFileFilter(includeOnly))));
    } else {
      testFiles.addAll(Arrays.asList(queryDir.listFiles(new QFileFilter(includeOnly))));
    }

    for (String qFileName : excludedQueryFileNames) {
      // in case of running as ptest, exclusions should be respected,
      // because test drivers receive every qfiles regardless of exclusions
      if ("hiveptest".equals(System.getProperty("user.name")) || !isQFileSpecified()
          || QTestSystemProperties.shouldForceExclusions()) {
        testFiles.remove(new File(queryDir, qFileName));
      }
    }

    return testFiles;
  }