all: fix lint warnings and errors (#7150)

This commit is contained in:
Jihun Cho 2020-06-23 10:10:42 -07:00 committed by GitHub
parent 8fb6591850
commit df54162ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -70,7 +70,7 @@ public class RetryingHelloWorldClient {
.usePlaintext();
if (enableRetries) {
Map<String, ?> serviceConfig = getRetryingServiceConfig();
logger.info("Client started with retrying configuration: " + serviceConfig.toString());
logger.info("Client started with retrying configuration: " + serviceConfig);
channelBuilder.defaultServiceConfig(serviceConfig).enableRetry();
}
channel = channelBuilder.build();

View File

@ -35,8 +35,8 @@ import java.util.logging.Logger;
*/
public class RetryingHelloWorldServer {
private static final Logger logger = Logger.getLogger(RetryingHelloWorldServer.class.getName());
private static final float unavailablePercentage = 0.5F;
private static Random random = new Random();
private static final float UNAVAILABLE_PERCENTAGE = 0.5F;
private static final Random random = new Random();
private Server server;
@ -50,7 +50,7 @@ public class RetryingHelloWorldServer {
logger.info("Server started, listening on " + port);
DecimalFormat df = new DecimalFormat("#%");
logger.info("Responding as UNAVAILABLE to " + df.format(unavailablePercentage) + " requests");
logger.info("Responding as UNAVAILABLE to " + df.format(UNAVAILABLE_PERCENTAGE) + " requests");
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
@ -96,7 +96,7 @@ public class RetryingHelloWorldServer {
@Override
public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
int count = retryCounter.incrementAndGet();
if (random.nextFloat() < unavailablePercentage) {
if (random.nextFloat() < UNAVAILABLE_PERCENTAGE) {
logger.info("Returning stubbed UNAVAILABLE error. count: " + count);
responseObserver.onError(Status.UNAVAILABLE
.withDescription("Greeter temporarily unavailable...").asRuntimeException());

View File

@ -41,7 +41,7 @@ public final class EnvoyServerProtoData {
public abstract static class BaseTlsContext {
@Nullable protected final CommonTlsContext commonTlsContext;
public BaseTlsContext(@Nullable CommonTlsContext commonTlsContext) {
protected BaseTlsContext(@Nullable CommonTlsContext commonTlsContext) {
this.commonTlsContext = commonTlsContext;
}
@ -54,7 +54,7 @@ public final class EnvoyServerProtoData {
if (this == o) {
return true;
}
if (o == null || !(o instanceof BaseTlsContext)) {
if (!(o instanceof BaseTlsContext)) {
return false;
}
BaseTlsContext that = (BaseTlsContext) o;
@ -63,7 +63,7 @@ public final class EnvoyServerProtoData {
@Override
public int hashCode() {
return Objects.hash(commonTlsContext);
return Objects.hashCode(commonTlsContext);
}
}

View File

@ -31,8 +31,11 @@ import java.util.Map;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Tests for {@link RouteMatch}. */
@RunWith(JUnit4.class)
public class RouteMatchTest {
private final Map<String, Set<String>> headers = new HashMap<>();