Skip to content

Commit

Permalink
xds: Avoid default locale and reset()
Browse files Browse the repository at this point in the history
Found via linter
  • Loading branch information
ejona86 committed May 8, 2023
1 parent 0847e2b commit a99c8d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion xds/src/main/java/io/grpc/xds/RoutingUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private static boolean matchPath(PathMatcher pathMatcher, String fullMethodName)
} else if (pathMatcher.prefix() != null) {
return pathMatcher.caseSensitive()
? fullMethodName.startsWith(pathMatcher.prefix())
: fullMethodName.toLowerCase().startsWith(pathMatcher.prefix().toLowerCase());
: fullMethodName.toLowerCase(Locale.US).startsWith(
pathMatcher.prefix().toLowerCase(Locale.US));
}
return pathMatcher.regEx().matches(fullMethodName);
}
Expand Down
4 changes: 2 additions & 2 deletions xds/src/test/java/io/grpc/xds/orca/OrcaServiceImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -115,7 +116,6 @@ public void testReportingLifeCycle() {
}

@Test
@SuppressWarnings("unchecked")
public void testReportingLifeCycle_serverShutdown() {
ClientCall<OrcaLoadReportRequest, OrcaLoadReport> call = channel.newCall(
OpenRcaServiceGrpc.getStreamCoreMetricsMethod(), CallOptions.DEFAULT);
Expand All @@ -128,7 +128,7 @@ public void testReportingLifeCycle_serverShutdown() {
OrcaLoadReport expect = OrcaLoadReport.newBuilder().putUtilization("buffer", 0.2).build();
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(1);
verify(listener).onMessage(eq(expect));
reset(listener);
verify(listener, never()).onClose(any(), any());
oobServer.shutdownNow();
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);
Expand Down

0 comments on commit a99c8d1

Please sign in to comment.