|
37 | 37 | import org.apache.commons.logging.Log; |
38 | 38 | import org.apache.commons.logging.LogFactory; |
39 | 39 | import org.apache.hadoop.conf.Configuration; |
| 40 | +import org.apache.hadoop.fs.FileUtil; |
40 | 41 | import org.apache.hadoop.fs.Path; |
41 | 42 | import org.apache.hadoop.util.StringUtils; |
42 | 43 | import org.apache.hadoop.yarn.api.records.ContainerId; |
@@ -78,8 +79,8 @@ private List<String> readMockParams() throws IOException { |
78 | 79 | @Before |
79 | 80 | public void setup() { |
80 | 81 | File f = new File("./src/test/resources/mock-container-executor"); |
81 | | - if(!f.canExecute()) { |
82 | | - f.setExecutable(true); |
| 82 | + if(!FileUtil.canExecute(f)) { |
| 83 | + FileUtil.setExecutable(f, true); |
83 | 84 | } |
84 | 85 | String executorPath = f.getAbsolutePath(); |
85 | 86 | Configuration conf = new Configuration(); |
@@ -140,8 +141,8 @@ public void testContainerLaunchWithPriority() throws IOException { |
140 | 141 |
|
141 | 142 | // set the scheduler priority to make sure still works with nice -n prio |
142 | 143 | File f = new File("./src/test/resources/mock-container-executor"); |
143 | | - if (!f.canExecute()) { |
144 | | - f.setExecutable(true); |
| 144 | + if (!FileUtil.canExecute(f)) { |
| 145 | + FileUtil.setExecutable(f, true); |
145 | 146 | } |
146 | 147 | String executorPath = f.getAbsolutePath(); |
147 | 148 | Configuration conf = new Configuration(); |
@@ -204,8 +205,8 @@ public void testContainerLaunchError() throws IOException { |
204 | 205 |
|
205 | 206 | // reinitialize executer |
206 | 207 | File f = new File("./src/test/resources/mock-container-executer-with-error"); |
207 | | - if (!f.canExecute()) { |
208 | | - f.setExecutable(true); |
| 208 | + if (!FileUtil.canExecute(f)) { |
| 209 | + FileUtil.setExecutable(f, true); |
209 | 210 | } |
210 | 211 | String executorPath = f.getAbsolutePath(); |
211 | 212 | Configuration conf = new Configuration(); |
|
0 commit comments