mirror of
https://github.com/google/nomulus
synced 2026-01-10 16:00:52 +00:00
Refactor SessionMetadata and TransportCredentials toString() methods
This cleanups up the toString() methods of all implementations of these interfaces, as pre-work for adding tests against the legacy logging statement in FlowRunner used for ICANN reporting, so that we can validate against any changes to that log statement in the future. It removes system hash codes since those aren't really safe to rely on in test code and they really don't help with debugging anyway. It also standardizes SessionMetadata.toString() a bit and regroups methods on that interface so all the getters are together. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125686039
This commit is contained in:
@@ -35,6 +35,11 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
||||
this.serviceExtensionUris = checkNotNull(serviceExtensionUris);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
@@ -46,8 +51,8 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
throw new UnsupportedOperationException();
|
||||
public int getFailedLoginAttempts() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,11 +65,6 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFailedLoginAttempts() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementFailedLoginAttempts() {
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -75,12 +75,11 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(getClass())
|
||||
.add("system hash code", System.identityHashCode(this))
|
||||
.add("clientId", getClientId())
|
||||
.add("failedLoginAttempts", getFailedLoginAttempts())
|
||||
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
||||
.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user