use of com.hazelcast.client.impl.statistics.ClientStatistics in project hazelcast by hazelcast.
the class ClientStatisticsTest method testNoUpdateWhenDisabled.
@Test
public void testNoUpdateWhenDisabled() {
HazelcastInstance hazelcastInstance = hazelcastFactory.newHazelcastInstance();
final ClientEngineImpl clientEngine = getClientEngineImpl(hazelcastInstance);
ClientConfig clientConfig = new ClientConfig();
clientConfig.getMetricsConfig().setEnabled(false).setCollectionFrequencySeconds(STATS_PERIOD_SECONDS);
hazelcastFactory.newHazelcastClient(clientConfig);
assertTrueAllTheTime(() -> {
Map<UUID, ClientStatistics> statistics = clientEngine.getClientStatistics();
assertEquals(0, statistics.size());
}, STATS_PERIOD_SECONDS * 3);
}
use of com.hazelcast.client.impl.statistics.ClientStatistics in project hazelcast by hazelcast.
the class ClientStatisticsTest method testStatisticsTwoClients.
@Test
public void testStatisticsTwoClients() {
HazelcastInstance hazelcastInstance = hazelcastFactory.newHazelcastInstance();
final HazelcastClientInstanceImpl client1 = createHazelcastClient();
final HazelcastClientInstanceImpl client2 = createHazelcastClient();
final ClientEngineImpl clientEngine = getClientEngineImpl(hazelcastInstance);
assertTrueEventually(() -> {
Map<UUID, ClientStatistics> clientStatistics = clientEngine.getClientStatistics();
assertNotNull(clientStatistics);
assertEquals(2, clientStatistics.size());
List<UUID> expectedUUIDs = new ArrayList<>(2);
expectedUUIDs.add(client1.getClientClusterService().getLocalClient().getUuid());
expectedUUIDs.add(client2.getClientClusterService().getLocalClient().getUuid());
for (Map.Entry<UUID, ClientStatistics> clientEntry : clientStatistics.entrySet()) {
assertTrue(expectedUUIDs.contains(clientEntry.getKey()));
String clientAttributes = clientEntry.getValue().clientAttributes();
assertNotNull(clientAttributes);
}
});
}
Aggregations