Пример #1
0
 @Test
 public void testImplicitModeDefaultPort() {
   FTPSConnectionPoint cp = new FTPSConnectionPoint();
   cp.setExplicit(false);
   assertEquals(
       "Default implicit port doesn't match", IFTPSConstants.FTPS_IMPLICIT_PORT, cp.getPort());
 }
Пример #2
0
 @Test
 public void testExplicitModeDefaultPort() {
   FTPSConnectionPoint cp = new FTPSConnectionPoint();
   cp.setExplicit(true);
   assertEquals(
       "Default explicit port doesn't match", IFTPSConstants.FTP_PORT_DEFAULT, cp.getPort());
 }
Пример #3
0
  private static void createAndTestConnectionPoint(
      String name,
      String host,
      int port,
      String login,
      char[] password,
      IPath path,
      String encoding,
      boolean passiveMode,
      String timezone,
      String transferType,
      boolean explicit,
      boolean noSSLSessionResumption,
      boolean validateCertificate) {
    FTPSConnectionPoint cp = new FTPSConnectionPoint();
    cp.setName(name);
    cp.setHost(host);
    cp.setPort(port);
    cp.setLogin(login);
    cp.setPassword(password);
    cp.setPassiveMode(passiveMode);
    cp.setPath(path);
    cp.setTimezone(timezone);
    cp.setTransferType(transferType);
    cp.setEncoding(encoding);
    cp.setExplicit(explicit);
    cp.setNoSSLSessionResumption(noSSLSessionResumption);
    cp.setValidateCertificate(validateCertificate);

    XMLMemento root = XMLMemento.createWriteRoot("root");
    IMemento memento = root.createChild("item");
    cp.saveState(memento);

    cp = new FTPSConnectionPoint();
    cp.loadState(memento);
    assertEquals("Name doesn't match", name, cp.getName());
    assertEquals("Host doesn't match", host, cp.getHost());
    assertEquals("Port doesn't match", port, cp.getPort());
    assertEquals("Login doesn't match", login, cp.getLogin());
    assertEquals("Password should not be persistent", null, cp.getPassword());
    assertEquals("Passive mode doesn't match", passiveMode, cp.isPassiveMode());
    assertEquals("Path doesn't match", path, cp.getPath());
    assertEquals("Timezone doesn't match", timezone, cp.getTimezone());
    assertEquals("Transfer type doesn't match", transferType, cp.getTransferType());
    assertEquals("Encoding doesn't match", encoding, cp.getEncoding());
    assertEquals("Explicit mode doesn't match", explicit, cp.isExplicit());
    assertEquals(
        "No SSL resumption mode doesn't match",
        noSSLSessionResumption,
        cp.isNoSSLSessionResumption());
    assertEquals(
        "Validate certificate mode doesn't match", validateCertificate, cp.isValidateCertificate());
  }