You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2019/08/22 06:59:09 UTC

[GitHub] [zeppelin] jongyoul commented on a change in pull request #3428: [ZEPPELIN-4305] LocalStorageConfig.atomicWriteToFile throws exception

jongyoul commented on a change in pull request #3428: [ZEPPELIN-4305] LocalStorageConfig.atomicWriteToFile throws exception
URL: https://github.com/apache/zeppelin/pull/3428#discussion_r316522717
 
 

 ##########
 File path: zeppelin-zengine/src/test/java/org/apache/zeppelin/storage/LocalConfigStorageTest.java
 ##########
 @@ -0,0 +1,50 @@
+package org.apache.zeppelin.storage;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import static org.junit.Assert.*;
+
+public class LocalConfigStorageTest {
+    public static final String TEST_STRING = "this is a test!";
+
+    @Test
+    public void testWritingAtomically() throws IOException {
+        final Path destination = Files.createTempFile("test-", "file");
+        final File destinationFile = destination.toFile();
+        try {
+            LocalConfigStorage.atomicWriteToFile(TEST_STRING, destinationFile);
 
 Review comment:
   I think it would be better to make those methods of `atomicWriteToFile` and `readFromFile` as a package local. `LocalConfigStorage` have `ZeppelinConfiguration` only and it could be initiated easily.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services