Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmkdir #2

Merged
merged 3 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main/java/com/nerox/client/Tfprotocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ public void mkdirCommand(String path) {
this.easyreum.getBuilder().build("MKDIR",path).translate()
.getBuilder().buildStatusInfo());
}


/**
* RMKDIR “path/to/new/dir”
* RMKDIR command creates a directory recursively at the specified
* @param path The path to the directory that is going to be created
*/
public void rmkdirCommand(String path) {
this.getProtoHandler().rmkdirCallback(
this.easyreum.getBuilder().build("RMKDIR",path).translate()
.getBuilder().buildStatusInfo());
}

/**
* Command deletes the specified file. This is a special command because is the only one who can operate in a locked
* directory. If it is the case, then DEL can only delete exactly one file: The locking file.
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is OK, please don't add any changes to it

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ default void mkdirCallback(StatusInfo status){
throw new RuntimeException("Callback is not implemented: exception");
}

default void rmkdirCallback(StatusInfo status){
throw new RuntimeException("Callback is not implemented: exception");
}

default void delCallback(StatusInfo status){
throw new RuntimeException("Callback is not implemented: exception");
}
Expand Down
8 changes: 7 additions & 1 deletion src/test/java/com/nerox/client/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.ByteArrayInputStream;

import com.nerox.client.keepalives.UDPKeepAlive;
import com.nerox.client.misc.StatusServer;
import com.nerox.client.misc.TCPTimeouts;
import com.nerox.client.security.Cryptography;
import org.junit.Test;
Expand Down Expand Up @@ -65,6 +66,7 @@ private String joinPaths(String ...paths){
public void runAllTests(){
this.tfprotocolDoesConnect();
this.testConnectionWithTimeout();
this.testsRmkdir();
//this.loginCommand();
//this.setfsidCommand();
//this.setfspermCommand();
Expand All @@ -76,7 +78,11 @@ public void tfprotocolDoesConnect()
{
assertTrue(this.tfprotocol.isConnect());
}

public void testsRmkdir(){
this.tfprotocol.rmkdirCommand(this.normalizePath("/rene/java/etc"));
assertTrue("Server status OK after RMKDIR command execution "
,this.tfprotocol.easyreum.getBuilder().getStatusInfo().getStatus()==StatusServer.OK);
}
public void testConnectionWithTimeout() {
TCPTimeouts tcptimeouts = TCPTimeouts.getInstance(this.callback);
tcptimeouts.setConnectTimeout(5);
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/nerox/client/Callback.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
public class Callback implements ITfprotocolCallback{
Tfprotocol tfprotocol;
@Override
public void rmkdirCallback(StatusInfo status) {
this.statusServer(status);
}
@Override
public void statusServer(StatusInfo status) {
System.out.println("------------------------------");
System.out.println(status.getStatus());
Expand Down
Loading