Пример #1
0
  @Test
  public void uncPath() throws Exception {
    // Simple UNC path
    NetworkPlace np = create("\\\\windowsserver");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "smb", "windowsserver", 0, "", "", "");

    // Simple UNC path with share
    np = create("\\\\windowsserver\\MyShare");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "smb", "windowsserver", 0, "/MyShare", "", "");

    // Simple UNC path with share with spaces
    np = create("\\\\windowsserver\\My Share");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "smb", "windowsserver", 0, "/My Share", "", "");
  }
Пример #2
0
  @Test
  public void localPath() throws Exception {
    // Local path
    String dir = SystemProperties.get("user.dir");
    NetworkPlace np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");

    // Windows path
    dir = "C:\\Program Files\\Adito";
    np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");

    // UNIX path
    dir = "/home/joeb/My Documents";
    np = create(dir);
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, dir, "", "");
  }
Пример #3
0
  @Test
  public void uriPath() throws Exception {
    // FTP URI
    NetworkPlace np = create("ftp://*****:*****@ftpserver.test.com/home/joeb");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "ftp", "ftpserver.test.com", 0, "/home/joeb", "joeb", "secret");

    // FTP URI with replacements
    np = create("ftp://${session:username}:${session:password}@ftpserver.test.com/home/brett");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(
        np,
        "ftp",
        "ftpserver.test.com",
        0,
        "/home/brett",
        "${session:username}",
        "${session:password}");

    // FTP URI with encoded bits
    np = create("ftp://joeb%3A:sec%[email protected]/home/joeb/Dir%20With+Spaces");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "ftp", "ftpserver.test.com", 0, "/home/joeb/Dir With Spaces", "joeb:", "sec+ret");

    // SMB URI
    np = create("smb://smbserver.test.com/MyShare");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "smb", "smbserver.test.com", 0, "/MyShare", "", "");

    // Absolute file URI
    np = create("file://opt/adito/logs");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, "/opt/adito/logs", "", "");

    // Windows Absolute file URI
    np = create("file:///C:/Documents and Settings/joeb");
    NetworkPlaceUtil.convertNetworkPlace(np);
    test(np, "file", "", 0, "C:/Documents and Settings/joeb", "", "");
  }