Package com.splunk

Examples of com.splunk.ClusterPeer


  /**
   * Indexer host and port from a guid.
   */
  public IndexerInfo indexerForGuid(String guid) {
    URI clusterMasterUri = getClusterMasterUriChecked();
    ClusterPeer clusterPeer = getClusterPeerChecked(guid, clusterMasterUri);
    return IndexerInfo.create(clusterPeer);
  }
View Full Code Here


            + clusterConfig.getService().getHost());
  }

  private ClusterPeer getClusterPeerChecked(String guid, URI clusterMasterUri) {
    ClusterPeers clusterPeers = peersProvider.getClusterPeers(clusterMasterUri);
    ClusterPeer clusterPeer = clusterPeers.get(guid);
    if (clusterPeer == null)
      throwClusterPeersException(guid, clusterPeers);
    return clusterPeer;
  }
View Full Code Here

  public void getPort_givenPort_returnsPort() {
    assertGetPortEqualsSetUpHost(indexerInfo);
  }

  public void create_givenClusterPeer_hostAndPort() {
    ClusterPeer peer = mock(ClusterPeer.class);
    when(peer.getHost()).thenReturn(host);
    when(peer.getPort()).thenReturn(port);
    IndexerInfo instance = IndexerInfo.create(peer);
    assertGetHostEqualsSetUpHost(instance);
    assertGetPortEqualsSetUpHost(instance);
  }
View Full Code Here

    assertGetPortEqualsSetUpHost(instance);
  }

  @Test(expectedExceptions = { ClusterPeerException.class })
  public void create_clusterPeerHostIsNull_throws() {
    ClusterPeer peer = mock(ClusterPeer.class);
    when(peer.getHost()).thenReturn(null);
    IndexerInfo.create(peer);
  }
View Full Code Here

    IndexerInfo.create(peer);
  }

  @Test(expectedExceptions = { ClusterPeerException.class })
  public void create_clusterPeerPortIsNull_throws() {
    ClusterPeer peer = mock(ClusterPeer.class);
    when(peer.getHost()).thenReturn(host);
    when(peer.getPort()).thenReturn(null);
    IndexerInfo.create(peer);
  }
View Full Code Here

    URI masterUri = URI.create("https://" + host + ":" + port);

    when(clusterConfig.getClusterMasterUri()).thenReturn(masterUri);
    ClusterPeers clusterPeers = mock(ClusterPeers.class);
    when(peersProvider.getClusterPeers(masterUri)).thenReturn(clusterPeers);
    ClusterPeer clusterPeer = mock(ClusterPeer.class);
    when(clusterPeers.get(guid)).thenReturn(clusterPeer);
    when(clusterPeer.getHost()).thenReturn(host);
    when(clusterPeer.getPort()).thenReturn(port);

    IndexerInfo indexer = clusterMaster.indexerForGuid(guid);
    assertEquals(indexer, new IndexerInfo(host, port));
  }
View Full Code Here

TOP

Related Classes of com.splunk.ClusterPeer

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.