tkalkirill commented on a change in pull request #568:
URL: https://github.com/apache/ignite-3/pull/568#discussion_r789568170
##########
File path:
modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
##########
@@ -1383,27 +1389,113 @@ void
testNotificationEventForNamedConfigAfterNotifyListeners() throws Exception
@Test
void testGetErrorFromListener() {
- configuration.child().listen(configListener(ctx -> {
+ config.child().listen(configListener(ctx -> {
throw new RuntimeException("from test");
}));
ExecutionException ex = assertThrows(
ExecutionException.class,
- () ->
configuration.child().str().update(UUID.randomUUID().toString()).get(1, SECONDS)
+ () ->
config.child().str().update(UUID.randomUUID().toString()).get(1, SECONDS)
);
assertTrue(hasCause(ex, RuntimeException.class, "from test"));
}
@Test
void testGetErrorFromListenerFuture() {
- configuration.child().listen(ctx -> CompletableFuture.failedFuture(new
RuntimeException("from test")));
+ config.child().listen(ctx -> CompletableFuture.failedFuture(new
RuntimeException("from test")));
ExecutionException ex = assertThrows(
ExecutionException.class,
- () ->
configuration.child().str().update(UUID.randomUUID().toString()).get(1, SECONDS)
+ () ->
config.child().str().update(UUID.randomUUID().toString()).get(1, SECONDS)
);
assertTrue(hasCause(ex, RuntimeException.class, "from test"));
}
+
+ @Test
+ void testNotifyListenersOnCurrentConfigWithoutChange() throws Exception {
+ config.children().change(c -> c.create("0",
doNothingConsumer())).get(1, SECONDS);
+
+ config.polyChildren().change(c -> c.create("0",
doNothingConsumer())).get(1, SECONDS);
+
+ Set<String> events = new HashSet<>();
+
+ config.listen(configListener(ctx -> events.add("root")));
+
+ config.child().listen(configListener(ctx -> events.add("child")));
+ config.child().str().listen(configListener(ctx ->
events.add("child.str")));
+
+ config.children().listen(configListener(ctx ->
events.add("children")));
+ config.children().listenElements(configNamedListenerOnCreate(ctx ->
events.add("children.onCreate")));
+ config.children().listenElements(configNamedListenerOnUpdate(ctx ->
events.add("children.onUpdate")));
+ config.children().listenElements(configNamedListenerOnRename(ctx ->
events.add("children.onRename")));
+ config.children().listenElements(configNamedListenerOnDelete(ctx ->
events.add("children.onDelete")));
+
+ config.children().get("0").listen(configListener(ctx ->
events.add("children.0")));
+ config.children().get("0").str().listen(configListener(ctx ->
events.add("children.0.str")));
+
+ config.children().any().listen(configListener(ctx ->
events.add("children.any")));
+ config.children().any().str().listen(configListener(ctx ->
events.add("children.any.str")));
+
+ // Polymorphic configs.
+
+ config.polyChild().listen(configListener(ctx ->
events.add("polyChild")));
+ config.polyChild().commonIntVal().listen(configListener(ctx ->
events.add("polyChild.int")));
+ ((StringPolyConfiguration)
config.polyChild()).specificVal().listen(configListener(ctx ->
events.add("polyChild.str")));
+
+ config.polyChildren().listen(configListener(ctx ->
events.add("polyChildren")));
+ config.polyChildren().listenElements(configNamedListenerOnCreate(ctx
-> events.add("polyChildren.onCreate")));
+ config.polyChildren().listenElements(configNamedListenerOnUpdate(ctx
-> events.add("polyChildren.onUpdate")));
+ config.polyChildren().listenElements(configNamedListenerOnRename(ctx
-> events.add("polyChildren.onRename")));
+ config.polyChildren().listenElements(configNamedListenerOnDelete(ctx
-> events.add("polyChildren.onDelete")));
+
+ config.polyChildren().get("0").listen(configListener(ctx ->
events.add("polyChildren.0")));
+
config.polyChildren().get("0").commonIntVal().listen(configListener(ctx ->
events.add("polyChildren.0.int")));
+ ((StringPolyConfiguration)
config.polyChildren().get("0")).specificVal()
+ .listen(configListener(ctx ->
events.add("polyChildren.0.str")));
+
+ config.polyChildren().any().listen(configListener(ctx ->
events.add("polyChildren.any")));
+ config.polyChildren().any().commonIntVal().listen(configListener(ctx
-> events.add("polyChildren.any.int")));
+
+ Collection<CompletableFuture<?>> futs = notifyListeners(
+ null,
+ (InnerNode) config.value(),
+ (DynamicConfiguration) config,
+ 0
+ );
+
+ for (CompletableFuture<?> fut : futs) {
+ fut.get(1, SECONDS);
+ }
+
+ assertEquals(
+ Set.of(
Review comment:
Yes, I can do it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]