Testing the Server and Bidirectional Streaming RPCs
Demonstrate the gRPC FTP service in the terminal.
We have added the server streaming readFile
RPC and the bidirectional streaming getFileAttributes
RPC to the ftp-service
project created in Setting up the Dev Environment lesson.
The project has a destOnServer
addFile
RPC. We will create three test files in the destOnServer
directory to test the read and get file attributes RPCs. We have named the files myFile
, sample.cpp
, and testFile.txt
. The files contain dummy text.
After adding the new RPCs we recompile the project from the Terminal in the IDE by executing the following command:
mvn clean install
This deletes the target
directory from each module and triggers the build process again to recompile the project’s source code. After running this command, the target
folder within each module of your project will be updated. The target
folder contains the compiled classes, JAR files, and other artifacts generated during the build process.
Start the gRPC server
To start the server we will run the commands from the target
folder in the ftp-service
project. Navigate to the target directory of the server project (grpc-ftp-project/ftp-service/target
).
From this directory we will execute the following command:
java -cp ftp-service-1.0.2.jar io.datajek.ftpservice.Application