当前位置: 首页>>代码示例>>Java>>正文


Java TemporaryFolder.delete方法代码示例

本文整理汇总了Java中org.junit.rules.TemporaryFolder.delete方法的典型用法代码示例。如果您正苦于以下问题:Java TemporaryFolder.delete方法的具体用法?Java TemporaryFolder.delete怎么用?Java TemporaryFolder.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.rules.TemporaryFolder的用法示例。


在下文中一共展示了TemporaryFolder.delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test0

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public void test0(){
	if (System.getenv().get("SKIP_HEAVY")!=null){
		return;
	}
	TemporaryFolder tempSwaggerApis=new TemporaryFolder();
	TemporaryFolder tempRAMLApis=new TemporaryFolder();
	try{
	File fs=File.createTempFile("ddd", "tmp");		
	FileUtils.copyInputStreamToFile(RegistryManager.getInstance().getClass().getResourceAsStream("/azure-specs.zip"), fs);
	tempSwaggerApis.create();
	tempRAMLApis.create();
	extractFolder(fs.getAbsolutePath(), tempSwaggerApis.getRoot().getAbsolutePath());
	WriteApis.write(tempSwaggerApis.getRoot().getAbsolutePath(), tempRAMLApis.getRoot().getAbsolutePath());
	tempSwaggerApis.delete();
	tempRAMLApis.delete();
	}catch (Exception e) {
		throw new IllegalStateException();
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:20,代码来源:Swagger2RamlTest.java

示例2: test0

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public void test0() {
	if (System.getenv().get("SKIP_HEAVY")!=null){
		return;
	}
	TemporaryFolder temporaryFolder = new TemporaryFolder();
	try {
		temporaryFolder.create();
		Converter converter = new Converter(temporaryFolder.getRoot().getAbsolutePath());
		converter.get();
		TestCase.assertTrue(converter.getSucccessCount()>=129);
		temporaryFolder.delete();
	} catch (Exception e) {
		throw new IllegalStateException(e);
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:16,代码来源:LoadGurusTest.java

示例3: compile

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
default List<IMessage> compile(final Class<?>... classes) throws IOException {
    final TemporaryFolder temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();

    try {
        final List<String> arguments = new ArrayList<>();

        arguments.add("-source");
        arguments.add("1.8");
        arguments.add("-target");
        arguments.add("1.8");

        arguments.add("-cp");
        arguments.add(System.getProperty("java.class.path"));

        arguments.add("-aspectpath");
        arguments.add("target/classes");

        arguments.add("-d");

        arguments.add(temporaryFolder.newFolder().getAbsolutePath());

        asList(classes).stream()
                .map(Class::getName)
                .map(n -> n.replace('.', '/'))
                .map(n -> format("src/test/java/%s.java", n))
                .forEach(arguments::add);

        final Main compiler = new Main();
        final MessageHandler handler = new MessageHandler();
        compiler.run(toArray(arguments, String.class), handler);

        return asList(handler.getMessages(null, true))
                .stream()
                .filter(IMessage::isError)
                .collect(toList());
    } finally {
        temporaryFolder.delete();
    }
}
 
开发者ID:whiskeysierra,项目名称:archer,代码行数:41,代码来源:Compiling.java

示例4: recursiveDeleteFolderWithOneElement

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithOneElement() throws IOException {
    TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    File file = folder.newFile("a");
    folder.delete();
    assertFalse(file.exists());
    assertFalse(folder.getRoot().exists());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:TempFolderRuleTest.java

示例5: recursiveDeleteFolderWithOneRandomElement

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithOneRandomElement() throws IOException {
    TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    File file = folder.newFile();
    folder.delete();
    assertFalse(file.exists());
    assertFalse(folder.getRoot().exists());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:TempFolderRuleTest.java

示例6: recursiveDeleteFolderWithZeroElements

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithZeroElements() throws IOException {
    TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    folder.delete();
    assertFalse(folder.getRoot().exists());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:8,代码来源:TempFolderRuleTest.java

示例7: sanitizeSymlinkedWorkingDirectory

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void sanitizeSymlinkedWorkingDirectory() throws InterruptedException, IOException {
  TemporaryFolder folder = new TemporaryFolder();
  folder.create();
  ProjectFilesystem filesystem =
      TestProjectFilesystems.createProjectFilesystem(folder.getRoot().toPath());

  // Setup up a symlink to our working directory.
  Path symlinkedRoot = folder.getRoot().toPath().resolve("symlinked-root");
  java.nio.file.Files.createSymbolicLink(symlinkedRoot, tmp.getRoot());

  // Run the build, setting PWD to the above symlink.  Typically, this causes compilers to use
  // the symlinked directory, even though it's not the right project root.
  BuildTarget target = BuildTargetFactory.newInstance("//:simple#default,static");
  workspace
      .runBuckCommandWithEnvironmentOverridesAndContext(
          tmp.getRoot(),
          Optional.empty(),
          ImmutableMap.of("PWD", symlinkedRoot.toString()),
          "build",
          target.getFullyQualifiedName())
      .assertSuccess();

  // Verify that we still sanitized this path correctly.
  Path lib = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/libsimple.a"));
  String contents = Files.asByteSource(lib.toFile()).asCharSource(Charsets.ISO_8859_1).read();
  assertFalse(lib.toString(), contents.contains(tmp.getRoot().toString()));
  assertFalse(lib.toString(), contents.contains(symlinkedRoot.toString()));

  folder.delete();
}
 
开发者ID:facebook,项目名称:buck,代码行数:32,代码来源:CxxPreprocessAndCompileIntegrationTest.java

示例8: tearDown

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
	for (TemporaryFolder f:folders){
		f.delete();
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:7,代码来源:CompilerTestCase.java


注:本文中的org.junit.rules.TemporaryFolder.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。