mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
I'm setting it to three buckets across all tests, because the default one bucket wasn't realistic enough, and allowed some tests to pass that shouldn't have, essentially by accident. This also changes RegistryConfig from being an interface to being an abstract base class. The medium term goal here is to have it be a static class so that it can provide fields from the YAML-derived POJO in situations where Dagger injection isn't feasible. The expected end state is as follows: default-config.yaml -- The master config file that provides defaults for all values. nomulus-config.yaml -- A per-environment config file that overrides the defaults from the previous file. YamlConfig.java -- The POJO that the aforementioned YAML files are deserialized into. RegistryConfig.java -- Contains a static, memoized instance of YamlConfig and provides static methods for getting some of those values. ConfigModule -- Will become a static inner class of RegistryConfig, using Dagger to provide most of the fields from the memoized YamlConfig instance. This way, all configuration will be coming from a single place: RegistryConfig.java. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143567288
118 lines
2.9 KiB
Java
118 lines
2.9 KiB
Java
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.config;
|
|
|
|
import static google.registry.config.ConfigUtils.makeUrl;
|
|
import static org.joda.time.Duration.standardDays;
|
|
|
|
import com.google.common.base.Optional;
|
|
import com.google.common.net.HostAndPort;
|
|
import java.net.URL;
|
|
import org.joda.time.Duration;
|
|
|
|
/**
|
|
* An implementation of RegistryConfig for unit testing that contains suitable testing data.
|
|
*/
|
|
public class TestRegistryConfig extends RegistryConfig {
|
|
|
|
public TestRegistryConfig() {}
|
|
|
|
@Override
|
|
public Duration getCommitLogDatastoreRetention() {
|
|
return Duration.standardDays(30);
|
|
}
|
|
|
|
@Override
|
|
public String getSnapshotsBucket() {
|
|
return RegistryConfig.getProjectId() + "-snapshots";
|
|
}
|
|
|
|
@Override
|
|
public boolean getTmchCaTestingMode() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public Optional<String> getECatcherAddress() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override
|
|
public HostAndPort getServer() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override
|
|
public Duration getSingletonCacheRefreshDuration() {
|
|
// All cache durations are set to zero so that unit tests can update and then retrieve data
|
|
// immediately without failure.
|
|
return Duration.ZERO;
|
|
}
|
|
|
|
@Override
|
|
public Duration getDomainLabelListCacheDuration() {
|
|
return Duration.ZERO;
|
|
}
|
|
|
|
@Override
|
|
public Duration getSingletonCachePersistDuration() {
|
|
return Duration.ZERO;
|
|
}
|
|
|
|
@Override
|
|
public String getReservedTermsExportDisclaimer() {
|
|
return "This is a disclaimer.\n";
|
|
}
|
|
|
|
@Override
|
|
public String getGoogleAppsAdminEmailDisplayName() {
|
|
return "Testing Nomulus";
|
|
}
|
|
|
|
@Override
|
|
public String getGoogleAppsSendFromEmailAddress() {
|
|
return "noreply@testing.example";
|
|
}
|
|
|
|
@Override
|
|
public String getRegistrarDefaultWhoisServer() {
|
|
return "whois.nic.fakewhois.example";
|
|
}
|
|
|
|
@Override
|
|
public URL getRegistrarDefaultReferralUrl() {
|
|
return makeUrl("http://www.referral.example/path");
|
|
}
|
|
|
|
@Override
|
|
public int getEppResourceIndexBucketCount() {
|
|
return 2;
|
|
}
|
|
|
|
@Override
|
|
public Duration getBaseOfyRetryDuration() {
|
|
return Duration.ZERO;
|
|
}
|
|
|
|
@Override
|
|
public Duration getContactAutomaticTransferLength() {
|
|
return standardDays(5);
|
|
}
|
|
|
|
@Override
|
|
public String getCheckApiServletRegistrarClientId() {
|
|
return "TheRegistrar";
|
|
}
|
|
}
|