mirror of
https://github.com/google/nomulus.git
synced 2025-08-04 08:52:12 +02:00
Use enum instead of boolean for TMCH CA mode
Also more narrowly scopes a catch block in TmchCertificateAuthority. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=144744847
This commit is contained in:
parent
0dbaa8e5bc
commit
a28e0b3ff7
13 changed files with 90 additions and 73 deletions
|
@ -25,6 +25,7 @@ import static org.joda.time.DateTimeZone.UTC;
|
|||
import static org.joda.time.Duration.standardDays;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
import google.registry.flows.EppTestComponent.FakesAndMocksModule;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
|
@ -71,7 +72,7 @@ public class EppCommitLogsTest extends ShardableTestCase {
|
|||
SessionMetadata sessionMetadata = new HttpSessionMetadata(new FakeHttpSession());
|
||||
sessionMetadata.setClientId("TheRegistrar");
|
||||
DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, true))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, TmchCaMode.PILOT))
|
||||
.build()
|
||||
.startRequest()
|
||||
.flowComponentBuilder()
|
||||
|
|
|
@ -23,6 +23,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
|
|||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
import google.registry.flows.EppTestComponent.FakesAndMocksModule;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
import google.registry.testing.FakeClock;
|
||||
|
@ -114,7 +115,7 @@ public class EppTestCase extends ShardableTestCase {
|
|||
FakeResponse response = new FakeResponse();
|
||||
handler.response = response;
|
||||
handler.eppController = DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, true))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, TmchCaMode.PILOT))
|
||||
.build()
|
||||
.startRequest()
|
||||
.eppController();
|
||||
|
|
|
@ -22,6 +22,7 @@ import dagger.Module;
|
|||
import dagger.Provides;
|
||||
import dagger.Subcomponent;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
import google.registry.dns.DnsQueue;
|
||||
import google.registry.flows.custom.CustomLogicFactory;
|
||||
import google.registry.flows.custom.TestCustomLogicFactory;
|
||||
|
@ -61,14 +62,13 @@ interface EppTestComponent {
|
|||
final Sleeper sleeper;
|
||||
|
||||
FakesAndMocksModule() {
|
||||
this(new FakeClock(), true);
|
||||
this(new FakeClock(), TmchCaMode.PILOT);
|
||||
}
|
||||
|
||||
FakesAndMocksModule(FakeClock clock, boolean tmchCaTestingMode) {
|
||||
FakesAndMocksModule(FakeClock clock, TmchCaMode tmchCaMode) {
|
||||
this.clock = clock;
|
||||
this.domainFlowTmchUtils =
|
||||
new DomainFlowTmchUtils(
|
||||
new TmchXmlSignature(new TmchCertificateAuthority(tmchCaTestingMode)));
|
||||
new DomainFlowTmchUtils(new TmchXmlSignature(new TmchCertificateAuthority(tmchCaMode)));
|
||||
this.sleeper = new FakeSleeper(clock);
|
||||
this.dnsQueue = DnsQueue.create();
|
||||
this.metricBuilder = EppMetric.builderForRequest("request-id-1", clock);
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
import google.registry.flows.EppTestComponent.FakesAndMocksModule;
|
||||
import google.registry.flows.picker.FlowPicker;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
|
@ -277,7 +278,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
.isEqualTo(new TypeInstantiator<F>(getClass()){}.getExactType());
|
||||
// Run the flow.
|
||||
return DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, tmchCaTestingMode))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, tmchCaMode))
|
||||
.build()
|
||||
.startRequest()
|
||||
.flowComponentBuilder()
|
||||
|
@ -339,10 +340,10 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
return output;
|
||||
}
|
||||
|
||||
private boolean tmchCaTestingMode = true;
|
||||
private TmchCaMode tmchCaMode = TmchCaMode.PILOT;
|
||||
|
||||
protected void useTmchProdCert() {
|
||||
tmchCaTestingMode = false;
|
||||
tmchCaMode = TmchCaMode.PRODUCTION;
|
||||
}
|
||||
|
||||
public EppOutput dryRunFlowAssertResponse(String xml, String... ignoredPaths) throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue