|
16 | 16 |
|
17 | 17 | package com.google.cloud.pubsub.spi.v1; |
18 | 18 |
|
| 19 | +import static org.junit.Assert.*; |
| 20 | + |
19 | 21 | import com.google.api.core.ApiFuture; |
20 | 22 | import com.google.api.gax.batching.BatchingSettings; |
21 | 23 | import com.google.api.gax.batching.FlowControlSettings; |
22 | 24 | import com.google.api.gax.batching.FlowController.LimitExceededBehavior; |
| 25 | +import com.google.api.gax.core.CredentialsProvider; |
23 | 26 | import com.google.api.gax.grpc.ChannelProvider; |
24 | 27 | import com.google.api.gax.grpc.ExecutorProvider; |
25 | 28 | import com.google.api.gax.grpc.FixedExecutorProvider; |
26 | 29 | import com.google.api.gax.grpc.InstantiatingExecutorProvider; |
| 30 | +import com.google.auth.Credentials; |
27 | 31 | import com.google.cloud.pubsub.spi.v1.Publisher.Builder; |
28 | 32 | import com.google.protobuf.ByteString; |
29 | 33 | import com.google.pubsub.v1.PublishResponse; |
|
35 | 39 | import io.grpc.inprocess.InProcessChannelBuilder; |
36 | 40 | import io.grpc.inprocess.InProcessServerBuilder; |
37 | 41 | import io.grpc.internal.ServerImpl; |
| 42 | +import java.util.concurrent.ExecutionException; |
| 43 | +import java.util.concurrent.Executor; |
38 | 44 | import org.junit.After; |
39 | 45 | import org.junit.Before; |
40 | 46 | import org.junit.Test; |
41 | 47 | import org.junit.runner.RunWith; |
42 | 48 | import org.junit.runners.JUnit4; |
43 | 49 | import org.threeten.bp.Duration; |
44 | 50 |
|
45 | | -import java.util.concurrent.ExecutionException; |
46 | | -import java.util.concurrent.Executor; |
47 | | - |
48 | | -import static org.junit.Assert.*; |
49 | | - |
50 | 51 | @RunWith(JUnit4.class) |
51 | 52 | public class PublisherImplTest { |
52 | 53 |
|
@@ -78,6 +79,16 @@ public ManagedChannel getChannel(Executor executor) { |
78 | 79 | } |
79 | 80 | }; |
80 | 81 |
|
| 82 | + // Gax declares a similar type, which can be used after gax is upgraded. |
| 83 | + @Deprecated |
| 84 | + private static final CredentialsProvider NO_CREDENTIALS_PROVIDER = |
| 85 | + new CredentialsProvider() { |
| 86 | + @Override |
| 87 | + public Credentials getCredentials() { |
| 88 | + return null; |
| 89 | + } |
| 90 | + }; |
| 91 | + |
81 | 92 | private FakeScheduledExecutorService fakeExecutor; |
82 | 93 |
|
83 | 94 | private FakePublisherServiceImpl testPublisherServiceImpl; |
@@ -427,6 +438,7 @@ public void testPublisherGetters() throws Exception { |
427 | 438 | .setDelayThreshold(Duration.ofMillis(11)) |
428 | 439 | .setElementCountThreshold(12L) |
429 | 440 | .build()); |
| 441 | + builder.setCredentialsProvider(NO_CREDENTIALS_PROVIDER); |
430 | 442 | builder.setFlowControlSettings( |
431 | 443 | FlowControlSettings.newBuilder() |
432 | 444 | .setMaxOutstandingRequestBytes(13) |
@@ -661,6 +673,7 @@ private Builder getTestPublisherBuilder() { |
661 | 673 | return Publisher.defaultBuilder(TEST_TOPIC) |
662 | 674 | .setExecutorProvider(FixedExecutorProvider.create(fakeExecutor)) |
663 | 675 | .setChannelProvider(TEST_CHANNEL_PROVIDER) |
| 676 | + .setCredentialsProvider(NO_CREDENTIALS_PROVIDER) |
664 | 677 | .setLongRandom( |
665 | 678 | new Publisher.LongRandom() { |
666 | 679 | @Override |
|
0 commit comments