1818
1919package org .apache .hadoop .yarn .server .timelineservice .reader ;
2020
21- import static org .junit .Assert .assertEquals ;
22- import static org .junit .Assert .assertNotNull ;
23- import static org .junit .Assert .assertTrue ;
24- import static org .junit .Assert .fail ;
21+ import static org .junit .jupiter . api . Assertions .assertEquals ;
22+ import static org .junit .jupiter . api . Assertions .assertNotNull ;
23+ import static org .junit .jupiter . api . Assertions .assertTrue ;
24+ import static org .junit .jupiter . api . Assertions .fail ;
2525
2626import javax .ws .rs .client .Client ;
2727
5959import org .apache .hadoop .yarn .server .timelineservice .storage .HBaseTimelineWriterImpl ;
6060import org .apache .hadoop .yarn .server .timelineservice .storage .common .HBaseTimelineSchemaUtils ;
6161import org .apache .hadoop .yarn .server .utils .BuilderUtils ;
62- import org .junit .AfterClass ;
63- import org .junit .BeforeClass ;
64- import org .junit .Test ;
62+ import org .junit .jupiter . api . AfterAll ;
63+ import org .junit .jupiter . api . BeforeAll ;
64+ import org .junit .jupiter . api . Test ;
6565
6666import org .apache .hadoop .thirdparty .com .google .common .collect .ImmutableMap ;
6767
@@ -75,14 +75,14 @@ public class TestTimelineReaderWebServicesHBaseStorage
7575 HBaseTimelineSchemaUtils .getTopOfTheDayTimestamp (ts );
7676 private static String doAsUser = "remoteuser" ;
7777
78- @ BeforeClass
78+ @ BeforeAll
7979 public static void setupBeforeClass () throws Exception {
8080 setup ();
8181 loadData ();
8282 initialize ();
8383 }
8484
85- @ AfterClass
85+ @ AfterAll
8686 public static void tearDownAfterClass () throws Exception {
8787 tearDown ();
8888 }
@@ -505,13 +505,14 @@ public void testGetFlowRuns() throws Exception {
505505 assertNotNull (entities );
506506 assertEquals (2 , entities .size ());
507507 for (FlowRunEntity entity : entities ) {
508- assertTrue ("Id, run id or start time does not match." ,
508+ assertTrue (
509509 ((entity .getId ().equals ("user1@flow_name/1002345678919" )) &&
510510 (entity .getRunId () == 1002345678919L ) &&
511511 (entity .getStartTime () == 1425016501000L )) ||
512512 ((entity .getId ().equals ("user1@flow_name/1002345678920" )) &&
513513 (entity .getRunId () == 1002345678920L ) &&
514- (entity .getStartTime () == 1425016501034L )));
514+ (entity .getStartTime () == 1425016501034L )),
515+ "Id, run id or start time does not match." );
515516 assertEquals (0 , entity .getMetrics ().size ());
516517 }
517518
@@ -525,10 +526,11 @@ public void testGetFlowRuns() throws Exception {
525526 assertNotNull (entities );
526527 assertEquals (1 , entities .size ());
527528 for (FlowRunEntity entity : entities ) {
528- assertTrue ("Id, run id or start time does not match." ,
529+ assertTrue (
529530 entity .getId ().equals ("user1@flow_name/1002345678920" ) &&
530531 entity .getRunId () == 1002345678920L &&
531- entity .getStartTime () == 1425016501034L );
532+ entity .getStartTime () == 1425016501034L ,
533+ "Id, run id or start time does not match." );
532534 assertEquals (0 , entity .getMetrics ().size ());
533535 }
534536
@@ -542,10 +544,11 @@ public void testGetFlowRuns() throws Exception {
542544 assertNotNull (entities );
543545 assertEquals (1 , entities .size ());
544546 for (FlowRunEntity entity : entities ) {
545- assertTrue ("Id, run id or start time does not match." ,
547+ assertTrue (
546548 entity .getId ().equals ("user1@flow_name/1002345678920" ) &&
547549 entity .getRunId () == 1002345678920L &&
548- entity .getStartTime () == 1425016501034L );
550+ entity .getStartTime () == 1425016501034L ,
551+ "Id, run id or start time does not match." );
549552 assertEquals (0 , entity .getMetrics ().size ());
550553 }
551554
@@ -559,13 +562,14 @@ public void testGetFlowRuns() throws Exception {
559562 assertNotNull (entities );
560563 assertEquals (2 , entities .size ());
561564 for (FlowRunEntity entity : entities ) {
562- assertTrue ("Id, run id or start time does not match." ,
565+ assertTrue (
563566 ((entity .getId ().equals ("user1@flow_name/1002345678919" )) &&
564567 (entity .getRunId () == 1002345678919L ) &&
565568 (entity .getStartTime () == 1425016501000L )) ||
566569 ((entity .getId ().equals ("user1@flow_name/1002345678920" )) &&
567570 (entity .getRunId () == 1002345678920L ) &&
568- (entity .getStartTime () == 1425016501034L )));
571+ (entity .getStartTime () == 1425016501034L )),
572+ "Id, run id or start time does not match." );
569573 assertEquals (0 , entity .getMetrics ().size ());
570574 }
571575
@@ -579,10 +583,11 @@ public void testGetFlowRuns() throws Exception {
579583 assertNotNull (entities );
580584 assertEquals (1 , entities .size ());
581585 for (FlowRunEntity entity : entities ) {
582- assertTrue ("Id, run id or start time does not match." ,
586+ assertTrue (
583587 entity .getId ().equals ("user1@flow_name/1002345678919" ) &&
584588 entity .getRunId () == 1002345678919L &&
585- entity .getStartTime () == 1425016501000L );
589+ entity .getStartTime () == 1425016501000L ,
590+ "Id, run id or start time does not match." );
586591 assertEquals (0 , entity .getMetrics ().size ());
587592 }
588593
@@ -596,15 +601,16 @@ public void testGetFlowRuns() throws Exception {
596601 assertNotNull (entities );
597602 assertEquals (2 , entities .size ());
598603 for (FlowRunEntity entity : entities ) {
599- assertTrue ("Id, run id or start time does not match." ,
604+ assertTrue (
600605 ((entity .getId ().equals ("user1@flow_name/1002345678919" )) &&
601606 (entity .getRunId () == 1002345678919L ) &&
602607 (entity .getStartTime () == 1425016501000L ) &&
603608 (entity .getMetrics ().size () == 3 )) ||
604609 ((entity .getId ().equals ("user1@flow_name/1002345678920" )) &&
605610 (entity .getRunId () == 1002345678920L ) &&
606611 (entity .getStartTime () == 1425016501034L ) &&
607- (entity .getMetrics ().size () == 1 )));
612+ (entity .getMetrics ().size () == 1 )),
613+ "Id, run id or start time does not match." );
608614 }
609615
610616 // fields as CONFIGS will lead to a HTTP 400 as it makes no sense for
@@ -1999,11 +2005,12 @@ public void testGetFlowRunApps() throws Exception {
19992005 assertNotNull (entities );
20002006 assertEquals (2 , entities .size ());
20012007 for (TimelineEntity entity : entities ) {
2002- assertTrue ("Unexpected app in result" ,
2008+ assertTrue (
20032009 (entity .getId ().equals ("application_1111111111_1111" ) &&
20042010 entity .getMetrics ().size () == 3 ) ||
20052011 (entity .getId ().equals ("application_1111111111_2222" ) &&
2006- entity .getMetrics ().size () == 1 ));
2012+ entity .getMetrics ().size () == 1 ),
2013+ "Unexpected app in result" );
20072014 for (TimelineMetric metric : entity .getMetrics ()) {
20082015 assertEquals (TimelineMetric .Type .SINGLE_VALUE , metric .getType ());
20092016 assertEquals (1 , metric .getValues ().size ());
@@ -2018,11 +2025,12 @@ public void testGetFlowRunApps() throws Exception {
20182025 assertNotNull (entities );
20192026 assertEquals (2 , entities .size ());
20202027 for (TimelineEntity entity : entities ) {
2021- assertTrue ("Unexpected app in result" ,
2028+ assertTrue (
20222029 (entity .getId ().equals ("application_1111111111_1111" ) &&
20232030 entity .getMetrics ().size () == 3 ) ||
20242031 (entity .getId ().equals ("application_1111111111_2222" ) &&
2025- entity .getMetrics ().size () == 1 ));
2032+ entity .getMetrics ().size () == 1 ),
2033+ "Unexpected app in result" );
20262034 for (TimelineMetric metric : entity .getMetrics ()) {
20272035 assertTrue (metric .getValues ().size () <= 2 );
20282036 assertEquals (TimelineMetric .Type .TIME_SERIES , metric .getType ());
@@ -2062,15 +2070,16 @@ public void testGetFlowApps() throws Exception {
20622070 assertNotNull (entities );
20632071 assertEquals (3 , entities .size ());
20642072 for (TimelineEntity entity : entities ) {
2065- assertTrue ("Unexpected app in result" ,
2073+ assertTrue (
20662074 (entity .getId ().equals ("application_1111111111_1111" ) &&
20672075 entity .getConfigs ().size () == 1 &&
20682076 entity .getConfigs ().equals (ImmutableMap .of ("cfg2" , "value1" ))) ||
20692077 (entity .getId ().equals ("application_1111111111_2222" ) &&
20702078 entity .getConfigs ().size () == 1 &&
20712079 entity .getConfigs ().equals (ImmutableMap .of ("cfg1" , "value1" ))) ||
20722080 (entity .getId ().equals ("application_1111111111_2224" ) &&
2073- entity .getConfigs ().size () == 0 ));
2081+ entity .getConfigs ().size () == 0 ),
2082+ "Unexpected app in result" );
20742083 for (TimelineMetric metric : entity .getMetrics ()) {
20752084 if (entity .getId ().equals ("application_1111111111_1111" )) {
20762085 TimelineMetric m1 = newMetric (TimelineMetric .Type .SINGLE_VALUE ,
@@ -2100,15 +2109,16 @@ public void testGetFlowApps() throws Exception {
21002109 assertNotNull (entities );
21012110 assertEquals (3 , entities .size ());
21022111 for (TimelineEntity entity : entities ) {
2103- assertTrue ("Unexpected app in result" ,
2112+ assertTrue (
21042113 (entity .getId ().equals ("application_1111111111_1111" ) &&
21052114 entity .getConfigs ().size () == 1 &&
21062115 entity .getConfigs ().equals (ImmutableMap .of ("cfg2" , "value1" ))) ||
21072116 (entity .getId ().equals ("application_1111111111_2222" ) &&
21082117 entity .getConfigs ().size () == 1 &&
21092118 entity .getConfigs ().equals (ImmutableMap .of ("cfg1" , "value1" ))) ||
21102119 (entity .getId ().equals ("application_1111111111_2224" ) &&
2111- entity .getConfigs ().size () == 0 ));
2120+ entity .getConfigs ().size () == 0 ),
2121+ "Unexpected app in result" );
21122122 for (TimelineMetric metric : entity .getMetrics ()) {
21132123 if (entity .getId ().equals ("application_1111111111_1111" )) {
21142124 TimelineMetric m1 = newMetric (TimelineMetric .Type .TIME_SERIES ,
@@ -2167,8 +2177,9 @@ public void testGetFlowAppsFilters() throws Exception {
21672177 resp .readEntity (new GenericType <Set <TimelineEntity >>(){});
21682178 assertNotNull (entities );
21692179 assertEquals (1 , entities .size ());
2170- assertTrue ("Unexpected app in result" , entities .contains (
2171- newEntity (entityType , "application_1111111111_1111" )));
2180+ assertTrue (entities .contains (
2181+ newEntity (entityType , "application_1111111111_1111" )),
2182+ "Unexpected app in result" );
21722183
21732184 uri = URI .create ("http://localhost:" + getServerPort () + "/ws/v2/" +
21742185 "timeline/clusters/cluster1/users/user1/flows/flow_name/apps?" +
@@ -2177,8 +2188,9 @@ public void testGetFlowAppsFilters() throws Exception {
21772188 entities = resp .readEntity (new GenericType <Set <TimelineEntity >>(){});
21782189 assertNotNull (entities );
21792190 assertEquals (1 , entities .size ());
2180- assertTrue ("Unexpected app in result" , entities .contains (
2181- newEntity (entityType , "application_1111111111_1111" )));
2191+ assertTrue (entities .contains (
2192+ newEntity (entityType , "application_1111111111_1111" )),
2193+ "Unexpected app in result" );
21822194
21832195 uri = URI .create ("http://localhost:" + getServerPort () + "/ws/v2/" +
21842196 "timeline/clusters/cluster1/users/user1/flows/flow_name/apps?" +
@@ -2187,8 +2199,9 @@ public void testGetFlowAppsFilters() throws Exception {
21872199 entities = resp .readEntity (new GenericType <Set <TimelineEntity >>(){});
21882200 assertNotNull (entities );
21892201 assertEquals (1 , entities .size ());
2190- assertTrue ("Unexpected app in result" , entities .contains (
2191- newEntity (entityType , "application_1111111111_2222" )));
2202+ assertTrue (entities .contains (
2203+ newEntity (entityType , "application_1111111111_2222" )),
2204+ "Unexpected app in result" );
21922205 } finally {
21932206 client .close ();
21942207 }
0 commit comments