25
25
import org .apache .hadoop .metrics2 .sink .timeline .TimelineMetrics ;
26
26
import org .apache .ambari .metrics .core .timeline .TestTimelineMetricStore ;
27
27
import org .apache .ambari .metrics .core .timeline .TimelineMetricStore ;
28
+ import org .apache .hadoop .metrics2 .sink .timeline .TimelineMetrics ;
28
29
import org .apache .hadoop .yarn .webapp .GenericExceptionHandler ;
29
30
import org .apache .hadoop .yarn .webapp .YarnJacksonJaxbJsonProvider ;
31
+
30
32
import org .junit .Test ;
31
33
32
34
import com .google .inject .Guice ;
@@ -75,24 +77,24 @@ protected Injector getInjector() {
75
77
76
78
public TestTimelineWebServices () {
77
79
super (new WebAppDescriptor .Builder (
78
- "org.apache.ambari.metrics.webapp" )
79
- .contextListenerClass (GuiceServletConfig .class )
80
- .filterClass (com .google .inject .servlet .GuiceFilter .class )
81
- .contextPath ("jersey-guice-filter" )
82
- .servletPath ("/" )
83
- .clientConfig (new DefaultClientConfig (YarnJacksonJaxbJsonProvider .class ))
84
- .build ());
80
+ "org.apache.ambari.metrics.webapp" )
81
+ .contextListenerClass (GuiceServletConfig .class )
82
+ .filterClass (com .google .inject .servlet .GuiceFilter .class )
83
+ .contextPath ("jersey-guice-filter" )
84
+ .servletPath ("/" )
85
+ .clientConfig (new DefaultClientConfig (YarnJacksonJaxbJsonProvider .class ))
86
+ .build ());
85
87
}
86
88
87
89
@ Test
88
90
public void testAbout () throws Exception {
89
91
WebResource r = resource ();
90
92
ClientResponse response = r .path ("ws" ).path ("v1" ).path ("timeline" )
91
- .accept (MediaType .APPLICATION_JSON )
92
- .get (ClientResponse .class );
93
+ .accept (MediaType .APPLICATION_JSON )
94
+ .get (ClientResponse .class );
93
95
assertEquals (MediaType .APPLICATION_JSON_TYPE , response .getType ());
94
96
TimelineWebServices .AboutInfo about =
95
- response .getEntity (TimelineWebServices .AboutInfo .class );
97
+ response .getEntity (TimelineWebServices .AboutInfo .class );
96
98
Assert .assertNotNull (about );
97
99
Assert .assertEquals ("AMS API" , about .getAbout ());
98
100
}
@@ -109,9 +111,9 @@ private static void verifyMetrics(TimelineMetrics metrics) {
109
111
public void testGetMetrics () throws Exception {
110
112
WebResource r = resource ();
111
113
ClientResponse response = r .path ("ws" ).path ("v1" ).path ("timeline" )
112
- .path ("metrics" ).queryParam ("metricNames" , "cpu_user" ).queryParam ("precision" , "seconds" )
113
- .accept (MediaType .APPLICATION_JSON )
114
- .get (ClientResponse .class );
114
+ .path ("metrics" ).queryParam ("metricNames" , "cpu_user" ).queryParam ("precision" , "seconds" )
115
+ .accept (MediaType .APPLICATION_JSON )
116
+ .get (ClientResponse .class );
115
117
assertEquals (MediaType .APPLICATION_JSON_TYPE , response .getType ());
116
118
verifyMetrics (response .getEntity (TimelineMetrics .class ));
117
119
}
0 commit comments