Examples of HotRodServer


Examples of org.infinispan.server.hotrod.HotRodServer

      final AtomicInteger clientTopologyId = (AtomicInteger) TestingUtil.extractField(remoteCacheManager, "topologyId");

      final int topologyIdBeforeJoin = clientTopologyId.get();
      log.tracef("Starting test with client topology id %d", topologyIdBeforeJoin);
      EmbeddedCacheManager cm5 = addClusterEnabledCacheManager(buildConfiguration());
      HotRodServer hotRodServer5 = TestHelper.startHotRodServer(cm5);

      // Rebalancing to include the joiner will increment the topology id by 2
      eventually(new Condition() {
         @Override
         public boolean isSatisfied() throws Exception {
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

      assertEquals("v", remoteCache.put("k","v"));
      assertOnlyServerHit(expectedServer);

      //this would be the next server to be shutdown
      expectedServer = strategy.getServers()[strategy.getNextPosition()];
      HotRodServer toStop = addr2hrServer.get(expectedServer);
      toStop.stop();
      for (Iterator<EmbeddedCacheManager> ecmIt = cacheManagers.iterator(); ecmIt.hasNext();) {
         if (ecmIt.next().getAddress().equals(expectedServer)) ecmIt.remove();
      }
      waitForClusterToForm();
   }
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

      HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
      filters.add(new TestKeyValueFilterFactory());
      serverBuilder.keyValueFilterFactory("test-filter-factory", filters.get(0));
      converters.add(new TestConverterFactory());
      serverBuilder.converterFactory("test-converter-factory", converters.get(0));
      HotRodServer server = TestHelper.startHotRodServer(cm, serverBuilder);
      servers.add(server);
      return server;
   }
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

   }

   public void testEventReplayAfterFailover() {
      org.infinispan.client.hotrod.configuration.ConfigurationBuilder builder =
            new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
      HotRodServer server = server(0);
      builder.addServers(server.getHost() + ":" + server.getPort());
      builder.balancingStrategy(FirstServerAvailableBalancer.class);
      RemoteCacheManager newClient = new RemoteCacheManager(builder.build());
      EventLogListener eventListener = new EventLogListener();
      RemoteCache<Integer, String> c = newClient.getCache();
      c.put(0, "zero");
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

            c.clear();
        }
    }

    private static HotRodServer buildServer(int port) {
        HotRodServer hotRodServer = new HotRodServer() {
            @Override
            public ConfigurationBuilder createTopologyCacheConfig(long distSyncTimeout) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                }

                ConfigurationBuilder c = super.createTopologyCacheConfig(distSyncTimeout);
                c.transaction().syncCommitPhase(false).syncRollbackPhase(false);
                return c;
            }
        };

        HotRodServerConfiguration hotrodConfig = new HotRodServerConfigurationBuilder()
                .host("127.0.0.1")
                .port(port)
                .proxyHost("127.0.0.1")
                .proxyPort(port)
                .topologyStateTransfer(false)
                .defaultCacheName(BasicCacheContainer.DEFAULT_CACHE_NAME)
                .recvBufSize(4096)
                .sendBufSize(4096)
                        //.idleTimeout(0)
                .workerThreads(2)
                .build(true);


        GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder()
                .classLoader(InfinispanEmbeddedCacheManager.class.getClassLoader())
                .globalJmxStatistics()
                .jmxDomain("org.apache.marmotta.kiwi")
                .allowDuplicateDomains(true)
                .build();

        Configuration defaultConfiguration = new ConfigurationBuilder()
                .clustering()
                .cacheMode(CacheMode.LOCAL)
                .sync()
                .dataContainer()
                .keyEquivalence(ByteArrayEquivalence.INSTANCE)
                .valueEquivalence(ByteArrayEquivalence.INSTANCE)
                .build();

        EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true);
        cacheManager.defineConfiguration(CacheManager.NODE_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.TRIPLE_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.URI_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.BNODE_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.LITERAL_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.NS_PREFIX_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.NS_URI_CACHE, defaultConfiguration);
        cacheManager.defineConfiguration(CacheManager.REGISTRY_CACHE, defaultConfiguration);
        cacheManager.getCache(CacheManager.NODE_CACHE, true);
        cacheManager.getCache(CacheManager.TRIPLE_CACHE, true);
        cacheManager.getCache(CacheManager.URI_CACHE, true);
        cacheManager.getCache(CacheManager.BNODE_CACHE, true);
        cacheManager.getCache(CacheManager.LITERAL_CACHE, true);
        cacheManager.getCache(CacheManager.NS_PREFIX_CACHE, true);
        cacheManager.getCache(CacheManager.NS_URI_CACHE, true);
        cacheManager.getCache(CacheManager.REGISTRY_CACHE, true);

        hotRodServer.start(hotrodConfig, cacheManager);

        return hotRodServer;
    }
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

      return cacheManager;
   }

   private ConfigurationBuilder initServerAndClient() {
      hotrodServer = new HotRodServer();
      HotRodServerConfigurationBuilder serverBuilder = HotRodTestingUtil.getDefaultHotRodConfiguration();
      SimpleServerAuthenticationProvider sap = new SimpleServerAuthenticationProvider();
      sap.addUser("user", "realm", "password".toCharArray(), null);
      serverBuilder.authentication()
         .enable()
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

   TestConverterFactory converterFactory = new TestConverterFactory();

   @Override
   protected HotRodServer createHotRodServer() {
      HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder();
      HotRodServer server = TestHelper.startHotRodServer(cacheManager, builder);
      server.addConverterFactory("test-converter-factory", converterFactory);
      return server;
   }
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

   }

   protected HotRodServer addHotRodServer(ConfigurationBuilder builder) {
      EmbeddedCacheManager cm = addClusterEnabledCacheManager(builder);
      HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
      HotRodServer server = TestHelper.startHotRodServer(cm, serverBuilder);
      filters.add(new TestKeyValueFilterFactory());
      server.addKeyValueFilterFactory("test-filter-factory", filters.get(0));
      converters.add(new TestConverterFactory());
      server.addConverterFactory("test-converter-factory", converters.get(0));
      servers.add(server);
      return server;
   }
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

   }

   public void testEventReplayAfterFailover() {
      org.infinispan.client.hotrod.configuration.ConfigurationBuilder builder =
            new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
      HotRodServer server = server(0);
      builder.addServers(server.getHost() + ":" + server.getPort());
      builder.balancingStrategy(FirstServerAvailableBalancer.class);
      RemoteCacheManager newClient = new RemoteCacheManager(builder.build());
      EventLogListener eventListener = new EventLogListener();
      RemoteCache<Integer, String> c = newClient.getCache();
      c.put(0, "zero");
View Full Code Here

Examples of org.infinispan.server.hotrod.HotRodServer

   TestKeyValueFilterFactory filterFactory = new TestKeyValueFilterFactory();

   @Override
   protected HotRodServer createHotRodServer() {
      HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder();
      HotRodServer server = TestHelper.startHotRodServer(cacheManager, builder);
      server.addKeyValueFilterFactory("test-filter-factory", filterFactory);
      return server;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.