From 434c1fa913dfe935e74f7171b8fe18efb38dbfcf Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 7 Sep 2014 11:24:08 +0000 Subject: [PATCH] Fix test to abort, if filesystem does not support non-readable directories (e.g., windows). git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1622999 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/org/apache/solr/core/TestCoreDiscovery.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java index d4fb8e49912..0a753c277a2 100644 --- a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java +++ b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java @@ -241,7 +241,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 { new File(coreDir, "core2" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME)); File toSet = new File(coreDir, "core1"); - toSet.setReadable(false, false); + assumeTrue("Cannot make " + toSet + " non-readable. Test aborted.", toSet.setReadable(false, false)); CoreContainer cc = init(); try (SolrCore core1 = cc.getCore("core1"); SolrCore core2 = cc.getCore("core2")) { @@ -266,7 +266,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 { File toSet = new File(solrHomeDirectory, "cantReadDir"); assertTrue("Should have been able to make directory '" + toSet.getAbsolutePath() + "' ", toSet.mkdirs()); - toSet.setReadable(false, false); + assumeTrue("Cannot make " + toSet + " non-readable. Test aborted.", toSet.setReadable(false, false)); CoreContainer cc = init(); try (SolrCore core1 = cc.getCore("core1"); SolrCore core2 = cc.getCore("core2")) { @@ -289,7 +289,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 { File toSet = new File(solrHomeDirectory, "cantReadFile"); assertTrue("Should have been able to make file '" + toSet.getAbsolutePath() + "' ", toSet.createNewFile()); - toSet.setReadable(false, false); + assumeTrue("Cannot make " + toSet + " non-readable. Test aborted.", toSet.setReadable(false, false)); CoreContainer cc = init(); try (SolrCore core1 = cc.getCore("core1")) { assertNotNull(core1); // Should still be able to create core despite r/o file. @@ -325,7 +325,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 { addCoreWithProps(makeCorePropFile("core1", false, true), new File(homeDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME)); - homeDir.setReadable(false, false); + assumeTrue("Cannot make " + homeDir + " non-readable. Test aborted.", homeDir.setReadable(false, false)); CoreContainer cc = null; try {