Skip to content
Open
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
41 changes: 37 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [opened, reopened, synchronize]

jobs:
build_and_test_desktop:
build_and_test_fastdds_desktop:
runs-on: ubuntu-24.04
steps:
- name: Install Java
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
mkdir -p ros2_java_ws/src
cd ros2_java_ws
curl -sL file://${{ github.workspace }}/ros2_java_desktop.repos | vcs import src
curl -sL file://${{ github.workspace }}/ros2_java_desktop_fastdds.repos | vcs import src
# Use checked out version of ros2_java
rm -rf src/ros2-java/ros2_java
ln --symbolic ${{ github.workspace }} src/ros2-java
Expand All @@ -41,7 +41,40 @@ jobs:
source install/setup.bash
colcon test --event-handlers=console_direct+ --packages-select rosidl_generator_java_tests rosidl_generator_java rcljava_common rcljava
colcon test-result --verbose
build_android:
build_and_test_zenoh_desktop:
runs-on: ubuntu-24.04
steps:
- name: Install Java
run: |
sudo apt-get update -qq
sudo apt-get install -y openjdk-21-jre
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y libasio-dev libbenchmark-dev
- uses: ros-tooling/setup-ros@0.7.9
with:
required-ros-distributions: jazzy
- uses: actions/checkout@v4.2.1
- name: Setup workspace with VCS repo file
run: |
mkdir -p ros2_java_ws/src
cd ros2_java_ws
curl -sL file://${{ github.workspace }}/ros2_java_desktop_zenoh.repos | vcs import src
# Use checked out version of ros2_java
rm -rf src/ros2-java/ros2_java
ln --symbolic ${{ github.workspace }} src/ros2-java
- name: Run Colcon Build
run: |
cd ros2_java_ws
colcon build --event-handlers=console_direct+ --symlink-install --packages-up-to rosidl_generator_java_tests rosidl_generator_java rcljava_common rcljava
- name: Run Colcon Test
run: |
cd ros2_java_ws
source install/setup.bash
colcon test --event-handlers=console_direct+ --packages-select rosidl_generator_java_tests rosidl_generator_java rcljava_common rcljava
colcon test-result --verbose
build_fastdds_android:
runs-on: ubuntu-24.04
steps:
- name: Install Java
Expand Down Expand Up @@ -70,7 +103,7 @@ jobs:
run: |
mkdir -p ros2_java_ws/src
cd ros2_java_ws
curl -sL file://${{ github.workspace }}/ros2_java_android.repos | vcs import src
curl -sL file://${{ github.workspace }}/ros2_java_android_fastdds.repos | vcs import src
# Use checked out version of ros2_java
rm -rf src/ros2-java/ros2_java
ln --symbolic ${{ github.workspace }} src/ros2-java
Expand Down
78 changes: 50 additions & 28 deletions rcljava/src/test/java/org/ros2/rcljava/node/NodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1092,20 +1092,31 @@ public final void testGetPublishersInfo() {
new Consumer<Collection<EndpointInfo>>() {
public void accept(final Collection<EndpointInfo> info) {
assertEquals(info.size(), 2);
Iterator<EndpointInfo> it = info.iterator();
EndpointInfo item = it.next();
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(item.endpointType, EndpointInfo.EndpointType.PUBLISHER);
assertEquals(item.qos.getReliability(), Reliability.RELIABLE);
item = it.next();
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(item.endpointType, EndpointInfo.EndpointType.PUBLISHER);
assertEquals(item.qos.getReliability(), Reliability.BEST_EFFORT);
assertFalse(it.hasNext());
boolean hasSeenReliable = false;
boolean hasSeenBestEffort = false;

for (EndpointInfo item : info) {
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(EndpointInfo.EndpointType.PUBLISHER, item.endpointType);

// The order of returned publishers it not stable across RMW implementations, so the test
// must support receiving them in either order
assertTrue(Reliability.RELIABLE == item.qos.getReliability() || Reliability.BEST_EFFORT == item.qos.getReliability());

// We can only see each Reliability type once
if (Reliability.RELIABLE == item.qos.getReliability()) {
assertFalse(hasSeenReliable);
hasSeenReliable = true;
} else if (Reliability.BEST_EFFORT == item.qos.getReliability()) {
assertFalse(hasSeenBestEffort);
hasSeenBestEffort = true;
}
}

assertTrue(hasSeenReliable);
assertTrue(hasSeenBestEffort);
}
};

Expand Down Expand Up @@ -1149,20 +1160,31 @@ public void accept(final rcljava.msg.UInt32 msg) {}
new Consumer<Collection<EndpointInfo>>() {
public void accept(final Collection<EndpointInfo> info) {
assertEquals(info.size(), 2);
Iterator<EndpointInfo> it = info.iterator();
EndpointInfo item = it.next();
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(item.endpointType, EndpointInfo.EndpointType.SUBSCRIPTION);
assertEquals(item.qos.getReliability(), Reliability.RELIABLE);
item = it.next();
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(item.endpointType, EndpointInfo.EndpointType.SUBSCRIPTION);
assertEquals(item.qos.getReliability(), Reliability.BEST_EFFORT);
assertFalse(it.hasNext());
boolean hasSeenReliable = false;
boolean hasSeenBestEffort = false;

for (EndpointInfo item : info) {
assertEquals("test_node", item.nodeName);
assertEquals("/", item.nodeNamespace);
assertEquals("rcljava/msg/UInt32", item.topicType);
assertEquals(EndpointInfo.EndpointType.SUBSCRIPTION, item.endpointType);

// The order of returned publishers it not stable across RMW implementations, so the test
// must support receiving them in either order
assertTrue(Reliability.RELIABLE == item.qos.getReliability() || Reliability.BEST_EFFORT == item.qos.getReliability());

// We can only see each Reliability type once
if (Reliability.RELIABLE == item.qos.getReliability()) {
assertFalse(hasSeenReliable);
hasSeenReliable = true;
} else if (Reliability.BEST_EFFORT == item.qos.getReliability()) {
assertFalse(hasSeenBestEffort);
hasSeenBestEffort = true;
}
}

assertTrue(hasSeenReliable);
assertTrue(hasSeenBestEffort);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ public final void testCreateAndDispose() {
@Test
public final void testCreateLivelinessLostEvent() {
RCLJava.rclJavaInit();

String identifier = RCLJava.getRMWIdentifier();
if (identifier.equals("rmw_zenoh_cpp")) {
// LivelinessLost events are not supported in Zenoh yet.
return;
}

Node node = RCLJava.createNode("test_node");
Publisher<std_msgs.msg.String> publisher =
node.<std_msgs.msg.String>createPublisher(std_msgs.msg.String.class, "test_topic");
Expand All @@ -114,7 +121,7 @@ public void accept(final LivelinessLost status) {
@Test
public final void testCreateOfferedQosIncompatibleEvent() {
String identifier = RCLJava.getRMWIdentifier();
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp")) {
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp") || identifier.equals("rmw_zenoh_cpp")) {
// event not supported in these implementations
return;
}
Expand Down Expand Up @@ -144,6 +151,13 @@ public void accept(final OfferedQosIncompatible status) {
@Test
public final void testCreateOfferedDeadlineMissedEvent() {
RCLJava.rclJavaInit();

String identifier = RCLJava.getRMWIdentifier();
if (identifier.equals("rmw_zenoh_cpp")) {
// OfferedDeadlineMissed events are not supported in Zenoh yet.
return;
}

Node node = RCLJava.createNode("test_node");
Publisher<std_msgs.msg.String> publisher =
node.<std_msgs.msg.String>createPublisher(std_msgs.msg.String.class, "test_topic");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public void accept(final std_msgs.msg.String msg) {}
@Test
public final void testCreateLivelinessChangedEvent() {
String identifier = RCLJava.getRMWIdentifier();

if (identifier.equals("rmw_zenoh_cpp")) {
// LivelinessChanged events are not supported in Zenoh yet.
return;
}

RCLJava.rclJavaInit();
Node node = RCLJava.createNode("test_node");
Subscription<std_msgs.msg.String> subscription = node.<std_msgs.msg.String>createSubscription(
Expand All @@ -101,6 +107,12 @@ public void accept(final LivelinessChanged status) {
@Test
public final void testCreateRequestedDeadlineMissedEvent() {
String identifier = RCLJava.getRMWIdentifier();

if (identifier.equals("rmw_zenoh_cpp")) {
// RequestedDeadlineMissed events are not supported in Zenoh yet.
return;
}

RCLJava.rclJavaInit();
Node node = RCLJava.createNode("test_node");
Subscription<std_msgs.msg.String> subscription = node.<std_msgs.msg.String>createSubscription(
Expand All @@ -125,7 +137,7 @@ public void accept(final RequestedDeadlineMissed status) {
@Test
public final void testCreateRequestedQosIncompatibleEvent() {
String identifier = RCLJava.getRMWIdentifier();
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp")) {
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp") || identifier.equals("rmw_zenoh_cpp")) {
// event not supported in these implementations
return;
}
Expand Down Expand Up @@ -154,7 +166,7 @@ public void accept(final RequestedQosIncompatible status) {
@Test
public final void testCreateMessageLost() {
String identifier = RCLJava.getRMWIdentifier();
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp")) {
if (identifier.equals("rmw_fastrtps_cpp") || identifier.equals("rmw_fastrtps_dynamic_cpp") || identifier.equals("rmw_zenoh_cpp")) {
// event not supported in these implementations
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ repositories:
version: jazzy
ros2/rmw_implementation:
type: git
url: https://github.com/ros2/rmw_implementation.git
url: https://github.com/skalldri/rmw_implementation.git
version: jazzy
ros2/rpyutils:
type: git
Expand Down
Loading