Skip to content

Commit 32fd329

Browse files
committed
core: Rename withCredentials to withCallCredentials on CallOptions
It was withCallCredentials on the stub to avoid confusion with channel credentials (which don't exist in Java at this time, but do in other languages), and having the method names be different doesn't add value.
1 parent 8f78b4d commit 32fd329

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

core/src/main/java/io/grpc/CallOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public CallOptions withAuthority(@Nullable String authority) {
9797
* Returns a new {@code CallOptions} with the given call credentials.
9898
*/
9999
@ExperimentalApi("https//github.com/grpc/grpc-java/issues/1914")
100-
public CallOptions withCredentials(@Nullable CallCredentials credentials) {
100+
public CallOptions withCallCredentials(@Nullable CallCredentials credentials) {
101101
CallOptions newOptions = new CallOptions(this);
102102
newOptions.credentials = credentials;
103103
return newOptions;

core/src/test/java/io/grpc/CallOptionsTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class CallOptionsTest {
6868
.withAuthority(sampleAuthority)
6969
.withDeadline(sampleDeadline)
7070
.withAffinity(sampleAffinity)
71-
.withCredentials(sampleCreds)
71+
.withCallCredentials(sampleCreds)
7272
.withCompression(sampleCompressor)
7373
.withWaitForReady()
7474
.withExecutor(directExecutor())
@@ -120,7 +120,8 @@ public void noStrayModifications() {
120120
.isTrue();
121121
assertThat(
122122
equal(allSet,
123-
allSet.withCredentials(mock(CallCredentials.class)).withCredentials(sampleCreds)))
123+
allSet.withCallCredentials(mock(CallCredentials.class))
124+
.withCallCredentials(sampleCreds)))
124125
.isTrue();
125126
}
126127

@@ -165,7 +166,7 @@ public void toStringMatches_noDeadline_default() {
165166
String actual = allSet
166167
.withDeadline(null)
167168
.withExecutor(new SerializingExecutor(directExecutor()))
168-
.withCredentials(null)
169+
.withCallCredentials(null)
169170
.toString();
170171

171172
assertThat(actual).isEqualTo(expected);

core/src/test/java/io/grpc/internal/CallCredentialsApplyingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void setUp() {
120120
mockTransportFactory, mockExecutor);
121121
transport = (ForwardingConnectionClientTransport) transportFactory.newClientTransport(
122122
address, authority, userAgent);
123-
callOptions = CallOptions.DEFAULT.withCredentials(mockCreds);
123+
callOptions = CallOptions.DEFAULT.withCallCredentials(mockCreds);
124124
verify(mockTransportFactory).newClientTransport(address, authority, userAgent);
125125
assertSame(mockTransport, transport.delegate());
126126
}
@@ -270,7 +270,7 @@ public void fail_delayed() {
270270

271271
@Test
272272
public void noCreds() {
273-
callOptions = callOptions.withCredentials(null);
273+
callOptions = callOptions.withCallCredentials(null);
274274
ClientStream stream = transport.newStream(method, origHeaders, callOptions);
275275

276276
verify(mockTransport).newStream(method, origHeaders, callOptions);

stub/src/main/java/io/grpc/stub/AbstractStub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,6 @@ public final S withInterceptors(ClientInterceptor... interceptors) {
179179
*/
180180
@ExperimentalApi("https//github.com/grpc/grpc-java/issues/1914")
181181
public final S withCallCredentials(CallCredentials credentials) {
182-
return build(channel, callOptions.withCredentials(credentials));
182+
return build(channel, callOptions.withCallCredentials(credentials));
183183
}
184184
}

0 commit comments

Comments
 (0)