Example usage for org.apache.solr.common.cloud ZkStateReader CORE_NAME_PROP

List of usage examples for org.apache.solr.common.cloud ZkStateReader CORE_NAME_PROP

Introduction

In this page you can find the example usage for org.apache.solr.common.cloud ZkStateReader CORE_NAME_PROP.

Prototype

String CORE_NAME_PROP

To view the source code for org.apache.solr.common.cloud ZkStateReader CORE_NAME_PROP.

Click Source Link

Document

SolrCore name.

Usage

From source file:org.opencommercesearch.CloudSearchServerUnitTest.java

License:Apache License

private void initZkMocks() throws KeeperException, InterruptedException {
    when(zkClient.exists(anyString(), anyBoolean())).thenReturn(false);
    when(zkStatereader.getClusterState()).thenReturn(clusterState);
    Set<String> liveNodes = new HashSet<String>();
    liveNodes.add("nodeName1");
    liveNodes.add("nodeName2");
    when(clusterState.getLiveNodes()).thenReturn(liveNodes);

    Map<String, Slice> slices = new HashMap<String, Slice>();
    slices.put("slice1", slice1);
    slices.put("slice2", slice2);
    when(clusterState.getSlicesMap(cloudSearchServer.getRulesCollection(getLocale()))).thenReturn(slices);
    when(clusterState.getSlicesMap(cloudSearchServer.getCatalogCollection(getLocale()))).thenReturn(slices);

    Collection<Replica> replicas = Arrays.asList(replica1, replica2);
    when(slice1.getReplicas()).thenReturn(replicas);

    when(replica1.getStr(ZkStateReader.NODE_NAME_PROP)).thenReturn("nodeName1");
    when(replica2.getStr(ZkStateReader.NODE_NAME_PROP)).thenReturn("nodeName2");
    when(replica1.getStr(ZkStateReader.STATE_PROP)).thenReturn(ZkStateReader.ACTIVE);
    when(replica2.getStr(ZkStateReader.STATE_PROP)).thenReturn(ZkStateReader.DOWN);
    when(replica1.getStr(ZkStateReader.BASE_URL_PROP)).thenReturn("http://node1.opencommercesearch.org");
    when(replica2.getStr(ZkStateReader.BASE_URL_PROP)).thenReturn("http://node2.opencommercesearch.org");
    when(replica1.getStr(ZkStateReader.CORE_NAME_PROP)).thenReturn("mycore");
    when(replica2.getStr(ZkStateReader.CORE_NAME_PROP)).thenReturn("mycore");

    when(catalogSolrServer.getZkStateReader()).thenReturn(zkStatereader);
    when(catalogSolrServer.getLbServer()).thenReturn(lbHttpSolrServer);
    when(rulesSolrServer.getZkStateReader()).thenReturn(zkStatereader);
    when(rulesSolrServer.getLbServer()).thenReturn(lbHttpSolrServer);
    when(lbHttpSolrServer.getHttpClient()).thenReturn(httpClient);
}

From source file:org.vootoo.server.Vootoo.java

License:Apache License

public static SolrCore checkProps(CoreContainer cores, ZkNodeProps zkProps) {
    String corename;/*  w  w w  .j a  v  a 2  s .  c  o  m*/
    SolrCore core = null;
    if (cores.getZkController().getNodeName().equals(zkProps.getStr(ZkStateReader.NODE_NAME_PROP))) {
        corename = zkProps.getStr(ZkStateReader.CORE_NAME_PROP);
        core = cores.getCore(corename);
    }
    return core;
}