This is an automated email from the ASF dual-hosted git repository. pdallig pushed a commit to branch branch-0.12 in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.12 by this push: new 9ad1fc762f [ZEPPELIN-6210] Removed unused CommandLineUtilsTest.java file 9ad1fc762f is described below commit 9ad1fc762f4823ee82676fd7f0fd359472cd505a Author: Gyeongtae Park <67095975+parkgyeong...@users.noreply.github.com> AuthorDate: Wed Jul 2 23:10:37 2025 +0900 [ZEPPELIN-6210] Removed unused CommandLineUtilsTest.java file ### What is this PR for? This PR removes the unused CommandLineUtils.java class from zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/utils/. The class is no longer referenced anywhere in the codebase and appears to be obsolete. Removing it helps reduce unnecessary code and improves overall maintainability. ### What type of PR is it? Improvement ### Todos * [x] - Remove unused CommandLineUtils.java class * [x] - Remove unused CommandLineUtilsTest.java class ### What is the Jira issue? * Jira: https://issues.apache.org/jira/browse/ZEPPELIN/ZEPPELIN-6210 ### How should this be tested? No specific tests are required, as the class is unused. ### Screenshots (if appropriate) N/A ### Questions: * Does the license files need to update? No. * Is there breaking changes for older versions? No. * Does this needs documentation? No. Closes #4955 from ParkGyeongTae/ZEPPELIN-6210. Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com> (cherry picked from commit 4d4b57363bf32dfc50b528f8706d0e5b5f76fc03) Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com> --- .../apache/zeppelin/utils/CommandLineUtils.java | 41 ---------- .../zeppelin/utils/CommandLineUtilsTest.java | 91 ---------------------- 2 files changed, 132 deletions(-) diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/utils/CommandLineUtils.java b/zeppelin-server/src/main/java/org/apache/zeppelin/utils/CommandLineUtils.java deleted file mode 100644 index 63f8580597..0000000000 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/utils/CommandLineUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.utils; - -import java.util.Locale; - -import org.apache.zeppelin.util.Util; - -/** - * CommandLine Support Class. - */ -public class CommandLineUtils { - public static void main(String[] args) { - if (args.length == 0) { - return; - } - - String usage = args[0].toLowerCase(Locale.US); - switch (usage) { - case "--version": - case "-v": - System.out.println(Util.getVersion()); - break; - default: - } - } -} diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/utils/CommandLineUtilsTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/utils/CommandLineUtilsTest.java deleted file mode 100644 index 2c309c2a1d..0000000000 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/utils/CommandLineUtilsTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.utils; - -import org.apache.zeppelin.util.Util; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Unit tests for {@link CommandLineUtils} written in Given-When-Then style. - */ -class CommandLineUtilsTest { - - /** - * Captures standard output during test execution. - */ - private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); - - /** - * Original System.out kept for restoration. - */ - private final PrintStream originalOut = System.out; - - @AfterEach - void restoreStdout() { - // Restore the original System.out after each test - System.setOut(originalOut); - } - - @Test - @DisplayName("Given --version flag, when main is executed, then version is printed") - void givenVersionFlag_whenMain_thenPrintsVersion() { - // ----- Given ----- - System.setOut(new PrintStream(outContent)); - String expected = Util.getVersion(); // whatever the project returns - - // ----- When ----- - CommandLineUtils.main(new String[]{"--version"}); - - // ----- Then ----- - assertEquals(expected, outContent.toString().trim()); - } - - @Test - @DisplayName("Given -v flag, when main is executed, then version is printed") - void givenShortVersionFlag_whenMain_thenPrintsVersion() { - // ----- Given ----- - System.setOut(new PrintStream(outContent)); - String expected = Util.getVersion(); - - // ----- When ----- - CommandLineUtils.main(new String[]{"-v"}); - - // ----- Then ----- - assertEquals(expected, outContent.toString().trim()); - } - - @Test - @DisplayName("Given no arguments, when main is executed, then nothing is printed") - void givenNoArgs_whenMain_thenPrintsNothing() { - // ----- Given ----- - System.setOut(new PrintStream(outContent)); - - // ----- When ----- - CommandLineUtils.main(new String[]{}); - - // ----- Then ----- - assertEquals("", outContent.toString().trim()); - } -} \ No newline at end of file