Clean up the tattered shreds of SessionMetadata

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125334811
This commit is contained in:
cgoldfeder 2016-06-20 07:26:00 -07:00 committed by Ben McIlwain
parent 2a3a3fbc30
commit bb82f5bc05
11 changed files with 169 additions and 185 deletions

View file

@ -28,10 +28,10 @@ import com.google.common.net.MediaType;
import google.registry.model.ofy.Ofy;
import google.registry.monitoring.whitebox.EppMetrics;
import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession;
import google.registry.testing.FakeResponse;
import google.registry.testing.InjectRule;
import google.registry.testing.ShardableTestCase;
import google.registry.testing.TestSessionMetadata;
import org.joda.time.DateTime;
import org.junit.Before;
@ -49,7 +49,7 @@ public class EppTestCase extends ShardableTestCase {
private final FakeClock clock = new FakeClock();
private TestSessionMetadata sessionMetadata;
private SessionMetadata sessionMetadata;
private TransportCredentials credentials = new PasswordOnlyTransportCredentials();
private boolean isSuperuser;
@ -94,12 +94,16 @@ public class EppTestCase extends ShardableTestCase {
String expectedOutput =
loadFileWithSubstitutions(getClass(), outputFilename, outputSubstitutions);
if (sessionMetadata == null) {
sessionMetadata = new TestSessionMetadata();
sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()) {
@Override
public void invalidate() {
// When a session is invalidated, reset the sessionMetadata field.
super.invalidate();
EppTestCase.this.sessionMetadata = null;
}
};
}
String actualOutput = executeXmlCommand(input);
if (!sessionMetadata.isValid()) {
sessionMetadata = null;
}
assertXmlEqualsWithMessage(
expectedOutput,
actualOutput,