Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jmahonin committed Feb 16, 2023
1 parent d7eb015 commit e029280
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ static final class ServiceAccountImpersonationOptions implements Serializable {
private static final int MINIMUM_TOKEN_LIFETIME_SECONDS = 600;
private static final String TOKEN_LIFETIME_SECONDS_KEY = "token_lifetime_seconds";


private final int lifetime;

ServiceAccountImpersonationOptions(Map<String, Object> optionsMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,25 +958,32 @@ public void getRequestMetadata_withQuotaProjectId() throws IOException {

@Test
public void serialize() throws IOException, ClassNotFoundException {
Map<String, Object> impersonationOpts = new HashMap<String, Object>(){{ put("token_lifetime_seconds", 1000); }};
Map<String, Object> impersonationOpts =
new HashMap<String, Object>() {
{
put("token_lifetime_seconds", 1000);
}
};

TestExternalAccountCredentials testCredentials =
(TestExternalAccountCredentials)
TestExternalAccountCredentials.newBuilder()
.setHttpTransportFactory(transportFactory)
.setAudience("audience")
.setSubjectTokenType("subjectTokenType")
.setTokenUrl(STS_URL)
.setCredentialSource(new TestCredentialSource(FILE_CREDENTIAL_SOURCE_MAP))
.setServiceAccountImpersonationOptions(impersonationOpts)
.build();

TestExternalAccountCredentials deserializedCredentials = serializeAndDeserialize(testCredentials);
(TestExternalAccountCredentials)
TestExternalAccountCredentials.newBuilder()
.setHttpTransportFactory(transportFactory)
.setAudience("audience")
.setSubjectTokenType("subjectTokenType")
.setTokenUrl(STS_URL)
.setCredentialSource(new TestCredentialSource(FILE_CREDENTIAL_SOURCE_MAP))
.setServiceAccountImpersonationOptions(impersonationOpts)
.build();

TestExternalAccountCredentials deserializedCredentials =
serializeAndDeserialize(testCredentials);
assertEquals(testCredentials, deserializedCredentials);
assertEquals(testCredentials.hashCode(), deserializedCredentials.hashCode());
assertEquals(testCredentials.toString(), deserializedCredentials.toString());
assertEquals(testCredentials.getServiceAccountImpersonationOptions().getLifetime(),
deserializedCredentials.getServiceAccountImpersonationOptions().getLifetime());
assertEquals(
testCredentials.getServiceAccountImpersonationOptions().getLifetime(),
deserializedCredentials.getServiceAccountImpersonationOptions().getLifetime());
assertSame(deserializedCredentials.clock, Clock.SYSTEM);
}

Expand Down

0 comments on commit e029280

Please sign in to comment.