parakhnr commented on code in PR #2476:
URL: https://github.com/apache/helix/pull/2476#discussion_r1183141335
##########
helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProvider.java:
##########
@@ -298,21 +284,26 @@ public void testCustomizedViewWithoutType() {
public void testCustomizedViewCorrectConstructor() throws Exception {
Map<PropertyType, List<String>> sourceDataTypes = new HashMap<>();
sourceDataTypes.put(PropertyType.CUSTOMIZEDVIEW, Arrays.asList("typeA"));
- MockRoutingTableProvider routingTableProvider =
- new MockRoutingTableProvider(_spectator, sourceDataTypes);
+ CountDownLatch countDownLatch = new CountDownLatch(1);
+ RoutingTableProvider routingTableProvider =
+ new RoutingTableProvider(_spectator, sourceDataTypes) {
+ @Override
+ public void onCustomizedViewChange(List<CustomizedView>
customizedViewList,
+ NotificationContext changeContext){
+ countDownLatch.countDown();
+ super.onCustomizedViewChange(customizedViewList, changeContext);
+ }
+ };
CustomizedView customizedView = new CustomizedView(TEST_DB);
customizedView.setState("p1", "h1", "testState");
// Clear the flag before writing to the Customized View Path
- customizedViewChangeCalled.getAndSet(false);
String customizedViewPath =
PropertyPathBuilder.customizedView(CLUSTER_NAME, "typeA", TEST_DB);
_spectator.getHelixDataAccessor().getBaseDataAccessor().set(customizedViewPath,
customizedView.getRecord(), AccessOption.PERSISTENT);
- boolean onCustomizedViewChangeCalled =
- TestHelper.verify(() -> customizedViewChangeCalled.get(),
WAIT_DURATION);
- Assert.assertTrue(onCustomizedViewChangeCalled);
+ Assert.assertTrue(countDownLatch.await(5000, TimeUnit.MILLISECONDS));
Review Comment:
nit: Should we use `WAIT_DURATION` instead of `5000`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]