コード例 #1
0
ファイル: FsTestMac.java プロジェクト: oceaneuropa/dev
  @Ignore
  @Test
  public void test008_downloadDirectories() throws IOException {
    System.out.println("--- --- --- test008_downloadDirectories() --- --- ---");

    File localDir = new File("/Users/yayang/Downloads/test_target1");
    FileRef[] fileRefs = FileRef.listRoots(fs);
    for (FileRef fileRef : fileRefs) {
      boolean succeed = false;
      if (fileRef.isDirectory()) {
        succeed = fs.downloadFsDirectoryToDirectory(fileRef, localDir, true);
      } else {
        succeed = fs.downloadFsFileToDirectory(fileRef, localDir);
      }
      System.out.println(
          "Path '"
              + fileRef.getPath()
              + "' is downloaded to local dir '"
              + localDir.getAbsolutePath()
              + "'? "
              + succeed);
    }

    System.out.println();
  }
コード例 #2
0
ファイル: FsTestMac.java プロジェクト: oceaneuropa/dev
  @Ignore
  @Test
  public void test004_uploadFiles() throws IOException {
    System.out.println("--- --- --- test004_uploadFiles() --- --- ---");

    File localFile1 = new File("/Users/yayang/Downloads/test_source1/invoke.timeout.zip");
    File localFile2 = new File("/Users/yayang/Downloads/test_source1/japanese_issue.zip");

    FileRef fileRef1 = FileRef.newInstance(fs, fs.root(), localFile1.getName());
    FileRef fileRef2 = FileRef.newInstance(fs, fs.root(), localFile2.getName());

    boolean succeed1 = fs.uploadFileToFsFile(localFile1, fileRef1);
    boolean succeed2 = fs.uploadFileToFsFile(localFile2, fileRef2);

    System.out.println(
        "Local file '"
            + localFile1.getAbsolutePath()
            + "' is uploaded to path '"
            + fileRef1.getPath()
            + "' (succeed="
            + succeed1
            + ")? "
            + fileRef1.exists());
    System.out.println(
        "Local file '"
            + localFile2.getAbsolutePath()
            + "' is uploaded to path '"
            + fileRef2.getPath()
            + "' (succeed="
            + succeed2
            + ")? "
            + fileRef2.exists());

    System.out.println();
  }
コード例 #3
0
ファイル: FsTestMac.java プロジェクト: oceaneuropa/dev
  @Ignore
  @Test
  public void test007_downloadFiles() throws IOException {
    System.out.println("--- --- --- test007_downloadFiles() --- --- ---");

    FileRef fileRef1 = FileRef.newInstance(fs, "/invoke.timeout.zip");
    FileRef fileRef2 = FileRef.newInstance(fs, "/japanese_issue.zip");
    FileRef fileRef3 = FileRef.newInstance(fs, "/log_01.txt");
    FileRef fileRef4 = FileRef.newInstance(fs, "/xsd-sourcedoc-2.10.0.zip");

    File localDir = new File("/Users/yayang/Downloads/test_target2/");
    File localFile1 = new File(localDir, "invoke.timeout(A).zip");
    File localFile2 = new File(localDir, "japanese_issue(A).zip");
    File localFile3 = new File(localDir, "log_01(A).txt");
    File localFile4 = new File(localDir, "xsd-sourcedoc-2.10.0(A).zip");

    boolean succeed1 = fs.downloadFsFileToFile(fileRef1, localFile1);
    boolean succeed2 = fs.downloadFsFileToFile(fileRef2, localFile2);
    boolean succeed3 = fs.downloadFsFileToFile(fileRef3, localFile3);
    boolean succeed4 = fs.downloadFsFileToFile(fileRef4, localFile4);

    System.out.println(
        "Path '"
            + fileRef1.getPath()
            + "' is downloaded to local file '"
            + localFile1.getAbsolutePath()
            + "'? "
            + succeed1);
    System.out.println(
        "Path '"
            + fileRef2.getPath()
            + "' is downloaded to local file '"
            + localFile2.getAbsolutePath()
            + "'? "
            + succeed2);
    System.out.println(
        "Path '"
            + fileRef3.getPath()
            + "' is downloaded to local file '"
            + localFile3.getAbsolutePath()
            + "'? "
            + succeed3);
    System.out.println(
        "Path '"
            + fileRef4.getPath()
            + "' is downloaded to local file '"
            + localFile4.getAbsolutePath()
            + "'? "
            + succeed4);

    System.out.println();
  }
コード例 #4
0
ファイル: FsTestMac.java プロジェクト: oceaneuropa/dev
  @Ignore
  @Test
  public void test006_uploadDirectories() throws IOException {
    System.out.println("--- --- --- test006_uploadDirectories() --- --- ---");

    // File localDir = new File("/Users/yayang/Downloads/test_source1");
    // FileRef dirRef = fs.root();
    File localDir = new File("/Users/yayang/osgi");
    FileRef dirRef = FileRef.newInstance(fs, "/osgi");

    boolean succeed = fs.uploadDirectoryToFsDirectory(localDir, dirRef, false);
    System.out.println(
        "Local directory '"
            + localDir.getAbsolutePath()
            + "' is uploaded to path '"
            + dirRef.getPath()
            + "'? "
            + succeed);

    System.out.println();
  }
コード例 #5
0
ファイル: FsTestMac.java プロジェクト: oceaneuropa/dev
 protected FileSystem getFileSystem() {
   FileSystemConfiguration config =
       new FileSystemConfiguration("http://127.0.0.1:9090", "/fs/v1", "root", "admin");
   return FileSystem.newInstance(config);
 }