kevinrr888 commented on code in PR #5547:
URL: https://github.com/apache/accumulo/pull/5547#discussion_r2124676080


##########
hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloFileOutputFormatIT.java:
##########
@@ -192,36 +193,36 @@ public int run(String[] args) throws Exception {
     public static void main(String[] args) throws Exception {
       Configuration conf = new Configuration();
       conf.set("mapreduce.framework.name", "local");
-      conf.set("mapreduce.cluster.local.dir", 
java.nio.file.Path.of(System.getProperty("user.dir"))
-          
.resolve("target").resolve("mapreduce-tmp").toFile().getAbsolutePath());
+      conf.set("mapreduce.cluster.local.dir",
+          tempDir.resolve("mapreduce-tmp").toAbsolutePath().toString());
       assertEquals(0, ToolRunner.run(conf, new MRTester(), args));
     }
   }
 
   private void handleWriteTests(boolean content) throws Exception {
-    File f = tempDir.toPath().resolve(testName()).toFile();
-    assertTrue(f.createNewFile(), "Failed to create file: " + f);
-    assertTrue(f.delete());
-    MRTester.main(new String[] {content ? TEST_TABLE : EMPTY_TABLE, 
f.getAbsolutePath()});
-
-    assertTrue(f.exists());
-    File[] files = f.listFiles(file -> file.getName().startsWith("part-m-"));
-    assertNotNull(files);
-    if (content) {
-      assertEquals(1, files.length);
-      assertTrue(files[0].exists());
+    java.nio.file.Path f = tempDir.resolve(testName());
+    Files.createFile(f);
+    Files.deleteIfExists(f);
+    MRTester.main(new String[] {content ? TEST_TABLE : EMPTY_TABLE, 
f.toAbsolutePath().toString()});
+
+    assertTrue(Files.exists(f));
+    try (var stream = Files.list(f).filter(p -> 
p.getFileName().toString().startsWith("part-m-"))) {
+      if (!content) {
+        assertTrue(stream.findAny().isEmpty());
+        return;
+      }
+      java.nio.file.Path path = stream.collect(onlyElement());
+      assertTrue(Files.exists(path));
 
       Configuration conf = cluster.getServerContext().getHadoopConf();
       DefaultConfiguration acuconf = DefaultConfiguration.getInstance();
       FileSystem fs = FileSystem.getLocal(conf);
       FileSKVIterator sample = RFileOperations.getInstance().newReaderBuilder()
-          .forFile(UnreferencedTabletFile.of(fs, new 
Path(files[0].toString())),
-              FileSystem.getLocal(conf), conf, NoCryptoServiceFactory.NONE)
+          .forFile(UnreferencedTabletFile.of(fs, new Path(path.toString())), 
fs, conf,

Review Comment:
   Ah oops missed that `fs = FileSystem.getLocal(conf)`. This looks good then



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to