diff --git a/zeppelin-integration/src/test/java/org/apache/zeppelin/ProcessData.java b/zeppelin-integration/src/test/java/org/apache/zeppelin/ProcessData.java index 39a8a1384f4..82d71543513 100644 --- a/zeppelin-integration/src/test/java/org/apache/zeppelin/ProcessData.java +++ b/zeppelin-integration/src/test/java/org/apache/zeppelin/ProcessData.java @@ -41,7 +41,6 @@ public enum Types_Of_Data { private Process checked_process; private boolean printToConsole = false; - private boolean removeRedundantOutput = true; public ProcessData(Process connected_process, boolean printToConsole, int silenceTimeout, TimeUnit timeUnit) { this.checked_process = connected_process; diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/cluster/ClusterManager.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/cluster/ClusterManager.java index 6e586afb7f0..d0240d9c322 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/cluster/ClusterManager.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/cluster/ClusterManager.java @@ -131,7 +131,7 @@ public abstract class ClusterManager { private static final Logger LOGGER = LoggerFactory.getLogger(ClusterManager.class); - public ZeppelinConfiguration zConf; + protected final ZeppelinConfiguration zConf; protected Collection clusterNodes = new ArrayList<>(); @@ -158,8 +158,8 @@ public abstract class ClusterManager { protected boolean isTest = false; public ClusterManager(ZeppelinConfiguration zConf) { + this.zConf = zConf; try { - this.zConf = zConf; zeplServerHost = RemoteInterpreterUtils.findAvailableHostAddress(); String clusterAddr = this.zConf.getClusterAddress(); if (!StringUtils.isEmpty(clusterAddr)) { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java index d138595fe7d..a2e87670c58 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/Application.java @@ -31,7 +31,7 @@ public abstract class Application { private final ApplicationContext context; - public Application(ApplicationContext context) { + protected Application(ApplicationContext context) { this.context = context; } @@ -129,7 +129,7 @@ public void printStringAsJavascript(String js) throws IOException { } private void beginJavascript() throws IOException { - StringBuffer js = new StringBuffer(); + StringBuilder js = new StringBuilder(); js.append("\n\n"); context.out.write(js.toString()); diff --git a/zeppelin-plugins/launcher/cluster/src/test/java/org/apache/zeppelin/interpreter/launcher/ClusterInterpreterLauncherTest.java b/zeppelin-plugins/launcher/cluster/src/test/java/org/apache/zeppelin/interpreter/launcher/ClusterInterpreterLauncherTest.java index f41d4d879ed..a9467fa93fa 100644 --- a/zeppelin-plugins/launcher/cluster/src/test/java/org/apache/zeppelin/interpreter/launcher/ClusterInterpreterLauncherTest.java +++ b/zeppelin-plugins/launcher/cluster/src/test/java/org/apache/zeppelin/interpreter/launcher/ClusterInterpreterLauncherTest.java @@ -23,8 +23,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -32,9 +30,7 @@ import java.io.IOException; import java.util.Properties; -public class ClusterInterpreterLauncherTest extends ClusterMockTest { - private static final Logger LOGGER = - LoggerFactory.getLogger(ClusterInterpreterLauncherTest.class); +class ClusterInterpreterLauncherTest extends ClusterMockTest { @BeforeAll static void startTest() throws IOException, InterruptedException { @@ -77,6 +73,7 @@ void testConnectExistOnlineIntpProcess() throws IOException { assertEquals("127.0.0.1", interpreterProcess.getHost()); assertEquals("name", interpreterProcess.getInterpreterSettingName()); assertEquals(5000, interpreterProcess.getConnectTimeout()); + interpreterProcess.close(); } @Test @@ -104,6 +101,7 @@ void testConnectExistOfflineIntpProcess() throws IOException { assertEquals(zconf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner()); assertTrue(interpreterProcess.getEnv().size() >= 1); assertEquals(true, interpreterProcess.isUserImpersonated()); + interpreterProcess.close(); } @Test diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java index 9dff0794293..8bc7e39febb 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumBundleFactory.java @@ -288,15 +288,17 @@ public boolean accept(File pathname) { // if online package String version = nameAndVersion[1]; File tgz = new File(heliumLocalRepoDirectory, pkg.getName() + "-" + version + ".tgz"); - tgz.delete(); + FileUtils.deleteQuietly(tgz); // wget, extract and move dir to `bundles/${pkg.getName()}`, and remove tgz npmCommand(fpf, "pack " + pkg.getArtifact()); File extracted = new File(heliumBundleDirectory, "package"); FileUtils.deleteDirectory(extracted); List entries = unTgz(tgz, heliumBundleDirectory); - for (String entry: entries) LOGGER.debug("Extracted " + entry); - tgz.delete(); + for (String entry : entries) { + LOGGER.debug("Extracted {}", entry); + } + FileUtils.deleteQuietly(tgz); FileUtils.copyDirectory(extracted, bundleDir); FileUtils.deleteDirectory(extracted); } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java index 58ddcd8e9f5..bab17ded138 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java @@ -100,7 +100,9 @@ public synchronized List getAll() throws IOException { if (response.getStatusLine().getStatusCode() != 200) { // try read from cache - logger.error(uri() + " returned " + response.getStatusLine().toString()); + if (logger.isErrorEnabled()) { + logger.error("{} returned {}", uri(), response.getStatusLine()); + } return readFromCache(); } else { List packageList = new LinkedList<>(); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java index 13b4325d13c..4971063ee04 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumRegistry.java @@ -26,7 +26,7 @@ public abstract class HeliumRegistry { private final String name; private final String uri; - public HeliumRegistry(String name, String uri) { + protected HeliumRegistry(String name, String uri) { this.name = name; this.uri = uri; } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/exception/CorruptedNoteException.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/exception/CorruptedNoteException.java index 53076330a16..e50c45afa2a 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/exception/CorruptedNoteException.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/exception/CorruptedNoteException.java @@ -20,7 +20,10 @@ import java.io.IOException; public class CorruptedNoteException extends IOException { - public CorruptedNoteException(final String noteId, final String message, Exception e) { - super(String.format("noteId: %s - %s", noteId, message), e); - } + + private static final long serialVersionUID = 1743308058186542714L; + + public CorruptedNoteException(final String noteId, final String message, Exception e) { + super(String.format("noteId: %s - %s", noteId, message), e); + } } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepo.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepo.java index bae5cba8dd3..d141e85a7fd 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepo.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepo.java @@ -23,6 +23,7 @@ import org.apache.zeppelin.notebook.NoteInfo; import org.apache.zeppelin.user.AuthenticationInfo; +import java.io.Closeable; import java.io.IOException; import java.util.List; import java.util.Map; @@ -30,7 +31,7 @@ /** * Notebook repository (persistence layer) abstraction. */ -public interface NotebookRepo { +public interface NotebookRepo extends Closeable { void init(ZeppelinConfiguration zConf) throws IOException; @@ -115,6 +116,7 @@ void move(String folderPath, String newFolderPath, /** * Release any underlying resources */ + @Override @ZeppelinApi void close(); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java index b4bd56e8bb8..d36e4b1693b 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java @@ -31,7 +31,7 @@ */ public abstract class SearchService extends NoteEventAsyncListener { - public SearchService(String name) { + protected SearchService(String name) { super(name); } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java index c380e5a8b17..c69de56ad40 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/ConfigStorage.java @@ -63,7 +63,7 @@ private static ConfigStorage createConfigStorage(ZeppelinConfiguration zConf) th } - public ConfigStorage(ZeppelinConfiguration zConf) { + protected ConfigStorage(ZeppelinConfiguration zConf) { this.zConf = zConf; } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java index ba5e609ca2d..0a35282117b 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ZeppelinConfigurationTest { +class ZeppelinConfigurationTest { @BeforeAll public static void clearSystemVariables() { ZeppelinConfiguration.reset(); @@ -41,7 +41,7 @@ public void cleanup() { } @Test - public void getAllowedOrigins2Test() throws MalformedURLException { + void getAllowedOrigins2Test() throws MalformedURLException { ZeppelinConfiguration conf = ZeppelinConfiguration.create("test-zeppelin-site2.xml"); List origins = conf.getAllowedOrigins(); @@ -51,7 +51,7 @@ public void getAllowedOrigins2Test() throws MalformedURLException { } @Test - public void getAllowedOrigins1Test() throws MalformedURLException { + void getAllowedOrigins1Test() throws MalformedURLException { ZeppelinConfiguration conf = ZeppelinConfiguration.create("test-zeppelin-site1.xml"); List origins = conf.getAllowedOrigins(); @@ -60,7 +60,7 @@ public void getAllowedOrigins1Test() throws MalformedURLException { } @Test - public void getAllowedOriginsNoneTest() throws MalformedURLException { + void getAllowedOriginsNoneTest() throws MalformedURLException { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); List origins = conf.getAllowedOrigins(); @@ -68,7 +68,7 @@ public void getAllowedOriginsNoneTest() throws MalformedURLException { } @Test - public void isWindowsPathTestTrue() { + void isWindowsPathTestTrue() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); Boolean isIt = conf.isWindowsPath("c:\\test\\file.txt"); @@ -76,7 +76,7 @@ public void isWindowsPathTestTrue() { } @Test - public void isWindowsPathTestFalse() { + void isWindowsPathTestFalse() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); Boolean isIt = conf.isWindowsPath("~/test/file.xml"); @@ -84,7 +84,7 @@ public void isWindowsPathTestFalse() { } @Test - public void isPathWithSchemeTestTrue() { + void isPathWithSchemeTestTrue() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); Boolean isIt = conf.isPathWithScheme("hdfs://hadoop.example.com/zeppelin/notebook"); @@ -92,7 +92,7 @@ public void isPathWithSchemeTestTrue() { } @Test - public void isPathWithSchemeTestFalse() { + void isPathWithSchemeTestFalse() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); Boolean isIt = conf.isPathWithScheme("~/test/file.xml"); @@ -100,7 +100,7 @@ public void isPathWithSchemeTestFalse() { } @Test - public void isPathWithInvalidSchemeTest() { + void isPathWithInvalidSchemeTest() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); Boolean isIt = conf.isPathWithScheme("c:\\test\\file.txt"); @@ -108,14 +108,14 @@ public void isPathWithInvalidSchemeTest() { } @Test - public void getNotebookDirTest() { + void getNotebookDirTest() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); String notebookLocation = conf.getNotebookDir(); assertTrue(notebookLocation.endsWith("notebook")); } @Test - public void isNotebookPublicTest() { + void isNotebookPublicTest() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); boolean isIt = conf.isNotebookPublic(); @@ -123,7 +123,7 @@ public void isNotebookPublicTest() { } @Test - public void getPathTest() { + void getPathTest() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); conf.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), "/usr/lib/zeppelin"); assertEquals("/usr/lib/zeppelin", conf.getZeppelinHome()); @@ -131,7 +131,7 @@ public void getPathTest() { } @Test - public void getConfigFSPath() { + void getConfigFSPath() { ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-test-site.xml"); conf.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), "/usr/lib/zeppelin"); conf.setProperty(ConfVars.ZEPPELIN_CONFIG_FS_DIR.getVarName(), "conf"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java index 574b4e22556..ae8e690378e 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java @@ -43,7 +43,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -public class HeliumApplicationFactoryTest extends AbstractInterpreterTest { +class HeliumApplicationFactoryTest extends AbstractInterpreterTest { private NotebookRepo notebookRepo; private Notebook notebook; @@ -88,7 +88,7 @@ public void tearDown() throws Exception { @Test @Disabled - public void testLoadRunUnloadApplication() + void testLoadRunUnloadApplication() throws IOException, ApplicationException, InterruptedException { // given HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, @@ -138,7 +138,7 @@ public void testLoadRunUnloadApplication() @Test @Disabled - public void testUnloadOnParagraphRemove() throws IOException { + void testUnloadOnParagraphRemove() throws IOException { // given HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, "name1", @@ -181,7 +181,7 @@ public void testUnloadOnParagraphRemove() throws IOException { @Test @Disabled - public void testUnloadOnInterpreterUnbind() throws IOException { + void testUnloadOnInterpreterUnbind() throws IOException { // given HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, "name1", @@ -221,7 +221,7 @@ public void testUnloadOnInterpreterUnbind() throws IOException { @Test @Disabled - public void testInterpreterUnbindOfNullReplParagraph() throws IOException { + void testInterpreterUnbindOfNullReplParagraph() throws IOException { // create note String note1Id = notebook.createNote("note1", anonymous); Note note1 = notebook.processNote(note1Id, @@ -248,7 +248,7 @@ public void testInterpreterUnbindOfNullReplParagraph() throws IOException { @Test @Disabled - public void testUnloadOnInterpreterRestart() throws IOException, InterpreterException { + void testUnloadOnInterpreterRestart() throws IOException, InterpreterException { // given HeliumPackage pkg1 = newHeliumPackage(HeliumType.APPLICATION, "name1", diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java index 00f5bb0058b..d7a6036a217 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumBundleFactoryTest.java @@ -37,7 +37,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class HeliumBundleFactoryTest { +class HeliumBundleFactoryTest { private HeliumBundleFactory hbf; private File nodeInstallationDir; private String zeppelinHomePath; @@ -64,14 +64,14 @@ public void tearDown() throws IOException { } @Test - public void testInstallNpm() throws InstallationException { + void testInstallNpm() throws InstallationException { assertTrue(new File(nodeInstallationDir, "/node/npm").isFile()); assertTrue(new File(nodeInstallationDir, "/node/node").isFile()); assertTrue(new File(nodeInstallationDir, "/node/yarn/dist/bin/yarn").isFile()); } @Test - public void downloadPackage() throws TaskRunnerException { + void downloadPackage() throws TaskRunnerException { HeliumPackage pkg = newHeliumPackage( HeliumType.VISUALIZATION, @@ -88,7 +88,7 @@ public void downloadPackage() throws TaskRunnerException { } @Test - public void bundlePackage() throws IOException, TaskRunnerException { + void bundlePackage() throws IOException, TaskRunnerException { HeliumPackage pkg = newHeliumPackage( HeliumType.VISUALIZATION, @@ -109,7 +109,7 @@ public void bundlePackage() throws IOException, TaskRunnerException { } @Test - public void bundleLocalPackage() throws IOException, TaskRunnerException { + void bundleLocalPackage() throws IOException, TaskRunnerException { URL res = Resources.getResource("helium/webpack.config.js"); String resDir = new File(res.getFile()).getParent(); String localPkg = resDir + "/../../../src/test/resources/helium/vis1"; @@ -157,7 +157,7 @@ public void bundleErrorPropagation() throws IOException, TaskRunnerException { } @Test - public void switchVersion() throws IOException, TaskRunnerException { + void switchVersion() throws IOException, TaskRunnerException { URL res = Resources.getResource("helium/webpack.config.js"); String resDir = new File(res.getFile()).getParent(); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java index 328656a58de..c6e9a781219 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumLocalRegistryTest.java @@ -28,7 +28,7 @@ import static org.apache.zeppelin.helium.HeliumPackage.newHeliumPackage; import static org.junit.jupiter.api.Assertions.assertEquals; -public class HeliumLocalRegistryTest { +class HeliumLocalRegistryTest { private File tmpDir; @BeforeEach @@ -43,7 +43,7 @@ public void tearDown() throws IOException { } @Test - public void testGetAllPackage() throws IOException { + void testGetAllPackage() throws IOException { // given File r1Path = new File(tmpDir, "r1"); HeliumLocalRegistry r1 = new HeliumLocalRegistry("r1", r1Path.getAbsolutePath()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java index 9fb4f0a1dee..35bfa0c6b3f 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumOnlineRegistryTest.java @@ -27,7 +27,7 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration; -public class HeliumOnlineRegistryTest { +class HeliumOnlineRegistryTest { // ip 192.168.65.17 belongs to private network // request will be ended with connection time out error private static final String IP = "192.168.65.17"; @@ -50,7 +50,7 @@ public void tearDown() throws IOException { } @Test - public void zeppelinNotebookS3TimeoutPropertyTest() throws IOException { + void zeppelinNotebookS3TimeoutPropertyTest() throws IOException { System.setProperty( ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_S3_TIMEOUT.getVarName(), TIMEOUT diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTest.java index 384103c2627..05cab2bbdc5 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTest.java @@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class HeliumTest { +class HeliumTest { private File tmpDir; private File localRegistryPath; @@ -49,7 +49,7 @@ public void tearDown() throws IOException { } @Test - public void testSaveLoadConf() throws IOException, URISyntaxException, TaskRunnerException { + void testSaveLoadConf() throws IOException, URISyntaxException, TaskRunnerException { // given File heliumConf = new File(tmpDir, "helium.conf"); Helium helium = new Helium(heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), @@ -68,7 +68,7 @@ public void testSaveLoadConf() throws IOException, URISyntaxException, TaskRunne } @Test - public void testRestoreRegistryInstances() throws IOException, URISyntaxException, TaskRunnerException { + void testRestoreRegistryInstances() throws IOException, URISyntaxException, TaskRunnerException { File heliumConf = new File(tmpDir, "helium.conf"); Helium helium = new Helium( heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), null, null, null, null); @@ -103,7 +103,7 @@ public void testRestoreRegistryInstances() throws IOException, URISyntaxExceptio } @Test - public void testRefresh() throws IOException, URISyntaxException, TaskRunnerException { + void testRefresh() throws IOException, URISyntaxException, TaskRunnerException { File heliumConf = new File(tmpDir, "helium.conf"); Helium helium = new Helium( heliumConf.getAbsolutePath(), localRegistryPath.getAbsolutePath(), null, null, null, null); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java index a7b153816c6..e8ab9c1baab 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumTestRegistry.java @@ -17,7 +17,6 @@ package org.apache.zeppelin.helium; import java.io.IOException; -import java.net.URI; import java.util.LinkedList; import java.util.List; diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ConfInterpreterTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ConfInterpreterTest.java index 18fec666fd6..785c30122f1 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ConfInterpreterTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ConfInterpreterTest.java @@ -24,13 +24,13 @@ import static org.junit.jupiter.api.Assertions.*; -public class ConfInterpreterTest extends AbstractInterpreterTest { +class ConfInterpreterTest extends AbstractInterpreterTest { private ExecutionContext executionContext = new ExecutionContext("user1", "note1", "test"); @Test - public void testCorrectConf() throws InterpreterException { + void testCorrectConf() throws InterpreterException { assertTrue(interpreterFactory.getInterpreter("test.conf", executionContext) instanceof ConfInterpreter); ConfInterpreter confInterpreter = (ConfInterpreter) interpreterFactory.getInterpreter("test.conf", executionContext); @@ -60,7 +60,7 @@ public void testCorrectConf() throws InterpreterException { } @Test - public void testPropertyTrim() throws InterpreterException { + void testPropertyTrim() throws InterpreterException { assertTrue(interpreterFactory.getInterpreter("test.conf", executionContext) instanceof ConfInterpreter); ConfInterpreter confInterpreter = (ConfInterpreter) interpreterFactory.getInterpreter("test.conf", executionContext); @@ -90,7 +90,7 @@ public void testPropertyTrim() throws InterpreterException { } @Test - public void testEmptyValue() throws InterpreterException { + void testEmptyValue() throws InterpreterException { ConfInterpreter confInterpreter = (ConfInterpreter) interpreterFactory.getInterpreter("test.conf", executionContext); InterpreterContext context = InterpreterContext.builder() @@ -111,7 +111,7 @@ public void testEmptyValue() throws InterpreterException { } @Test - public void testEmptyConf() throws InterpreterException { + void testEmptyConf() throws InterpreterException { assertTrue(interpreterFactory.getInterpreter("test.conf", executionContext) instanceof ConfInterpreter); ConfInterpreter confInterpreter = (ConfInterpreter) interpreterFactory.getInterpreter("test.conf", executionContext); @@ -131,7 +131,7 @@ public void testEmptyConf() throws InterpreterException { @Test - public void testRunningAfterOtherInterpreter() throws InterpreterException { + void testRunningAfterOtherInterpreter() throws InterpreterException { assertTrue(interpreterFactory.getInterpreter("test.conf", executionContext) instanceof ConfInterpreter); ConfInterpreter confInterpreter = (ConfInterpreter) interpreterFactory.getInterpreter("test.conf", executionContext); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index 54c6ad94ca9..d972eff735d 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -24,10 +24,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class InterpreterFactoryTest extends AbstractInterpreterTest { +class InterpreterFactoryTest extends AbstractInterpreterTest { @Test - public void testGetFactory() throws InterpreterException { + void testGetFactory() throws InterpreterException { assertTrue(interpreterFactory.getInterpreter("", new ExecutionContext("user1", "note1", "test")) instanceof RemoteInterpreter); RemoteInterpreter remoteInterpreter = (RemoteInterpreter) interpreterFactory.getInterpreter("", new ExecutionContext("user1", "note1", "test")); @@ -52,7 +52,7 @@ public void testGetFactory() throws InterpreterException { } @Test - public void testUnknownRepl1() { + void testUnknownRepl1() { try { interpreterFactory.getInterpreter("test.unknown_repl", new ExecutionContext("user1", "note1", "test")); fail("should fail due to no such interpreter"); @@ -62,7 +62,7 @@ public void testUnknownRepl1() { } @Test - public void testUnknownRepl2() { + void testUnknownRepl2() { try { interpreterFactory.getInterpreter("unknown_repl", new ExecutionContext("user1", "note1", "test")); fail("should fail due to no such interpreter"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java index 365546eee68..15688a21260 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.mock; -public class InterpreterSettingManagerTest extends AbstractInterpreterTest { +class InterpreterSettingManagerTest extends AbstractInterpreterTest { private String note1Id; private String note2Id; @@ -58,7 +58,7 @@ public void setUp() throws Exception { } @Test - public void testInitInterpreterSettingManager() throws IOException, RepositoryException { + void testInitInterpreterSettingManager() throws IOException, RepositoryException { assertEquals(6, interpreterSettingManager.get().size()); InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); assertEquals("test", interpreterSetting.getName()); @@ -108,7 +108,7 @@ public void testInitInterpreterSettingManager() throws IOException, RepositoryEx } @Test - public void testCreateUpdateRemoveSetting() throws IOException, InterpreterException { + void testCreateUpdateRemoveSetting() throws IOException, InterpreterException { // create new interpreter setting InterpreterOption option = new InterpreterOption(); option.setPerNote("scoped"); @@ -203,7 +203,7 @@ public void testCreateUpdateRemoveSetting() throws IOException, InterpreterExcep } @Test - public void testGetEditor() { + void testGetEditor() { // get editor setting from interpreter-setting.json Map editor = interpreterSettingManager.getEditorSetting("%test.echo", note1Id); assertEquals("java", editor.get("language")); @@ -213,7 +213,7 @@ public void testGetEditor() { } @Test - public void testRestartShared() throws InterpreterException { + void testRestartShared() throws InterpreterException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser("shared"); interpreterSetting.getOption().setPerNote("shared"); @@ -227,7 +227,7 @@ public void testRestartShared() throws InterpreterException { } @Test - public void testRestartPerUserIsolated() throws InterpreterException { + void testRestartPerUserIsolated() throws InterpreterException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser("isolated"); interpreterSetting.getOption().setPerNote("shared"); @@ -241,7 +241,7 @@ public void testRestartPerUserIsolated() throws InterpreterException { } @Test - public void testRestartPerNoteIsolated() throws InterpreterException { + void testRestartPerNoteIsolated() throws InterpreterException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser("shared"); interpreterSetting.getOption().setPerNote("isolated"); @@ -255,7 +255,7 @@ public void testRestartPerNoteIsolated() throws InterpreterException { } @Test - public void testRestartPerUserScoped() throws InterpreterException { + void testRestartPerUserScoped() throws InterpreterException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser("scoped"); interpreterSetting.getOption().setPerNote("shared"); @@ -271,7 +271,7 @@ public void testRestartPerUserScoped() throws InterpreterException { } @Test - public void testRestartPerNoteScoped() throws InterpreterException { + void testRestartPerNoteScoped() throws InterpreterException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser("shared"); interpreterSetting.getOption().setPerNote("scoped"); @@ -287,7 +287,7 @@ public void testRestartPerNoteScoped() throws InterpreterException { } @Test - public void testInterpreterInclude() throws Exception { + void testInterpreterInclude() throws Exception { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_INCLUDES.getVarName(), "mock1"); setUp(); @@ -300,7 +300,7 @@ public void testInterpreterInclude() throws Exception { } @Test - public void testInterpreterExclude() throws Exception { + void testInterpreterExclude() throws Exception { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_EXCLUDES.getVarName(), "test,config_test,mock_resource_pool"); @@ -315,7 +315,7 @@ public void testInterpreterExclude() throws Exception { } @Test - public void testInterpreterIncludeExcludeTogether() throws Exception { + void testInterpreterIncludeExcludeTogether() throws Exception { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_INCLUDES.getVarName(), "test,"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingTest.java index 82df374b949..e27450ae9fe 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class InterpreterSettingTest extends AbstractInterpreterTest{ +class InterpreterSettingTest extends AbstractInterpreterTest{ private static final Logger LOGGER = LoggerFactory.getLogger(InterpreterSettingTest.class); @@ -59,7 +59,7 @@ public void setUp() throws Exception { } @Test - public void testCreateInterpreters() { + void testCreateInterpreters() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.SHARED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -95,7 +95,7 @@ public void testCreateInterpreters() { } @Test - public void testSharedMode() { + void testSharedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.SHARED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -135,7 +135,7 @@ public void testSharedMode() { } @Test - public void testPerUserScopedMode() { + void testPerUserScopedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.SCOPED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -175,7 +175,7 @@ public void testPerUserScopedMode() { } @Test - public void testPerNoteScopedMode() { + void testPerNoteScopedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerNote(InterpreterOption.SCOPED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -215,7 +215,7 @@ public void testPerNoteScopedMode() { } @Test - public void testPerUserIsolatedMode() { + void testPerUserIsolatedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.ISOLATED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -256,7 +256,7 @@ public void testPerUserIsolatedMode() { } @Test - public void testPerNoteIsolatedMode() { + void testPerNoteIsolatedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerNote(InterpreterOption.ISOLATED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -297,7 +297,7 @@ public void testPerNoteIsolatedMode() { } @Test - public void testPerUserIsolatedPerNoteScopedMode() { + void testPerUserIsolatedPerNoteScopedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.ISOLATED); interpreterOption.setPerNote(InterpreterOption.SCOPED); @@ -353,7 +353,7 @@ public void testPerUserIsolatedPerNoteScopedMode() { } @Test - public void testPerUserIsolatedPerNoteIsolatedMode() { + void testPerUserIsolatedPerNoteIsolatedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.ISOLATED); interpreterOption.setPerNote(InterpreterOption.ISOLATED); @@ -415,7 +415,7 @@ public void testPerUserIsolatedPerNoteIsolatedMode() { } @Test - public void testPerUserScopedPerNoteScopedMode() { + void testPerUserScopedPerNoteScopedMode() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.SCOPED); interpreterOption.setPerNote(InterpreterOption.SCOPED); @@ -474,7 +474,7 @@ public void testPerUserScopedPerNoteScopedMode() { } @Test - public void testInterpreterJsonSerializable() { + void testInterpreterJsonSerializable() { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setPerUser(InterpreterOption.SHARED); InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), @@ -496,16 +496,16 @@ public void testInterpreterJsonSerializable() { String json = InterpreterSetting.toJson(interpreterSetting); InterpreterSetting checkIntpSetting = InterpreterSetting.fromJson(json); - assertEquals(checkIntpSetting.getId(), "id"); - assertEquals(checkIntpSetting.getName(), "id"); - assertEquals(checkIntpSetting.getGroup(), "group"); + assertEquals("id", checkIntpSetting.getId()); + assertEquals("id", checkIntpSetting.getName()); + assertEquals("group", checkIntpSetting.getGroup()); assertTrue(checkIntpSetting.getOption().perUserShared()); assertNotNull(checkIntpSetting.getInterpreterInfo("echo")); assertNotNull(checkIntpSetting.getInterpreterInfo("double_echo")); } @Test - public void testIsUserAuthorized() { + void testIsUserAuthorized() { List userAndRoles = new ArrayList<>(); userAndRoles.add("User1"); userAndRoles.add("Role1"); @@ -557,7 +557,7 @@ public void testIsUserAuthorized() { } @Test - public void testLoadDependency() throws InterruptedException { + void testLoadDependency() throws InterruptedException { InterpreterOption interpreterOption = new InterpreterOption(); interpreterOption.setUserPermission(true); InterpreterSetting interpreterSetting = new InterpreterSetting.Builder() diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroupTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroupTest.java index af9bb782106..ec22c1f04a5 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroupTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroupTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ManagedInterpreterGroupTest { +class ManagedInterpreterGroupTest { private InterpreterSetting interpreterSetting; @@ -54,7 +54,7 @@ public void setUp() throws IOException, RepositoryException { } @Test - public void testInterpreterGroup() { + void testInterpreterGroup() { ManagedInterpreterGroup interpreterGroup = new ManagedInterpreterGroup("group_1", interpreterSetting); assertEquals(0, interpreterGroup.getSessionNum()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/SessionConfInterpreterTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/SessionConfInterpreterTest.java index ab04d569b10..38ce0cf6611 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/SessionConfInterpreterTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/SessionConfInterpreterTest.java @@ -29,10 +29,10 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class SessionConfInterpreterTest { +class SessionConfInterpreterTest { @Test - public void testUserSessionConfInterpreter() throws InterpreterException { + void testUserSessionConfInterpreter() throws InterpreterException { InterpreterSetting mockInterpreterSetting = mock(InterpreterSetting.class); ManagedInterpreterGroup mockInterpreterGroup = mock(ManagedInterpreterGroup.class); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/install/InstallInterpreterTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/install/InstallInterpreterTest.java index 800dc5b6277..9c80f5e4902 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/install/InstallInterpreterTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/install/InstallInterpreterTest.java @@ -29,7 +29,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -public class InstallInterpreterTest { +class InstallInterpreterTest { private File tmpDir; private InstallInterpreter installer; private File interpreterBaseDir; @@ -66,12 +66,12 @@ public void tearDown() throws IOException { @Test - public void testList() { + void testList() { assertEquals(2, installer.list().size()); } @Test - public void install() { + void install() { assertEquals(0, interpreterBaseDir.listFiles().length); installer.install("intp1"); @@ -79,7 +79,7 @@ public void install() { } @Test - public void installAll() { + void installAll() { installer.installAll(); assertTrue(new File(interpreterBaseDir, "intp1").isDirectory()); assertTrue(new File(interpreterBaseDir, "intp2").isDirectory()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java index 15b07a245b0..e8d08e93219 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java @@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SparkInterpreterLauncherTest { +class SparkInterpreterLauncherTest { private static final Logger LOGGER = LoggerFactory.getLogger(SparkInterpreterLauncher.class); @@ -63,7 +63,7 @@ public void setUp() { } @Test - public void testConnectTimeOut() throws IOException { + void testConnectTimeOut() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -87,7 +87,7 @@ public void testConnectTimeOut() throws IOException { } @Test - public void testLocalMode() throws IOException { + void testLocalMode() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -118,7 +118,7 @@ public void testLocalMode() throws IOException { } @Test - public void testYarnClientMode_1() throws IOException { + void testYarnClientMode_1() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -152,7 +152,7 @@ public void testYarnClientMode_1() throws IOException { } @Test - public void testYarnClientMode_2() throws IOException { + void testYarnClientMode_2() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -188,7 +188,7 @@ public void testYarnClientMode_2() throws IOException { } @Test - public void testYarnClusterMode_1() throws IOException { + void testYarnClusterMode_1() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -231,7 +231,7 @@ public void testYarnClusterMode_1() throws IOException { } @Test - public void testYarnClusterMode_2() throws IOException { + void testYarnClusterMode_2() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -283,7 +283,7 @@ public void testYarnClusterMode_2() throws IOException { } @Test - public void testYarnClusterMode_3() throws IOException { + void testYarnClusterMode_3() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); Properties properties = new Properties(); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncherTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncherTest.java index 6912a26712d..c28a0d54304 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncherTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/StandardInterpreterLauncherTest.java @@ -29,7 +29,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class StandardInterpreterLauncherTest { +class StandardInterpreterLauncherTest { + @BeforeEach public void setUp() { for (final ZeppelinConfiguration.ConfVars confVar : ZeppelinConfiguration.ConfVars.values()) { @@ -38,7 +39,7 @@ public void setUp() { } @Test - public void testLauncher() throws IOException { + void testLauncher() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); StandardInterpreterLauncher launcher = new StandardInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -60,10 +61,11 @@ public void testLauncher() throws IOException { assertEquals("VALUE_1", interpreterProcess.getEnv().get("ENV_1")); assertTrue(interpreterProcess.getEnv().containsKey("INTERPRETER_GROUP_ID")); assertEquals(true, interpreterProcess.isUserImpersonated()); + interpreterProcess.close(); } @Test - public void testConnectTimeOut() throws IOException { + void testConnectTimeOut() throws IOException { ZeppelinConfiguration zConf = ZeppelinConfiguration.create(); StandardInterpreterLauncher launcher = new StandardInterpreterLauncher(zConf, null); Properties properties = new Properties(); @@ -83,6 +85,7 @@ public void testConnectTimeOut() throws IOException { assertTrue(interpreterProcess.getEnv().size() >= 1); assertTrue(interpreterProcess.getEnv().containsKey("INTERPRETER_GROUP_ID")); assertEquals(true, interpreterProcess.isUserImpersonated()); + interpreterProcess.close(); } } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java index 0c7e5df6c62..8fbc108d44e 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter1.java @@ -33,83 +33,83 @@ public class MockInterpreter1 extends Interpreter { - private static AtomicInteger IdGenerator = new AtomicInteger(); - - private int object_id; - private String pid; - Map vars = new HashMap<>(); - - public MockInterpreter1(Properties property) { - super(property); - this.object_id = IdGenerator.getAndIncrement(); - this.pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; - } - - boolean open; - - - @Override - public void open() { - open = true; - } - - @Override - public void close() { - open = false; - } - - - public boolean isOpen() { - return open; - } - - @Override - public InterpreterResult interpret(String st, InterpreterContext context) { - InterpreterResult result; - st = st.trim(); - if ("getId".equals(st)) { - // get unique id of this interpreter instance - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "" + this.object_id + "-" + this.pid); - } else if (st.startsWith("sleep")) { - try { - Thread.sleep(Integer.parseInt(st.split(" ")[1])); - } catch (InterruptedException e) { - // nothing to do - } - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl1: " + st); - } else { - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl1: " + st); - } - - if (context.getResourcePool() != null) { - context.getResourcePool().put(context.getNoteId(), context.getParagraphId(), "result", result); - } - - return result; - } - - @Override - public void cancel(InterpreterContext context) { - } - - @Override - public FormType getFormType() { - return FormType.SIMPLE; - } - - @Override - public int getProgress(InterpreterContext context) { - return 0; - } - - @Override - public Scheduler getScheduler() { - return SchedulerFactory.singleton().createOrGetFIFOScheduler("test_"+this.hashCode()); - } - - @Override - public List completion(String buf, int cursor, - InterpreterContext interpreterContext) { - return null; - } + private static AtomicInteger IdGenerator = new AtomicInteger(); + + private int object_id; + private String pid; + Map vars = new HashMap<>(); + + public MockInterpreter1(Properties property) { + super(property); + this.object_id = IdGenerator.getAndIncrement(); + this.pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; + } + + boolean open; + + + @Override + public void open() { + open = true; + } + + @Override + public void close() { + open = false; + } + + + public boolean isOpen() { + return open; + } + + @Override + public InterpreterResult interpret(String st, InterpreterContext context) { + InterpreterResult result; + st = st.trim(); + if ("getId".equals(st)) { + // get unique id of this interpreter instance + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "" + this.object_id + "-" + this.pid); + } else if (st.startsWith("sleep")) { + try { + Thread.sleep(Integer.parseInt(st.split(" ")[1])); + } catch (InterruptedException e) { + // nothing to do + } + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl1: " + st); + } else { + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl1: " + st); + } + + if (context.getResourcePool() != null) { + context.getResourcePool().put(context.getNoteId(), context.getParagraphId(), "result", result); + } + + return result; + } + + @Override + public void cancel(InterpreterContext context) { + } + + @Override + public FormType getFormType() { + return FormType.SIMPLE; + } + + @Override + public int getProgress(InterpreterContext context) { + return 0; + } + + @Override + public Scheduler getScheduler() { + return SchedulerFactory.singleton().createOrGetFIFOScheduler("test_"+this.hashCode()); + } + + @Override + public List completion(String buf, int cursor, + InterpreterContext interpreterContext) { + return null; + } } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java index 43f9f517771..dd04a03b31b 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/mock/MockInterpreter2.java @@ -32,73 +32,73 @@ public class MockInterpreter2 extends Interpreter{ Map vars = new HashMap<>(); - public MockInterpreter2(Properties property) { - super(property); - } - - boolean open; - - @Override - public void open() { - open = true; - } - - @Override - public void close() { - open = false; - } - - public boolean isOpen() { - return open; - } - - - @Override - public InterpreterResult interpret(String st, InterpreterContext context) { - InterpreterResult result; - st = st.trim(); - if ("getId".equals(st)) { - // get unique id of this interpreter instance - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "" + this.hashCode()); - } else if (st.startsWith("sleep")) { - try { - Thread.sleep(Integer.parseInt(st.split(" ")[1])); - } catch (InterruptedException e) { - // nothing to do - } - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl2: " + st); - } else { - result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl2: " + st); - } - - if (context.getResourcePool() != null) { - context.getResourcePool().put(context.getNoteId(), context.getParagraphId(), "result", result); - } - return result; - } - - @Override - public void cancel(InterpreterContext context) { - } - - @Override - public FormType getFormType() { - return FormType.SIMPLE; - } - - @Override - public int getProgress(InterpreterContext context) { - return 0; - } - - @Override - public Scheduler getScheduler() { - return SchedulerFactory.singleton().createOrGetFIFOScheduler("test_"+this.hashCode()); - } - - @Override - public List completion(String buf, int cursor, - InterpreterContext interpreterContext) { - return null; - } + public MockInterpreter2(Properties property) { + super(property); + } + + boolean open; + + @Override + public void open() { + open = true; + } + + @Override + public void close() { + open = false; + } + + public boolean isOpen() { + return open; + } + + + @Override + public InterpreterResult interpret(String st, InterpreterContext context) { + InterpreterResult result; + st = st.trim(); + if ("getId".equals(st)) { + // get unique id of this interpreter instance + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "" + this.hashCode()); + } else if (st.startsWith("sleep")) { + try { + Thread.sleep(Integer.parseInt(st.split(" ")[1])); + } catch (InterruptedException e) { + // nothing to do + } + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl2: " + st); + } else { + result = new InterpreterResult(InterpreterResult.Code.SUCCESS, "repl2: " + st); + } + + if (context.getResourcePool() != null) { + context.getResourcePool().put(context.getNoteId(), context.getParagraphId(), "result", result); + } + return result; + } + + @Override + public void cancel(InterpreterContext context) { + } + + @Override + public FormType getFormType() { + return FormType.SIMPLE; + } + + @Override + public int getProgress(InterpreterContext context) { + return 0; + } + + @Override + public Scheduler getScheduler() { + return SchedulerFactory.singleton().createOrGetFIFOScheduler("test_"+this.hashCode()); + } + + @Override + public List completion(String buf, int cursor, + InterpreterContext interpreterContext) { + return null; + } } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/FileSystemRecoveryStorageTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/FileSystemRecoveryStorageTest.java index d099bc1c5d4..2b321908c53 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/FileSystemRecoveryStorageTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/FileSystemRecoveryStorageTest.java @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FileSystemRecoveryStorageTest extends AbstractInterpreterTest { +class FileSystemRecoveryStorageTest extends AbstractInterpreterTest { private File recoveryDir = null; private String note1Id; @@ -66,7 +66,7 @@ public void tearDown() throws Exception { } @Test - public void testSingleInterpreterProcess() throws InterpreterException, IOException { + void testSingleInterpreterProcess() throws InterpreterException, IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); @@ -85,7 +85,7 @@ public void testSingleInterpreterProcess() throws InterpreterException, IOExcept } @Test - public void testMultipleInterpreterProcess() throws InterpreterException, IOException { + void testMultipleInterpreterProcess() throws InterpreterException, IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser(InterpreterOption.ISOLATED); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/LocalRecoveryStorageTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/LocalRecoveryStorageTest.java index cce4a48a5e5..52c8cdea3d1 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/LocalRecoveryStorageTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/recovery/LocalRecoveryStorageTest.java @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class LocalRecoveryStorageTest extends AbstractInterpreterTest { +class LocalRecoveryStorageTest extends AbstractInterpreterTest { private File recoveryDir = null; private String note1Id; private String note2Id; @@ -66,7 +66,7 @@ public void tearDown() throws Exception { } @Test - public void testSingleInterpreterProcess() throws InterpreterException, IOException { + void testSingleInterpreterProcess() throws InterpreterException, IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); @@ -85,7 +85,7 @@ public void testSingleInterpreterProcess() throws InterpreterException, IOExcept } @Test - public void testMultipleInterpreterProcess() throws InterpreterException, IOException { + void testMultipleInterpreterProcess() throws InterpreterException, IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getByName("test"); interpreterSetting.getOption().setPerUser(InterpreterOption.ISOLATED); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunnerTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunnerTest.java index 992ebddb08d..1d8d273cb73 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunnerTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/AppendOutputRunnerTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class AppendOutputRunnerTest { +class AppendOutputRunnerTest { private static final int NUM_EVENTS = 10000; private static final int NUM_CLUBBED_EVENTS = 100; @@ -63,7 +63,7 @@ public void afterEach() { } @Test - public void testSingleEvent() throws InterruptedException { + void testSingleEvent() throws InterruptedException { RemoteInterpreterProcessListener listener = mock(RemoteInterpreterProcessListener.class); String[][] buffer = {{"note", "para", "data\n"}}; @@ -89,7 +89,7 @@ public void testMultipleEventsOfSameParagraph() throws InterruptedException { } @Test - public void testMultipleEventsOfDifferentParagraphs() throws InterruptedException { + void testMultipleEventsOfDifferentParagraphs() throws InterruptedException { RemoteInterpreterProcessListener listener = mock(RemoteInterpreterProcessListener.class); String note1 = "note1"; String note2 = "note2"; @@ -111,7 +111,7 @@ public void testMultipleEventsOfDifferentParagraphs() throws InterruptedExceptio } @Test - public void testClubbedData() throws InterruptedException { + void testClubbedData() throws InterruptedException { RemoteInterpreterProcessListener listener = mock(RemoteInterpreterProcessListener.class); AppendOutputRunner runner = new AppendOutputRunner(listener); future = service.scheduleWithFixedDelay(runner, 0, @@ -130,7 +130,7 @@ public void testClubbedData() throws InterruptedException { } @Test - public void testWarnLoggerForLargeData() throws InterruptedException { + void testWarnLoggerForLargeData() throws InterruptedException { RemoteInterpreterProcessListener listener = mock(RemoteInterpreterProcessListener.class); AppendOutputRunner runner = new AppendOutputRunner(listener); String data = "data\n"; diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java index 04849761d79..68db648aa30 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteAngularObjectTest.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoteAngularObjectTest extends AbstractInterpreterTest +class RemoteAngularObjectTest extends AbstractInterpreterTest implements AngularObjectRegistryListener { private RemoteInterpreter intp; @@ -74,7 +74,7 @@ public void setUp() throws Exception { } @Test - public void testAngularObjectInterpreterSideCRUD() throws InterruptedException, InterpreterException { + void testAngularObjectInterpreterSideCRUD() throws InterruptedException, InterpreterException { InterpreterResult ret = intp.interpret("get", context); Thread.sleep(500); // waitFor eventpoller pool event String[] result = ret.message().get(0).getData().split(" "); @@ -107,7 +107,7 @@ public void testAngularObjectInterpreterSideCRUD() throws InterruptedException, } @Test - public void testAngularObjectRemovalOnZeppelinServerSide() throws InterruptedException, InterpreterException { + void testAngularObjectRemovalOnZeppelinServerSide() throws InterruptedException, InterpreterException { // test if angularobject removal from server side propagate to interpreter process's registry. // will happen when notebook is removed. @@ -132,7 +132,7 @@ public void testAngularObjectRemovalOnZeppelinServerSide() throws InterruptedExc } @Test - public void testAngularObjectAddOnZeppelinServerSide() throws InterruptedException, InterpreterException { + void testAngularObjectAddOnZeppelinServerSide() throws InterruptedException, InterpreterException { // test if angularobject add from server side propagate to interpreter process's registry. // will happen when zeppelin server loads notebook and restore the object into registry diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStreamTest.java similarity index 70% rename from zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java rename to zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStreamTest.java index 1e36eaa7b42..189c37ec7df 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStream.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterOutputTestStreamTest.java @@ -17,19 +17,19 @@ package org.apache.zeppelin.interpreter.remote; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.zeppelin.interpreter.AbstractInterpreterTest; import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterSetting; -import org.apache.zeppelin.interpreter.thrift.ParagraphInfo; +import org.apache.zeppelin.user.AuthenticationInfo; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.io.File; import java.io.IOException; -import java.util.List; -import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -37,21 +37,27 @@ /** * Test for remote interpreter output stream */ -public class RemoteInterpreterOutputTestStream extends AbstractInterpreterTest - implements RemoteInterpreterProcessListener { +class RemoteInterpreterOutputTestStreamTest extends AbstractInterpreterTest { private InterpreterSetting interpreterSetting; + private String noteId; + @Override @BeforeEach public void setUp() throws Exception { super.setUp(); interpreterSetting = interpreterSettingManager.get("test"); + noteId = notebook.createNote(File.separator + RandomStringUtils.randomAlphabetic(6), + AuthenticationInfo.ANONYMOUS); } + @Override @AfterEach public void tearDown() throws Exception { interpreterSetting.close(); + notebook.removeNote(noteId, AuthenticationInfo.ANONYMOUS); + super.tearDown(); } private InterpreterContext createInterpreterContext() { @@ -62,8 +68,8 @@ private InterpreterContext createInterpreterContext() { } @Test - public void testInterpreterResultOnly() throws InterpreterException { - RemoteInterpreter intp = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", "note1", "mock_stream"); + void testInterpreterResultOnly() throws InterpreterException, IOException { + RemoteInterpreter intp = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", noteId, "mock_stream"); InterpreterResult ret = intp.interpret("SUCCESS::staticresult", createInterpreterContext()); assertEquals(InterpreterResult.Code.SUCCESS, ret.code()); assertEquals("staticresult", ret.message().get(0).getData()); @@ -78,8 +84,9 @@ public void testInterpreterResultOnly() throws InterpreterException { } @Test - public void testInterpreterOutputStreamOnly() throws InterpreterException { - RemoteInterpreter intp = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", "note1", "mock_stream"); + void testInterpreterOutputStreamOnly() throws InterpreterException { + RemoteInterpreter intp = + (RemoteInterpreter) interpreterSetting.getInterpreter("user1", noteId, "mock_stream"); InterpreterResult ret = intp.interpret("SUCCESS:streamresult:", createInterpreterContext()); assertEquals(InterpreterResult.Code.SUCCESS, ret.code()); assertEquals("streamresult", ret.message().get(0).getData()); @@ -90,8 +97,9 @@ public void testInterpreterOutputStreamOnly() throws InterpreterException { } @Test - public void testInterpreterResultOutputStreamMixed() throws InterpreterException { - RemoteInterpreter intp = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", "note1", "mock_stream"); + void testInterpreterResultOutputStreamMixed() throws InterpreterException { + RemoteInterpreter intp = + (RemoteInterpreter) interpreterSetting.getInterpreter("user1", noteId, "mock_stream"); InterpreterResult ret = intp.interpret("SUCCESS:stream:static", createInterpreterContext()); assertEquals(InterpreterResult.Code.SUCCESS, ret.code()); assertEquals("stream", ret.message().get(0).getData()); @@ -99,8 +107,9 @@ public void testInterpreterResultOutputStreamMixed() throws InterpreterException } @Test - public void testOutputType() throws InterpreterException { - RemoteInterpreter intp = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", "note1", "mock_stream"); + void testOutputType() throws InterpreterException { + RemoteInterpreter intp = + (RemoteInterpreter) interpreterSetting.getInterpreter("user1", noteId, "mock_stream"); InterpreterResult ret = intp.interpret("SUCCESS:%html hello:", createInterpreterContext()); assertEquals(InterpreterResult.Type.HTML, ret.message().get(0).getType()); @@ -117,38 +126,4 @@ public void testOutputType() throws InterpreterException { assertEquals("world", ret.message().get(1).getData()); } - @Override - public void onOutputAppend(String noteId, String paragraphId, int index, String output) { - - } - - @Override - public void onOutputUpdated(String noteId, String paragraphId, int index, InterpreterResult.Type type, String output) { - - } - - @Override - public void onOutputClear(String noteId, String paragraphId) { - - } - - @Override - public void runParagraphs(String noteId, List paragraphIndices, List paragraphIds, String curParagraphId) throws IOException { - - } - - @Override - public void onParaInfosReceived(String noteId, String paragraphId, - String interpreterSettingId, Map metaInfos) { - } - - @Override - public List getParagraphList(String user, String noteId) { - return null; - } - - @Override - public void checkpointOutput(String noteId, String paragraphId) { - - } } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java index a899dbea3a2..cdeea28dcb4 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterTest.java @@ -51,7 +51,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class RemoteInterpreterTest extends AbstractInterpreterTest { +class RemoteInterpreterTest extends AbstractInterpreterTest { private InterpreterSetting interpreterSetting; private String note1Id; @@ -70,7 +70,7 @@ public void tearDown() throws Exception { } @Test - public void testSharedMode() throws InterpreterException, IOException { + void testSharedMode() throws InterpreterException, IOException { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); Interpreter interpreter1 = interpreterSetting.getDefaultInterpreter("user1", note1Id); @@ -104,7 +104,7 @@ public void testSharedMode() throws InterpreterException, IOException { } @Test - public void testScopedMode() throws InterpreterException, IOException { + void testScopedMode() throws InterpreterException, IOException { interpreterSetting.getOption().setPerUser(InterpreterOption.SCOPED); Interpreter interpreter1 = interpreterSetting.getDefaultInterpreter("user1", note1Id); @@ -148,7 +148,7 @@ public void testScopedMode() throws InterpreterException, IOException { } @Test - public void testIsolatedMode() throws InterpreterException, IOException { + void testIsolatedMode() throws InterpreterException, IOException { interpreterSetting.getOption().setPerUser(InterpreterOption.ISOLATED); Interpreter interpreter1 = interpreterSetting.getDefaultInterpreter("user1", note1Id); @@ -192,7 +192,7 @@ public void testIsolatedMode() throws InterpreterException, IOException { } @Test - public void testExecuteIncorrectPrecode() throws TTransportException, IOException, InterpreterException { + void testExecuteIncorrectPrecode() throws TTransportException, IOException, InterpreterException { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); interpreterSetting.setProperty("zeppelin.SleepInterpreter.precode", "fail test"); Interpreter interpreter1 = interpreterSetting.getInterpreter("user1", note1Id, "sleep"); @@ -201,7 +201,7 @@ public void testExecuteIncorrectPrecode() throws TTransportException, IOExceptio } @Test - public void testExecuteCorrectPrecode() throws TTransportException, IOException, InterpreterException { + void testExecuteCorrectPrecode() throws TTransportException, IOException, InterpreterException { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); interpreterSetting.setProperty("zeppelin.SleepInterpreter.precode", "1"); Interpreter interpreter1 = interpreterSetting.getInterpreter("user1", note1Id, "sleep"); @@ -210,7 +210,8 @@ public void testExecuteCorrectPrecode() throws TTransportException, IOException, } @Test - public void testRemoteInterperterErrorStatus() throws TTransportException, IOException, InterpreterException { + void testRemoteInterperterErrorStatus() + throws TTransportException, IOException, InterpreterException { interpreterSetting.setProperty("zeppelin.interpreter.echo.fail", "true"); interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); @@ -223,7 +224,7 @@ public void testRemoteInterperterErrorStatus() throws TTransportException, IOExc } @Test - public void testFIFOScheduler() throws InterruptedException, InterpreterException { + void testFIFOScheduler() throws InterruptedException, InterpreterException { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); // by default SleepInterpreter would use FIFOScheduler @@ -306,7 +307,7 @@ public void run() { } @Test - public void testRemoteInterpreterSharesTheSameSchedulerInstanceInTheSameGroup() { + void testRemoteInterpreterSharesTheSameSchedulerInstanceInTheSameGroup() { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); Interpreter interpreter1 = interpreterSetting.getInterpreter("user1", note1Id, "sleep"); Interpreter interpreter2 = interpreterSetting.getInterpreter("user1", note1Id, "echo"); @@ -315,7 +316,7 @@ public void testRemoteInterpreterSharesTheSameSchedulerInstanceInTheSameGroup() } @Test - public void testMultiInterpreterSession() { + void testMultiInterpreterSession() { interpreterSetting.getOption().setPerUser(InterpreterOption.SCOPED); Interpreter interpreter1_user1 = interpreterSetting.getInterpreter("user1", note1Id, "sleep"); Interpreter interpreter2_user1 = interpreterSetting.getInterpreter("user1", note1Id, "echo"); @@ -332,7 +333,7 @@ public void testMultiInterpreterSession() { } @Test - public void should_push_local_angular_repo_to_remote() throws Exception { + void should_push_local_angular_repo_to_remote() throws Exception { final AngularObjectRegistry registry = new AngularObjectRegistry("spark", null); registry.add("name_1", "value_1", "note_1", "paragraphId_1"); @@ -347,7 +348,7 @@ public void should_push_local_angular_repo_to_remote() throws Exception { } @Test - public void testEnvStringPattern() { + void testEnvStringPattern() { assertFalse(RemoteInterpreterUtils.isEnvString(null)); assertFalse(RemoteInterpreterUtils.isEnvString("")); assertFalse(RemoteInterpreterUtils.isEnvString("abcDEF")); @@ -358,7 +359,7 @@ public void testEnvStringPattern() { } @Test - public void testEnvironmentAndProperty() throws InterpreterException { + void testEnvironmentAndProperty() throws InterpreterException { interpreterSetting.getOption().setPerUser(InterpreterOption.SHARED); interpreterSetting.setProperty("ENV_1", "VALUE_1"); interpreterSetting.setProperty("property_1", "value_1"); @@ -374,7 +375,7 @@ public void testEnvironmentAndProperty() throws InterpreterException { } @Test - public void testConvertDynamicForms() throws InterpreterException { + void testConvertDynamicForms() throws InterpreterException { GUI gui = new GUI(); OptionInput.ParamOption[] paramOptions = { new OptionInput.ParamOption("value1", "param1"), @@ -395,7 +396,7 @@ public void testConvertDynamicForms() throws InterpreterException { } @Test - public void testFailToLaunchInterpreterProcess_InvalidRunner() { + void testFailToLaunchInterpreterProcess_InvalidRunner() { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_REMOTE_RUNNER.getVarName(), "invalid_runner"); final Interpreter interpreter1 = interpreterSetting.getInterpreter("user1", note1Id, "sleep"); @@ -414,7 +415,7 @@ public void testFailToLaunchInterpreterProcess_InvalidRunner() { } @Test - public void testFailToLaunchInterpreterProcess_ErrorInRunner() { + void testFailToLaunchInterpreterProcess_ErrorInRunner() { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_REMOTE_RUNNER.getVarName(), zeppelinHome.getAbsolutePath() + "/zeppelin-zengine/src/test/resources/bin/interpreter_invalid.sh"); @@ -434,7 +435,7 @@ public void testFailToLaunchInterpreterProcess_ErrorInRunner() { } @Test - public void testFailToLaunchInterpreterProcess_Timeout() { + void testFailToLaunchInterpreterProcess_Timeout() { try { System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_REMOTE_RUNNER.getVarName(), zeppelinHome.getAbsolutePath() + "/zeppelin-zengine/src/test/resources/bin/interpreter_timeout.sh"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/CredentialInjectorTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/CredentialInjectorTest.java index 9a17969238f..645f46b8502 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/CredentialInjectorTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/CredentialInjectorTest.java @@ -28,7 +28,7 @@ import org.apache.zeppelin.user.UsernamePassword; import org.junit.jupiter.api.Test; -public class CredentialInjectorTest { +class CredentialInjectorTest { private static final String TEMPLATE = "val jdbcUrl = \"jdbc:mysql://localhost/emp?user={mysql.user}&password={mysql.password}\""; @@ -41,7 +41,7 @@ public class CredentialInjectorTest { "jdbcUrl: String = jdbc:mysql://localhost/employees?user=username&password=###"; @Test - public void replaceCredentials() { + void replaceCredentials() { UserCredentials userCredentials = mock(UserCredentials.class); UsernamePassword usernamePassword = new UsernamePassword("username", "pwd"); when(userCredentials.getUsernamePassword("mysql")).thenReturn(usernamePassword); @@ -56,7 +56,7 @@ public void replaceCredentials() { } @Test - public void replaceCredentialNoTexts() { + void replaceCredentialNoTexts() { UserCredentials userCredentials = mock(UserCredentials.class); CredentialInjector testee = new CredentialInjector(userCredentials); String actual = testee.replaceCredentials(null); @@ -64,7 +64,7 @@ public void replaceCredentialNoTexts() { } @Test - public void replaceCredentialsNotExisting() { + void replaceCredentialsNotExisting() { UserCredentials userCredentials = mock(UserCredentials.class); CredentialInjector testee = new CredentialInjector(userCredentials); String actual = testee.replaceCredentials(TEMPLATE); @@ -75,9 +75,9 @@ public void replaceCredentialsNotExisting() { assertEquals(1, hiddenResult.message().size()); assertEquals(ANSWER, hiddenResult.message().get(0).getData()); } - + @Test - public void hidePasswordsNoResult() { + void hidePasswordsNoResult() { UserCredentials userCredentials = mock(UserCredentials.class); CredentialInjector testee = new CredentialInjector(userCredentials); assertNull(testee.hidePasswords(null)); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteAuthTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteAuthTest.java index b8dff580670..149a15fd0a8 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteAuthTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteAuthTest.java @@ -31,11 +31,11 @@ import java.util.Map; import java.util.Set; -public class NoteAuthTest { +class NoteAuthTest { private ZeppelinConfiguration conf = mock(ZeppelinConfiguration.class); @Test - public void testAnonymous() { + void testAnonymous() { NoteAuth auth = new NoteAuth("note1", conf); assertEquals(0, auth.getOwners().size()); assertEquals(0, auth.getReaders().size()); @@ -44,7 +44,7 @@ public void testAnonymous() { } @Test - public void testPublicNotes() { + void testPublicNotes() { when(conf.isNotebookPublic()).thenReturn(true); @@ -68,7 +68,7 @@ public void testPublicNotes() { } @Test - public void testNoPublicNotes() { + void testNoPublicNotes() { when(conf.isNotebookPublic()).thenReturn(false); @@ -96,7 +96,7 @@ public void testNoPublicNotes() { } @Test - public void testFoceLowerCaseUsers() { + void testFoceLowerCaseUsers() { when(conf.isNotebookPublic()).thenReturn(false); when(conf.isUsernameForceLowerCase()).thenReturn(true); @@ -116,7 +116,7 @@ public void testFoceLowerCaseUsers() { } @Test - public void testMapConstructor() { + void testMapConstructor() { when(conf.isNotebookPublic()).thenReturn(false); NoteAuth auth = new NoteAuth("note1", getTestMap("TestUser", "TestGroup"), conf); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteManagerTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteManagerTest.java index c0044c926b7..b9f43f2291a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteManagerTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteManagerTest.java @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -public class NoteManagerTest { +class NoteManagerTest { private NoteManager noteManager; private ZeppelinConfiguration conf; @@ -51,7 +51,7 @@ public void setUp() throws IOException { } @Test - public void testNoteOperations() throws IOException { + void testNoteOperations() throws IOException { assertEquals(0, this.noteManager.getNotesInfo().size()); Note note1 = createNote("/prod/my_note1"); @@ -94,7 +94,7 @@ public void testNoteOperations() throws IOException { } @Test - public void testAddNoteRejectsDuplicatePath() throws IOException { + void testAddNoteRejectsDuplicatePath() throws IOException { assertThrows(NotePathAlreadyExistsException.class, () -> { @@ -108,7 +108,7 @@ public void testAddNoteRejectsDuplicatePath() throws IOException { } @Test - public void testMoveNoteRejectsDuplicatePath() throws IOException { + void testMoveNoteRejectsDuplicatePath() throws IOException { assertThrows(NotePathAlreadyExistsException.class, () -> { Note note1 = createNote("/prod/note-1"); @@ -127,7 +127,7 @@ private Note createNote(String notePath) { } @Test - public void testLruCache() throws IOException { + void testLruCache() throws IOException { int cacheThreshold = conf.getNoteCacheThreshold(); @@ -175,7 +175,7 @@ public void testLruCache() throws IOException { } @Test - public void testConcurrentOperation() throws Exception { + void testConcurrentOperation() throws Exception { int threshold = 10, noteNum = 150; Map notes = new ConcurrentHashMap<>(); ExecutorService threadPool = Executors.newFixedThreadPool(threshold); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java index e6927dddb0c..b3140d80cfd 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java @@ -82,7 +82,7 @@ import static org.mockito.Mockito.mock; -public class NotebookTest extends AbstractInterpreterTest implements ParagraphJobListener { +class NotebookTest extends AbstractInterpreterTest implements ParagraphJobListener { private static final Logger logger = LoggerFactory.getLogger(NotebookTest.class); private Notebook notebook; @@ -126,7 +126,7 @@ public void tearDown() throws Exception { } @Test - public void testRevisionSupported() throws IOException { + void testRevisionSupported() throws IOException { NotebookRepo notebookRepo; Notebook notebook; @@ -281,7 +281,7 @@ public void updateSettings(Map settings, AuthenticationInfo subj } @Test - public void testSelectingReplImplementation() throws IOException { + void testSelectingReplImplementation() throws IOException { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -310,7 +310,7 @@ public void testSelectingReplImplementation() throws IOException { } @Test - public void testReloadAndSetInterpreter() throws IOException { + void testReloadAndSetInterpreter() throws IOException { String noteId = notebook.createNote("note1", AuthenticationInfo.ANONYMOUS); notebook.processNote(noteId, note -> { @@ -339,7 +339,7 @@ public void testReloadAndSetInterpreter() throws IOException { } @Test - public void testReloadAllNotes() throws IOException { + void testReloadAllNotes() throws IOException { String note1Id = notebook.createNote("note1", AuthenticationInfo.ANONYMOUS); notebook.processNote(note1Id, note1 -> { @@ -387,7 +387,7 @@ public void testReloadAllNotes() throws IOException { } @Test - public void testLoadAllNotes() { + void testLoadAllNotes() { try { assertEquals(0, notebook.getNotesInfo().size()); String noteId = notebook.createNote("note1", anonymous); @@ -409,7 +409,7 @@ public void testLoadAllNotes() { } @Test - public void testPersist() throws IOException, SchedulerException { + void testPersist() throws IOException, SchedulerException { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -427,7 +427,7 @@ public void testPersist() throws IOException, SchedulerException { } @Test - public void testCreateNoteWithSubject() throws IOException, SchedulerException, RepositoryException { + void testCreateNoteWithSubject() throws IOException, SchedulerException, RepositoryException { AuthenticationInfo subject = new AuthenticationInfo("user1"); String noteId = notebook.createNote("note1", subject); assertNotNull(authorizationService.getOwners(noteId)); @@ -439,7 +439,7 @@ public void testCreateNoteWithSubject() throws IOException, SchedulerException, } @Test - public void testClearParagraphOutput() throws IOException, SchedulerException { + void testClearParagraphOutput() throws IOException, SchedulerException { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -463,7 +463,7 @@ public void testClearParagraphOutput() throws IOException, SchedulerException { } @Test - public void testRunBlankParagraph() throws IOException, SchedulerException, InterruptedException { + void testRunBlankParagraph() throws IOException, SchedulerException, InterruptedException { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -485,7 +485,7 @@ public void testRunBlankParagraph() throws IOException, SchedulerException, Inte } @Test - public void testRemoveNote() throws IOException, InterruptedException { + void testRemoveNote() throws IOException, InterruptedException { try { LOGGER.info("--------------- Test testRemoveNote ---------------"); // create a note and a paragraph @@ -521,28 +521,28 @@ public void testRemoveNote() throws IOException, InterruptedException { } @Test - public void testRemoveCorruptedNote() throws IOException{ - LOGGER.info("--------------- Test testRemoveCorruptedNote ---------------"); - // create a note and a paragraph - String corruptedNoteId = notebook.createNote("note1", anonymous); - String corruptedNotePath = notebook.processNote(corruptedNoteId, - corruptedNote -> { - return notebookDir.getAbsolutePath() + corruptedNote.getPath() + "_" + corruptedNote.getId() + ".zpln"; - }); + void testRemoveCorruptedNote() throws IOException { + LOGGER.info("--------------- Test testRemoveCorruptedNote ---------------"); + // create a note and a paragraph + String corruptedNoteId = notebook.createNote("note1", anonymous); + String corruptedNotePath = notebook.processNote(corruptedNoteId, + corruptedNote -> { + return notebookDir.getAbsolutePath() + corruptedNote.getPath() + "_" + corruptedNote.getId() + ".zpln"; + }); - // corrupt note - FileWriter myWriter = new FileWriter(corruptedNotePath); - myWriter.write("{{{I'm corrupted;;;"); - myWriter.close(); - LOGGER.info("--------------- Finish Test testRemoveCorruptedNote ---------------"); - int numberOfNotes = notebook.getNotesInfo().size(); - notebook.removeNote(corruptedNoteId, anonymous); - assertEquals(numberOfNotes - 1, notebook.getNotesInfo().size()); - LOGGER.info("--------------- Finish Test testRemoveCorruptedNote ---------------"); + // corrupt note + FileWriter myWriter = new FileWriter(corruptedNotePath); + myWriter.write("{{{I'm corrupted;;;"); + myWriter.close(); + LOGGER.info("--------------- Finish Test testRemoveCorruptedNote ---------------"); + int numberOfNotes = notebook.getNotesInfo().size(); + notebook.removeNote(corruptedNoteId, anonymous); + assertEquals(numberOfNotes - 1, notebook.getNotesInfo().size()); + LOGGER.info("--------------- Finish Test testRemoveCorruptedNote ---------------"); } @Test - public void testInvalidInterpreter() throws IOException, InterruptedException { + void testInvalidInterpreter() throws IOException, InterruptedException { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -567,7 +567,7 @@ public void testInvalidInterpreter() throws IOException, InterruptedException { } @Test - public void testRunAll() throws Exception { + void testRunAll() throws Exception { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -605,7 +605,7 @@ public void testRunAll() throws Exception { } @Test - public void testSchedule() throws InterruptedException, IOException { + void testSchedule() throws InterruptedException, IOException { // create a note and a paragraph String noteId = notebook.createNote("note1", anonymous); // use write lock, because note configuration is overwritten @@ -649,7 +649,7 @@ public void testSchedule() throws InterruptedException, IOException { } @Test - public void testScheduleAgainstRunningAndPendingParagraph() throws InterruptedException, IOException { + void testScheduleAgainstRunningAndPendingParagraph() throws InterruptedException, IOException { // create a note String noteId = notebook.createNote("note1", anonymous); // append running and pending paragraphs to the note @@ -703,7 +703,7 @@ public void testScheduleAgainstRunningAndPendingParagraph() throws InterruptedEx } @Test - public void testSchedulePoolUsage() throws InterruptedException, IOException { + void testSchedulePoolUsage() throws InterruptedException, IOException { final int timeout = 30; final String everySecondCron = "* * * * * ?"; // each run starts a new JVM and the job takes about ~5 seconds @@ -741,8 +741,7 @@ private void executeNewParagraphByCron(String noteId, String cron) throws IOExce } @Test - public void testScheduleDisabled() throws InterruptedException, IOException { - + void testScheduleDisabled() throws InterruptedException, IOException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_CRON_ENABLE.getVarName(), "false"); try { final int timeout = 10; @@ -771,7 +770,7 @@ public void onStatusChanged(Job job, Status before, Status after) { } @Test - public void testScheduleDisabledWithName() throws InterruptedException, IOException { + void testScheduleDisabledWithName() throws InterruptedException, IOException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_CRON_FOLDERS.getVarName(), "/System"); try { @@ -989,7 +988,7 @@ public void testCronWithReleaseResourceClosesOnlySpecificInterpreters() } @Test - public void testCronNoteInTrash() throws InterruptedException, IOException, SchedulerException { + void testCronNoteInTrash() throws InterruptedException, IOException, SchedulerException { String noteId = notebook.createNote("~Trash/NotCron", anonymous); // use write lock because we overwrite the note config notebook.processNote(noteId, @@ -1017,7 +1016,7 @@ public void testCronNoteInTrash() throws InterruptedException, IOException, Sche } @Test - public void testExportAndImportNote() throws Exception { + void testExportAndImportNote() throws Exception { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, @@ -1068,7 +1067,7 @@ public void testExportAndImportNote() throws Exception { } @Test - public void testCloneNote() throws Exception { + void testCloneNote() throws Exception { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, note -> { @@ -1116,7 +1115,7 @@ public void testCloneNote() throws Exception { } @Test - public void testResourceRemovealOnParagraphNoteRemove() throws Exception { + void testResourceRemovealOnParagraphNoteRemove() throws Exception { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, @@ -1150,7 +1149,7 @@ public void testResourceRemovealOnParagraphNoteRemove() throws Exception { } @Test - public void testAngularObjectRemovalOnNotebookRemove() throws InterruptedException, + void testAngularObjectRemovalOnNotebookRemove() throws InterruptedException, IOException { // create a note and a paragraph String noteId = notebook.createNote("note1", anonymous); @@ -1184,7 +1183,7 @@ public void testAngularObjectRemovalOnNotebookRemove() throws InterruptedExcepti } @Test - public void testAngularObjectRemovalOnParagraphRemove() throws InterruptedException, + void testAngularObjectRemovalOnParagraphRemove() throws InterruptedException, IOException { // create a note and a paragraph String noteId = notebook.createNote("note1", anonymous); @@ -1227,7 +1226,7 @@ public void testAngularObjectRemovalOnParagraphRemove() throws InterruptedExcept } @Test - public void testAngularObjectRemovalOnInterpreterRestart() throws InterruptedException, + void testAngularObjectRemovalOnInterpreterRestart() throws InterruptedException, IOException, InterpreterException { // create a note and a paragraph String noteId = notebook.createNote("note1", anonymous); @@ -1260,7 +1259,7 @@ public void testAngularObjectRemovalOnInterpreterRestart() throws InterruptedExc } @Test - public void testPermissions() throws IOException { + void testPermissions() throws IOException { // create a note and a paragraph String noteId = notebook.createNote("note1", anonymous); // empty owners, readers or writers means note is public @@ -1313,7 +1312,7 @@ public void testPermissions() throws IOException { } @Test - public void testAuthorizationRoles() throws IOException { + void testAuthorizationRoles() throws IOException { String user1 = "user1"; String user2 = "user2"; Set roles = new HashSet<>(Arrays.asList("admin")); @@ -1359,7 +1358,7 @@ public void testAuthorizationRoles() throws IOException { } @Test - public void testInterpreterSettingConfig() { + void testInterpreterSettingConfig() { LOGGER.info("testInterpreterSettingConfig >>> "); Note note = new Note("testInterpreterSettingConfig", "config_test", interpreterFactory, interpreterSettingManager, this, credentials, new ArrayList<>()); @@ -1414,7 +1413,7 @@ public void testInterpreterSettingConfig() { } @Test - public void testAbortParagraphStatusOnInterpreterRestart() throws Exception { + void testAbortParagraphStatusOnInterpreterRestart() throws Exception { String noteId = notebook.createNote("note1", anonymous); notebook.processNote(noteId, @@ -1458,7 +1457,7 @@ public void testAbortParagraphStatusOnInterpreterRestart() throws Exception { } @Test - public void testPerSessionInterpreterCloseOnNoteRemoval() throws IOException, InterpreterException { + void testPerSessionInterpreterCloseOnNoteRemoval() throws IOException, InterpreterException { // create a notes String note1Id = notebook.createNote("note1", anonymous); InterpreterResult result = notebook.processNote(note1Id, @@ -1502,7 +1501,7 @@ public void testPerSessionInterpreterCloseOnNoteRemoval() throws IOException, In } @Test - public void testPerSessionInterpreter() throws IOException, InterpreterException { + void testPerSessionInterpreter() throws IOException, InterpreterException { // create two notes String note1Id = notebook.createNote("note1", anonymous); notebook.processNote(note1Id, @@ -1559,7 +1558,7 @@ public void testPerSessionInterpreter() throws IOException, InterpreterException @Test - public void testPerNoteSessionInterpreter() throws IOException, InterpreterException { + void testPerNoteSessionInterpreter() throws IOException, InterpreterException { // create two notes String note1Id = notebook.createNote("note1", anonymous); notebook.processNote(note1Id, @@ -1698,7 +1697,7 @@ public void onParagraphStatusChange(Paragraph p, Status status) { } @Test - public void testGetAllNotes() throws Exception { + void testGetAllNotes() throws Exception { String note1Id = notebook.createNote("note1", anonymous); String note2Id = notebook.createNote("note2", anonymous); assertEquals(2, notebook.getNotesInfo(noteId -> authorizationService.isReader(noteId, new HashSet<>(Arrays.asList("anonymous")))).size()); @@ -1722,7 +1721,7 @@ public void testGetAllNotes() throws Exception { } @Test - public void testCreateDuplicateNote() throws Exception { + void testCreateDuplicateNote() throws Exception { String note1Id = notebook.createNote("note1", anonymous); try { notebook.createNote("note1", anonymous); @@ -1735,7 +1734,7 @@ public void testCreateDuplicateNote() throws Exception { } @Test - public void testGetAllNotesWithDifferentPermissions() throws IOException { + void testGetAllNotesWithDifferentPermissions() throws IOException { List notes1 = notebook.getNotesInfo(noteId -> authorizationService.isReader(noteId, new HashSet<>(Arrays.asList("user1")))); List notes2 = notebook.getNotesInfo(noteId -> authorizationService.isReader(noteId, new HashSet<>(Arrays.asList("user2")))); assertEquals(0, notes1.size()); @@ -1771,7 +1770,7 @@ public void testGetAllNotesWithDifferentPermissions() throws IOException { } @Test - public void testPublicPrivateNewNote() throws IOException { + void testPublicPrivateNewNote() throws IOException { // case of public note assertTrue(conf.isNotebookPublic()); assertTrue(authorizationService.isPublic()); @@ -1840,7 +1839,7 @@ public void testPublicPrivateNewNote() throws IOException { } @Test - public void testCloneImportCheck() throws IOException { + void testCloneImportCheck() throws IOException { String sourceNoteId = notebook.createNote("note1", new AuthenticationInfo("user")); notebook.processNote(sourceNoteId, sourceNote -> { @@ -1869,7 +1868,7 @@ public void testCloneImportCheck() throws IOException { @ParameterizedTest @MethodSource("provideMoveTestParameters") - public void testMoveNote(String oldName, String newPath) throws InterruptedException, IOException { + void testMoveNote(String oldName, String newPath) throws InterruptedException, IOException { String noteId = null; String newName = FilenameUtils.getBaseName(newPath); try { diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java index 612ee2f728e..869d5622fcb 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java @@ -66,10 +66,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class ParagraphTest extends AbstractInterpreterTest { +class ParagraphTest extends AbstractInterpreterTest { @Test - public void scriptBodyWithReplName() { + void scriptBodyWithReplName() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%test (1234567"); @@ -82,7 +82,7 @@ public void scriptBodyWithReplName() { } @Test - public void scriptBodyWithoutReplName() { + void scriptBodyWithoutReplName() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("1234567"); @@ -91,7 +91,7 @@ public void scriptBodyWithoutReplName() { } @Test - public void replNameAndNoBody() { + void replNameAndNoBody() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%test"); @@ -100,7 +100,7 @@ public void replNameAndNoBody() { } @Test - public void replSingleCharName() { + void replSingleCharName() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%r a"); @@ -109,7 +109,7 @@ public void replSingleCharName() { } @Test - public void testParagraphProperties() { + void testParagraphProperties() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%test(p1=v1,p2=v2) a"); @@ -135,18 +135,18 @@ public void testParagraphProperties() { } @Test - public void testInvalidProperties() { + void testInvalidProperties() { + Note note = createNote(); + Paragraph paragraph = new Paragraph(note, null); assertThrows(RuntimeException.class, () -> { - Note note = createNote(); - Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%test(p1=v1=v2) a"); }, "Invalid paragraph properties format"); } @Test - public void replInvalid() { + void replInvalid() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("foo %r"); @@ -163,7 +163,7 @@ public void replInvalid() { } @Test - public void replNameEndsWithWhitespace() { + void replNameEndsWithWhitespace() { Note note = createNote(); Paragraph paragraph = new Paragraph(note, null); paragraph.setText("%test\r\n###Hello"); @@ -204,7 +204,7 @@ public void replNameEndsWithWhitespace() { } @Test - public void should_extract_variable_from_angular_object_registry() throws Exception { + void should_extract_variable_from_angular_object_registry() throws Exception { //Given final String noteId = "noteId"; @@ -243,7 +243,7 @@ public void should_extract_variable_from_angular_object_registry() throws Except } @Test - public void returnDefaultParagraphWithNewUser() { + void returnDefaultParagraphWithNewUser() { Paragraph p = new Paragraph("para_1", null, null); String defaultValue = "Default Value"; p.setResult(new InterpreterResult(Code.SUCCESS, defaultValue)); @@ -253,7 +253,8 @@ public void returnDefaultParagraphWithNewUser() { } @Disabled - public void returnUnchangedResultsWithDifferentUser() throws Throwable { + @Test + void returnUnchangedResultsWithDifferentUser() throws Throwable { Note mockNote = mock(Note.class); when(mockNote.getCredentials()).thenReturn(mock(Credentials.class)); Paragraph spyParagraph = spy(new Paragraph("para_1", mockNote, null)); @@ -319,7 +320,7 @@ public void returnUnchangedResultsWithDifferentUser() throws Throwable { } @Test - public void testCursorPosition() { + void testCursorPosition() { Paragraph paragraph = spy(new Paragraph()); // left = buffer, middle = cursor position into source code, right = cursor position after parse List> dataSet = Arrays.asList( @@ -350,7 +351,7 @@ public void testCursorPosition() { } @Test - public void credentialReplacement() throws Throwable { + void credentialReplacement() throws Throwable { Note mockNote = mock(Note.class); Credentials creds = mock(Credentials.class); when(mockNote.getCredentials()).thenReturn(creds); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTextParserTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTextParserTest.java index c1f508a3512..ef62f0cf3dd 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTextParserTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTextParserTest.java @@ -17,16 +17,15 @@ package org.apache.zeppelin.notebook; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -public class ParagraphTextParserTest { +class ParagraphTextParserTest { @Test - public void testJupyter() { + void testJupyter() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%jupyter(kernel=ir)"); assertEquals("jupyter", parseResult.getIntpText()); assertEquals(1, parseResult.getLocalProperties().size()); @@ -36,7 +35,7 @@ public void testJupyter() { @Test - public void testCassandra() { + void testCassandra() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse( "%cassandra(locale=ru_RU, timeFormat=\"E, d MMM yy\", floatPrecision = 5, output=cql)\n" + "select * from system_auth.roles;"); @@ -47,7 +46,7 @@ public void testCassandra() { } @Test - public void testSparkSubmit() { + void testSparkSubmit() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse( "%spark-submit --class A a.jar"); assertEquals("spark-submit", parseResult.getIntpText()); @@ -55,7 +54,7 @@ public void testSparkSubmit() { } @Test - public void testParagraphTextLocalPropertiesAndText() { + void testParagraphTextLocalPropertiesAndText() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%spark.pyspark(pool=pool_1) sc.version"); assertEquals("spark.pyspark", parseResult.getIntpText()); assertEquals(1, parseResult.getLocalProperties().size()); @@ -64,7 +63,7 @@ public void testParagraphTextLocalPropertiesAndText() { } @Test - public void testParagraphTextLocalPropertiesNoText() { + void testParagraphTextLocalPropertiesNoText() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%spark.pyspark(pool=pool_1)"); assertEquals("spark.pyspark", parseResult.getIntpText()); assertEquals(1, parseResult.getLocalProperties().size()); @@ -73,7 +72,7 @@ public void testParagraphTextLocalPropertiesNoText() { } @Test - public void testParagraphTextLocalPropertyNoValueNoText() { + void testParagraphTextLocalPropertyNoValueNoText() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%spark.pyspark(pool)"); assertEquals("spark.pyspark", parseResult.getIntpText()); assertEquals(1, parseResult.getLocalProperties().size()); @@ -82,7 +81,7 @@ public void testParagraphTextLocalPropertyNoValueNoText() { } @Test - public void testParagraphTextNoLocalProperties() { + void testParagraphTextNoLocalProperties() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%spark.pyspark\nsc.version"); assertEquals("spark.pyspark", parseResult.getIntpText()); assertEquals(0, parseResult.getLocalProperties().size()); @@ -90,7 +89,7 @@ public void testParagraphTextNoLocalProperties() { } @Test - public void testParagraphNoInterpreter() { + void testParagraphNoInterpreter() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("sc.version"); assertEquals("", parseResult.getIntpText()); assertEquals(0, parseResult.getLocalProperties().size()); @@ -98,7 +97,7 @@ public void testParagraphNoInterpreter() { } @Test - public void testParagraphInterpreterWithoutProperties() { + void testParagraphInterpreterWithoutProperties() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse("%spark() sc.version"); assertEquals("spark", parseResult.getIntpText()); assertEquals(0, parseResult.getLocalProperties().size()); @@ -106,7 +105,7 @@ public void testParagraphInterpreterWithoutProperties() { } @Test - public void testParagraphTextQuotedPropertyValue1() { + void testParagraphTextQuotedPropertyValue1() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse( "%spark.pyspark(pool=\"value with = inside\")"); assertEquals("spark.pyspark", parseResult.getIntpText()); @@ -116,7 +115,7 @@ public void testParagraphTextQuotedPropertyValue1() { } @Test - public void testParagraphTextQuotedPropertyValue2() { + void testParagraphTextQuotedPropertyValue2() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse( "%spark.pyspark(pool=\"value with \\\" inside\", p=\"eol\\ninside\" )"); assertEquals("spark.pyspark", parseResult.getIntpText()); @@ -127,7 +126,7 @@ public void testParagraphTextQuotedPropertyValue2() { } @Test - public void testParagraphTextQuotedPropertyKeyAndValue() { + void testParagraphTextQuotedPropertyKeyAndValue() { ParagraphTextParser.ParseResult parseResult = ParagraphTextParser.parse( "%spark.pyspark(\"po ol\"=\"value with \\\" inside\")"); assertEquals("spark.pyspark", parseResult.getIntpText()); @@ -138,28 +137,28 @@ public void testParagraphTextQuotedPropertyKeyAndValue() { @Test - public void testParagraphTextUnfinishedConfig() { + void testParagraphTextUnfinishedConfig() { assertThrows(RuntimeException.class, () -> ParagraphTextParser.parse("%spark.pyspark(pool="), "Problems by parsing paragraph. Not finished interpreter configuration"); } @Test - public void testParagraphTextUnfinishedQuote() { + void testParagraphTextUnfinishedQuote() { assertThrows(RuntimeException.class, () -> ParagraphTextParser.parse("%spark.pyspark(pool=\"2314234) sc.version"), "Problems by parsing paragraph. Not finished interpreter configuration"); } @Test - public void testParagraphTextUnclosedBackslash() { + void testParagraphTextUnclosedBackslash() { assertThrows(RuntimeException.class, () -> ParagraphTextParser.parse("%spark.pyspark(pool=\\"), "Problems by parsing paragraph. Unfinished escape sequence"); } @Test - public void testParagraphTextEmptyKey() { + void testParagraphTextEmptyKey() { assertThrows((RuntimeException.class), () -> ParagraphTextParser.parse("%spark.pyspark(pool=123, ,)"), "Problems by parsing paragraph. Local property key is empty"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java index 054b90c21c7..5a655cf1e27 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java @@ -53,7 +53,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class GitNotebookRepoTest { +class GitNotebookRepoTest { private static final Logger LOG = LoggerFactory.getLogger(GitNotebookRepoTest.class); private static final String TEST_NOTE_ID = "2A94M5J1Z"; @@ -96,7 +96,7 @@ public void tearDown() throws Exception { } @Test - public void initNonemptyNotebookDir() throws IOException, GitAPIException { + void initNonemptyNotebookDir() throws IOException, GitAPIException { //given - .git does not exit File dotGit = new File(String.join(File.separator, notebooksDir, ".git")); assertFalse(dotGit.exists()); @@ -117,7 +117,7 @@ public void initNonemptyNotebookDir() throws IOException, GitAPIException { } @Test - public void showNotebookHistoryEmptyTest() throws GitAPIException, IOException { + void showNotebookHistoryEmptyTest() throws GitAPIException, IOException { //given notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -131,7 +131,7 @@ public void showNotebookHistoryEmptyTest() throws GitAPIException, IOException { } @Test - public void showNotebookHistoryMultipleNotesTest() throws IOException { + void showNotebookHistoryMultipleNotesTest() throws IOException { //initial checks notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -176,7 +176,7 @@ public void showNotebookHistoryMultipleNotesTest() throws IOException { } @Test - public void addCheckpointTest() throws IOException, GitAPIException { + void addCheckpointTest() throws IOException, GitAPIException { // initial checks notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -243,7 +243,7 @@ private boolean containsNote(Map notes, String noteId) { } @Test - public void getRevisionTest() throws IOException { + void getRevisionTest() throws IOException { // initial checks notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -301,7 +301,7 @@ public void getRevisionTest() throws IOException { } @Test - public void getRevisionFailTest() throws IOException { + void getRevisionFailTest() throws IOException { // initial checks notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -343,7 +343,7 @@ public void getRevisionFailTest() throws IOException { } @Test - public void setRevisionTest() throws IOException { + void setRevisionTest() throws IOException { //create repo and check that note doesn't contain revisions notebookRepo = new GitNotebookRepo(conf); assertFalse(notebookRepo.list(null).isEmpty()); @@ -405,7 +405,7 @@ public void setRevisionTest() throws IOException { } @Test - public void moveNoteTest() throws IOException, GitAPIException { + void moveNoteTest() throws IOException, GitAPIException { //given notebookRepo = new GitNotebookRepo(conf); notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit, note1", null); @@ -422,7 +422,7 @@ public void moveNoteTest() throws IOException, GitAPIException { } @Test - public void moveFolderTest() throws IOException, GitAPIException { + void moveFolderTest() throws IOException, GitAPIException { //given notebookRepo = new GitNotebookRepo(conf); notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit, note1", null); @@ -439,7 +439,7 @@ public void moveFolderTest() throws IOException, GitAPIException { } @Test - public void removeNoteTest() throws IOException, GitAPIException { + void removeNoteTest() throws IOException, GitAPIException { //given notebookRepo = new GitNotebookRepo(conf); notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit, note1", null); @@ -452,7 +452,7 @@ public void removeNoteTest() throws IOException, GitAPIException { } @Test - public void removeFolderTest() throws IOException, GitAPIException { + void removeFolderTest() throws IOException, GitAPIException { //given notebookRepo = new GitNotebookRepo(conf); notebookRepo.checkpoint(TEST_NOTE_ID, TEST_NOTE_PATH, "first commit, note1", null); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncInitializationTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncInitializationTest.java index bd940017ae8..5f8a5d92d86 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncInitializationTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncInitializationTest.java @@ -33,9 +33,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -//TODO(zjffdu) move it to zeppelin-zengine -public class NotebookRepoSyncInitializationTest { +class NotebookRepoSyncInitializationTest { private static final Logger LOGGER = LoggerFactory.getLogger(NotebookRepoSyncInitializationTest.class); + private String validFirstStorageClass = "org.apache.zeppelin.notebook.repo.VFSNotebookRepo"; private String validSecondStorageClass = "org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock"; private String invalidStorageClass = "org.apache.zeppelin.notebook.repo.DummyNotebookRepo"; @@ -57,20 +57,21 @@ public void tearDown() { } @Test - public void validInitOneStorageTest() throws IOException { + void validInitOneStorageTest() throws IOException { // no need to initialize folder due to one storage // set confs System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), validOneStorageConf); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); - // check proper initialization of one storage - assertEquals(notebookRepoSync.getRepoCount(), 1); - assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { + // check proper initialization of one storage + assertEquals(1, notebookRepoSync.getRepoCount()); + assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); + } } @Test - public void validInitTwoStorageTest() throws IOException { + void validInitTwoStorageTest() throws IOException { // initialize folders for each storage String zpath = System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis(); File mainZepDir = new File(zpath); @@ -89,21 +90,21 @@ public void validInitTwoStorageTest() throws IOException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), validTwoStorageConf); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); - // check that both initialized - assertEquals(notebookRepoSync.getRepoCount(), 2); - assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); - assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { + // check that both initialized + assertEquals(2, notebookRepoSync.getRepoCount()); + assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); + assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock); + } } @Test - public void invalidInitTwoStorageTest() throws IOException { + void invalidInitTwoStorageTest() throws IOException { // set confs System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), invalidTwoStorageConf); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - try { - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { fail("Should throw exception due to invalid NotebookRepo"); } catch (IOException e) { LOGGER.error(e.getMessage()); @@ -112,7 +113,7 @@ public void invalidInitTwoStorageTest() throws IOException { } @Test - public void initUnsupportedNumberStoragesTest() throws IOException { + void initUnsupportedNumberStoragesTest() throws IOException { // initialize folders for each storage, currently for 2 only String zpath = System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis(); File mainZepDir = new File(zpath); @@ -131,32 +132,33 @@ public void initUnsupportedNumberStoragesTest() throws IOException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), unsupportedStorageConf); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); - // check that first two storages initialized instead of three - assertEquals(notebookRepoSync.getRepoCount(), 2); - assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); - assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { + // check that first two storages initialized instead of three + assertEquals(2, notebookRepoSync.getRepoCount()); + assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo); + assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock); + } } @Test - public void initEmptyStorageTest() throws IOException { + void initEmptyStorageTest() throws IOException { // set confs System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), emptyStorageConf); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); - // check initialization of one default storage - assertEquals(notebookRepoSync.getRepoCount(), 1); - assertTrue(notebookRepoSync.getRepo(0) instanceof NotebookRepoWithVersionControl); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { + // check initialization of one default storage + assertEquals(1, notebookRepoSync.getRepoCount()); + assertTrue(notebookRepoSync.getRepo(0) instanceof NotebookRepoWithVersionControl); + } } @Test - public void initOneDummyStorageTest() { + void initOneDummyStorageTest() { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), invalidStorageClass); ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // create repo - try { - NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf); + try (NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf)) { fail("Should throw exception due to invalid NotebookRepo"); } catch (IOException e) { LOGGER.error(e.getMessage()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java index 08ff441cf04..ebb45ab26d2 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java @@ -51,7 +51,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NotebookRepoSyncTest { +class NotebookRepoSyncTest { private File ZEPPELIN_HOME; private ZeppelinConfiguration conf; @@ -111,19 +111,19 @@ public void tearDown() throws Exception { } @Test - public void testRepoCount() throws IOException { + void testRepoCount() throws IOException { assertTrue(notebookRepoSync.getMaxRepoNum() >= notebookRepoSync.getRepoCount()); } @Test - public void testSyncOnCreate() throws IOException { + void testSyncOnCreate() throws IOException { /* check that both storage systems are empty */ assertTrue(notebookRepoSync.getRepoCount() > 1); assertEquals(0, notebookRepoSync.list(0, anonymous).size()); assertEquals(0, notebookRepoSync.list(1, anonymous).size()); /* create note */ - String noteId = notebook.createNote("test", "", anonymous); + notebook.createNote("test", "", anonymous); // check that automatically saved on both storages assertEquals(1, notebookRepoSync.list(0, anonymous).size()); @@ -135,13 +135,13 @@ public void testSyncOnCreate() throws IOException { } @Test - public void testSyncOnDelete() throws IOException { + void testSyncOnDelete() throws IOException { /* create note */ assertTrue(notebookRepoSync.getRepoCount() > 1); assertEquals(0, notebookRepoSync.list(0, anonymous).size()); assertEquals(0, notebookRepoSync.list(1, anonymous).size()); - String noteId = notebook.createNote("test", "", anonymous); + notebook.createNote("test", "", anonymous); /* check that created in both storage systems */ assertEquals(1, notebookRepoSync.list(0, anonymous).size()); @@ -159,7 +159,7 @@ public void testSyncOnDelete() throws IOException { } @Test - public void testSyncUpdateMain() throws IOException { + void testSyncUpdateMain() throws IOException { /* create note */ String noteId = notebook.createNote("/test", "test", anonymous); @@ -167,7 +167,7 @@ public void testSyncUpdateMain() throws IOException { note -> { note.setInterpreterFactory(mock(InterpreterFactory.class)); Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS); - Map config = p1.getConfig(); + Map config = p1.getConfig(); config.put("enabled", true); p1.setConfig(config); p1.setText("hello world"); @@ -225,7 +225,7 @@ public void testSyncUpdateMain() throws IOException { } @Test - public void testSyncOnReloadedList() throws Exception { + void testSyncOnReloadedList() throws Exception { /* check that both storage repos are empty */ assertTrue(notebookRepoSync.getRepoCount() > 1); assertEquals(0, notebookRepoSync.list(0, anonymous).size()); @@ -251,7 +251,7 @@ public void testSyncOnReloadedList() throws Exception { } @Test - public void testOneWaySyncOnReloadedList() throws IOException, SchedulerException { + void testOneWaySyncOnReloadedList() throws IOException, SchedulerException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath()); System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC.getVarName(), "true"); conf = ZeppelinConfiguration.create(); @@ -298,7 +298,7 @@ public void testOneWaySyncOnReloadedList() throws IOException, SchedulerExceptio } @Test - public void testCheckpointOneStorage() throws IOException, SchedulerException { + void testCheckpointOneStorage() throws IOException, SchedulerException { System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.GitNotebookRepo"); ZeppelinConfiguration vConf = ZeppelinConfiguration.create(); @@ -346,7 +346,7 @@ public void testCheckpointOneStorage() throws IOException, SchedulerException { } @Test - public void testSyncWithAcl() throws IOException { + void testSyncWithAcl() throws IOException { /* scenario 1 - note exists with acl on main storage */ AuthenticationInfo user1 = new AuthenticationInfo("user1"); String noteId = notebook.createNote("/test", "test", user1); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java index 6aef8c8359e..465f0c8e718 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java @@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class VFSNotebookRepoTest { +class VFSNotebookRepoTest { private ZeppelinConfiguration zConf; private VFSNotebookRepo notebookRepo; @@ -59,7 +59,7 @@ public void tearDown() throws IOException { } @Test - public void testBasics() throws IOException { + void testBasics() throws IOException { assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size()); // create note1 @@ -107,7 +107,7 @@ public void testBasics() throws IOException { } @Test - public void testNoteNameWithColon() throws IOException { + void testNoteNameWithColon() throws IOException { assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size()); // create note with colon in name @@ -122,7 +122,7 @@ public void testNoteNameWithColon() throws IOException { } @Test - public void testUpdateSettings() throws IOException { + void testUpdateSettings() throws IOException { List repoSettings = notebookRepo.getSettings(AuthenticationInfo.ANONYMOUS); assertEquals(1, repoSettings.size()); NotebookRepoSettingsInfo settingInfo = repoSettings.get(0); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/plugin/PluginManagerTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/plugin/PluginManagerTest.java index 16c14a9113b..45a53c14d46 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/plugin/PluginManagerTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/plugin/PluginManagerTest.java @@ -26,10 +26,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -public class PluginManagerTest { +class PluginManagerTest { @Test - public void testLoadGitNotebookRepo() throws IOException { + void testLoadGitNotebookRepo() throws IOException { NotebookRepo notebookRepo = PluginManager.get() .loadNotebookRepo("org.apache.zeppelin.notebook.repo.GitNotebookRepo"); assertTrue(notebookRepo instanceof GitNotebookRepo); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java index aea076b8258..664d2a4d97e 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/resource/DistributedResourcePoolTest.java @@ -35,7 +35,7 @@ /** * Unittest for DistributedResourcePool */ -public class DistributedResourcePoolTest extends AbstractInterpreterTest { +class DistributedResourcePoolTest extends AbstractInterpreterTest { private RemoteInterpreter intp1; private RemoteInterpreter intp2; @@ -73,7 +73,7 @@ public void tearDown() throws Exception { } @Test - public void testRemoteDistributedResourcePool() throws InterpreterException { + void testRemoteDistributedResourcePool() throws InterpreterException { Gson gson = new Gson(); InterpreterResult ret; intp1.interpret("put key1 value1", context); @@ -93,7 +93,7 @@ public void testRemoteDistributedResourcePool() throws InterpreterException { } @Test - public void testDistributedResourcePool() { + void testDistributedResourcePool() { final LocalResourcePool pool2 = new LocalResourcePool("pool2"); final LocalResourcePool pool3 = new LocalResourcePool("pool3"); @@ -155,7 +155,7 @@ public Resource invokeMethod(ResourceId id, String methodName, Class[] paramType } @Test - public void testResourcePoolUtils() throws InterpreterException { + void testResourcePoolUtils() throws InterpreterException { Gson gson = new Gson(); // when create some resources @@ -193,7 +193,7 @@ public void testResourcePoolUtils() throws InterpreterException { } @Test - public void testResourceInvokeMethod() throws InterpreterException { + void testResourceInvokeMethod() throws InterpreterException { Gson gson = new Gson(); InterpreterResult ret; intp1.interpret("put key1 hey", context); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java index de9484a38b0..8bb9deafd70 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/scheduler/RemoteSchedulerTest.java @@ -20,11 +20,8 @@ import org.apache.zeppelin.interpreter.AbstractInterpreterTest; import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; -import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.interpreter.remote.RemoteInterpreter; -import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener; -import org.apache.zeppelin.interpreter.thrift.ParagraphInfo; import org.apache.zeppelin.resource.LocalResourcePool; import org.apache.zeppelin.scheduler.Job.Status; import org.apache.zeppelin.user.AuthenticationInfo; @@ -32,8 +29,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.IOException; -import java.util.List; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -41,8 +36,8 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RemoteSchedulerTest extends AbstractInterpreterTest - implements RemoteInterpreterProcessListener { +class RemoteSchedulerTest extends AbstractInterpreterTest +{ private InterpreterSetting interpreterSetting; private SchedulerFactory schedulerSvc; @@ -66,7 +61,7 @@ public void tearDown() { } @Test - public void test() throws Exception { + void test() throws Exception { final RemoteInterpreter intpA = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", note1Id, "mock"); intpA.open(); @@ -136,7 +131,7 @@ public void setResult(Object results) { } @Test - public void testAbortOnPending() throws Exception { + void testAbortOnPending() throws Exception { final RemoteInterpreter intpA = (RemoteInterpreter) interpreterSetting.getInterpreter("user1", note1Id, "mock"); intpA.open(); @@ -269,38 +264,4 @@ public void setResult(Object results) { schedulerSvc.removeScheduler("test"); } - @Override - public void onOutputAppend(String noteId, String paragraphId, int index, String output) { - - } - - @Override - public void onOutputUpdated(String noteId, String paragraphId, int index, InterpreterResult.Type type, String output) { - - } - - @Override - public void onOutputClear(String noteId, String paragraphId) { - - } - - @Override - public void runParagraphs(String noteId, List paragraphIndices, List paragraphIds, String curParagraphId) throws IOException { - - } - - @Override - public void onParaInfosReceived(String noteId, String paragraphId, - String interpreterSettingId, Map metaInfos) { - } - - @Override - public List getParagraphList(String user, String noteId) { - return null; - } - - @Override - public void checkpointOutput(String noteId, String paragraphId) { - - } } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java index 0e554fe218f..7da1e0774a1 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java @@ -49,7 +49,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class LuceneSearchTest { +class LuceneSearchTest { private Notebook notebook; private InterpreterSettingManager interpreterSettingManager; @@ -89,9 +89,9 @@ private void drainSearchEvents() throws InterruptedException { } @Test - public void canIndexAndQuery() throws IOException, InterruptedException { + void canIndexAndQuery() throws IOException, InterruptedException { // given - String note1Id = newNoteWithParagraph("Notebook1", "test"); + newNoteWithParagraph("Notebook1", "test"); String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); @@ -109,10 +109,10 @@ public void canIndexAndQuery() throws IOException, InterruptedException { } @Test - public void canIndexAndQueryByNotebookName() throws IOException, InterruptedException { + void canIndexAndQueryByNotebookName() throws IOException, InterruptedException { // given String note1Id = newNoteWithParagraph("Notebook1", "test"); - String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); + newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); // when @@ -125,10 +125,10 @@ public void canIndexAndQueryByNotebookName() throws IOException, InterruptedExce } @Test - public void canIndexAndQueryByParagraphTitle() throws IOException, InterruptedException { + void canIndexAndQueryByParagraphTitle() throws IOException, InterruptedException { // given - String note1Id = newNoteWithParagraph("Notebook1", "test", "testingTitleSearch"); - String note2Id = newNoteWithParagraph("Notebook2", "not test", "notTestingTitleSearch"); + newNoteWithParagraph("Notebook1", "test", "testingTitleSearch"); + newNoteWithParagraph("Notebook2", "not test", "notTestingTitleSearch"); drainSearchEvents(); // when @@ -147,7 +147,7 @@ public void canIndexAndQueryByParagraphTitle() throws IOException, InterruptedEx } @Test - public void indexKeyContract() throws IOException, InterruptedException { + void indexKeyContract() throws IOException, InterruptedException { // given String note1Id = newNoteWithParagraph("Notebook1", "test"); drainSearchEvents(); @@ -163,7 +163,7 @@ public void indexKeyContract() throws IOException, InterruptedException { } @Test // (expected=IllegalStateException.class) - public void canNotSearchBeforeIndexing() { + void canNotSearchBeforeIndexing() { // given NO noteSearchService.index() was called // when List> result = noteSearchService.query("anything"); @@ -174,9 +174,9 @@ public void canNotSearchBeforeIndexing() { } @Test - public void canIndexAndReIndex() throws IOException, InterruptedException { + void canIndexAndReIndex() throws IOException, InterruptedException { // given - String note1Id = newNoteWithParagraph("Notebook1", "test"); + newNoteWithParagraph("Notebook1", "test"); String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); @@ -199,7 +199,7 @@ public void canIndexAndReIndex() throws IOException, InterruptedException { } @Test - public void canDeleteNull() throws IOException { + void canDeleteNull() { // give // looks like a bug in web UI: it tries to delete a note twice (after it has just been deleted) // when @@ -207,9 +207,9 @@ public void canDeleteNull() throws IOException { } @Test - public void canDeleteFromIndex() throws IOException, InterruptedException { + void canDeleteFromIndex() throws IOException, InterruptedException { // given - String note1Id = newNoteWithParagraph("Notebook1", "test"); + newNoteWithParagraph("Notebook1", "test"); String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); @@ -228,10 +228,10 @@ public void canDeleteFromIndex() throws IOException, InterruptedException { } @Test - public void indexParagraphUpdatedOnNoteSave() throws IOException, InterruptedException { + void indexParagraphUpdatedOnNoteSave() throws IOException, InterruptedException { // given: total 2 notebooks, 3 paragraphs String note1Id = newNoteWithParagraph("Notebook1", "test"); - String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); + newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); assertEquals(3, resultForQuery("test").size()); @@ -261,10 +261,10 @@ public void indexParagraphUpdatedOnNoteSave() throws IOException, InterruptedExc } @Test - public void indexNoteNameUpdatedOnNoteSave() throws IOException, InterruptedException { + void indexNoteNameUpdatedOnNoteSave() throws IOException, InterruptedException { // given: total 2 notebooks, 3 paragraphs String note1Id = newNoteWithParagraph("Notebook1", "test"); - String note2Id = newNoteWithParagraphs("Notebook2", "not test", "not test at all"); + newNoteWithParagraphs("Notebook2", "not test", "not test at all"); drainSearchEvents(); assertEquals(3, resultForQuery("test").size()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/storage/LocalConfigStorageTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/storage/LocalConfigStorageTest.java index 64a675b6a0f..8c9decab53c 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/storage/LocalConfigStorageTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/storage/LocalConfigStorageTest.java @@ -33,11 +33,11 @@ import static org.junit.jupiter.api.Assertions.*; -public class LocalConfigStorageTest { +class LocalConfigStorageTest { public static final String TEST_STRING = "this is a test!"; @Test - public void testWritingAtomically() throws IOException { + void testWritingAtomically() throws IOException { final Path destination = Files.createTempFile("test-", "file"); final File destinationFile = destination.toFile(); try { @@ -52,7 +52,7 @@ public void testWritingAtomically() throws IOException { } @Test - public void testWritingAtomicallyNonExistingDir() throws IOException { + void testWritingAtomicallyNonExistingDir() throws IOException { Random rnd = new Random(); final Path destDir = Paths.get(System.getProperty("java.io.tmpdir"), "non-existing-" + rnd.nextLong()); final Path destination = Paths.get(destDir.toString(),"test-" + rnd.nextLong() + "-file"); @@ -70,7 +70,7 @@ public void testWritingAtomicallyNonExistingDir() throws IOException { } @Test - public void testReading() throws IOException { + void testReading() throws IOException { final Path destination = Files.createTempFile("test-", "file"); final File destinationFile = destination.toFile(); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java index 34aeab56a05..494716dea5f 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/CredentialsTest.java @@ -23,10 +23,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CredentialsTest { +class CredentialsTest { @Test - public void testDefaultProperty() throws IOException { + void testDefaultProperty() throws IOException { Credentials credentials = new Credentials(); UserCredentials userCredentials = new UserCredentials(); UsernamePassword up1 = new UsernamePassword("user2", "password"); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java index 1e57beeaa6c..73613e538a4 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/user/EncryptorTest.java @@ -24,10 +24,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class EncryptorTest { +class EncryptorTest { @Test - public void testEncryption() throws IOException { + void testEncryption() throws IOException { Encryptor encryptor = new Encryptor("foobar1234567890"); String input = "test"; diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/util/UtilTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/util/UtilTest.java index 57727f7edc6..3dbd9ee499c 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/util/UtilTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/util/UtilTest.java @@ -21,15 +21,15 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -public class UtilTest { +class UtilTest { @Test - public void getVersionTest() { + void getVersionTest() { assertNotNull(Util.getVersion()); } @Test - public void getGitInfoTest() { + void getGitInfoTest() { assertNotNull(Util.getGitCommitId()); assertNotNull(Util.getGitTimestamp()); }