-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: expose test-jar and mock classes in oauth2 (#1224)
* test: expose test-jar and mock classes in oauth2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: adapt appengine oauth2-http import * test: correct appengine import in pom * test: correct base serialization test export * chore: expose MockTokenServerTransportFactory * chore: infer version from parent in appengine pom dependencies --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
27db5f2
commit 12e8db6
Showing
19 changed files
with
85 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTestUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.google.auth.oauth2; | ||
|
||
import com.google.api.client.testing.http.FixedClock; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.util.Map; | ||
|
||
public class GdchCredentialsTestUtil { | ||
public static void registerGdchCredentialWithMockTransport( | ||
GdchCredentials credentials, | ||
MockTokenServerTransport transport, | ||
String projectId, | ||
String serviceIdentityName, | ||
String tokenString, | ||
URI tokenServerUri) { | ||
credentials.clock = new FixedClock(0L); | ||
transport.addGdchServiceAccount( | ||
GdchCredentials.getIssuerSubjectValue(projectId, serviceIdentityName), tokenString); | ||
transport.setTokenServerUri(tokenServerUri); | ||
} | ||
|
||
public static GdchCredentials fromJson( | ||
Map<String, Object> json, MockTokenServerTransportFactory transportFactory) | ||
throws IOException { | ||
return GdchCredentials.fromJson(json, transportFactory); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
oauth2_http/javatests/com/google/auth/oauth2/MockHttpTransportFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.google.auth.oauth2; | ||
|
||
import com.google.api.client.http.HttpTransport; | ||
import com.google.api.client.testing.http.MockHttpTransport; | ||
import com.google.auth.http.HttpTransportFactory; | ||
|
||
public class MockHttpTransportFactory implements HttpTransportFactory { | ||
|
||
MockHttpTransport transport = new MockHttpTransport(); | ||
|
||
@Override | ||
public HttpTransport create() { | ||
return transport; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransportFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.google.auth.oauth2; | ||
|
||
import com.google.api.client.http.HttpTransport; | ||
import com.google.auth.http.HttpTransportFactory; | ||
|
||
public class MockTokenServerTransportFactory implements HttpTransportFactory { | ||
|
||
public MockTokenServerTransport transport = new MockTokenServerTransport(); | ||
|
||
@Override | ||
public HttpTransport create() { | ||
return transport; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters