Skip to content

Commit

Permalink
feat(discovery): add new eventkind for modified state (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thuan Vo authored Jan 13, 2023
1 parent 867a959 commit f5d52fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ public void onDiscovery(DiscoveryEvent evt) {
c -> c.accept(new JvmDiscoveryEvent(EventKind.LOST, desc)));
break;
case CHANGED:
eventListeners.forEach(
c -> c.accept(new JvmDiscoveryEvent(EventKind.LOST, desc)));
eventListeners.forEach(
c ->
c.accept(
new JvmDiscoveryEvent(
EventKind.FOUND, desc)));
EventKind.MODIFIED, desc)));
break;
default:
logger.error(
Expand Down Expand Up @@ -148,6 +146,6 @@ public DiscoveredJvmDescriptor getJvmDescriptor() {
public enum EventKind {
FOUND,
LOST,
;
MODIFIED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,11 @@ void testChangedEvent() throws IOException {
"com.example.Foo", "service:jmx:rmi:///jndi/rmi://foo:9091/jmxrmi");
listener.onDiscovery(new DiscoveryEvent(DiscoveryEvent.Kind.CHANGED, discoverable));

MatcherAssert.assertThat(
kinds, Matchers.equalTo(List.of(EventKind.LOST, EventKind.FOUND)));
MatcherAssert.assertThat(kinds, Matchers.equalTo(List.of(EventKind.MODIFIED)));
MatcherAssert.assertThat(
jvms,
Matchers.equalTo(
List.of(
new DiscoveredJvmDescriptor(discoverable.getPayload()),
new DiscoveredJvmDescriptor(discoverable.getPayload()))));
List.of(new DiscoveredJvmDescriptor(discoverable.getPayload()))));
}
}

Expand Down

0 comments on commit f5d52fe

Please sign in to comment.