3030
3131package com .google .showcase .v1beta1 .it ;
3232
33+ import static com .google .common .truth .Truth .assertThat ;
34+ import static java .nio .charset .StandardCharsets .UTF_8 ;
35+ import static org .junit .Assert .assertThrows ;
36+
3337import com .google .api .client .http .HttpTransport ;
3438import com .google .api .gax .core .NoCredentialsProvider ;
3539import com .google .api .gax .retrying .RetrySettings ;
5559import io .opentelemetry .sdk .metrics .SdkMeterProvider ;
5660import io .opentelemetry .sdk .metrics .data .MetricData ;
5761import io .opentelemetry .sdk .testing .exporter .InMemoryMetricReader ;
58- import org .junit .jupiter .api .AfterEach ;
59- import org .junit .jupiter .api .BeforeEach ;
60- import org .junit .jupiter .api .Test ;
61-
6262import java .io .ByteArrayInputStream ;
6363import java .io .InputStream ;
6464import java .time .Duration ;
6565import java .util .Collection ;
66-
67- import static com .google .common .truth .Truth .assertThat ;
68- import static java .nio .charset .StandardCharsets .UTF_8 ;
69- import static org .junit .Assert .assertThrows ;
66+ import org .junit .jupiter .api .AfterEach ;
67+ import org .junit .jupiter .api .BeforeEach ;
68+ import org .junit .jupiter .api .Test ;
7069
7170class ITOtelGoldenMetrics {
7271 private static final String SHOWCASE_SERVER_ADDRESS = "localhost" ;
@@ -501,7 +500,8 @@ void testMetrics_retryShouldResultInOneMetric_grpc() throws Exception {
501500 .setMaxAttempts (3 )
502501 .build ();
503502
504- java .util .concurrent .atomic .AtomicInteger attemptCount = new java .util .concurrent .atomic .AtomicInteger (0 );
503+ java .util .concurrent .atomic .AtomicInteger attemptCount =
504+ new java .util .concurrent .atomic .AtomicInteger (0 );
505505
506506 ClientInterceptor interceptor =
507507 new ClientInterceptor () {
@@ -534,7 +534,8 @@ public void sendMessage(ReqT message) {}
534534 }
535535 };
536536
537- java .util .Set <StatusCode .Code > retryableCodes = java .util .Collections .singleton (StatusCode .Code .UNAVAILABLE );
537+ java .util .Set <StatusCode .Code > retryableCodes =
538+ java .util .Collections .singleton (StatusCode .Code .UNAVAILABLE );
538539
539540 try (EchoClient client =
540541 TestClientInitializer .createGrpcEchoClientOpentelemetry (
@@ -579,7 +580,8 @@ void testMetrics_retryShouldResultInOneMetric_httpjson() throws Exception {
579580 .setMaxAttempts (3 )
580581 .build ();
581582
582- java .util .concurrent .atomic .AtomicInteger requestCount = new java .util .concurrent .atomic .AtomicInteger (0 );
583+ java .util .concurrent .atomic .AtomicInteger requestCount =
584+ new java .util .concurrent .atomic .AtomicInteger (0 );
583585
584586 HttpTransport mockTransport =
585587 new HttpTransport () {
@@ -601,73 +603,111 @@ public InputStream getContent() {
601603 }
602604
603605 @ Override
604- public String getContentEncoding () { return null ; }
606+ public String getContentEncoding () {
607+ return null ;
608+ }
605609
606610 @ Override
607- public long getContentLength () { return 2 ; }
611+ public long getContentLength () {
612+ return 2 ;
613+ }
608614
609615 @ Override
610- public String getContentType () { return "application/json" ; }
616+ public String getContentType () {
617+ return "application/json" ;
618+ }
611619
612620 @ Override
613- public String getStatusLine () { return "HTTP/1.1 503 Service Unavailable" ; }
621+ public String getStatusLine () {
622+ return "HTTP/1.1 503 Service Unavailable" ;
623+ }
614624
615625 @ Override
616- public int getStatusCode () { return 503 ; }
626+ public int getStatusCode () {
627+ return 503 ;
628+ }
617629
618630 @ Override
619- public String getReasonPhrase () { return "Service Unavailable" ; }
631+ public String getReasonPhrase () {
632+ return "Service Unavailable" ;
633+ }
620634
621635 @ Override
622- public int getHeaderCount () { return 0 ; }
636+ public int getHeaderCount () {
637+ return 0 ;
638+ }
623639
624640 @ Override
625- public String getHeaderName (int index ) { return null ; }
641+ public String getHeaderName (int index ) {
642+ return null ;
643+ }
626644
627645 @ Override
628- public String getHeaderValue (int index ) { return null ; }
646+ public String getHeaderValue (int index ) {
647+ return null ;
648+ }
629649 };
630650 } else {
631651 return new com .google .api .client .http .LowLevelHttpResponse () {
632652 @ Override
633653 public InputStream getContent () {
634- return new ByteArrayInputStream ("{\" content\" :\" metrics-test\" }" .getBytes (UTF_8 ));
654+ return new ByteArrayInputStream (
655+ "{\" content\" :\" metrics-test\" }" .getBytes (UTF_8 ));
635656 }
636657
637658 @ Override
638- public String getContentEncoding () { return null ; }
659+ public String getContentEncoding () {
660+ return null ;
661+ }
639662
640663 @ Override
641- public long getContentLength () { return 24 ; }
664+ public long getContentLength () {
665+ return 24 ;
666+ }
642667
643668 @ Override
644- public String getContentType () { return "application/json" ; }
669+ public String getContentType () {
670+ return "application/json" ;
671+ }
645672
646673 @ Override
647- public String getStatusLine () { return "HTTP/1.1 200 OK" ; }
674+ public String getStatusLine () {
675+ return "HTTP/1.1 200 OK" ;
676+ }
648677
649678 @ Override
650- public int getStatusCode () { return 200 ; }
679+ public int getStatusCode () {
680+ return 200 ;
681+ }
651682
652683 @ Override
653- public String getReasonPhrase () { return "OK" ; }
684+ public String getReasonPhrase () {
685+ return "OK" ;
686+ }
654687
655688 @ Override
656- public int getHeaderCount () { return 0 ; }
689+ public int getHeaderCount () {
690+ return 0 ;
691+ }
657692
658693 @ Override
659- public String getHeaderName (int index ) { return null ; }
694+ public String getHeaderName (int index ) {
695+ return null ;
696+ }
660697
661698 @ Override
662- public String getHeaderValue (int index ) { return null ; }
699+ public String getHeaderValue (int index ) {
700+ return null ;
701+ }
663702 };
664703 }
665704 }
666705 };
667706 }
668707 };
669708
670- java .util .Set <StatusCode .Code > retryableCodes = java .util .Collections .singleton (StatusCode .Code .UNAVAILABLE );
709+ java .util .Set <StatusCode .Code > retryableCodes =
710+ java .util .Collections .singleton (StatusCode .Code .UNAVAILABLE );
671711
672712 try (EchoClient client =
673713 TestClientInitializer .createHttpJsonEchoClientOpentelemetry (
0 commit comments