@Test public void testCreateCollectionWhenCollectionExists() throws Exception { NamedList<Object> namedList = new NamedList<>(); namedList.add("collections", Arrays.asList("collection2", "collection3")); expect(mockedSolrClient.request(anyObject(CollectionAdminRequest.class), anyString())).andReturn(namedList).times(2); replay(mockedSolrClient); String result = underTest.createCollection(); assertEquals("collection1", result); verify(mockedSolrClient); }
public String createCollection() throws Exception { List<String> collections = listCollections(); if (!collections.contains(getCollection())) { String collection = new CreateCollectionCommand(getRetryTimes(), getInterval()).run(this); LOG.info("Collection '{}' created.", collection); } else { LOG.info("Collection '{}' already exits.", getCollection()); if (this.isSplitting()) { createShard(null); } } return getCollection(); }
AmbariSolrCloudClient { public String createCollection() throws Exception { List<String> collections = listCollections(); if (!collections.contains(getCollection())) { String collection = new CreateCollectionCommand(getRetryTimes(), getInterval()).run(this); LOG.info("Collection '{}' created.", collection); } else { LOG.info("Collection '{}' already exits.", getCollection()); if (this.isSplitting()) { createShard(null); } } return getCollection(); } }
AmbariSolrCloudClient { public String createCollection() throws Exception { List<String> collections = listCollections(); if (!collections.contains(getCollection())) { String collection = new CreateCollectionCommand(getRetryTimes(), getInterval()).run(this); LOG.info("Collection '{}' created.", collection); } else { LOG.info("Collection '{}' already exits.", getCollection()); if (this.isSplitting()) { createShard(null); } } return getCollection(); } AmbariSolrCloudClient(AmbariSolrCloudClientBuilder builder); }
AmbariSolrCloudClient { public String createCollection() throws Exception { List<String> collections = listCollections(); if (!collections.contains(getCollection())) { String collection = new CreateCollectionCommand(getRetryTimes(), getInterval()).run(this); LOG.info("Collection '{}' created.", collection); } else { LOG.info("Collection '{}' already exits.", getCollection()); if (this.isSplitting()) { createShard(null); } } return getCollection(); } AmbariSolrCloudClient(AmbariSolrCloudClientBuilder builder); List<String> listCollections(); String createCollection(); void setClusterProp(); void createZnode(); boolean isZnodeExists(String znode); void setupKerberosPlugin(); void secureSolrZnode(); void secureZnode(); String uploadConfiguration(); String downloadConfiguration(); boolean configurationExists(); Collection<String> createShard(String shard); Collection<String> getShardNames(); Collection<String> getSolrHosts(); String getZkConnectString(); String getCollection(); String getConfigSet(); String getConfigDir(); int getShards(); int getReplication(); int getRetryTimes(); int getInterval(); CloudSolrClient getSolrCloudClient(); SolrZkClient getSolrZkClient(); int getMaxShardsPerNode(); String getRouterName(); String getRouterField(); boolean isSplitting(); String getJaasFile(); String getSaslUsers(); String getZnode(); String getPropName(); String getPropValue(); boolean isSecure(); String getSecurityJsonLocation(); }
AmbariSolrCloudClient { public String createCollection() throws Exception { List<String> collections = listCollections(); if (!collections.contains(getCollection())) { String collection = new CreateCollectionCommand(getRetryTimes(), getInterval()).run(this); LOG.info("Collection '{}' created.", collection); } else { LOG.info("Collection '{}' already exits.", getCollection()); if (this.isSplitting()) { createShard(null); } } return getCollection(); } AmbariSolrCloudClient(AmbariSolrCloudClientBuilder builder); List<String> listCollections(); String createCollection(); void setClusterProp(); void createZnode(); boolean isZnodeExists(String znode); void setupKerberosPlugin(); void secureSolrZnode(); void secureZnode(); String uploadConfiguration(); String downloadConfiguration(); boolean configurationExists(); Collection<String> createShard(String shard); Collection<String> getShardNames(); Collection<String> getSolrHosts(); String getZkConnectString(); String getCollection(); String getConfigSet(); String getConfigDir(); int getShards(); int getReplication(); int getRetryTimes(); int getInterval(); CloudSolrClient getSolrCloudClient(); SolrZkClient getSolrZkClient(); int getMaxShardsPerNode(); String getRouterName(); String getRouterField(); boolean isSplitting(); String getJaasFile(); String getSaslUsers(); String getZnode(); String getPropName(); String getPropValue(); boolean isSecure(); String getSecurityJsonLocation();  }