@Test public void testOnDiskOnly() throws Exception { try { System.clearProperty("solr.solrxml.location"); setUpZkAndDiskXml(false, true); assertEquals("Should have gotten the default port", cfg.getZkHostPort(), "8983"); } finally { closeZK(); } }
@Test public void testXmlInZkOnly() throws Exception { try { setUpZkAndDiskXml(true, false); assertEquals( "Should have gotten a new port the xml file sent to ZK", cfg.getZkHostPort(), "9045"); } finally { closeZK(); } }
@Test public void testXmlOnBoth() throws Exception { try { setUpZkAndDiskXml(true, true); assertEquals( "Should have gotten a new port the xml file sent to ZK, overrides the copy on disk", cfg.getZkHostPort(), "9045"); } finally { closeZK(); } }
// TODO: Remove for 5.x, this should fail when we don't have a real solr.xml file after we take // out the remove // the hard-coded default from ConifgSolrXmlOld @Test public void testHardCodedSolrXml() throws IOException { SolrResourceLoader loader = null; final File solrHome = new File( TEMP_DIR, SolrXmlInZkTest.getClassName() + File.separator + "testHardCodedSolrXml"); try { loader = new SolrResourceLoader(solrHome.getAbsolutePath()); ConfigSolr.fromSolrHome(loader, solrHome.getAbsolutePath()); } catch (Exception e) { fail( "Should NOT have thrown any exception here, solr.xml should have been received from the hard-coded string"); } finally { loader.close(); } }