Examples of ServiceProperties


Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    // one for uri onAdd
    ++expectedVersion;

    assertEquals(_state.getVersion(), expectedVersion);

    _serviceRegistry.put("service-1", new ServiceProperties("service-1",
                                                            "cluster-1",
                                                            "/test",
                                                            "random"));

    // one for service onAdd
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    Map<String,Object> transportClientProperties = new HashMap<String,Object>();
    transportClientProperties.put(HttpClientFactory.HTTP_SSL_CONTEXT, _sslContext);
    transportClientProperties.put(HttpClientFactory.HTTP_SSL_PARAMS, _sslParameters);
    transportClientProperties = Collections.unmodifiableMap(transportClientProperties);

    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1",
                                                            "/test", "random", null,
                                                            Collections.<String, Object>emptyMap(),
                                                            transportClientProperties, null, schemes, null));

    assertNull(_state.getClient("service-1", uri));
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    compressionOperations.add("get_all");
    transportClientProperties.put(PropertyKeys.HTTP_RESPONSE_COMPRESSION_OPERATIONS, compressionOperations);

    transportClientProperties = Collections.unmodifiableMap(transportClientProperties);

    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1",
                                                            "/test", "random", null,
                                                            Collections.<String, Object>emptyMap(),
                                                            transportClientProperties, null, schemes, null));

    assertNull(_state.getClient("service-1", uri));
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    _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,
                                                            Collections.<String, Object>emptyMap(),
                                                             null, null, schemes, null));

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

    _uriRegistry.put("cluster-1", new UriProperties("cluster-1", uriData));

    TrackerClient client = _state.getClient("service-1", uri);

    assertNotNull(client);
    assertEquals(client.getUri(), uri);

    //now we publish an event that tells service-1 changes cluster. Now it's hosted in cluster-2
    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-2",
                                                            "/test", "random", null,
                                                            Collections.<String, Object>emptyMap(),
                                                             null, null, schemes, null));

    //this time, since we haven't listened to cluster-2 and there's no uri in cluster-2, we get no client.
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

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

    Map<String,Object> transportProperties = new HashMap<String,Object>();
    transportProperties.put("foobar", "unsupportedValue");
    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1",
                                                            "/test", "random", null,
                                                            Collections.<String, Object>emptyMap(),
                                                            transportProperties, null, schemes, null));

    // we add the property first before listening to the service because the MockStore will
    // immediately publish to the eventBus when listenToService() is called, whereas the
    // ZooKeeper stores wait until we get a response back from zookeeper, which triggers handlePut.
    CountDownLatch cdl1 = new CountDownLatch(1);
    _state.listenToService("service-1", new SimpleLoadBalancer.SimpleLoadBalancerCountDownCallback(cdl1));

    // Verify the callback did NOT get invoked, i.e., the exception was thrown during handlePut()
    assertEquals(cdl1.getCount(), 1);

    // set up state
    CountDownLatch cdl2 = new CountDownLatch(1);
    _state.listenToCluster("cluster-1", new SimpleLoadBalancer.SimpleLoadBalancerCountDownCallback(cdl2));
    assertTrue(cdl2.await(60, TimeUnit.SECONDS));

    _uriRegistry.put("cluster-1", new UriProperties("cluster-1", uriData));

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

    _serviceRegistry.put("service-1", new ServiceProperties("service-1", "cluster-1",
                                                            "/test", "random", null,
                                                            Collections.<String, Object>emptyMap(),
                                                            null, null, schemes, null));

    CountDownLatch cdl = new CountDownLatch(1);
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    uriData.put(uri, partitionDataMap);

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

    // first we announce uri with empty partition data map
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

              new ZooKeeperPermanentStore<ServiceProperties>(conn, new ServicePropertiesJsonSerializer(), ZKFSUtil.servicePath(BASE_PATH));
      callback = new FutureCallback<None>();
      store.start(callback);
      callback.get(30, TimeUnit.SECONDS);

      ServiceProperties props = new ServiceProperties(TEST_SERVICE_NAME, "someCluster", "/somePath", "someStrategy");
      store.put(TEST_SERVICE_NAME, props);

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

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

      ZooKeeperPermanentStore<ServiceProperties> serviceStore =
              new ZooKeeperPermanentStore<ServiceProperties>(conn,
                                                             new ServicePropertiesJsonSerializer(),
                                                             ZKFSUtil.servicePath(BASE_PATH));

      ServiceProperties props = new ServiceProperties(TEST_SERVICE_NAME, TEST_CLUSTER_NAME, "/test", "degrader",
                                                      Collections.<String>emptyList(),
                                                      Collections.<String, Object> emptyMap(),
                                                      null,
                                                      null,
                                                      Arrays.asList("http"),
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

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


      ServiceProperties props = new ServiceProperties(TEST_SERVICE_NAME, TEST_CLUSTER_NAME, "/somePath", "degrader",
                                                      Collections.<String>emptyList(),
                                                      Collections.<String, Object>emptyMap(),
                                                      null,
                                                      null,
                                                      Arrays.asList("http"),
View Full Code Here

Examples of com.linkedin.d2.balancer.properties.ServiceProperties

    if (_balancer != null)
    {
      try
      {
        String serviceName = LoadBalancerUtil.getServiceNameFromUri(uri);
        ServiceProperties serviceProperties = _balancer.getLoadBalancedServiceProperties(serviceName);
        if (serviceProperties != null)
        {
          return Collections.unmodifiableMap(serviceProperties.getServiceMetadataProperties());
        }
      }
      catch (ServiceUnavailableException e)
      {
        error(_log, e);
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.