mirror of https://github.com/grpc/grpc-java.git
xds: verify and fix presubmit lints errors (#9036)
This commit is contained in:
parent
40c929e39f
commit
7572afb32b
|
|
@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.ExperimentalApi;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -30,7 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* for periodic load reports. A user should use the public set-APIs to update the server machine's
|
||||
* utilization metrics data.
|
||||
*/
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/9006")
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9006")
|
||||
public final class OrcaOobService {
|
||||
/**
|
||||
* Empty or invalid (non-positive) minInterval config in will be treated to this default value.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ final class OrcaServiceImpl extends OpenRcaServiceGrpc.OpenRcaServiceImplBase {
|
|||
}
|
||||
|
||||
private final class OrcaClient implements Runnable {
|
||||
final OrcaLoadReportRequest request;
|
||||
final ServerCallStreamObserver<OrcaLoadReport> responseObserver;
|
||||
SynchronizationContext.ScheduledHandle periodicReportTimer;
|
||||
final long reportIntervalNanos;
|
||||
|
|
@ -72,9 +71,8 @@ final class OrcaServiceImpl extends OpenRcaServiceGrpc.OpenRcaServiceImplBase {
|
|||
});
|
||||
|
||||
OrcaClient(OrcaLoadReportRequest request, StreamObserver<OrcaLoadReport> responseObserver) {
|
||||
this.request = checkNotNull(request);
|
||||
this.reportIntervalNanos = Math.max(Durations.toNanos(request.getReportInterval()),
|
||||
minReportIntervalNanos);
|
||||
this.reportIntervalNanos = Math.max(Durations.toNanos(
|
||||
checkNotNull(request).getReportInterval()), minReportIntervalNanos);
|
||||
this.responseObserver = (ServerCallStreamObserver<OrcaLoadReport>) responseObserver;
|
||||
this.responseObserver.setOnCancelHandler(new Runnable() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import io.grpc.inprocess.InProcessServerBuilder;
|
|||
import io.grpc.internal.FakeClock;
|
||||
import io.grpc.testing.GrpcCleanupRule;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -53,12 +52,15 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.JUnit4;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class OrcaServiceImplTest {
|
||||
@Rule
|
||||
public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule();
|
||||
@Rule
|
||||
public final MockitoRule mocks = MockitoJUnit.rule();
|
||||
private ManagedChannel channel;
|
||||
private Server oobServer;
|
||||
private final FakeClock fakeClock = new FakeClock();
|
||||
|
|
@ -69,7 +71,6 @@ public class OrcaServiceImplTest {
|
|||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
defaultTestService = new OrcaOobService(1, TimeUnit.SECONDS,
|
||||
fakeClock.getScheduledExecutorService());
|
||||
startServerAndGetChannel(defaultTestService.getService());
|
||||
|
|
@ -234,7 +235,7 @@ public class OrcaServiceImplTest {
|
|||
|
||||
@Test
|
||||
public void testApis() throws Exception {
|
||||
Map<String, Double> firstUtilization = ImmutableMap.of("util", 0.1);
|
||||
ImmutableMap<String, Double> firstUtilization = ImmutableMap.of("util", 0.1);
|
||||
OrcaLoadReport goldenReport = OrcaLoadReport.newBuilder()
|
||||
.setCpuUtilization(random.nextDouble())
|
||||
.setMemUtilization(random.nextDouble())
|
||||
|
|
|
|||
Loading…
Reference in New Issue