Examples of NullStateListenerCallback


Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

  }

  @Override
  public void listenToCluster(String clusterName)
  {
    _state.listenToCluster(clusterName, new NullStateListenerCallback());
  }
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

  }

  @Override
  public void listenToService(String serviceName)
  {
    _state.listenToService(serviceName, new NullStateListenerCallback());
  }
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    assertNull(listener.serviceName);

    // trigger a strategy add

    // first add a cluster
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());
    _clusterRegistry.put("cluster-1", new ClusterProperties("cluster-1"));

    // then add a service
    _state.listenToService("service-1", new NullStateListenerCallback());
    _serviceRegistry.put("service-1", new ServiceProperties("service-1",
                                                            "cluster-1",
                                                            "/test",
                                                            "random",
                                                            Collections.<String>emptyList(),
                                                            Collections.<String, Object>emptyMap(),
                                                            null,
                                                            null,
                                                            schemes,
                                                            null));

    // this should trigger a refresh
    assertEquals(listener.scheme, "http");
    assertTrue(listener.strategy instanceof RandomLoadBalancerStrategy);
    assertEquals(listener.serviceName, "service-1");

    // then update the cluster
    _clusterRegistry.put("cluster-1", new ClusterProperties("cluster-1"));

    // this triggered a second refresh, but also an onStrategyRemoved. The onStrategyRemoved should
    // be done first, and then the onStrategyAdd, so we should still see a valid strategy.
    assertEquals(listener.scheme, "http");
    assertTrue(listener.strategy instanceof RandomLoadBalancerStrategy);
    assertEquals(listener.serviceName, "service-1");

    _state.listenToCluster("partition-cluster-1", new NullStateListenerCallback());
    _clusterRegistry.put("partition-cluster-1", new ClusterProperties("partition-cluster-1", null,
        new HashMap<String, String>(), new HashSet<URI>(), new RangeBasedPartitionProperties("id=(\\d+)", 0, 100, 2)));

    _state.listenToService("partition-service-1", new NullStateListenerCallback());
    _serviceRegistry.put("partition-service-1",
        new ServiceProperties("partition-service-1",
        "partition-cluster-1", "/partition-test", "degraderV3",
        Collections.<String>emptyList(),
        Collections.<String, Object>emptyMap(),
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    assertNull(listener.serviceName);

    // trigger a strategy add

    // first add a cluster
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());
    _clusterRegistry.put("cluster-1", new ClusterProperties("cluster-1"));

    // then add a service
    _state.listenToService("service-1", new NullStateListenerCallback());
    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1", "/test", "random",
                                                            Collections.<String>emptyList(),
                                                            Collections.<String, Object> emptyMap(),
                                                            null, null,
                                                            schemes, null));
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    assertNull(listener.scheme);
    assertNull(listener.strategy);
    assertNull(listener.serviceName);

    // set up state
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());
    _state.listenToService("service-1", new NullStateListenerCallback());
    _clusterRegistry.put("cluster-1", new ClusterProperties("cluster-1", schemes));
    _uriRegistry.put("cluster-1", new UriProperties("cluster-1", uriData));
    _serviceRegistry.put("service-1", new ServiceProperties("service-1",
                                                            "cluster-1",
                                                            "/test",
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    schemes.add("http");

    assertNull(_state.getClient("service-1", uri));

    // set up state
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());

    assertNull(_state.getClient("service-1", uri));

    _state.listenToService("service-1", new NullStateListenerCallback());

    assertNull(_state.getClient("service-1", uri));

    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1",
                                                            "/test", "random", null,
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    schemes.add("http");

    assertNull(_state.getStrategy("service-1", "http"));

    // set up state
    _state.listenToService("service-1", new NullStateListenerCallback());

    assertNull(_state.getStrategy("service-1", "http"));

    _serviceRegistry.put("service-1", new ServiceProperties("service-1",
                                                            "cluster-1",
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    schemes.add("http");

    assertNull(_state.getStrategy("service-1", "http"));

    // set up state
    _state.listenToService("service-1", new NullStateListenerCallback());
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());

    assertNull(_state.getStrategy("service-1", "http"));

    _serviceRegistry.put("service-1", new ServiceProperties("service-1",
                                                            "cluster-1",
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    schemes.add("http");

    assertNull(_state.getStrategy("service-1", "http"));

    // set up state
    _state.listenToService("service-1", new NullStateListenerCallback());
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());

    assertNull(_state.getStrategy("service-1", "http"));

    // Put degrader into the strategyList, it it not one of the supported strategies in
    // this strategyFactory, so we should not get a strategy back for http.
View Full Code Here

Examples of com.linkedin.d2.balancer.LoadBalancerState.NullStateListenerCallback

    final List<String> schemes = new ArrayList<String>();

    schemes.add("http");
    strategyList.add("degraderV3");
    // set up state
    _state.listenToService("service-1", new NullStateListenerCallback());
    _state.listenToCluster("cluster-1", new NullStateListenerCallback());

    assertNull(_state.getStrategy("service-1", "http"));

    // Use the _clusterRegistry.put to populate the _state.clusterProperties, used by
    // _state.refreshServiceStrategies
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.