use of org.infinispan.client.hotrod.test.RemoteCacheManagerCallable in project infinispan by infinispan.
the class PingOnStartupTest method testTopologyFetched.
public void testTopologyFetched() {
HotRodServer hotRodServer2 = server(1);
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder(hotRodServer2);
withRemoteCacheManager(new RemoteCacheManagerCallable(new InternalRemoteCacheManager(clientBuilder.build())) {
@Override
public void call() {
ChannelFactory channelFactory = ((InternalRemoteCacheManager) rcm).getChannelFactory();
for (int i = 0; i < 10; i++) {
if (channelFactory.getServers().size() == 1) {
TestingUtil.sleepThread(1000);
} else {
break;
}
}
assertEquals(2, channelFactory.getServers().size());
}
});
}
use of org.infinispan.client.hotrod.test.RemoteCacheManagerCallable in project infinispan by infinispan.
the class PingOnStartupTest method testGetCacheWithPingOnStartupDisabledMultipleNodes.
public void testGetCacheWithPingOnStartupDisabledMultipleNodes() {
HotRodServer hotRodServer2 = server(1);
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
clientBuilder.addServers("boomoo:12345;localhost:" + hotRodServer2.getPort());
withRemoteCacheManager(new RemoteCacheManagerCallable(new RemoteCacheManager(clientBuilder.build())) {
@Override
public void call() {
RemoteCache<Object, Object> cache = rcm.getCache();
assertFalse(cache.containsKey("k"));
}
});
}
use of org.infinispan.client.hotrod.test.RemoteCacheManagerCallable in project infinispan by infinispan.
the class PingOnStartupTest method testHashAwareIntelligence.
public void testHashAwareIntelligence() {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
clientBuilder.addServer().host("127.0.0.1").port(server(0).getPort());
clientBuilder.clientIntelligence(ClientIntelligence.HASH_DISTRIBUTION_AWARE);
withRemoteCacheManager(new RemoteCacheManagerCallable(new InternalRemoteCacheManager(clientBuilder.build())) {
@Override
public void call() {
rcm.getCache();
ChannelFactory channelFactory = ((InternalRemoteCacheManager) rcm).getChannelFactory();
assertEquals(2, channelFactory.getServers().size());
}
});
}
use of org.infinispan.client.hotrod.test.RemoteCacheManagerCallable in project infinispan by infinispan.
the class PingOnStartupTest method testTopologyAwareIntelligence.
public void testTopologyAwareIntelligence() {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
clientBuilder.addServer().host("127.0.0.1").port(server(0).getPort());
clientBuilder.clientIntelligence(ClientIntelligence.TOPOLOGY_AWARE);
withRemoteCacheManager(new RemoteCacheManagerCallable(new InternalRemoteCacheManager(clientBuilder.build())) {
@Override
public void call() {
rcm.getCache();
ChannelFactory channelFactory = ((InternalRemoteCacheManager) rcm).getChannelFactory();
assertEquals(2, channelFactory.getServers().size());
}
});
}
use of org.infinispan.client.hotrod.test.RemoteCacheManagerCallable in project infinispan by infinispan.
the class PingOnStartupTest method testGetCacheWorksIfNodeNotDown.
public void testGetCacheWorksIfNodeNotDown() {
HotRodServer hotRodServer2 = server(1);
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
clientBuilder.addServers("localhost:" + hotRodServer2.getPort());
withRemoteCacheManager(new RemoteCacheManagerCallable(new RemoteCacheManager(clientBuilder.build())) {
@Override
public void call() {
rcm.getCache();
}
});
}
Aggregations