public class ClientPutDiskDir {
- private final TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void setup() throws IOException {
- folder.create();
- Files.write("file1\n", folder.newFile("file1.txt"), StandardCharsets.UTF_8);
- Files.write("file2\n", folder.newFile("file2.txt"), StandardCharsets.UTF_8);
- File directory = folder.newFolder("dir");
- Files.write("file3\n", new File(directory, "file3.txt"), StandardCharsets.UTF_8);
- }
-
- @After
- public void removeFolder() {
- folder.delete();
- }
-
@Test
public void commandIsSentCorrectly() throws InterruptedException, ExecutionException, IOException {
- Future<Optional<Key>> key = fcpClient.clientPutDiskDir().fromDirectory(folder.getRoot()).uri("CHK@").execute();
+ Future<Optional<Key>> key = fcpClient.clientPutDiskDir().fromDirectory(new File("")).uri("CHK@").execute();
connectAndAssert(this::matchesClientPutDiskDir);
fcpServer.writeLine("PutSuccessful", "Identifier=" + identifier, "URI=CHK@abc", "EndMessage");
assertThat(key.get().get().getKey(), is("CHK@abc"));
@Test
public void protocolErrorAbortsCommand() throws InterruptedException, ExecutionException, IOException {
- Future<Optional<Key>> key = fcpClient.clientPutDiskDir().fromDirectory(folder.getRoot()).uri("CHK@").execute();
+ Future<Optional<Key>> key = fcpClient.clientPutDiskDir().fromDirectory(new File("")).uri("CHK@").execute();
connectAndAssert(this::matchesClientPutDiskDir);
replyWithProtocolError();
assertThat(key.get().isPresent(), is(false));
"ClientPutDiskDir",
"Identifier=" + identifier,
"URI=CHK@",
- "Filename=" + folder.getRoot().getPath()
+ "Filename=" + new File("").getPath()
);
}