linliu-code commented on code in PR #10718:
URL: https://github.com/apache/hudi/pull/10718#discussion_r1499910893


##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHoodieCompactor.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.utilities;
+
+import org.apache.hudi.common.model.HoodieAvroPayload;
+import org.apache.hudi.common.model.HoodieTableType;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.testutils.HoodieTestUtils;
+import org.apache.hudi.config.HoodieWriteConfig;
+import org.apache.hudi.utilities.testutils.UtilitiesTestBase;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.mockito.Mockito;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Properties;
+
+import static 
org.apache.hudi.common.testutils.HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TestHoodieCompactor extends UtilitiesTestBase {
+  @TempDir
+  protected static java.nio.file.Path sharedTempDir;
+  protected static Configuration hadoopConf = 
HoodieTestUtils.getDefaultHadoopConf();
+  private final FileSystem fs;
+  private final JavaSparkContext jsc;
+  private String base;
+  private String schemaFile;
+
+  public TestHoodieCompactor() throws IOException {
+    fs = FileSystem.getLocal(hadoopConf);
+    jsc = UtilHelpers.buildSparkContext(TestHoodieCompactor.class + "-hoodie", 
"local[4]");
+    basePath = sharedTempDir.toUri().toString();
+  }
+
+  @BeforeEach
+  public void setUp() throws Exception {
+    base = basePath + "base";
+    schemaFile = basePath + "schema.avro";
+
+    HoodieWriteConfig writeConfig = getWriteConfig(base);
+    Properties metaClientProps = HoodieTableMetaClient.withPropertyBuilder()
+        .setTableType(HoodieTableType.MERGE_ON_READ)
+        .setPayloadClass(HoodieAvroPayload.class)
+        .fromProperties(writeConfig.getProps())
+        .build();
+    HoodieTableMetaClient.initTableAndGetMetaClient(
+        jsc.hadoopConfiguration(), base, metaClientProps);
+  }
+
+  public static HoodieWriteConfig getWriteConfig(String basePath) {
+    return HoodieWriteConfig.newBuilder()
+        .forTable("compactor_test_table")
+        .withPath(basePath)
+        .withSchema(TRIP_EXAMPLE_SCHEMA)
+        .build();
+  }
+
+  public static void writeSchema(FileSystem fs, String path, String schema) 
throws IOException {

Review Comment:
    FileIOUtils.writeStringToFile failed since it cannot find the file. Tried 
to create the file first, but still not work. I guess 
`FileIOUtils.writeStringToFile` misses the file system info.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to