diff --git a/xds/src/main/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProvider.java b/xds/src/main/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProvider.java index c03829766f..18fc27b946 100644 --- a/xds/src/main/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProvider.java +++ b/xds/src/main/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProvider.java @@ -31,8 +31,9 @@ import com.google.auth.oauth2.GoogleCredentials; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.protobuf.Duration; -import google.security.meshca.v1.MeshCertificateServiceGrpc; -import google.security.meshca.v1.Meshca; +import com.google.security.meshca.v1.MeshCertificateRequest; +import com.google.security.meshca.v1.MeshCertificateResponse; +import com.google.security.meshca.v1.MeshCertificateServiceGrpc; import io.grpc.CallOptions; import io.grpc.Channel; import io.grpc.ClientCall; @@ -213,8 +214,8 @@ final class MeshCaCertificateProvider extends CertificateProvider { String reqId, Duration duration, String csr) { - Meshca.MeshCertificateRequest request = - Meshca.MeshCertificateRequest.newBuilder() + MeshCertificateRequest request = + MeshCertificateRequest.newBuilder() .setValidity(duration) .setCsr(csr) .setRequestId(reqId) @@ -224,7 +225,7 @@ final class MeshCaCertificateProvider extends CertificateProvider { Throwable lastException = null; for (int i = 0; i <= maxRetryAttempts; i++) { try { - Meshca.MeshCertificateResponse response = + MeshCertificateResponse response = stub.withDeadlineAfter(rpcTimeoutMillis, TimeUnit.MILLISECONDS) .createCertificate(request); return getX509CertificatesFromResponse(response); @@ -326,7 +327,7 @@ final class MeshCaCertificateProvider extends CertificateProvider { } private List getX509CertificatesFromResponse( - Meshca.MeshCertificateResponse response) throws CertificateException, IOException { + MeshCertificateResponse response) throws CertificateException, IOException { List certChain = response.getCertChainList(); List x509Chain = new ArrayList<>(certChain.size()); for (String certString : certChain) { diff --git a/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderTest.java b/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderTest.java index 7117b8cccb..7f1f04a7f9 100644 --- a/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderTest.java @@ -37,8 +37,9 @@ import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.MoreExecutors; -import google.security.meshca.v1.MeshCertificateServiceGrpc; -import google.security.meshca.v1.Meshca; +import com.google.security.meshca.v1.MeshCertificateRequest; +import com.google.security.meshca.v1.MeshCertificateResponse; +import com.google.security.meshca.v1.MeshCertificateServiceGrpc; import io.grpc.Context; import io.grpc.ManagedChannel; import io.grpc.Metadata; @@ -52,6 +53,7 @@ import io.grpc.inprocess.InProcessChannelBuilder; import io.grpc.inprocess.InProcessServerBuilder; import io.grpc.internal.BackoffPolicy; import io.grpc.internal.TimeProvider; +import io.grpc.stub.StreamObserver; import io.grpc.testing.GrpcCleanupRule; import io.grpc.xds.internal.certprovider.CertificateProvider.DistributorWatcher; import io.grpc.xds.internal.sds.CommonTlsContextTestsUtil; @@ -149,7 +151,7 @@ public class MeshCaCertificateProviderTest { } } - private final Queue receivedRequests = new ArrayDeque<>(); + private final Queue receivedRequests = new ArrayDeque<>(); private final Queue receivedStsCreds = new ArrayDeque<>(); private final Queue receivedZoneValues = new ArrayDeque<>(); private final Queue responsesToSend = new ArrayDeque<>(); @@ -189,9 +191,8 @@ public class MeshCaCertificateProviderTest { @Override public void createCertificate( - google.security.meshca.v1.Meshca.MeshCertificateRequest request, - io.grpc.stub.StreamObserver - responseObserver) { + MeshCertificateRequest request, + StreamObserver responseObserver) { assertThat(callEnded.get()).isTrue(); // ensure previous call was ended callEnded.set(false); Context.current() @@ -209,8 +210,8 @@ public class MeshCaCertificateProviderTest { responseObserver.onError(response.getThrowable()); } else if (response instanceof ResponseList) { List certChainInResponse = response.getList(); - Meshca.MeshCertificateResponse responseToSend = - Meshca.MeshCertificateResponse.newBuilder() + MeshCertificateResponse responseToSend = + MeshCertificateResponse.newBuilder() .addAllCertChain(certChainInResponse) .build(); responseObserver.onNext(responseToSend); @@ -331,7 +332,7 @@ public class MeshCaCertificateProviderTest { .when(timeService) .schedule(any(Runnable.class), any(Long.TYPE), eq(TimeUnit.SECONDS)); provider.refreshCertificate(); - Meshca.MeshCertificateRequest receivedReq = receivedRequests.poll(); + MeshCertificateRequest receivedReq = receivedRequests.poll(); assertThat(receivedReq.getValidity().getSeconds()).isEqualTo(TimeUnit.HOURS.toSeconds(9L)); // cannot decode CSR: just check the PEM format delimiters String csr = receivedReq.getCsr();