Skip to content

Commit

Permalink
#18 test coverage for SFTP
Browse files Browse the repository at this point in the history
  • Loading branch information
maddingo committed Jan 2, 2017
1 parent 1ecff3a commit 435b134
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 393 deletions.
6 changes: 3 additions & 3 deletions sftp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<version>0.1.54</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nio-fs-test-util</artifactId>
<version>${project.version}</version>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
212 changes: 108 additions & 104 deletions sftp/src/main/java/no/maddin/niofs/sftp/SFTPHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,111 +13,115 @@

/**
* Represents a host for the SFTP file system provider.
*
*
*/
public class SFTPHost extends FileSystem {

private final FileSystemProvider provider;
private final URI serverUri;
private final int port;
private final String host;
private final String password;
private final String username;

public SFTPHost(FileSystemProvider provider, URI serverUri) {
this.provider = provider;
this.serverUri = serverUri;
this.host = serverUri.getHost();
this.port = serverUri.getPort();
String[] ui = serverUri.getUserInfo().split(":");
this.username = ui[0];
this.password = ui[1];
}

@Override
public FileSystemProvider provider() {
return provider;
}

@Override
public void close() throws IOException {
// TODO Auto-generated method stub

}

@Override
public boolean isOpen() {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean isReadOnly() {
// TODO Auto-generated method stub
return false;
}

@Override
public String getSeparator() {
// TODO Auto-generated method stub
return null;
}

@Override
public Iterable<Path> getRootDirectories() {
// TODO Auto-generated method stub
return null;
}

@Override
public Iterable<FileStore> getFileStores() {
// TODO Auto-generated method stub
return null;
}

@Override
public Set<String> supportedFileAttributeViews() {
// TODO Auto-generated method stub
return null;
}

@Override
public Path getPath(String first, String... more) {
// TODO Auto-generated method stub
return null;
}

@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
// TODO Auto-generated method stub
return null;
}

@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
// TODO Auto-generated method stub
return null;
}

@Override
public WatchService newWatchService() throws IOException {
// TODO Auto-generated method stub
return null;
}

public String getUserName() {
return this.username;
}

public String getPassword() {
return this.password;
}

public String getHost() {
return this.host;
}

public int getPort() {
return this.port;
}
private final FileSystemProvider provider;
private final int port;
private final String host;
private final String password;
private final String username;

SFTPHost(FileSystemProvider provider, URI serverUri) {
this.provider = provider;
this.host = serverUri.getHost();
this.port = serverUri.getPort();
String userInfo = serverUri.getUserInfo();
if (userInfo != null) {
String[] ui = userInfo.split(":");
this.username = ui[0];
this.password = ui[1];
} else {
username = null;
password = null;
}
}

@Override
public FileSystemProvider provider() {
return provider;
}

@Override
public void close() throws IOException {
// TODO Auto-generated method stub

}

@Override
public boolean isOpen() {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean isReadOnly() {
// TODO Auto-generated method stub
return false;
}

@Override
public String getSeparator() {
// TODO Auto-generated method stub
return null;
}

@Override
public Iterable<Path> getRootDirectories() {
// TODO Auto-generated method stub
return null;
}

@Override
public Iterable<FileStore> getFileStores() {
// TODO Auto-generated method stub
return null;
}

@Override
public Set<String> supportedFileAttributeViews() {
// TODO Auto-generated method stub
return null;
}

@Override
public Path getPath(String first, String... more) {
// TODO Auto-generated method stub
return null;
}

@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
// TODO Auto-generated method stub
return null;
}

@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
// TODO Auto-generated method stub
return null;
}

@Override
public WatchService newWatchService() throws IOException {
// TODO Auto-generated method stub
return null;
}

String getUserName() {
return this.username;
}

String getPassword() {
return this.password;
}

String getHost() {
return this.host;
}

int getPort() {
return this.port;
}
}
Loading

0 comments on commit 435b134

Please sign in to comment.