@Before
  public void setUp() throws Exception {
    RESTHelper.addServer(
        server1.getRESTEndpoint().getInetAddress().getHostName(),
        server1.getRESTEndpoint().getContextPath());
    RESTHelper.addServer(
        server2.getRESTEndpoint().getInetAddress().getHostName(),
        server2.getRESTEndpoint().getContextPath());

    delete(fullPathKey(KEY_A));
    head(fullPathKey(KEY_A), HttpServletResponse.SC_NOT_FOUND);
  }
Example #2
0
 private Configuration createRemoteCacheManagerConfiguration() {
   ConfigurationBuilder config = new ConfigurationBuilder();
   config
       .addServer()
       .host(server1.getHotrodEndpoint().getInetAddress().getHostName())
       .port(server1.getHotrodEndpoint().getPort());
   return config.build();
 }
  private Configuration createRemoteCacheManagerConfiguration() {
    ConfigurationBuilder config = new ConfigurationBuilder();
    for (RemoteInfinispanServer server : getServers()) {
      config
          .addServer()
          .host(server.getHotrodEndpoint().getInetAddress().getHostName())
          .port(server.getHotrodEndpoint().getPort());
    }
    config
        .balancingStrategy(
            "org.infinispan.server.test.client.hotrod.HotRodTestRequestBalancingStrategy")
        // load balancing
        .balancingStrategy(
            "org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy")
        // list of HotRod servers available to connect to
        // .addServers(hotRodServerList)
        .forceReturnValues(false)
        // TCP stuff
        .tcpNoDelay(true)
        .pingOnStartup(true)
        .transportFactory("org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory")
        // marshalling
        .marshaller("org.infinispan.commons.marshall.jboss.GenericJBossMarshaller")
        // executors
        .asyncExecutorFactory()
        .factoryClass("org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory")
        .addExecutorProperty("infinispan.client.hotrod.default_executor_factory.pool_size", "10")
        .addExecutorProperty(
            "infinispan.client.hotrod.default_executor_factory.queue_size", "100000")
        // hashing
        .keySizeEstimate(64)
        .valueSizeEstimate(512);

    if (isDistributedMode()) {
      config.consistentHashImpl(
          1, "org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV1");
    } else {
      config.consistentHashImpl(
          2, "org.infinispan.client.hotrod.impl.consistenthash.ConsistentHashV2");
    }

    return config.build();
  }
  @Before
  public void prepare() throws Exception {
    // If already started don't start.
    if (!controller.isStarted("container1")) {
      controller.start("container1");
    }

    if (!controller.isStarted("container2")) {
      controller.start("container2");
    }
    testCounter++;

    String host1Address = server1.getHotrodEndpoint().getInetAddress().getHostAddress();
    int port1 = server1.getHotrodEndpoint().getPort();

    String host2Address = server2.getHotrodEndpoint().getInetAddress().getHostAddress();
    int port2 = server2.getHotrodEndpoint().getPort();

    inputCache =
        new RemoteCacheManager(
                new ConfigurationBuilder().addServer().host(host1Address).port(port1).build())
            .getCache(INPUT_CACHE_NAME);

    outputCache =
        new RemoteCacheManager(
                new ConfigurationBuilder().addServer().host(host2Address).port(port2).build())
            .getCache(OUTPUT_CACHE_NAME);

    inputCache.clear();
    outputCache.clear();

    List<WebPage> webPages = createData();

    saveToInputCache(webPages);
    saveToHDFS(miniHadoopCluster, webPages);
  }