private void checkRebalanceStatus( final boolean expectedStatus, MBeanServerConnectionProvider... providers) throws Exception { for (final MBeanServerConnectionProvider provider : providers) { eventually( new ITestUtils.Condition() { @Override public boolean isSatisfied() throws Exception { return expectedStatus == Boolean.parseBoolean( getAttribute(provider, LOCAL_TOPOLOGY_MANAGER, REBALANCE_ENABLED_ATTR_NAME)); } }, 10000); } }
private void checkRpcManagerStatistics( String[] expectedPendingViews, final String expectedCommitedView, MBeanServerConnectionProvider... providers) throws Exception { // on windows, everything is slow and the view might not be yet updated, so we sleep a little for (final MBeanServerConnectionProvider provider : providers) { if (expectedCommitedView != null) { eventually( new ITestUtils.Condition() { @Override public boolean isSatisfied() throws Exception { String committedViewAsString = String.valueOf( getAttribute( provider, RPC_MANAGER_MBEAN, COMMITTED_VIEW_AS_STRING_ATTR_NAME)); return expectedCommitedView.equals(committedViewAsString); } }, 10000); } String pendingViewAsString = String.valueOf( getAttribute(provider, RPC_MANAGER_MBEAN, PENDING_VIEW_AS_STRING_ATTR_NAME)); boolean passed = false; for (String expectedPendingView : expectedPendingViews) { if (expectedPendingView.equals(pendingViewAsString)) { passed = true; break; } } assertTrue( "The pending view doesn't match to any of expected ones, but is " + pendingViewAsString + ".", passed); } }