org.apache.commons.io.filefilter.RegexFileFilter Java Examples

The following examples show how to use org.apache.commons.io.filefilter.RegexFileFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RailsAssetsService.java    From gocd with Apache License 2.0 6 votes vote down vote up
public void initialize() throws IOException {
    if (!systemEnvironment.useCompressedJs()) {
        return;
    }
    String assetsDirPath = servletContext.getRealPath(servletContext.getInitParameter("rails.root") + "/public/assets/");
    File assetsDir = new File(assetsDirPath);
    if (!assetsDir.exists()) {
        throw new RuntimeException(String.format("Assets directory does not exist %s", assetsDirPath));
    }
    Collection files = FileUtils.listFiles(assetsDir, new RegexFileFilter(MANIFEST_FILE_PATTERN), null);
    if (files.isEmpty()) {
        throw new RuntimeException(String.format("Manifest json file was not found at %s", assetsDirPath));
    }

    File manifestFile = (File) files.iterator().next();

    LOG.info("Found rails assets manifest file named {} ", manifestFile.getName());
    String manifest = FileUtils.readFileToString(manifestFile, UTF_8);
    Gson gson = new Gson();
    railsAssetsManifest = gson.fromJson(manifest, RailsAssetsManifest.class);
    LOG.info("Successfully read rails assets manifest file located at {}", manifestFile.getAbsolutePath());
}
 
Example #2
Source File: DistinctTokenCount.java    From tassal with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @param args
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public static void main(final String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException {

	if (args.length != 2) {
		System.err.println("Usage: <directory> <tokenizerClass>");
		return;
	}

	final DistinctTokenCount tokCount = new DistinctTokenCount(args[1]);
	for (final File fi : FileUtils.listFiles(new File(args[0]),
			new RegexFileFilter(".*\\.java$"),
			DirectoryFileFilter.DIRECTORY)) {
		try {
			tokCount.addTokens(fi);
		} catch (final IOException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	}

	tokCount.printCounts();
}
 
Example #3
Source File: App.java    From fdroidclient with GNU General Public License v3.0 6 votes vote down vote up
public static void initInstalledObbFiles(Apk apk) {
    File obbdir = getObbDir(apk.packageName);
    FileFilter filter = new RegexFileFilter("(main|patch)\\.[0-9-][0-9]*\\." + apk.packageName + "\\.obb");
    File[] files = obbdir.listFiles(filter);
    if (files == null) {
        return;
    }
    Arrays.sort(files);
    for (File f : files) {
        String filename = f.getName();
        String[] segments = filename.split("\\.");
        if (Integer.parseInt(segments[1]) <= apk.versionCode) {
            if ("main".equals(segments[0])) {
                apk.obbMainFile = filename;
                apk.obbMainFileSha256 = Utils.getBinaryHash(f, apk.hashType);
            } else if ("patch".equals(segments[0])) {
                apk.obbPatchFile = filename;
                apk.obbPatchFileSha256 = Utils.getBinaryHash(f, apk.hashType);
            }
        }
    }
}
 
Example #4
Source File: LaborBalanceSummaryReportServiceImpl.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Generates reports about the output of a poster run.
 * 
 * @param runDate the date the poster was run.
 */
protected void generatePosterOutputSummaryReport(Date runDate) {
    PosterOutputSummaryReport posterOutputSummaryReport = new PosterOutputSummaryReport();
    
    // summarize all the entries for the main poster
    File mainPosterFile = FileUtil.getNewestFile(new File(batchFileDirectoryName), new RegexFileFilter((LaborConstants.BatchFileSystem.POSTER_INPUT_FILE + "\\.[0-9_\\-]+\\" + GeneralLedgerConstants.BatchFileSystem.EXTENSION)));        
    if (mainPosterFile != null && mainPosterFile.exists()) {
        LaborOriginEntryFileIterator mainPosterIterator = new LaborOriginEntryFileIterator(mainPosterFile);
        while (mainPosterIterator.hasNext()) {
            OriginEntryInformation originEntry = mainPosterIterator.next();
            posterOutputSummaryReport.summarize(originEntry);
        }
    } else {
        LOG.warn("Could not Main Poster Input file, "+ LaborConstants.BatchFileSystem.POSTER_INPUT_FILE + ", for tabulation in the Poster Output Summary Report");
    }
    
    posterOutputSummaryReport.writeReport(laborPosterOutputSummaryReportWriterService);
}
 
Example #5
Source File: DistinctTokenCount.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @param args
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public static void main(final String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException {

	if (args.length != 2) {
		System.err.println("Usage: <directory> <tokenizerClass>");
		return;
	}

	final DistinctTokenCount tokCount = new DistinctTokenCount(args[1]);
	for (final File fi : FileUtils.listFiles(new File(args[0]),
			new RegexFileFilter(".*\\.java$"),
			DirectoryFileFilter.DIRECTORY)) {
		try {
			tokCount.addTokens(fi);
		} catch (final IOException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	}

	tokCount.printCounts();
}
 
Example #6
Source File: DistinctTokenCount.java    From api-mining with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param args
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public static void main(final String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException {

	if (args.length != 2) {
		System.err.println("Usage: <directory> <tokenizerClass>");
		return;
	}

	final DistinctTokenCount tokCount = new DistinctTokenCount(args[1]);
	for (final File fi : FileUtils.listFiles(new File(args[0]),
			new RegexFileFilter(".*\\.java$"),
			DirectoryFileFilter.DIRECTORY)) {
		try {
			tokCount.addTokens(fi);
		} catch (final IOException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	}

	tokCount.printCounts();
}
 
Example #7
Source File: CasMergeSuiteTest.java    From webanno with Apache License 2.0 6 votes vote down vote up
@Test
public void runTest()
    throws Exception
{
    Map<String, List<CAS>> casByUser = new HashMap<>();
    
    List<File> inputFiles = asList(
            referenceFolder.listFiles((FilenameFilter) new RegexFileFilter("user.*\\.tsv")));
    
    for (File inputFile : inputFiles) {
        casByUser.put(inputFile.getName(), asList(loadWebAnnoTsv3(inputFile).getCas()));
    }
    
    JCas curatorCas = createText(casByUser.values().stream().flatMap(Collection::stream)
            .findFirst().get().getDocumentText());

    DiffResult result = doDiff(diffAdapters, LINK_TARGET_AS_LABEL, casByUser).toResult();

    // result.print(System.out);

    sut.reMergeCas(result, document, null, curatorCas.getCas(), getSingleCasByUser(casByUser));

    writeAndAssertEquals(curatorCas);
}
 
Example #8
Source File: DataAdapter.java    From candybean with GNU Affero General Public License v3.0 6 votes vote down vote up
protected static File[] getAllFilesBasedOnPattern(String fileFullDirPath,
		String testData, String ext) {
	File dir = new File(fileFullDirPath);
	File[] files;

	String pattern = testData + "." + ext + "|" + testData + "_[^_]+" + "."
			+ ext;
	
	if (selection == DataAdapter.Selection.SINGLE) {
		pattern = testData + "." + ext;
	}
	
	// System.out.println("\nFiles that match regular expression: " +
	// pattern);
	FileFilter filter = new RegexFileFilter(pattern);
	files = dir.listFiles(filter);

	return files;
}
 
Example #9
Source File: PackagingHandler.java    From deadcode4j with Apache License 2.0 6 votes vote down vote up
/**
 * Returns each compile source root of a given <code>MavenProject</code> as a <code>Repository</code> instance
 * providing access to the Java files it contains.
 * Silently ignores compile source roots that do not exist in the file system.
 *
 * @since 2.0.0
 */
@Nonnull
protected Collection<Repository> getJavaFilesOfCompileSourceRootsAsRepositories(@Nonnull MavenProject project) {
    Collection<Repository> codeRepositories = newArrayList();
    for (String compileSourceRoot : emptyIfNull(project.getCompileSourceRoots())) {
        File compileSourceDirectory = new File(compileSourceRoot);
        if (!compileSourceDirectory.exists()) {
            logger.debug("  Compile Source Directory [{}] does not exist?", compileSourceDirectory);
            continue;
        }
        codeRepositories.add(new Repository(compileSourceDirectory,
                new OrFileFilter(DIRECTORY, new RegexFileFilter(".*\\.java$", INSENSITIVE))));
        logger.debug("  Found source directory [{}].", compileSourceRoot);
    }
    return codeRepositories;
}
 
Example #10
Source File: CopyPattern.java    From spoofax with Apache License 2.0 6 votes vote down vote up
@Override public None build(Input input) throws IOException {
    requireBuild(input.origin);

    require(input.srcDir, new DirectoryModifiedStamper());

    final Collection<File> files =
        FileUtils.listFiles(input.srcDir, new RegexFileFilter(input.pattern), FalseFileFilter.INSTANCE);
    for(File file : files) {
        require(file);
        final File dstFile = new File(input.dstDir, file.getName());
        FileUtils.copyFile(file, dstFile);
        provide(dstFile);
    }

    return None.val;
}
 
Example #11
Source File: LogFileUtils.java    From singer with Apache License 2.0 6 votes vote down vote up
public static String getFilePathByInode(LogStream logStream, long inode)
    throws IOException {
  String result = null;
  String logDir = logStream.getLogDir();
  File dir = new File(logDir);
  if (dir.exists()) {
    SingerLogConfig logConfig = logStream.getSingerLog().getSingerLogConfig();
    String regexStr = logStream.getFileNamePrefix();
    if (logConfig.getFilenameMatchMode() == FileNameMatchMode.PREFIX) {
      regexStr += ".*";
    }
    LOG.info("Matching files under {} with filter {}", logDir, regexStr);
    FileFilter fileFilter = new RegexFileFilter(regexStr);
    File[] files = dir.listFiles(fileFilter);
    for (File file : files) {
      String path = file.getAbsolutePath();
      if (inode == SingerUtils.getFileInode(path)) {
        result = path;
        break;
      }
    }
  }
  return result;
}
 
Example #12
Source File: TemplateParser.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param sourceDirectory the template directory that stores the models
 * @return a map of model name and file path to it,
 * the map is ordered lexicographically by the model names
 */
protected static Map<String, String> resolveModels(String sourceDirectory) {
  File modelsDir = new File(sourceDirectory + "/models");
  Collection<File> modelFiles = FileUtils.listFiles(
      modelsDir, 
      new RegexFileFilter("^(.*?)"), 
      DirectoryFileFilter.DIRECTORY
      );

  Map<String, String> models = new TreeMap<>();
  for (File file : modelFiles) {
    String modelName = FilenameUtils.removeExtension(file.getName());
    String filePath = file.getAbsolutePath();
    String modelPackage = filePath
        .substring(filePath.lastIndexOf("org"), filePath.lastIndexOf(File.separator));
    
    models.put(modelName, modelPackage);
  }
  
  return models;
}
 
Example #13
Source File: LogStreamManager.java    From singer with Apache License 2.0 6 votes vote down vote up
private List<SingerLog> getMatchedSingerLogsInternal(Path parentDir, File logFile) {
  LOG.debug("Getting Singer Logs for " + logFile.toString() + " in " + parentDir);
  List<SingerLog> singerLogs = new ArrayList<>();
  String pathStr = parentDir.toString();
  if (singerLogPaths.containsKey(pathStr)) {
    for (SingerLog log : singerLogPaths.get(pathStr)) {
      String regex = log.getSingerLogConfig().getLogStreamRegex();
      LOG.debug("Checking..." + regex + " matching " + logFile.toString());
      if (new RegexFileFilter(regex).accept(logFile)) {
        singerLogs.add(log);
      }
    }
  }
  if (singerLogs.isEmpty()) {
    LOG.debug("Did not find any matched SingerLog for {}", logFile);
  }
  return singerLogs;
}
 
Example #14
Source File: AbstractJygmentsTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AbstractJygmentsTokenizer(final String fileSuffix)
		throws ResolutionException {
	lexer = Lexer.getForFileName("sample." + fileSuffix);
	// lexer.setStripAll(true);
	// lexer.setStripNewLines(true);
	// lexer.setTabSize(1);
	codeFilter = new RegexFileFilter(".*\\." + fileSuffix + "$");
}
 
Example #15
Source File: CbJinjaTester.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
private Collection<File> collectAllSlsFiles(String salt) throws IOException {
    File file = new ClassPathResource(salt).getFile();
    return FileUtils.listFiles(
            file,
            new RegexFileFilter("^(.*.sls)"),
            DirectoryFileFilter.DIRECTORY
    );
}
 
Example #16
Source File: FileSplitParallelDataSetIterator.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
public FileSplitParallelDataSetIterator(@NonNull File rootFolder, @NonNull String pattern,
                @NonNull FileCallback callback, int numThreads, int bufferPerThread,
                @NonNull InequalityHandling inequalityHandling) {
    super(numThreads);

    if (!rootFolder.exists() || !rootFolder.isDirectory())
        throw new IllegalArgumentException("Root folder should point to existing folder");

    this.pattern = pattern;
    this.inequalityHandling = inequalityHandling;
    this.buffer = bufferPerThread;

    String modifiedPattern = pattern.replaceAll("\\%d", ".*.");

    IOFileFilter fileFilter = new RegexFileFilter(modifiedPattern);


    List<File> files = new ArrayList<>(FileUtils.listFiles(rootFolder, fileFilter, null));
    log.debug("Files found: {}; Producers: {}", files.size(), numProducers);

    if (files.isEmpty())
        throw new IllegalArgumentException("No suitable files were found");

    int numDevices = Nd4j.getAffinityManager().getNumberOfDevices();
    int cnt = 0;
    for (List<File> part : Lists.partition(files, files.size() / numThreads)) {
        // discard remainder
        if (cnt >= numThreads)
            break;

        int cDev = cnt % numDevices;
        asyncIterators.add(new AsyncDataSetIterator(new FileSplitDataSetIterator(part, callback), bufferPerThread,
                        true, cDev));
        cnt++;
    }

}
 
Example #17
Source File: FreeipaJinjaTester.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
private Collection<File> collectAllSlsFiles(String salt) throws IOException {
    File file = new ClassPathResource(salt).getFile();
    return FileUtils.listFiles(
            file,
            new RegexFileFilter("^(.*.sls)"),
            DirectoryFileFilter.DIRECTORY
    );
}
 
Example #18
Source File: ResultParser.java    From acmeair with Apache License 2.0 5 votes vote down vote up
public void processDirectory(String dirName) {
	File root = new File(dirName);
	try {
		Collection<File> files = FileUtils.listFiles(root,
				new RegexFileFilter(getFileName()),
				DirectoryFileFilter.DIRECTORY);

		for (Iterator<File> iterator = files.iterator(); iterator.hasNext();) {
			File file = (File) iterator.next();
			processFile(file);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #19
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_LOCAL_WRITE_BYTES() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_LOCAL_WRITE_BYTES);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_LOCAL_WRITE_BYTES.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #20
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_LOCAL_READ_OPS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_LOCAL_READ_OPS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_LOCAL_READ_OPS.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #21
Source File: JvmMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.JvmMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testRead_JVM_PS_SCAVENGE_TIME() throws IOException {
	MetricsReader reader = new JvmMetricsReader(null, MetricsType.JVM_PS_SCAVENGE_TIME);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.JVM_PS_SCAVENGE_TIME.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #22
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_LOCAL_READ_BYTES() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_LOCAL_READ_BYTES);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_LOCAL_READ_BYTES.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #23
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_LOCAL_LARGEREAD_OPS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_LOCAL_LARGEREAD_OPS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_LOCAL_LARGEREAD_OPS.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #24
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_HDFS_WRITE_OPS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_HDFS_WRITE_OPS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_HDFS_WRITE_OPS.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #25
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_HDFS_WRITE_BYTES() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_HDFS_WRITE_BYTES);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_HDFS_WRITE_BYTES.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #26
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_HDFS_READ_OPS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_HDFS_READ_OPS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_HDFS_READ_OPS.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #27
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_HDFS_READ_BYTES() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_HDFS_READ_BYTES);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_HDFS_READ_BYTES.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #28
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_EXEC_FS_HDFS_LARGEREAD_OPS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.EXEC_FS_HDFS_LARGEREAD_OPS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.EXEC_FS_HDFS_LARGEREAD_OPS.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}
 
Example #29
Source File: FsMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.FsMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testReadWith_FS() throws IOException {
	MetricsReader reader = new FsMetricsReader(null, MetricsType.FS);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+).executor.filesystem.*\\.csv");
	
	assertEquals(result.size(), 20);  
	this.assertContent(filter, result);
}
 
Example #30
Source File: JvmMetricsReaderTest.java    From varOne with MIT License 5 votes vote down vote up
/**
 * Test method for {@link com.varone.node.reader.JvmMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testRead_JVM_PS_MARKSWEEP_COUNT() throws IOException {
	MetricsReader reader = new JvmMetricsReader(null, MetricsType.JVM_PS_MARKSWEEP_COUNT);
	
	String applicationId = "application_1439169262151_0237";
	
	Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
	IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+)."+MetricsType.JVM_PS_MARKSWEEP_COUNT.type()+".csv");
	
	assertEquals(result.size(), 2);  
	this.assertContent(filter, result);
}