com.thoughtworks.go.util.FileUtil.createTempFolder()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.thoughtworks.go.util.FileUtil.createTempFolder()方法的一些代码示例,展示了FileUtil.createTempFolder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.createTempFolder()方法的具体详情如下:
包路径:com.thoughtworks.go.util.FileUtil
类名称:FileUtil
方法名:createTempFolder

FileUtil.createTempFolder介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

private void mergeAndUploadTestResult(GoPublisher publisher, List<File> allFiles) {
  if (allFiles.size() > 0) {
    File tempFolder = null;
    try {
      tempFolder = FileUtil.createTempFolder();
      File testResultSource = new File(tempFolder, MERGED_TEST_RESULT_FOLDER);
      testResultSource.mkdirs();
      UnitTestReportGenerator generator = new UnitTestReportGenerator(publisher, testResultSource);
      generator.generate(allFiles.toArray(new File[allFiles.size()]), "testoutput");
      publisher.upload(testResultSource, "testoutput");
    } finally {
      if (tempFolder != null) {
        FileUtils.deleteQuietly(tempFolder);
      }
    }
  } else {
    String message = "No files were found in the Test Results folders";
    publisher.taggedConsumeLineWithPrefix(GoPublisher.PUBLISH_ERR, message);
    LOG.warn(message);
  }
}

代码示例来源:origin: gocd/gocd

@Override
public boolean execute(BuildCommand command, BuildSession buildSession) {
  File workingDirectory = buildSession.resolveRelativeDir(command.getWorkingDirectory());
  String uploadPath = command.getStringArg("uploadPath");
  String[] sources = command.getArrayArg("srcs");
  ArrayList<File> allFiles = findMatchedSourceFiles(buildSession, workingDirectory, sources);
  if (allFiles.size() > 0) {
    File tempFolder = null;
    try {
      tempFolder = FileUtil.createTempFolder();
      File testResultSource = new File(tempFolder, "result");
      testResultSource.mkdirs();
      UnitTestReportGenerator generator = new UnitTestReportGenerator(buildSession.getPublisher(), testResultSource);
      generator.generate(allFiles.toArray(new File[allFiles.size()]), uploadPath);
    } finally {
      if (tempFolder != null) {
        FileUtils.deleteQuietly(tempFolder);
      }
    }
  } else {
    String message = "No files were found in the Test Results folders";
    buildSession.printlnWithPrefix(message);
    LOG.warn(message);
  }
  return true;
}

代码示例来源:origin: gocd/gocd

publishingAttempts++;
tmpDir = FileUtil.createTempFolder();
File dataToUpload = new File(tmpDir, file.getName() + ".zip");
zipUtil.zip(file, dataToUpload, Deflater.BEST_SPEED);

代码示例来源:origin: gocd/gocd

publishingAttempts++;
tmpDir = FileUtil.createTempFolder();
File dataToUpload = new File(tmpDir, source.getName() + ".zip");
zipUtil.zip(source, dataToUpload, Deflater.BEST_SPEED);

相关文章