This directory contains acceptance tests for Java implementation.
Current implementation supports these tests:
- test_arrays
- test_binary
- test_builtin
- test_const
- test_enums
- test_lists
- test_struct
and communicate via TPC or serial port.
To check that all the prerequisites are correctly installed, run mvn -v
. You should get something like this:
Apache Maven 3.9.5 (***)
Maven home: c:\Program Files\Maven\apache-maven-3.9.5
Java version: 21, vendor: Oracle Corporation, runtime: c:\Program Files\Java\jdk-21
Default locale: en_US, platform encoding: UTF-8
OS name: "***", version: "***", arch: "***", family: "***"
- If
mvn -v
fails, check that you have added maven to thePATH
variable. - If you do not see the correct Java version, check that you have set the
JAVA_HOME
andPATH
variables correctly.
- client/ - client side tests
- server/ - server side tests
- servers/ - TCP and UART server for testing purpose
- services/ - server side functions implementation
To generate Java shim code for tests run:
ruby ..\..\internal\scripts\generate_erpc_java.rb [erpcgen_path] [erpc_path]
ruby ..\..\internal\scripts\generate_erpc_java.rb "erpcgen\VisualStudio_v14\Debug\" "C:\mcu-multicore\erpc"
To execute Java tests from commandline use Maven test
lifecycle. Selecting specific test case is done with
parameter -Dtest=TestName
. It is also possible to change transport configuration with parameters specified below.
TestName
is derived as PascalCase from base test name specified in IDL file.
Example: test_arrays -> TestArrays
Server tests names are create by adding Server
to TestName
.
Example: test_arrays -> TestArraysServer
To run client test, execute mvn test -Dtest=TestName
To run server test, execute mvn test -Dtest=TestNameServer -Dserver
-Dtest=TEST_NAME
- Name of the test (Pascal case)-Dclient
(Default) or-Dserver
-Dhost=HOST_NAME
(default: localhost) - Set host name-Dport=PORT
(default: 40) - Set port-Dserial=COM_PORT
(default: COM6) - Enable serial communication-Dbaudrate=BAUDRATE
(default: 115200) - Set serial link baudrate
mvn test -Dtest=TestArrays # Client test casemvn
mvn test -Dtest=TestArrays -Dserial=COM6 -Dbaudrate=115200 # Specified serial transport
mvn test -Dtest=TestArraysServer -Dserver # Server test case
mvn test -Dtest=TestArraysServer -Dserver -Dport=12345 # Server test case with custom port
- client/ - Client tests
- server/ - Server tests
- services/ - Services for server tests
- Connection.java - Helper class for transport creation
- TestingClient.java - Base class for client tests
- TestingServer.java
- This class represent ERPC server for testing purpose. SimpleServer instance is stored as static, so it
is possible to stop the server and close connection with static function
stop()
without access to the instance of the class. This is used inCommonService.java
to stop currently running server.
- This class represent ERPC server for testing purpose. SimpleServer instance is stored as static, so it
is possible to stop the server and close connection with static function