org.mule.runtime.core.api.util.FileUtils.openDirectory()方法的使用及代码示例

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

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

FileUtils.openDirectory介绍

暂无

代码示例

代码示例来源:origin: mulesoft/mule

@Test
public void testDirectoryTools() throws Exception {
 File dir = FileUtils.openDirectory("src");
 assertNotNull(dir);
 assertTrue(dir.exists());
 assertTrue(dir.canRead());
 assertTrue(dir.isDirectory());
 dir = FileUtils.openDirectory("doesNotExist");
 assertNotNull(dir);
 assertTrue(dir.exists());
 assertTrue(dir.canRead());
 assertTrue(dir.isDirectory());
 FileUtils.deleteTree(dir);
}

代码示例来源:origin: mulesoft/mule

@Test
public void skipAndMoveCorruptedOrUnreadableFiles() {
 final String KEY = "key";
 final String VALUE = "value";
 try {
  File.createTempFile("temp", ".obj", objectStoreFolder.getRoot());
  File corruptedFolder = openDirectory(workingDirectory.getAbsolutePath()
    + File.separator + PersistentObjectStorePartition.CORRUPTED_FOLDER);
  int corruptedBefore = corruptedFolder.list().length;
  partition.store(KEY, VALUE);
  // Expect the new stored object, and the partition-descriptor file
  assertEquals(2, objectStoreFolder.getRoot().listFiles().length);
  // Expect to have one more corrupted file in the corrupted folder
  assertEquals(corruptedBefore + 1, corruptedFolder.list().length);
 } catch (Exception e) {
  fail("Supposed to have skipped corrupted or unreadable files");
 }
}

代码示例来源:origin: mulesoft/mule

file.delete();
File dir = FileUtils.openDirectory("src");
assertNotNull(dir);
assertTrue(dir.exists());
assertTrue(dir.isDirectory());
dir = FileUtils.openDirectory("doesNotExist");
assertNotNull(dir);
assertTrue(dir.exists());

代码示例来源:origin: org.mule.runtime/mule-core

public void setWorkingDirectory(String workingDirectory) {
 if (verifyContextNotInitialized()) {
  try {
   File canonicalFile = FileUtils.openDirectory(workingDirectory);
   this.workingDirectory = canonicalFile.getCanonicalPath();
  } catch (IOException e) {
   throw new IllegalArgumentException(CoreMessages.initialisationFailure("Invalid working directory").getMessage(), e);
  }
 }
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void testDirectoryTools() throws Exception {
 File dir = FileUtils.openDirectory("src");
 assertNotNull(dir);
 assertTrue(dir.exists());
 assertTrue(dir.canRead());
 assertTrue(dir.isDirectory());
 dir = FileUtils.openDirectory("doesNotExist");
 assertNotNull(dir);
 assertTrue(dir.exists());
 assertTrue(dir.canRead());
 assertTrue(dir.isDirectory());
 FileUtils.deleteTree(dir);
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void skipAndMoveCorruptedOrUnreadableFiles() {
 final String KEY = "key";
 final String VALUE = "value";
 try {
  File.createTempFile("temp", ".obj", objectStoreFolder.getRoot());
  File corruptedFolder = openDirectory(workingDirectory.getAbsolutePath()
    + File.separator + PersistentObjectStorePartition.CORRUPTED_FOLDER);
  int corruptedBefore = corruptedFolder.list().length;
  partition.store(KEY, VALUE);
  // Expect the new stored object, and the partition-descriptor file
  assertEquals(2, objectStoreFolder.getRoot().listFiles().length);
  // Expect to have one more corrupted file in the corrupted folder
  assertEquals(corruptedBefore + 1, corruptedFolder.list().length);
 } catch (Exception e) {
  fail("Supposed to have skipped corrupted or unreadable files");
 }
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

file.delete();
File dir = FileUtils.openDirectory("src");
assertNotNull(dir);
assertTrue(dir.exists());
assertTrue(dir.isDirectory());
dir = FileUtils.openDirectory("doesNotExist");
assertNotNull(dir);
assertTrue(dir.exists());

相关文章