Skip to content

Commit

Permalink
Consistently pass "alwaysRun = true" to all TestNG @after* annotations (
Browse files Browse the repository at this point in the history
apache#9635)

* Convert Junit 4 test to TestNG test

* Consistently pass "alwaysRun = true" to all TestNG @after* annotations
  • Loading branch information
lhotari authored Feb 19, 2021
1 parent 3ad9d32 commit ec59e93
Show file tree
Hide file tree
Showing 113 changed files with 120 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void setup() throws Exception {
super.init();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected String changeLedgerPath() {
return "";
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
// stop bookkeeper service
stopBKCluster();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void setUpClass() {
cachedExecutor = Executors.newCachedThreadPool();
}

@AfterClass
@AfterClass(alwaysRun = true)
public void tearDownClass() {
executor.shutdown();
cachedExecutor.shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static void startMiniKdc() throws Exception {
log.info("created AuthenticationSasl");
}

@AfterClass
@AfterClass(alwaysRun = true)
public static void stopMiniKdc() {
System.clearProperty("java.security.auth.login.config");
System.clearProperty("java.security.krb5.conf");
Expand Down Expand Up @@ -206,7 +206,7 @@ protected void setup() throws Exception {
}

@Override
@AfterMethod
@AfterMethod(alwaysRun = true)
protected void cleanup() throws Exception {
super.internalCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static void startMiniKdc() throws Exception {
log.info("created AuthenticationSasl");
}

@AfterClass
@AfterClass(alwaysRun = true)
public static void stopMiniKdc() {
System.clearProperty("java.security.auth.login.config");
System.clearProperty("java.security.krb5.conf");
Expand Down Expand Up @@ -200,7 +200,7 @@ protected void setup() throws Exception {
super.producerBaseSetup();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void setUp() throws Exception {
Optional.of(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(3))));
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
this.authProvider.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected void setup() throws Exception {
//No-op
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void setup() throws Exception {
resetConfig();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
protected void cleanup() throws Exception {
super.internalCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void setup() throws Exception {
super.producerBaseSetup();
}

@AfterClass
@AfterClass(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected void setup() throws Exception {
Thread.sleep(1000 * 3);
}

@AfterMethod
@AfterMethod(alwaysRun = true)
protected void cleanup() {
super.internalCleanup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected void setup() throws Exception {
admin.namespaces().createNamespace("my-property/my-ns", Sets.newHashSet("test"));
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class IOUtilsTest {
InputStream stdin = System.in;
PrintStream stdout = System.out;

@AfterClass
@AfterClass(alwaysRun = true)
public void tearDown() {
System.setIn(stdin);
System.setOut(stdout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void setup() throws Exception {
super.internalSetup();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.resetConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Object[][] isNeedReceipt() {
return new Object[][] { { Boolean.TRUE }, { Boolean.FALSE } };
}

@AfterClass
@AfterClass(alwaysRun = true)
public void teardown() {
eventLoopGroup.shutdownGracefully();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void setupClientCnx() throws Exception {
requestMessage = mock(ByteBuf.class);
}

@AfterTest
@AfterTest(alwaysRun = true)
void cleanupClientCnx() {
eventLoop.shutdownNow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void setup() {
executor = Executors.newCachedThreadPool();
}

@AfterClass
@AfterClass(alwaysRun = true)
void teardown() {
executor.shutdownNow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testStringSchema() throws Exception {
assertEquals(stringSchemaUtf16.encode(testString), bytes2);
}

@AfterClass
@AfterClass(alwaysRun = true)
public void tearDown() throws PulsarClientException {
client.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void initEventLoop() {
eventLoop = new DefaultEventLoop();
}

@AfterTest
@AfterTest(alwaysRun = true)
public void shutdownEventLoop() throws InterruptedException {
eventLoop.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).await(100);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void init() throws Exception {
start();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
private void cleanup() throws Exception {
close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void init() throws Exception {
start();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
private void cleanup() throws Exception {
close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public KubernetesRuntimeFactoryTest() throws Exception {
this.logDirectory = "logs/functions";
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() {
if (null != this.factory) {
this.factory.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void setup() {
System.setProperty(FUNCTIONS_INSTANCE_CLASSPATH, "/pulsar/lib/*");
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() {
if (null != this.factory) {
this.factory.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void setup() {
System.setProperty(FUNCTIONS_INSTANCE_CLASSPATH, "/pulsar/lib/*");
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() {
if (null != this.factory) {
this.factory.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void setup() throws Exception {
}


@AfterMethod
@AfterMethod(alwaysRun = true)
public void teardown() {
coordinator.close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public FunctionMetaDataTopicTailerTest() throws Exception {
ErrorNotifier.getDefaultImpl());
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
fsc.close();
verify(reader, times(1)).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void setup() {
schedulerManager.setLeaderService(leaderService);
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void stop() {
this.executor.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void setup() throws Exception {
this.history = new PulsarDatabaseHistory();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
super.internalCleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public byte[] answer(InvocationOnMock invocation) throws Throwable {
}});
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public final void tearDown() throws Exception {
sink.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void init() throws IOException {
executor = Executors.newFixedThreadPool(10);
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
// Shutdown all of the processing threads
stopThreads();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String answer(InvocationOnMock invocation) throws Throwable {
});
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
source.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setUp() throws Exception {
mockSourceContext = mock(SourceContext.class);
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
sink.stop();
sink = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void setUp() throws Exception {
when(influxSink.influxDBBuilder.build(any())).thenReturn(influxDB);
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
influxSink.close();
verify(influxDB, times(1)).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setUp() throws IOException, SQLException {
sqliteUtils.setUp();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws IOException, SQLException {
sqliteUtils.tearDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void setUp() throws Exception {

}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
sqliteUtils.tearDown();
jdbcSink.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected void setup() throws Exception {

}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
tempFile.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected void setup() throws Exception {
this.offsetBackingStore.start();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
@Override
protected void cleanup() throws Exception {
if (null != offsetBackingStore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void initFailContext(String msg) {
}).when(mockPublisher).subscribe(any());
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
sink.close();
verify(mockMongoClient, times(1)).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setUp() {
}).when(mockPublisher).subscribe(any());
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
source.close();
verify(mockMongoClient, times(1)).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void setUp() throws Exception {
rabbitMQBrokerManager.startBroker();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
rabbitMQBrokerManager.stopBroker();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setUp() throws Exception {
rabbitMQBrokerManager.startBroker();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
rabbitMQBrokerManager.stopBroker();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setUp() throws Exception {
embeddedRedisUtils.setUp();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
embeddedRedisUtils.tearDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void setUp() throws Exception {
solrServerUtil.startStandaloneSolr();
}

@AfterMethod
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception {
solrServerUtil.stopStandaloneSolr();
}
Expand Down
Loading

0 comments on commit ec59e93

Please sign in to comment.