-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>nio-fs</artifactId> | ||
<groupId>no.maddin.niofs</groupId> | ||
<version>2.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>integration-tests</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>no.maddin.niofs</groupId> | ||
<artifactId>nio-fs-sftp</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import org.hamcrest.Matcher; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
|
||
@RunWith(Parameterized.class) | ||
public class PathServerOperations { | ||
|
||
private final String uriString; | ||
private final Matcher<?> expected; | ||
|
||
@Parameterized.Parameters(name="{index} {0} {1}") | ||
public static java.util.List<Object[]> data() { | ||
return Arrays.asList( | ||
new Object[] {"sftp://localhost/", is(true)}, | ||
new Object[] {"sftp://localhost/testfile/", is(true)} | ||
); | ||
} | ||
|
||
public PathServerOperations(String uriString, Matcher<?> expected) { | ||
this.uriString = uriString; | ||
this.expected = expected; | ||
} | ||
|
||
private void startSftpServer() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import no.maddin.niofs.sftp.SFTPPath; | ||
import org.hamcrest.Matcher; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.net.URI; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Arrays; | ||
|
||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
@RunWith(Parameterized.class) | ||
public class PathsGetUriIT { | ||
|
||
@Rule | ||
public ExpectedException exception = ExpectedException.none(); | ||
|
||
private final String uriString; | ||
private final Matcher<Path> testGetUriExpected; | ||
private final Matcher<? extends Throwable> exceptionExpectation; | ||
|
||
@Parameterized.Parameters(name="{index} {0} {1}") | ||
public static java.util.List<Object[]> data() { | ||
return Arrays.asList( | ||
new Object[] { | ||
"sftp://localhost/", | ||
null, | ||
instanceOf(SFTPPath.class) | ||
}, | ||
new Object[] { | ||
"sftp://localhost/testfile/", | ||
null, | ||
instanceOf(SFTPPath.class) | ||
}, | ||
new Object[] { | ||
"sftp://localhost/../testfile/", | ||
null, | ||
instanceOf(SFTPPath.class) | ||
}, | ||
new Object[] { | ||
"sftp:/localhost/../testfile/", | ||
instanceOf(IllegalArgumentException.class), | ||
instanceOf(SFTPPath.class) | ||
} | ||
|
||
); | ||
} | ||
|
||
public PathsGetUriIT(String uriString, Matcher<? extends Throwable> exceptionExpectation, Matcher<Path> testGetUriExpected) { | ||
this.uriString = uriString; | ||
this.exceptionExpectation = exceptionExpectation; | ||
this.testGetUriExpected = testGetUriExpected; | ||
} | ||
|
||
@Test | ||
public void getURI() throws Exception { | ||
|
||
if (exceptionExpectation != null) { | ||
exception.expect(exceptionExpectation); | ||
} | ||
Path p = Paths.get(URI.create(this.uriString)); | ||
|
||
assertThat(p, is(testGetUriExpected)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters