public static boolean hasInitException(Class<? extends Exception> exceptionType) { for (Map.Entry<String, CoreContainer.CoreLoadFailure> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) { if (exceptionType.isAssignableFrom(entry.getValue().exception.getClass())) return true; } return false; }
public static boolean hasInitException(String message) { for (Map.Entry<String, CoreContainer.CoreLoadFailure> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) { if (entry.getValue().exception.getMessage().contains(message)) return true; } return false; }
public static CoreContainer createDefaultCoreContainer(Path solrHome) { testSolrHome = requireNonNull(solrHome); h = new TestHarness("collection1", initCoreDataDir.getAbsolutePath(), "solrconfig.xml", "schema.xml"); lrf = h.getRequestFactory("", 0, 20, CommonParams.VERSION, "2.2"); return h.getCoreContainer(); }
public static CoreContainer createCoreContainer(Path solrHome, String solrXML) { testSolrHome = requireNonNull(solrHome); h = new TestHarness(solrHome, solrXML); lrf = h.getRequestFactory("", 0, 20, CommonParams.VERSION, "2.2"); return h.getCoreContainer(); }
/** * Create a new solr client. * If createJetty was called, an http implementation will be created, * otherwise an embedded implementation will be created. * Subclasses should override for other options. */ public SolrClient createNewSolrClient() { if (jetty != null) { try { // setup the client... String url = jetty.getBaseUrl().toString() + "/" + "collection1"; HttpSolrClient client = getHttpSolrClient(url, DEFAULT_CONNECTION_TIMEOUT); return client; } catch( Exception ex ) { throw new RuntimeException( ex ); } } else { return new EmbeddedSolrServer( h.getCoreContainer(), "collection1" ) { @Override public void close() { // do not close core container } }; } }
protected static SolrServerWrapper getWrapper() { return new SolrServerWrapper(h.getCoreContainer()); }
protected static SolrServerWrapper getWrapper() { return new SolrServerWrapper(h.getCoreContainer()); }
CoreContainer cc = h.getCoreContainer(); if (! cc.getCores().isEmpty() && cc.isZooKeeperAware()) { try {
public static CoreContainer createCoreContainer(NodeConfig config, CoresLocator locator) { testSolrHome = config.getSolrResourceLoader().getInstancePath(); h = new TestHarness(config, locator); lrf = h.getRequestFactory("", 0, 20, CommonParams.VERSION, "2.2"); return h.getCoreContainer(); }
CoreContainer cc = h.getCoreContainer(); for (Map.Entry<String, CoreContainer.CoreLoadFailure> entry : cc.getCoreInitFailures().entrySet()) { if (matches(entry.getValue().exception, errString))
@Before public void setUp() throws Exception { super.setUp(); solrServer = new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName()); }
@Before public void setUp() throws Exception { super.setUp(); collector = new Collector(); if (EXTERNAL_SOLR_SERVER_URL != null) { //solrServer = new ConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2); //solrServer = new SafeConcurrentUpdateSolrServer(EXTERNAL_SOLR_SERVER_URL, 2, 2); solrClient = getHttpSolrClient(EXTERNAL_SOLR_SERVER_URL); ((HttpSolrClient) solrClient).setParser(new XMLResponseParser()); } else { if (TEST_WITH_EMBEDDED_SOLR_SERVER) { solrClient = new TestEmbeddedSolrServer(h.getCoreContainer(), DEFAULT_TEST_CORENAME); } else { throw new RuntimeException("Not yet implemented"); //solrServer = new TestSolrServer(getSolrClient()); } } int batchSize = SEQ_NUM2.incrementAndGet() % 2 == 0 ? 100 : 1; //SolrInspector.DEFAULT_SOLR_SERVER_BATCH_SIZE : 1; testServer = new SolrServerDocumentLoader(solrClient, batchSize); deleteAllDocuments(); tempDir = createTempDir().toFile().getAbsolutePath(); }