You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2021/11/16 11:45:44 UTC

[GitHub] [avro] opwvhk commented on a change in pull request #944: AVRO-2916: add DataFileWriter.appendTo(Header,OutputStream)

opwvhk commented on a change in pull request #944:
URL: https://github.com/apache/avro/pull/944#discussion_r750188876



##########
File path: lang/java/avro/src/test/java/org/apache/avro/TestDataFileAppend.java
##########
@@ -0,0 +1,130 @@
+/*
+ * 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
+ *
+ *     https://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.avro;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+import org.apache.avro.file.CodecFactory;
+import org.apache.avro.file.DataFileReader;
+import org.apache.avro.file.DataFileStream.Header;
+import org.apache.avro.file.DataFileWriter;
+import org.apache.avro.generic.GenericDatumReader;
+import org.apache.avro.generic.GenericDatumWriter;
+import org.apache.avro.util.RandomData;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class TestDataFileAppend {
+
+  @Rule
+  public TemporaryFolder DIR = new TemporaryFolder();
+
+  private static final String SCHEMA_JSON = "{\"type\": \"record\", \"name\": \"Test\", \"fields\": ["
+      + "{\"name\":\"stringField\", \"type\":\"string\"}," + "{\"name\":\"longField\", \"type\":\"long\"}]}";
+  private static final Schema SCHEMA = new Schema.Parser().parse(SCHEMA_JSON);
+  private static final long SEED = System.currentTimeMillis();
+  private static final int COUNT = Integer.parseInt(System.getProperty("test.count", "200"));
+  private static final boolean VALIDATE = !"false".equals(System.getProperty("test.validate", "true"));
+
+  /*
+   * 
+   */
+  @Test
+  public void testAppendTo() throws Exception {
+    File file = new File(DIR.getRoot().getPath(), "testAppend.avro");

Review comment:
       No; the `TemporaryFolder` JUnit rule (or the JUnit5 `@TempDir` annotation) deletes files after the test.
   
   To be certain it is deleted, the constructor call in line 44 could be changed to `TemporaryFolder.builder().assureDeletion().build()`. But this only fails the test if the directory cannot be deleted.




-- 
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: issues-unsubscribe@avro.apache.org

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