Package com.linkedin.d2.balancer.util

Examples of com.linkedin.d2.balancer.util.TestHelper$DaemonFactory


  @Override
  public LoadBalancerStateItem<ClusterProperties> getClusterProperties(String clusterName)
  {
    List<String> prioritizedSchemes = new ArrayList<String>();
    prioritizedSchemes.add("http");
    ClusterProperties clusterProperties = new ClusterProperties(_cluster, prioritizedSchemes);
    return new LoadBalancerStateItem<ClusterProperties>(clusterProperties, 1, 1);
  }
View Full Code Here


  @Override
  public LoadBalancerStateItem<ClusterProperties> getClusterProperties(String clusterName)
  {
    return (getClusterProperties)
        ? new LoadBalancerStateItem<ClusterProperties>(new ClusterProperties("cluster-1"),
                                                       0,
                                                       0) : null;
  }
View Full Code Here

                                                             ZKFSUtil.clusterPath(BASE_PATH));
      callback = new FutureCallback<None>();
      store.start(callback);
      callback.get(30, TimeUnit.SECONDS);

      ClusterProperties props = new ClusterProperties(TEST_CLUSTER_NAME);
      store.put(TEST_CLUSTER_NAME, props);

      FutureCallback<List<String>> clusterCallback = new FutureCallback<List<String>>();
      dir.getClusterNames(clusterCallback);
View Full Code Here

                                                      null,
                                                      Arrays.asList("http"),
                                                      null);
      serviceStore.put(TEST_SERVICE_NAME, props);

      ClusterProperties clusterProperties = new ClusterProperties(TEST_CLUSTER_NAME);
      ZooKeeperPermanentStore<ClusterProperties> clusterStore =
              new ZooKeeperPermanentStore<ClusterProperties>(conn, new ClusterPropertiesJsonSerializer(), ZKFSUtil.clusterPath(BASE_PATH));
      clusterStore.put(TEST_CLUSTER_NAME, clusterProperties);

      ZooKeeperEphemeralStore<UriProperties> uriStore =
View Full Code Here

    _zkConnection.start();

    try
    {
      _log.info("Cluster configuration:\n" + clusters);
      writeConfig(ZKFSUtil.clusterPath(_basePath), new ClusterPropertiesJsonSerializer(),
                  new ClusterPropertiesJsonSerializer(), clusters, _clusterDefaults);
      _log.info("Wrote cluster configuration");

      _log.info("Service configuration:\n" + services);
      writeConfig(ZKFSUtil.servicePath(_basePath), new ServicePropertiesJsonSerializer(),
                  new ServicePropertiesJsonSerializer(), services, _serviceDefaults);
View Full Code Here

  @Override
  public TogglingLoadBalancer createLoadBalancer(ZKConnection zkConnection, ScheduledExecutorService executorService)
  {
    _log.info("Using d2ServicePath: " + _d2ServicePath);
    ZooKeeperPermanentStore<ClusterProperties> zkClusterRegistry = createPermanentStore(
            zkConnection, ZKFSUtil.clusterPath(_baseZKPath), new ClusterPropertiesJsonSerializer());
    ZooKeeperPermanentStore<ServiceProperties> zkServiceRegistry = createPermanentStore(
            zkConnection, ZKFSUtil.servicePath(_baseZKPath, _d2ServicePath), new ServicePropertiesJsonSerializer());
    ZooKeeperEphemeralStore<UriProperties> zkUriRegistry =  createEphemeralStore(
            zkConnection, ZKFSUtil.uriPath(_baseZKPath), new UriPropertiesJsonSerializer(), new UriPropertiesMerger());

    FileStore<ClusterProperties> fsClusterStore = createFileStore("clusters", new ClusterPropertiesJsonSerializer());
    FileStore<ServiceProperties> fsServiceStore = createFileStore(_d2ServicePath, new ServicePropertiesJsonSerializer());
    FileStore<UriProperties> fsUriStore = createFileStore("uris", new UriPropertiesJsonSerializer());

    PropertyEventBus<ClusterProperties> clusterBus = new PropertyEventBusImpl<ClusterProperties>(executorService);
    PropertyEventBus<ServiceProperties> serviceBus = new PropertyEventBusImpl<ServiceProperties>(executorService);
View Full Code Here

  @Override
  public TrackerClient getClient(String clusterName, URI uri)
  {
    Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>(2);
    partitionDataMap.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1));
    return (getClient) ? new TrackerClient(uri, partitionDataMap, new TestClient()) : null;
  }
View Full Code Here

      URI uri1 = URI.create("http://test.qa1.com:1234");
      URI uri2 = URI.create("http://test.qa2.com:2345");
      URI uri3 = URI.create("http://test.qa3.com:6789");

      Map<Integer, PartitionData> partitionData = new HashMap<Integer, PartitionData>(1);
      partitionData.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1d));
      Map<URI, Map<Integer, PartitionData>> uriData = new HashMap<URI, Map<Integer, PartitionData>>(3);
      uriData.put(uri1, partitionData);
      uriData.put(uri2, partitionData);
      uriData.put(uri3, partitionData);
      return (getUriProperties)
View Full Code Here

    Map<Integer, Double> rawObject =
        JacksonUtil.getObjectMapper().readValue(partitionDataJson, HashMap.class);
    Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>();
    for (Map.Entry<Integer, Double> entry : rawObject.entrySet())
    {
      PartitionData data = new PartitionData(entry.getValue());
      partitionDataMap.put(entry.getKey(), data);
    }
    _announcer.setPartitionData(partitionDataMap);
  }
View Full Code Here

  @Override
  public void setMarkUp(String clusterName, String uri, double weight) throws PropertyStoreException
  {
    Map<Integer, PartitionData> partitionDataMap = new HashMap<Integer, PartitionData>(1);
    partitionDataMap.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(weight));
    setMarkup(clusterName, uri, partitionDataMap, Collections.<String, Object>emptyMap());
  }
View Full Code Here

TOP

Related Classes of com.linkedin.d2.balancer.util.TestHelper$DaemonFactory

Copyright © 2018 www.massapicom. 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.