|
1 | | -///* |
| 1 | +/// * |
2 | 2 | // * Copyright 2023 Google LLC |
3 | 3 | // * |
4 | 4 | // * Licensed under the Apache License, Version 2.0 (the "License"); |
|
14 | 14 | // * limitations under the License. |
15 | 15 | // */ |
16 | 16 | // |
17 | | -//package com.google.showcase.v1beta1.it; |
18 | | -// |
19 | | -//import static com.google.common.truth.Truth.assertThat; |
20 | | -//import static com.google.common.truth.Truth.assertWithMessage; |
21 | | -//import static org.junit.jupiter.api.Assertions.assertEquals; |
22 | | -//import static org.junit.jupiter.api.Assertions.assertNotSame; |
23 | | -//import static org.junit.jupiter.api.Assertions.assertThrows; |
24 | | -//import static org.junit.jupiter.api.Assertions.assertTrue; |
25 | | -// |
26 | | -//import com.google.api.client.json.GenericJson; |
27 | | -//import com.google.api.client.json.JsonFactory; |
28 | | -//import com.google.api.client.json.gson.GsonFactory; |
29 | | -//import com.google.api.gax.core.FixedCredentialsProvider; |
30 | | -//import com.google.api.gax.rpc.ClientContext; |
31 | | -//import com.google.auth.Credentials; |
32 | | -//import com.google.auth.oauth2.GdchCredentials; |
33 | | -//import com.google.auth.oauth2.GdchCredentialsTestUtil; |
34 | | -//import com.google.showcase.v1beta1.EchoClient; |
35 | | -//import com.google.showcase.v1beta1.EchoSettings; |
36 | | -//import com.google.showcase.v1beta1.it.util.InterceptingMockTokenServerTransportFactory; |
37 | | -//import com.google.showcase.v1beta1.it.util.TestClientInitializer; |
38 | | -//import com.google.showcase.v1beta1.stub.EchoStubSettings; |
39 | | -//import java.io.File; |
40 | | -//import java.io.FileWriter; |
41 | | -//import java.io.IOException; |
42 | | -//import java.io.InputStream; |
43 | | -//import java.net.URI; |
44 | | -//import java.nio.file.Files; |
45 | | -//import java.nio.file.Path; |
46 | | -//import java.nio.file.StandardCopyOption; |
47 | | -//import java.util.concurrent.TimeUnit; |
48 | | -//import org.junit.jupiter.api.AfterEach; |
49 | | -//import org.junit.jupiter.api.BeforeEach; |
50 | | -//import org.junit.jupiter.api.Test; |
51 | | -//import org.junit.jupiter.api.io.TempDir; |
52 | | -// |
53 | | -///** |
54 | | -// * Test suite to confirm a client can be instantiated with GDCH credentials. No calls are made since |
| 17 | +// package com.google.showcase.v1beta1.it; |
| 18 | +// |
| 19 | +// import static com.google.common.truth.Truth.assertThat; |
| 20 | +// import static com.google.common.truth.Truth.assertWithMessage; |
| 21 | +// import static org.junit.jupiter.api.Assertions.assertEquals; |
| 22 | +// import static org.junit.jupiter.api.Assertions.assertNotSame; |
| 23 | +// import static org.junit.jupiter.api.Assertions.assertThrows; |
| 24 | +// import static org.junit.jupiter.api.Assertions.assertTrue; |
| 25 | +// |
| 26 | +// import com.google.api.client.json.GenericJson; |
| 27 | +// import com.google.api.client.json.JsonFactory; |
| 28 | +// import com.google.api.client.json.gson.GsonFactory; |
| 29 | +// import com.google.api.gax.core.FixedCredentialsProvider; |
| 30 | +// import com.google.api.gax.rpc.ClientContext; |
| 31 | +// import com.google.auth.Credentials; |
| 32 | +// import com.google.auth.oauth2.GdchCredentials; |
| 33 | +// import com.google.auth.oauth2.GdchCredentialsTestUtil; |
| 34 | +// import com.google.showcase.v1beta1.EchoClient; |
| 35 | +// import com.google.showcase.v1beta1.EchoSettings; |
| 36 | +// import com.google.showcase.v1beta1.it.util.InterceptingMockTokenServerTransportFactory; |
| 37 | +// import com.google.showcase.v1beta1.it.util.TestClientInitializer; |
| 38 | +// import com.google.showcase.v1beta1.stub.EchoStubSettings; |
| 39 | +// import java.io.File; |
| 40 | +// import java.io.FileWriter; |
| 41 | +// import java.io.IOException; |
| 42 | +// import java.io.InputStream; |
| 43 | +// import java.net.URI; |
| 44 | +// import java.nio.file.Files; |
| 45 | +// import java.nio.file.Path; |
| 46 | +// import java.nio.file.StandardCopyOption; |
| 47 | +// import java.util.concurrent.TimeUnit; |
| 48 | +// import org.junit.jupiter.api.AfterEach; |
| 49 | +// import org.junit.jupiter.api.BeforeEach; |
| 50 | +// import org.junit.jupiter.api.Test; |
| 51 | +// import org.junit.jupiter.api.io.TempDir; |
| 52 | +// |
| 53 | +/// ** |
| 54 | +// * Test suite to confirm a client can be instantiated with GDCH credentials. No calls are made |
| 55 | +// since |
55 | 56 | // * it is not feasible to test against real GDCH servers (or replicate an environment) |
56 | 57 | // */ |
57 | | -//class ITGdch { |
| 58 | +// class ITGdch { |
58 | 59 | // |
59 | 60 | // private static final String CA_CERT_FILENAME = "fake_cert.pem"; |
60 | 61 | // private static final String CA_CERT_RESOURCE_PATH = "/" + CA_CERT_FILENAME; |
|
123 | 124 | // } |
124 | 125 | // |
125 | 126 | // /** |
126 | | -// * {@link com.google.api.gax.rpc.ClientContext} will create a new {@link GdchCredentials} with an |
| 127 | +// * {@link com.google.api.gax.rpc.ClientContext} will create a new {@link GdchCredentials} with |
| 128 | +// an |
127 | 129 | // * audience defaulted to the endpoint if the audience is not manually passed. This test confirms |
128 | 130 | // * that a new credential is created from the context and can be refreshed |
129 | 131 | // * |
|
183 | 185 | // // be created without issues |
184 | 186 | // String testAudience = "valid-audience"; |
185 | 187 | // settings = |
186 | | -// settings.toBuilder().setGdchApiAudience(testAudience).setEndpoint("localhost:7469").build(); |
| 188 | +// |
| 189 | +// settings.toBuilder().setGdchApiAudience(testAudience).setEndpoint("localhost:7469").build(); |
187 | 190 | // context = ClientContext.create(settings); |
188 | 191 | // stubSettings = EchoStubSettings.newBuilder(context).build(); |
189 | 192 | // client = EchoClient.create(stubSettings.createStub()); |
|
194 | 197 | // Credentials fromContext = context.getCredentials(); |
195 | 198 | // assertNotSame(fromContext, initialCredentials); |
196 | 199 | // |
197 | | -// // Again, since the initial credentials don't have an audience, we should not be able to refresh |
| 200 | +// // Again, since the initial credentials don't have an audience, we should not be able to |
| 201 | +// refresh |
198 | 202 | // // them |
199 | 203 | // NullPointerException thrownByClientCreds = |
200 | 204 | // assertThrows(NullPointerException.class, () -> initialCredentials.refresh()); |
|
221 | 225 | // GDCH_TOKEN_STRING, |
222 | 226 | // tokenUri); |
223 | 227 | // } |
224 | | -//} |
| 228 | +// } |
0 commit comments