diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java index dbe9546d0f4e1..227d4a73f7e18 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/AbstractTimelineReaderHBaseTestBase.java @@ -18,9 +18,10 @@ package org.apache.hadoop.yarn.server.timelineservice.reader; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -43,7 +44,6 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.DataGeneratorForTest; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.HttpUrlConnectorProvider; -import org.junit.Assert; /** * Test Base for TimelineReaderServer HBase tests. @@ -101,7 +101,7 @@ protected void addFilters(Configuration conf) { server.start(); serverPort = server.getWebServerPort(); } catch (Exception e) { - Assert.fail("Web server failed to start"); + fail("Web server failed to start"); } } @@ -138,8 +138,8 @@ protected Response getResponse(Client client, URI uri) protected void verifyHttpResponse(Client client, URI uri, Response.Status status) { Response resp = client.target(uri).request(MediaType.APPLICATION_JSON).get(); assertNotNull(resp); - assertTrue("Response from server should have been " + status, - resp.getStatusInfo().getStatusCode() == status.getStatusCode()); + assertTrue(resp.getStatusInfo().getStatusCode() == status.getStatusCode(), + "Response from server should have been " + status); System.out.println("Response is: " + resp.readEntity(String.class)); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/TestTimelineReaderWebServicesHBaseStorage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/TestTimelineReaderWebServicesHBaseStorage.java index e54885369a706..6b189256d3675 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/TestTimelineReaderWebServicesHBaseStorage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/reader/TestTimelineReaderWebServicesHBaseStorage.java @@ -18,10 +18,10 @@ package org.apache.hadoop.yarn.server.timelineservice.reader; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import javax.ws.rs.client.Client; @@ -59,9 +59,9 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.HBaseTimelineWriterImpl; import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineSchemaUtils; import org.apache.hadoop.yarn.server.utils.BuilderUtils; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableMap; @@ -75,14 +75,14 @@ public class TestTimelineReaderWebServicesHBaseStorage HBaseTimelineSchemaUtils.getTopOfTheDayTimestamp(ts); private static String doAsUser = "remoteuser"; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { setup(); loadData(); initialize(); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { tearDown(); } @@ -505,13 +505,14 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(2, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( ((entity.getId().equals("user1@flow_name/1002345678919")) && (entity.getRunId() == 1002345678919L) && (entity.getStartTime() == 1425016501000L)) || ((entity.getId().equals("user1@flow_name/1002345678920")) && (entity.getRunId() == 1002345678920L) && - (entity.getStartTime() == 1425016501034L))); + (entity.getStartTime() == 1425016501034L)), + "Id, run id or start time does not match."); assertEquals(0, entity.getMetrics().size()); } @@ -525,10 +526,11 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(1, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( entity.getId().equals("user1@flow_name/1002345678920") && entity.getRunId() == 1002345678920L && - entity.getStartTime() == 1425016501034L); + entity.getStartTime() == 1425016501034L, + "Id, run id or start time does not match."); assertEquals(0, entity.getMetrics().size()); } @@ -542,10 +544,11 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(1, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( entity.getId().equals("user1@flow_name/1002345678920") && entity.getRunId() == 1002345678920L && - entity.getStartTime() == 1425016501034L); + entity.getStartTime() == 1425016501034L, + "Id, run id or start time does not match."); assertEquals(0, entity.getMetrics().size()); } @@ -559,13 +562,14 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(2, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( ((entity.getId().equals("user1@flow_name/1002345678919")) && (entity.getRunId() == 1002345678919L) && (entity.getStartTime() == 1425016501000L)) || ((entity.getId().equals("user1@flow_name/1002345678920")) && (entity.getRunId() == 1002345678920L) && - (entity.getStartTime() == 1425016501034L))); + (entity.getStartTime() == 1425016501034L)), + "Id, run id or start time does not match."); assertEquals(0, entity.getMetrics().size()); } @@ -579,10 +583,11 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(1, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( entity.getId().equals("user1@flow_name/1002345678919") && entity.getRunId() == 1002345678919L && - entity.getStartTime() == 1425016501000L); + entity.getStartTime() == 1425016501000L, + "Id, run id or start time does not match."); assertEquals(0, entity.getMetrics().size()); } @@ -596,7 +601,7 @@ public void testGetFlowRuns() throws Exception { assertNotNull(entities); assertEquals(2, entities.size()); for (FlowRunEntity entity : entities) { - assertTrue("Id, run id or start time does not match.", + assertTrue( ((entity.getId().equals("user1@flow_name/1002345678919")) && (entity.getRunId() == 1002345678919L) && (entity.getStartTime() == 1425016501000L) && @@ -604,7 +609,8 @@ public void testGetFlowRuns() throws Exception { ((entity.getId().equals("user1@flow_name/1002345678920")) && (entity.getRunId() == 1002345678920L) && (entity.getStartTime() == 1425016501034L) && - (entity.getMetrics().size() == 1))); + (entity.getMetrics().size() == 1)), + "Id, run id or start time does not match."); } // fields as CONFIGS will lead to a HTTP 400 as it makes no sense for @@ -1999,11 +2005,12 @@ public void testGetFlowRunApps() throws Exception { assertNotNull(entities); assertEquals(2, entities.size()); for (TimelineEntity entity : entities) { - assertTrue("Unexpected app in result", + assertTrue( (entity.getId().equals("application_1111111111_1111") && entity.getMetrics().size() == 3) || (entity.getId().equals("application_1111111111_2222") && - entity.getMetrics().size() == 1)); + entity.getMetrics().size() == 1), + "Unexpected app in result"); for (TimelineMetric metric : entity.getMetrics()) { assertEquals(TimelineMetric.Type.SINGLE_VALUE, metric.getType()); assertEquals(1, metric.getValues().size()); @@ -2018,11 +2025,12 @@ public void testGetFlowRunApps() throws Exception { assertNotNull(entities); assertEquals(2, entities.size()); for (TimelineEntity entity : entities) { - assertTrue("Unexpected app in result", + assertTrue( (entity.getId().equals("application_1111111111_1111") && entity.getMetrics().size() == 3) || (entity.getId().equals("application_1111111111_2222") && - entity.getMetrics().size() == 1)); + entity.getMetrics().size() == 1), + "Unexpected app in result"); for (TimelineMetric metric : entity.getMetrics()) { assertTrue(metric.getValues().size() <= 2); assertEquals(TimelineMetric.Type.TIME_SERIES, metric.getType()); @@ -2062,7 +2070,7 @@ public void testGetFlowApps() throws Exception { assertNotNull(entities); assertEquals(3, entities.size()); for (TimelineEntity entity : entities) { - assertTrue("Unexpected app in result", + assertTrue( (entity.getId().equals("application_1111111111_1111") && entity.getConfigs().size() == 1 && entity.getConfigs().equals(ImmutableMap.of("cfg2", "value1"))) || @@ -2070,7 +2078,8 @@ public void testGetFlowApps() throws Exception { entity.getConfigs().size() == 1 && entity.getConfigs().equals(ImmutableMap.of("cfg1", "value1"))) || (entity.getId().equals("application_1111111111_2224") && - entity.getConfigs().size() == 0)); + entity.getConfigs().size() == 0), + "Unexpected app in result"); for (TimelineMetric metric : entity.getMetrics()) { if (entity.getId().equals("application_1111111111_1111")) { TimelineMetric m1 = newMetric(TimelineMetric.Type.SINGLE_VALUE, @@ -2100,7 +2109,7 @@ public void testGetFlowApps() throws Exception { assertNotNull(entities); assertEquals(3, entities.size()); for (TimelineEntity entity : entities) { - assertTrue("Unexpected app in result", + assertTrue( (entity.getId().equals("application_1111111111_1111") && entity.getConfigs().size() == 1 && entity.getConfigs().equals(ImmutableMap.of("cfg2", "value1"))) || @@ -2108,7 +2117,8 @@ public void testGetFlowApps() throws Exception { entity.getConfigs().size() == 1 && entity.getConfigs().equals(ImmutableMap.of("cfg1", "value1"))) || (entity.getId().equals("application_1111111111_2224") && - entity.getConfigs().size() == 0)); + entity.getConfigs().size() == 0), + "Unexpected app in result"); for (TimelineMetric metric : entity.getMetrics()) { if (entity.getId().equals("application_1111111111_1111")) { TimelineMetric m1 = newMetric(TimelineMetric.Type.TIME_SERIES, @@ -2167,8 +2177,9 @@ public void testGetFlowAppsFilters() throws Exception { resp.readEntity(new GenericType>(){}); assertNotNull(entities); assertEquals(1, entities.size()); - assertTrue("Unexpected app in result", entities.contains( - newEntity(entityType, "application_1111111111_1111"))); + assertTrue(entities.contains( + newEntity(entityType, "application_1111111111_1111")), + "Unexpected app in result"); uri = URI.create("http://localhost:" + getServerPort() + "/ws/v2/" + "timeline/clusters/cluster1/users/user1/flows/flow_name/apps?" + @@ -2177,8 +2188,9 @@ public void testGetFlowAppsFilters() throws Exception { entities = resp.readEntity(new GenericType>(){}); assertNotNull(entities); assertEquals(1, entities.size()); - assertTrue("Unexpected app in result", entities.contains( - newEntity(entityType, "application_1111111111_1111"))); + assertTrue(entities.contains( + newEntity(entityType, "application_1111111111_1111")), + "Unexpected app in result"); uri = URI.create("http://localhost:" + getServerPort() + "/ws/v2/" + "timeline/clusters/cluster1/users/user1/flows/flow_name/apps?" + @@ -2187,8 +2199,9 @@ public void testGetFlowAppsFilters() throws Exception { entities = resp.readEntity(new GenericType>(){}); assertNotNull(entities); assertEquals(1, entities.size()); - assertTrue("Unexpected app in result", entities.contains( - newEntity(entityType, "application_1111111111_2222"))); + assertTrue(entities.contains( + newEntity(entityType, "application_1111111111_2222")), + "Unexpected app in result"); } finally { client.close(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageApps.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageApps.java index 0dee442264efd..1545ccdef0f2d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageApps.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageApps.java @@ -18,9 +18,10 @@ package org.apache.hadoop.yarn.server.timelineservice.storage; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.Arrays; @@ -76,12 +77,11 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.KeyConverter; import org.apache.hadoop.yarn.server.timelineservice.storage.common.Separator; import org.apache.hadoop.yarn.server.timelineservice.storage.common.StringKeyConverter; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Tests for apps stored in TimelineStorage. @@ -92,7 +92,7 @@ public class TestHBaseTimelineStorageApps { private HBaseTimelineReaderImpl reader; private static final long CURRENT_TIME = System.currentTimeMillis(); - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); util.startMiniCluster(); @@ -100,14 +100,14 @@ public static void setupBeforeClass() throws Exception { DataGeneratorForTest.loadApps(util, CURRENT_TIME); } - @Before + @BeforeEach public void init() throws Exception { reader = new HBaseTimelineReaderImpl(); reader.init(util.getConfiguration()); reader.start(); } - @After + @AfterEach public void stop() throws Exception { if (reader != null) { reader.stop(); @@ -641,13 +641,13 @@ public void testNonIntegralMetricValues() throws IOException { UserGroupInformation user = UserGroupInformation.createRemoteUser("u1"); try { hbi.write(context, teApp, user); - Assert.fail("Expected an exception as metric values are non integral"); + fail("Expected an exception as metric values are non integral"); } catch (IOException e) {} // Writing generic entity. try { hbi.write(context, teEntity, user); - Assert.fail("Expected an exception as metric values are non integral"); + fail("Expected an exception as metric values are non integral"); } catch (IOException e) {} hbi.stop(); } finally { @@ -719,7 +719,7 @@ public void testFilterAppsByCreatedTime() throws Exception { if (!entity.getId().equals("application_1111111111_2222") && !entity.getId().equals("application_1111111111_3333") && !entity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entities with ids' application_1111111111_2222, " + + fail("Entities with ids' application_1111111111_2222, " + "application_1111111111_3333 and application_1111111111_4444" + " should be present"); } @@ -735,7 +735,7 @@ public void testFilterAppsByCreatedTime() throws Exception { for (TimelineEntity entity : entities) { if (!entity.getId().equals("application_1111111111_3333") && !entity.getId().equals("application_1111111111_4444")) { - Assert.fail("Apps with ids' application_1111111111_3333 and" + + fail("Apps with ids' application_1111111111_3333 and" + " application_1111111111_4444 should be present"); } } @@ -749,7 +749,7 @@ public void testFilterAppsByCreatedTime() throws Exception { assertEquals(1, entities.size()); for (TimelineEntity entity : entities) { if (!entity.getId().equals("application_1111111111_2222")) { - Assert.fail("App with id application_1111111111_2222 should" + + fail("App with id application_1111111111_2222 should" + " be present"); } } @@ -836,7 +836,7 @@ public void testReadAppsIsRelatedTo() throws Exception { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222") && !timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity ids' should have been application_1111111111_2222" + fail("Entity ids' should have been application_1111111111_2222" + " and application_1111111111_3333"); } } @@ -860,7 +860,7 @@ public void testReadAppsIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity id should have been application_1111111111_4444"); + fail("Entity id should have been application_1111111111_4444"); } } assertEquals(0, isRelatedToCnt); @@ -884,7 +884,7 @@ public void testReadAppsIsRelatedTo() throws Exception { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222") && !timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity ids' should have been application_1111111111_2222" + fail("Entity ids' should have been application_1111111111_2222" + " and application_1111111111_3333"); } } @@ -905,7 +905,7 @@ public void testReadAppsIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity id should have been application_1111111111_3333"); + fail("Entity id should have been application_1111111111_3333"); } } assertEquals(0, isRelatedToCnt); @@ -960,7 +960,7 @@ public void testReadAppsIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity id should have been application_1111111111_3333"); + fail("Entity id should have been application_1111111111_3333"); } } assertEquals(0, isRelatedToCnt); @@ -989,7 +989,7 @@ public void testReadAppsRelatesTo() throws Exception { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222") && !timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity ids' should have been application_1111111111_2222" + fail("Entity ids' should have been application_1111111111_2222" + " and application_1111111111_4444"); } } @@ -1013,7 +1013,7 @@ public void testReadAppsRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity id should have been application_1111111111_3333"); + fail("Entity id should have been application_1111111111_3333"); } } assertEquals(0, relatesToCnt); @@ -1037,7 +1037,7 @@ public void testReadAppsRelatesTo() throws Exception { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222") && !timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity ids' should have been application_1111111111_2222" + fail("Entity ids' should have been application_1111111111_2222" + " and application_1111111111_4444"); } } @@ -1058,7 +1058,7 @@ public void testReadAppsRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222")) { - Assert.fail("Entity id should have been application_1111111111_2222"); + fail("Entity id should have been application_1111111111_2222"); } } assertEquals(0, relatesToCnt); @@ -1113,7 +1113,7 @@ public void testReadAppsRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_2222")) { - Assert.fail("Entity id should have been application_1111111111_2222"); + fail("Entity id should have been application_1111111111_2222"); } } assertEquals(0, relatesToCnt); @@ -1149,7 +1149,7 @@ public void testReadAppsRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_3333")) { - Assert.fail("Entity id should have been application_1111111111_3333"); + fail("Entity id should have been application_1111111111_3333"); } } assertEquals(0, relatesToCnt); @@ -1191,7 +1191,7 @@ public void testReadAppsRelationsAndEventFiltersDefaultView() isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity id should have been application_1111111111_4444"); + fail("Entity id should have been application_1111111111_4444"); } } assertEquals(0, eventCnt); @@ -1335,7 +1335,7 @@ public void testReadAppsEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity id should have been application_1111111111_4444"); + fail("Entity id should have been application_1111111111_4444"); } } assertEquals(1, eventCnt); @@ -1356,7 +1356,7 @@ public void testReadAppsEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity id should have been application_1111111111_4444"); + fail("Entity id should have been application_1111111111_4444"); } } assertEquals(0, eventCnt); @@ -1376,7 +1376,7 @@ public void testReadAppsEventFilters() throws Exception { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("application_1111111111_2222") && !timelineEntity.getId().equals("application_1111111111_4444")) { - Assert.fail("Entity ids' should have been application_1111111111_2222" + fail("Entity ids' should have been application_1111111111_2222" + " and application_1111111111_4444"); } } @@ -1415,7 +1415,7 @@ public void testReadAppsEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("application_1111111111_2222")) { - Assert.fail("Entity id should have been application_1111111111_2222"); + fail("Entity id should have been application_1111111111_2222"); } } assertEquals(0, eventCnt); @@ -1436,7 +1436,7 @@ public void testReadAppsEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("application_1111111111_2222")) { - Assert.fail("Entity id should have been application_1111111111_2222"); + fail("Entity id should have been application_1111111111_2222"); } } assertEquals(0, eventCnt); @@ -1464,8 +1464,8 @@ public void testReadAppsConfigPrefix() throws Exception { for (TimelineEntity entity : es1) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with cfg_", - confKey.startsWith("cfg_")); + assertTrue(confKey.startsWith("cfg_"), + "Config key returned should start with cfg_"); } } assertEquals(3, cfgCnt); @@ -1491,8 +1491,8 @@ public void testReadAppsConfigFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with cfg_", - confKey.startsWith("cfg_")); + assertTrue(confKey.startsWith("cfg_"), + "Config key returned should start with cfg_"); } } assertEquals(2, cfgCnt); @@ -1525,8 +1525,8 @@ public void testReadAppsConfigFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with config_", - confKey.startsWith("config_")); + assertTrue(confKey.startsWith("config_"), + "Config key returned should start with config_"); } } assertEquals(2, cfgCnt); @@ -1671,8 +1671,8 @@ public void testReadAppsMetricPrefix() throws Exception { for (TimelineEntity entity : es1) { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue(metric.getId().startsWith("MAP1_"), + "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1725,8 +1725,8 @@ public void testReadAppsMetricFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue(metric.getId().startsWith("MAP1_"), + "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1745,8 +1745,8 @@ public void testReadAppsMetricFilterPrefix() throws Exception { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { metricValCnt += metric.getValues().size(); - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue(metric.getId().startsWith("MAP1_"), + "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1934,7 +1934,7 @@ public void testReadAppsInfoFilters() throws Exception { assertEquals(3, entities.size()); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageDomain.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageDomain.java index 1f59088435e5b..ed00242d8647e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageDomain.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageDomain.java @@ -32,13 +32,13 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainColumn; import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainRowKey; import org.apache.hadoop.yarn.server.timelineservice.storage.domain.DomainTableRW; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test for timeline domain. @@ -47,7 +47,7 @@ public class TestHBaseTimelineStorageDomain { private static HBaseTestingUtility util; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); Configuration conf = util.getConfiguration(); @@ -125,7 +125,7 @@ public void testDomainIdTable() throws Exception { assertEquals("writer1,writer2", writers); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageEntities.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageEntities.java index 116285c23fa5b..bcdbc6caa9c9c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageEntities.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageEntities.java @@ -18,10 +18,11 @@ package org.apache.hadoop.yarn.server.timelineservice.storage; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.Arrays; @@ -81,12 +82,12 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.subapplication.SubApplicationRowKey; import org.apache.hadoop.yarn.server.timelineservice.storage.subapplication.SubApplicationRowKeyPrefix; import org.apache.hadoop.yarn.server.timelineservice.storage.subapplication.SubApplicationTableRW; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; /** * Various tests to test writing entities to HBase and reading them back from @@ -105,7 +106,7 @@ public class TestHBaseTimelineStorageEntities { private HBaseTimelineReaderImpl reader; private static final long CURRENT_TIME = System.currentTimeMillis(); - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); util.startMiniCluster(); @@ -113,14 +114,14 @@ public static void setupBeforeClass() throws Exception { DataGeneratorForTest.loadEntities(util, CURRENT_TIME); } - @Before + @BeforeEach public void init() throws Exception { reader = new HBaseTimelineReaderImpl(); reader.init(util.getConfiguration()); reader.start(); } - @After + @AfterEach public void stop() throws Exception { if (reader != null) { reader.stop(); @@ -722,7 +723,7 @@ public void testFilterEntitiesByCreatedTime() throws Exception { for (TimelineEntity entity : entities) { if (!entity.getId().equals("hello") && !entity.getId().equals("hello1") && !entity.getId().equals("hello2")) { - Assert.fail("Entities with ids' hello, hello1 and hello2 should be" + + fail("Entities with ids' hello, hello1 and hello2 should be" + " present"); } } @@ -736,7 +737,7 @@ public void testFilterEntitiesByCreatedTime() throws Exception { for (TimelineEntity entity : entities) { if (!entity.getId().equals("hello1") && !entity.getId().equals("hello2")) { - Assert.fail("Entities with ids' hello1 and hello2 should be present"); + fail("Entities with ids' hello1 and hello2 should be present"); } } entities = reader.getEntities( @@ -748,7 +749,7 @@ public void testFilterEntitiesByCreatedTime() throws Exception { assertEquals(1, entities.size()); for (TimelineEntity entity : entities) { if (!entity.getId().equals("hello")) { - Assert.fail("Entity with id hello should be present"); + fail("Entity with id hello should be present"); } } } @@ -788,7 +789,7 @@ public void testReadEntitiesRelationsAndEventFiltersDefaultView() isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity id should have been hello2"); + fail("Entity id should have been hello2"); } } assertEquals(0, eventCnt); @@ -814,7 +815,7 @@ public void testReadEntitiesEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity id should have been hello2"); + fail("Entity id should have been hello2"); } } assertEquals(1, eventCnt); @@ -834,7 +835,7 @@ public void testReadEntitiesEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity id should have been hello2"); + fail("Entity id should have been hello2"); } } assertEquals(0, eventCnt); @@ -853,7 +854,7 @@ public void testReadEntitiesEventFilters() throws Exception { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("hello") && !timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity ids' should have been hello and hello2"); + fail("Entity ids' should have been hello and hello2"); } } assertEquals(0, eventCnt); @@ -889,7 +890,7 @@ public void testReadEntitiesEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("hello")) { - Assert.fail("Entity id should have been hello"); + fail("Entity id should have been hello"); } } assertEquals(0, eventCnt); @@ -909,7 +910,7 @@ public void testReadEntitiesEventFilters() throws Exception { for (TimelineEntity timelineEntity : entities) { eventCnt += timelineEntity.getEvents().size(); if (!timelineEntity.getId().equals("hello")) { - Assert.fail("Entity id should have been hello"); + fail("Entity id should have been hello"); } } assertEquals(0, eventCnt); @@ -936,7 +937,7 @@ public void testReadEntitiesIsRelatedTo() throws Exception { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("hello") && !timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity ids' should have been hello and hello1"); + fail("Entity ids' should have been hello and hello1"); } } assertEquals(3, isRelatedToCnt); @@ -958,7 +959,7 @@ public void testReadEntitiesIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity id should have been hello2"); + fail("Entity id should have been hello2"); } } assertEquals(0, isRelatedToCnt); @@ -981,7 +982,7 @@ public void testReadEntitiesIsRelatedTo() throws Exception { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("hello") && !timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity ids' should have been hello and hello1"); + fail("Entity ids' should have been hello and hello1"); } } assertEquals(0, isRelatedToCnt); @@ -1000,7 +1001,7 @@ public void testReadEntitiesIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity id should have been hello1"); + fail("Entity id should have been hello1"); } } assertEquals(0, isRelatedToCnt); @@ -1052,7 +1053,7 @@ public void testReadEntitiesIsRelatedTo() throws Exception { for (TimelineEntity timelineEntity : entities) { isRelatedToCnt += timelineEntity.getIsRelatedToEntities().size(); if (!timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity id should have been hello1"); + fail("Entity id should have been hello1"); } } assertEquals(0, isRelatedToCnt); @@ -1079,7 +1080,7 @@ public void testReadEntitiesRelatesTo() throws Exception { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello") && !timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity ids' should have been hello and hello2"); + fail("Entity ids' should have been hello and hello2"); } } assertEquals(3, relatesToCnt); @@ -1101,7 +1102,7 @@ public void testReadEntitiesRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity id should have been hello1"); + fail("Entity id should have been hello1"); } } assertEquals(0, relatesToCnt); @@ -1124,7 +1125,7 @@ public void testReadEntitiesRelatesTo() throws Exception { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello") && !timelineEntity.getId().equals("hello2")) { - Assert.fail("Entity ids' should have been hello and hello2"); + fail("Entity ids' should have been hello and hello2"); } } assertEquals(0, relatesToCnt); @@ -1143,7 +1144,7 @@ public void testReadEntitiesRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello")) { - Assert.fail("Entity id should have been hello"); + fail("Entity id should have been hello"); } } assertEquals(0, relatesToCnt); @@ -1195,7 +1196,7 @@ public void testReadEntitiesRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello")) { - Assert.fail("Entity id should have been hello"); + fail("Entity id should have been hello"); } } assertEquals(0, relatesToCnt); @@ -1230,7 +1231,7 @@ public void testReadEntitiesRelatesTo() throws Exception { for (TimelineEntity timelineEntity : entities) { relatesToCnt += timelineEntity.getRelatesToEntities().size(); if (!timelineEntity.getId().equals("hello1")) { - Assert.fail("Entity id should have been hello1"); + fail("Entity id should have been hello1"); } } assertEquals(0, relatesToCnt); @@ -1311,8 +1312,7 @@ public void testReadEntitiesConfigPrefix() throws Exception { for (TimelineEntity entity : es1) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with cfg_", - confKey.startsWith("cfg_")); + assertTrue(confKey.startsWith("cfg_"), "Config key returned should start with cfg_"); } } assertEquals(3, cfgCnt); @@ -1447,8 +1447,8 @@ public void testReadEntitiesConfigFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with cfg_", - confKey.startsWith("cfg_")); + assertTrue( + confKey.startsWith("cfg_"), "Config key returned should start with cfg_"); } } assertEquals(2, cfgCnt); @@ -1479,8 +1479,8 @@ public void testReadEntitiesConfigFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { cfgCnt += entity.getConfigs().size(); for (String confKey : entity.getConfigs().keySet()) { - assertTrue("Config key returned should start with config_", - confKey.startsWith("config_")); + assertTrue( + confKey.startsWith("config_"), "Config key returned should start with config_"); } } assertEquals(2, cfgCnt); @@ -1506,8 +1506,8 @@ public void testReadEntitiesMetricPrefix() throws Exception { for (TimelineEntity entity : es1) { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue( + metric.getId().startsWith("MAP1_"), "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1699,8 +1699,8 @@ public void testReadEntitiesMetricFilterPrefix() throws Exception { for (TimelineEntity entity : entities) { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue( + metric.getId().startsWith("MAP1_"), "Metric Id returned should start with MAP1_"); } } assertEquals(1, metricCnt); @@ -1731,8 +1731,8 @@ public void testReadEntitiesMetricFilterPrefix() throws Exception { for (TimelineMetric metric : entity.getMetrics()) { assertEquals(TimelineMetric.Type.SINGLE_VALUE, metric.getType()); assertEquals(1, metric.getValues().size()); - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue( + metric.getId().startsWith("MAP1_"), "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1751,8 +1751,8 @@ public void testReadEntitiesMetricFilterPrefix() throws Exception { metricCnt += entity.getMetrics().size(); for (TimelineMetric metric : entity.getMetrics()) { metricValCnt += metric.getValues().size(); - assertTrue("Metric Id returned should start with MAP1_", - metric.getId().startsWith("MAP1_")); + assertTrue( + metric.getId().startsWith("MAP1_"), "Metric Id returned should start with MAP1_"); } } assertEquals(2, metricCnt); @@ -1854,7 +1854,8 @@ public void testReadEntitiesInfoFilters() throws Exception { assertEquals(3, entities.size()); } - @Test(timeout = 90000) + @Test + @Timeout(value = 90) public void testListTypesInApp() throws Exception { Set types = reader.getEntityTypes( new TimelineReaderContext("cluster1", "user1", "some_flow_name", @@ -1877,7 +1878,7 @@ public void testListTypesInApp() throws Exception { assertEquals(0, types.size()); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageSchema.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageSchema.java index 950ce62be59c0..3880ba266ef22 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageSchema.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineStorageSchema.java @@ -18,15 +18,15 @@ package org.apache.hadoop.yarn.server.timelineservice.storage; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTableRW; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -45,7 +45,7 @@ public class TestHBaseTimelineStorageSchema { private static HBaseTestingUtility util; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); Configuration conf = util.getConfiguration(); @@ -139,7 +139,7 @@ public void createWithSetPrefix() throws IOException { .unset(YarnConfiguration.TIMELINE_SERVICE_HBASE_SCHEMA_PREFIX_NAME); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineReaderHBaseDown.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineReaderHBaseDown.java index 7d7e6b24498d2..6d795507b8dd5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineReaderHBaseDown.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineReaderHBaseDown.java @@ -28,8 +28,8 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext; import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderServer; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import java.io.IOException; import java.util.Set; @@ -38,10 +38,13 @@ import static org.apache.hadoop.yarn.conf.YarnConfiguration.TIMELINE_SERVICE_READER_STORAGE_MONITOR_INTERVAL_MS; import static org.apache.hadoop.yarn.server.timelineservice.storage.HBaseStorageMonitor.DATA_TO_RETRIEVE; import static org.apache.hadoop.yarn.server.timelineservice.storage.HBaseStorageMonitor.MONITOR_FILTERS; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; public class TestTimelineReaderHBaseDown { - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineReaderHBaseUp() throws Exception { HBaseTestingUtility util = new HBaseTestingUtility(); configure(util); @@ -60,7 +63,8 @@ public void testTimelineReaderHBaseUp() throws Exception { } } - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineReaderInitWhenHBaseIsDown() throws TimeoutException, InterruptedException { HBaseTestingUtility util = new HBaseTestingUtility(); @@ -74,7 +78,8 @@ public void testTimelineReaderInitWhenHBaseIsDown() throws waitForHBaseDown(htr); } - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineReaderDetectsHBaseDown() throws Exception { HBaseTestingUtility util = new HBaseTestingUtility(); configure(util); @@ -101,7 +106,8 @@ public void testTimelineReaderDetectsHBaseDown() throws Exception { } } - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineReaderDetectsZooKeeperDown() throws Exception { HBaseTestingUtility util = new HBaseTestingUtility(); configure(util); @@ -128,7 +134,8 @@ public void testTimelineReaderDetectsZooKeeperDown() throws Exception { } } - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineReaderRecoversAfterHBaseReturns() throws Exception { HBaseTestingUtility util = new HBaseTestingUtility(); configure(util); @@ -177,9 +184,9 @@ private static void waitForHBaseDown(HBaseTimelineReaderImpl htr) throws } }, 1000, 150000); checkQuery(htr); - Assert.fail("Query should fail when HBase is down"); + fail("Query should fail when HBase is down"); } catch (IOException e) { - Assert.assertEquals("HBase is down", e.getMessage()); + assertEquals("HBase is down", e.getMessage()); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineWriterHBaseDown.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineWriterHBaseDown.java index 5d658b96c5b1c..f0028ae162962 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineWriterHBaseDown.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestTimelineWriterHBaseDown.java @@ -19,8 +19,8 @@ import java.io.IOException; -import org.junit.Test; -import org.junit.Assert; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -31,14 +31,16 @@ import org.apache.hadoop.yarn.api.records.timelineservice.ApplicationEntity; import static org.apache.hadoop.yarn.conf.YarnConfiguration.TIMELINE_SERVICE_READER_STORAGE_MONITOR_INTERVAL_MS; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * This class tests HbaseTimelineWriter with Hbase Down. */ public class TestTimelineWriterHBaseDown { - @Test(timeout=300000) + @Test + @Timeout(value = 300) public void testTimelineWriterHBaseDown() throws Exception { HBaseTestingUtility util = new HBaseTestingUtility(); HBaseTimelineWriterImpl writer = new HBaseTimelineWriterImpl(); @@ -58,7 +60,7 @@ public void testTimelineWriterHBaseDown() throws Exception { try { storageMonitor.checkStorageIsUp(); } catch(IOException e) { - Assert.fail("HBaseStorageMonitor failed to detect HBase Up"); + fail("HBaseStorageMonitor failed to detect HBase Up"); } util.shutdownMiniHBaseCluster(); @@ -82,8 +84,8 @@ public void testTimelineWriterHBaseDown() throws Exception { exceptionCaught = true; } } - assertTrue("HBaseStorageMonitor failed to detect HBase Down", - exceptionCaught); + assertTrue( + exceptionCaught, "HBaseStorageMonitor failed to detect HBase Down"); } finally { writer.stop(); util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowActivity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowActivity.java index 31434633b4a57..9c5f27d83f7c0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowActivity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowActivity.java @@ -18,10 +18,10 @@ package org.apache.hadoop.yarn.server.timelineservice.storage.flow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.Map; @@ -55,9 +55,9 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW; import org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnHelper; import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineSchemaUtils; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Tests the FlowRun and FlowActivity Tables. @@ -66,7 +66,7 @@ public class TestHBaseStorageFlowActivity { private static HBaseTestingUtility util; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); Configuration conf = util.getConfiguration(); @@ -490,7 +490,7 @@ private void checkFlowActivityRunId(long runid, String flowVersion, } } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRun.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRun.java index f34a6dcacf43b..eba05cd9f2cb6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRun.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRun.java @@ -18,10 +18,10 @@ package org.apache.hadoop.yarn.server.timelineservice.storage.flow; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.EnumSet; @@ -64,9 +64,9 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnHelper; import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineServerUtils; import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTableRW; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Tests the FlowRun and FlowActivity Tables. @@ -78,7 +78,7 @@ public class TestHBaseStorageFlowRun { private static final String METRIC1 = "MAP_SLOT_MILLIS"; private static final String METRIC2 = "HDFS_BYTES_READ"; - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); Configuration conf = util.getConfiguration(); @@ -1073,7 +1073,7 @@ public void testMetricFilters() throws Exception { } } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRunCompaction.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRunCompaction.java index 475cb7a306ffd..0e5cecb5e5a38 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRunCompaction.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/TestHBaseStorageFlowRunCompaction.java @@ -19,10 +19,11 @@ package org.apache.hadoop.yarn.server.timelineservice.storage.flow; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.ArrayList; @@ -59,10 +60,9 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineServerUtils; import org.apache.hadoop.yarn.server.timelineservice.storage.common.LongConverter; import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimestampGenerator; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Tests the FlowRun and FlowActivity Tables. @@ -78,7 +78,7 @@ public class TestHBaseStorageFlowRunCompaction { private final byte[] aFamily = Bytes.toBytes("family"); private final byte[] aQualifier = Bytes.toBytes("qualifier"); - @BeforeClass + @BeforeAll public static void setupBeforeClass() throws Exception { util = new HBaseTestingUtility(); Configuration conf = util.getConfiguration(); @@ -335,8 +335,8 @@ public void testWriteFlowRunCompaction() throws Exception { // flush and compact all the regions of the primary table int regionNum = HBaseTimelineServerUtils.flushCompactTableRegions( server, flowRunTable); - assertTrue("Didn't find any regions for primary table!", - regionNum > 0); + assertTrue(regionNum > 0, + "Didn't find any regions for primary table!"); // check flow run for one flow many apps checkFlowRunTable(cluster, user, flow, runid, c1, 4); @@ -490,7 +490,7 @@ public void checkProcessSummationMoreCellsSumFinal2() assertTrue(returnTs >= currentTimestamp); } else { // raise a failure since we expect only these two values back - Assert.fail(); + fail(); } } } @@ -576,7 +576,7 @@ public void checkProcessSummationMoreCellsSumFinalMany() throws IOException { assertTrue(returnTs <= cellTsNotFinalStart * count); } else { // raise a failure since we expect only these values back - Assert.fail(); + fail(); } } } @@ -691,7 +691,7 @@ public void checkProcessSummationMoreCellsSumFinalVariedTags() assertTrue(returnTs <= cellTsFinalStartNotExpire + countFinalNotExpire); } else { // raise a failure since we expect only these values back - Assert.fail(); + fail(); } } } @@ -755,7 +755,7 @@ public void testProcessSummationMoreCellsSumFinal() throws IOException { assertTrue(returnTs != inputTs1); } else { // raise a failure since we expect only these two values back - Assert.fail(); + fail(); } } @@ -850,7 +850,7 @@ public void testProcessSummationEmpty() throws IOException { assertEquals(0, cells.size()); } - @AfterClass + @AfterAll public static void tearDownAfterClass() throws Exception { if (util != null) { util.shutdownMiniCluster();