From f64e3710e51d7bd6d9771de0c7ca12a0280ff0e1 Mon Sep 17 00:00:00 2001 From: Chesnay Schepler Date: Mon, 2 May 2022 10:53:18 +0200 Subject: [PATCH] [FLINK-27467][cli][tests] Drop CliFrontendTestBase --- .../client/cli/CliFrontendCancelTest.java | 4 ++- .../cli/CliFrontendDynamicPropertiesTest.java | 3 +- .../flink/client/cli/CliFrontendInfoTest.java | 4 ++- .../flink/client/cli/CliFrontendListTest.java | 4 ++- .../flink/client/cli/CliFrontendRunTest.java | 4 ++- .../client/cli/CliFrontendSavepointTest.java | 3 +- .../cli/CliFrontendStopWithSavepointTest.java | 4 ++- .../flink/client/cli/CliFrontendTestBase.java | 29 ------------------- .../client/cli/CliFrontendTestUtils.java | 4 +++ .../yarn/CliFrontendRunWithYarnTest.java | 4 +-- 10 files changed, 25 insertions(+), 38 deletions(-) delete mode 100644 flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestBase.java diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendCancelTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendCancelTest.java index 506fd63ad259c9..08938cfb3df26a 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendCancelTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendCancelTest.java @@ -25,6 +25,7 @@ import org.apache.flink.core.execution.SavepointFormatType; import org.apache.flink.core.testutils.OneShotLatch; import org.apache.flink.runtime.messages.Acknowledge; +import org.apache.flink.util.TestLogger; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -33,13 +34,14 @@ import java.util.Collections; import java.util.concurrent.CompletableFuture; +import static org.apache.flink.client.cli.CliFrontendTestUtils.getCli; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; /** Tests for the CANCEL command. */ -public class CliFrontendCancelTest extends CliFrontendTestBase { +public class CliFrontendCancelTest extends TestLogger { @BeforeClass public static void init() { diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendDynamicPropertiesTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendDynamicPropertiesTest.java index a45f728c8b3fd0..5fc99b7e825760 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendDynamicPropertiesTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendDynamicPropertiesTest.java @@ -23,6 +23,7 @@ import org.apache.flink.configuration.CoreOptions; import org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders.ParentFirstClassLoader; import org.apache.flink.util.ChildFirstClassLoader; +import org.apache.flink.util.TestLogger; import org.apache.commons.cli.Options; import org.junit.AfterClass; @@ -39,7 +40,7 @@ import static org.junit.Assert.assertEquals; /** Tests for the RUN command with Dynamic Properties. */ -public class CliFrontendDynamicPropertiesTest extends CliFrontendTestBase { +public class CliFrontendDynamicPropertiesTest extends TestLogger { private GenericCLI cliUnderTest; private Configuration configuration; diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java index 43e783c60d59f8..95b73feeb076de 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java @@ -20,6 +20,7 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.CoreOptions; +import org.apache.flink.util.TestLogger; import org.junit.Test; @@ -27,11 +28,12 @@ import java.io.PrintStream; import java.util.Collections; +import static org.apache.flink.client.cli.CliFrontendTestUtils.getCli; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /** Tests for the "info" command. */ -public class CliFrontendInfoTest extends CliFrontendTestBase { +public class CliFrontendInfoTest extends TestLogger { private static PrintStream stdOut; private static PrintStream capture; diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendListTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendListTest.java index 4fa32554c5039b..c1d8572cafed88 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendListTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendListTest.java @@ -24,6 +24,7 @@ import org.apache.flink.client.program.ClusterClient; import org.apache.flink.configuration.Configuration; import org.apache.flink.runtime.client.JobStatusMessage; +import org.apache.flink.util.TestLogger; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -34,6 +35,7 @@ import java.util.Collections; import java.util.concurrent.CompletableFuture; +import static org.apache.flink.client.cli.CliFrontendTestUtils.getCli; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; @@ -41,7 +43,7 @@ import static org.mockito.Mockito.when; /** Tests for the LIST command. */ -public class CliFrontendListTest extends CliFrontendTestBase { +public class CliFrontendListTest extends TestLogger { @BeforeClass public static void init() { diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java index eeb0f985109969..a81872ea4e74ab 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendRunTest.java @@ -25,6 +25,7 @@ import org.apache.flink.configuration.CoreOptions; import org.apache.flink.runtime.jobgraph.RestoreMode; import org.apache.flink.runtime.jobgraph.SavepointRestoreSettings; +import org.apache.flink.util.TestLogger; import org.apache.commons.cli.CommandLine; import org.junit.AfterClass; @@ -33,13 +34,14 @@ import java.util.Collections; +import static org.apache.flink.client.cli.CliFrontendTestUtils.getCli; import static org.apache.flink.client.cli.CliFrontendTestUtils.getTestJarPath; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** Tests for the RUN command. */ -public class CliFrontendRunTest extends CliFrontendTestBase { +public class CliFrontendRunTest extends TestLogger { @BeforeClass public static void init() { diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java index 484c08cef28570..6b67c23b1b07ec 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java @@ -30,6 +30,7 @@ import org.apache.flink.util.ExceptionUtils; import org.apache.flink.util.FlinkException; import org.apache.flink.util.Preconditions; +import org.apache.flink.util.TestLogger; import org.apache.flink.util.concurrent.FutureUtils; import org.hamcrest.Matchers; @@ -59,7 +60,7 @@ import static org.mockito.Mockito.when; /** Tests for the SAVEPOINT command. */ -public class CliFrontendSavepointTest extends CliFrontendTestBase { +public class CliFrontendSavepointTest extends TestLogger { private static PrintStream stdOut; private static PrintStream stdErr; diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendStopWithSavepointTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendStopWithSavepointTest.java index f19843a9b6f488..6a56181ccecfe9 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendStopWithSavepointTest.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendStopWithSavepointTest.java @@ -26,6 +26,7 @@ import org.apache.flink.core.testutils.OneShotLatch; import org.apache.flink.util.ExceptionUtils; import org.apache.flink.util.FlinkException; +import org.apache.flink.util.TestLogger; import org.apache.flink.util.concurrent.FutureUtils; import org.junit.AfterClass; @@ -35,6 +36,7 @@ import java.util.Collections; import java.util.concurrent.CompletableFuture; +import static org.apache.flink.client.cli.CliFrontendTestUtils.getCli; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNull; @@ -42,7 +44,7 @@ import static org.junit.Assert.fail; /** Tests for the STOP command. */ -public class CliFrontendStopWithSavepointTest extends CliFrontendTestBase { +public class CliFrontendStopWithSavepointTest extends TestLogger { @BeforeClass public static void setup() { diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestBase.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestBase.java deleted file mode 100644 index a90e4909ee5f79..00000000000000 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestBase.java +++ /dev/null @@ -1,29 +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.flink.client.cli; - -import org.apache.flink.util.TestLogger; - -/** Base test class for {@link CliFrontend} tests. */ -public abstract class CliFrontendTestBase extends TestLogger { - - static AbstractCustomCommandLine getCli() { - return new DefaultCLI(); - } -} diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestUtils.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestUtils.java index 2b265d0bcea352..d7a83d2839e734 100644 --- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestUtils.java +++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendTestUtils.java @@ -64,6 +64,10 @@ public static void restoreSystemOut() { System.setOut(previousSysout); } + public static AbstractCustomCommandLine getCli() { + return new DefaultCLI(); + } + private static final class BlackholeOutputSteam extends java.io.OutputStream { @Override public void write(int b) {} diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendRunWithYarnTest.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendRunWithYarnTest.java index 43fa9808676a67..ad6037dcc50b04 100644 --- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendRunWithYarnTest.java +++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendRunWithYarnTest.java @@ -19,7 +19,6 @@ package org.apache.flink.yarn; import org.apache.flink.client.cli.CliFrontend; -import org.apache.flink.client.cli.CliFrontendTestBase; import org.apache.flink.client.cli.CliFrontendTestUtils; import org.apache.flink.client.deployment.ClusterClientServiceLoader; import org.apache.flink.client.deployment.DefaultClusterClientServiceLoader; @@ -27,6 +26,7 @@ import org.apache.flink.configuration.JobManagerOptions; import org.apache.flink.configuration.MemorySize; import org.apache.flink.configuration.TaskManagerOptions; +import org.apache.flink.util.TestLogger; import org.apache.flink.yarn.cli.FlinkYarnSessionCli; import org.junit.AfterClass; @@ -43,7 +43,7 @@ * * @see org.apache.flink.client.cli.CliFrontendRunTest */ -public class CliFrontendRunWithYarnTest extends CliFrontendTestBase { +public class CliFrontendRunWithYarnTest extends TestLogger { @Rule public TemporaryFolder tmp = new TemporaryFolder();