當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。