Search in sources :

Example 1 with InternalRemoteCacheManager

use of org.infinispan.client.hotrod.test.InternalRemoteCacheManager 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());
        }
    });
}
Also used : InternalRemoteCacheManager(org.infinispan.client.hotrod.test.InternalRemoteCacheManager) RemoteCacheManagerCallable(org.infinispan.client.hotrod.test.RemoteCacheManagerCallable) HotRodServer(org.infinispan.server.hotrod.HotRodServer) ChannelFactory(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory)

Example 2 with InternalRemoteCacheManager

use of org.infinispan.client.hotrod.test.InternalRemoteCacheManager 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());
        }
    });
}
Also used : InternalRemoteCacheManager(org.infinispan.client.hotrod.test.InternalRemoteCacheManager) RemoteCacheManagerCallable(org.infinispan.client.hotrod.test.RemoteCacheManagerCallable) ChannelFactory(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory)

Example 3 with InternalRemoteCacheManager

use of org.infinispan.client.hotrod.test.InternalRemoteCacheManager 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());
        }
    });
}
Also used : InternalRemoteCacheManager(org.infinispan.client.hotrod.test.InternalRemoteCacheManager) RemoteCacheManagerCallable(org.infinispan.client.hotrod.test.RemoteCacheManagerCallable) ChannelFactory(org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory)

Example 4 with InternalRemoteCacheManager

use of org.infinispan.client.hotrod.test.InternalRemoteCacheManager in project infinispan by infinispan.

the class RemoteAsyncAPITest method getRemoteCacheManager.

@Override
protected RemoteCacheManager getRemoteCacheManager() {
    ConfigurationBuilder builder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
    builder.forceReturnValues(isForceReturnValuesViaConfiguration());
    builder.addServer().host("127.0.0.1").port(hotrodServer.getPort());
    return new InternalRemoteCacheManager(builder.build());
}
Also used : ConfigurationBuilder(org.infinispan.client.hotrod.configuration.ConfigurationBuilder) InternalRemoteCacheManager(org.infinispan.client.hotrod.test.InternalRemoteCacheManager)

Example 5 with InternalRemoteCacheManager

use of org.infinispan.client.hotrod.test.InternalRemoteCacheManager in project infinispan by infinispan.

the class HotRodNonOwnerStatisticsTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    // Add 3 new nodes, but only start one server, so the client only has one connection
    newCacheManager();
    newCacheManager();
    newCacheManager();
    hotRodServer = startHotRodServer(cacheManagers.get(0));
    org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder(hotRodServer);
    clientBuilder.statistics().enable();
    // We only need one connection, avoid topology updates
    clientBuilder.clientIntelligence(ClientIntelligence.BASIC);
    remoteCacheManager = new InternalRemoteCacheManager(clientBuilder.build());
    remoteCache = remoteCacheManager.getCache();
}
Also used : InternalRemoteCacheManager(org.infinispan.client.hotrod.test.InternalRemoteCacheManager)

Aggregations

InternalRemoteCacheManager (org.infinispan.client.hotrod.test.InternalRemoteCacheManager)25 ConfigurationBuilder (org.infinispan.client.hotrod.configuration.ConfigurationBuilder)11 ChannelFactory (org.infinispan.client.hotrod.impl.transport.netty.ChannelFactory)6 RemoteCacheManagerCallable (org.infinispan.client.hotrod.test.RemoteCacheManagerCallable)4 HotRodServer (org.infinispan.server.hotrod.HotRodServer)3 Channel (io.netty.channel.Channel)2 InetSocketAddress (java.net.InetSocketAddress)2 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)2 NoopChannelOperation (org.infinispan.client.hotrod.test.NoopChannelOperation)2 ProtoStreamMarshaller (org.infinispan.commons.marshall.ProtoStreamMarshaller)2 HotRodServerConfigurationBuilder (org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)2 ExecutorService (java.util.concurrent.ExecutorService)1 KeyAffinityService (org.infinispan.affinity.KeyAffinityService)1 UserPB (org.infinispan.client.hotrod.query.testdomain.protobuf.UserPB)1 FixedServerBalancing (org.infinispan.client.hotrod.test.FixedServerBalancing)1 Marshaller (org.infinispan.commons.marshall.Marshaller)1 UTF8StringMarshaller (org.infinispan.commons.marshall.UTF8StringMarshaller)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 ContinuousQueryListener (org.infinispan.query.api.continuous.ContinuousQueryListener)1