mirror of
https://github.com/google/nomulus.git
synced 2025-05-01 04:27:51 +02:00
Remove more unnecessary "throws" declarations
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201243722
This commit is contained in:
parent
47322b7fcd
commit
ad73f3d167
61 changed files with 318 additions and 331 deletions
|
@ -127,7 +127,7 @@ public final class KmsUpdater {
|
||||||
* <p>The operations in this method are organized so that existing {@link KmsSecretRevision}
|
* <p>The operations in this method are organized so that existing {@link KmsSecretRevision}
|
||||||
* entities remain primary and decryptable if a failure occurs.
|
* entities remain primary and decryptable if a failure occurs.
|
||||||
*/
|
*/
|
||||||
public void update() throws IOException {
|
public void update() {
|
||||||
checkState(!secretValues.isEmpty(), "At least one Keyring value must be persisted");
|
checkState(!secretValues.isEmpty(), "At least one Keyring value must be persisted");
|
||||||
|
|
||||||
persistEncryptedValues(encryptValues(secretValues));
|
persistEncryptedValues(encryptValues(secretValues));
|
||||||
|
@ -139,8 +139,7 @@ public final class KmsUpdater {
|
||||||
*
|
*
|
||||||
* @see google.registry.config.RegistryConfigSettings#kms
|
* @see google.registry.config.RegistryConfigSettings#kms
|
||||||
*/
|
*/
|
||||||
private ImmutableMap<String, EncryptResponse> encryptValues(Map<String, byte[]> keyValues)
|
private ImmutableMap<String, EncryptResponse> encryptValues(Map<String, byte[]> keyValues) {
|
||||||
throws IOException {
|
|
||||||
ImmutableMap.Builder<String, EncryptResponse> encryptedValues = new ImmutableMap.Builder<>();
|
ImmutableMap.Builder<String, EncryptResponse> encryptedValues = new ImmutableMap.Builder<>();
|
||||||
for (Map.Entry<String, byte[]> entry : keyValues.entrySet()) {
|
for (Map.Entry<String, byte[]> entry : keyValues.entrySet()) {
|
||||||
String secretName = entry.getKey();
|
String secretName = entry.getKey();
|
||||||
|
|
|
@ -272,7 +272,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||||
protected abstract void initTldCommand();
|
protected abstract void initTldCommand();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final void init() throws Exception {
|
protected final void init() {
|
||||||
assertAllowedEnvironment();
|
assertAllowedEnvironment();
|
||||||
initTldCommand();
|
initTldCommand();
|
||||||
String duplicates = Joiner.on(", ").join(findDuplicates(mainParameters));
|
String duplicates = Joiner.on(", ").join(findDuplicates(mainParameters));
|
||||||
|
|
|
@ -66,8 +66,7 @@ final class LoadSnapshotCommand extends BigqueryCommand {
|
||||||
* Starts load jobs for the given snapshot kinds, and returns a map of kind name to
|
* Starts load jobs for the given snapshot kinds, and returns a map of kind name to
|
||||||
* ListenableFuture representing the result of the load job for that kind.
|
* ListenableFuture representing the result of the load job for that kind.
|
||||||
*/
|
*/
|
||||||
private Map<String, ListenableFuture<?>> loadSnapshotKinds(List<String> kindNames)
|
private Map<String, ListenableFuture<?>> loadSnapshotKinds(List<String> kindNames) {
|
||||||
throws Exception {
|
|
||||||
ImmutableMap.Builder<String, ListenableFuture<?>> builder = new ImmutableMap.Builder<>();
|
ImmutableMap.Builder<String, ListenableFuture<?>> builder = new ImmutableMap.Builder<>();
|
||||||
for (String kind : kindNames) {
|
for (String kind : kindNames) {
|
||||||
String filename = String.format(
|
String filename = String.format(
|
||||||
|
@ -79,7 +78,7 @@ final class LoadSnapshotCommand extends BigqueryCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts a load job for the specified kind name, sourcing data from the given GCS file. */
|
/** Starts a load job for the specified kind name, sourcing data from the given GCS file. */
|
||||||
private ListenableFuture<?> loadSnapshotFile(String filename, String kindName) throws Exception {
|
private ListenableFuture<?> loadSnapshotFile(String filename, String kindName) {
|
||||||
return bigquery().load(
|
return bigquery().load(
|
||||||
bigquery().buildDestinationTable(kindName)
|
bigquery().buildDestinationTable(kindName)
|
||||||
.description("Datastore snapshot import for " + kindName + ".")
|
.description("Datastore snapshot import for " + kindName + ".")
|
||||||
|
|
|
@ -61,7 +61,7 @@ public final class TeeOutputStream extends OutputStream {
|
||||||
|
|
||||||
/** Closes the stream. Any calls to a {@code write()} method after this will throw. */
|
/** Closes the stream. Any calls to a {@code write()} method after this will throw. */
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() {
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CommitLogCheckpointActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_noCheckpointEverWritten_writesCheckpointAndEnqueuesTask() throws Exception {
|
public void testRun_noCheckpointEverWritten_writesCheckpointAndEnqueuesTask() {
|
||||||
task.run();
|
task.run();
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
QUEUE_NAME,
|
QUEUE_NAME,
|
||||||
|
@ -80,8 +80,7 @@ public class CommitLogCheckpointActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_checkpointWrittenBeforeNow_writesCheckpointAndEnqueuesTask()
|
public void testRun_checkpointWrittenBeforeNow_writesCheckpointAndEnqueuesTask() {
|
||||||
throws Exception {
|
|
||||||
DateTime oneMinuteAgo = now.minusMinutes(1);
|
DateTime oneMinuteAgo = now.minusMinutes(1);
|
||||||
persistResource(CommitLogCheckpointRoot.create(oneMinuteAgo));
|
persistResource(CommitLogCheckpointRoot.create(oneMinuteAgo));
|
||||||
task.run();
|
task.run();
|
||||||
|
@ -95,7 +94,7 @@ public class CommitLogCheckpointActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_checkpointWrittenAfterNow_doesntOverwrite_orEnqueueTask() throws Exception {
|
public void testRun_checkpointWrittenAfterNow_doesntOverwrite_orEnqueueTask() {
|
||||||
DateTime oneMinuteFromNow = now.plusMinutes(1);
|
DateTime oneMinuteFromNow = now.plusMinutes(1);
|
||||||
persistResource(CommitLogCheckpointRoot.create(oneMinuteFromNow));
|
persistResource(CommitLogCheckpointRoot.create(oneMinuteFromNow));
|
||||||
task.run();
|
task.run();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class CommitLogFanoutActionTest {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() {
|
||||||
CommitLogFanoutAction action = new CommitLogFanoutAction();
|
CommitLogFanoutAction action = new CommitLogFanoutAction();
|
||||||
action.taskQueueUtils = new TaskQueueUtils(new Retrier(null, 1));
|
action.taskQueueUtils = new TaskQueueUtils(new Retrier(null, 1));
|
||||||
action.endpoint = ENDPOINT;
|
action.endpoint = ENDPOINT;
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class TldFanoutActionTest {
|
||||||
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertTasks(String... tasks) throws Exception {
|
private static void assertTasks(String... tasks) {
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
QUEUE,
|
QUEUE,
|
||||||
Stream.of(tasks).map(
|
Stream.of(tasks).map(
|
||||||
|
@ -111,7 +111,7 @@ public class TldFanoutActionTest {
|
||||||
.collect(toImmutableList()));
|
.collect(toImmutableList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertTaskWithoutTld() throws Exception {
|
private static void assertTaskWithoutTld() {
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
QUEUE,
|
QUEUE,
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
|
@ -120,7 +120,7 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_methodPostIsDefault() throws Exception {
|
public void testSuccess_methodPostIsDefault() {
|
||||||
run(getParamsMap("runInEmpty", ""));
|
run(getParamsMap("runInEmpty", ""));
|
||||||
assertTasksEnqueued(QUEUE, new TaskMatcher().method("POST"));
|
assertTasksEnqueued(QUEUE, new TaskMatcher().method("POST"));
|
||||||
}
|
}
|
||||||
|
@ -131,25 +131,25 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_runInEmpty() throws Exception {
|
public void testSuccess_runInEmpty() {
|
||||||
run(getParamsMap("runInEmpty", ""));
|
run(getParamsMap("runInEmpty", ""));
|
||||||
assertTaskWithoutTld();
|
assertTaskWithoutTld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_forEachRealTld() throws Exception {
|
public void testSuccess_forEachRealTld() {
|
||||||
run(getParamsMap("forEachRealTld", ""));
|
run(getParamsMap("forEachRealTld", ""));
|
||||||
assertTasks("com", "net", "org");
|
assertTasks("com", "net", "org");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_forEachTestTld() throws Exception {
|
public void testSuccess_forEachTestTld() {
|
||||||
run(getParamsMap("forEachTestTld", ""));
|
run(getParamsMap("forEachTestTld", ""));
|
||||||
assertTasks("example");
|
assertTasks("example");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_forEachTestTldAndForEachRealTld() throws Exception {
|
public void testSuccess_forEachTestTldAndForEachRealTld() {
|
||||||
run(getParamsMap(
|
run(getParamsMap(
|
||||||
"forEachTestTld", "",
|
"forEachTestTld", "",
|
||||||
"forEachRealTld", ""));
|
"forEachRealTld", ""));
|
||||||
|
@ -157,13 +157,13 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_runEverywhere() throws Exception {
|
public void testSuccess_runEverywhere() {
|
||||||
run(getParamsMap("forEachTestTld", "", "forEachRealTld", ""));
|
run(getParamsMap("forEachTestTld", "", "forEachRealTld", ""));
|
||||||
assertTasks("com", "net", "org", "example");
|
assertTasks("com", "net", "org", "example");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_excludeRealTlds() throws Exception {
|
public void testSuccess_excludeRealTlds() {
|
||||||
run(getParamsMap(
|
run(getParamsMap(
|
||||||
"forEachRealTld", "",
|
"forEachRealTld", "",
|
||||||
"exclude", "com,net"));
|
"exclude", "com,net"));
|
||||||
|
@ -171,7 +171,7 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_excludeTestTlds() throws Exception {
|
public void testSuccess_excludeTestTlds() {
|
||||||
run(getParamsMap(
|
run(getParamsMap(
|
||||||
"forEachTestTld", "",
|
"forEachTestTld", "",
|
||||||
"exclude", "example"));
|
"exclude", "example"));
|
||||||
|
@ -179,7 +179,7 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_excludeNonexistentTlds() throws Exception {
|
public void testSuccess_excludeNonexistentTlds() {
|
||||||
run(getParamsMap(
|
run(getParamsMap(
|
||||||
"forEachTestTld", "",
|
"forEachTestTld", "",
|
||||||
"forEachRealTld", "",
|
"forEachRealTld", "",
|
||||||
|
@ -221,14 +221,14 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_additionalArgsFlowThroughToPostParams() throws Exception {
|
public void testSuccess_additionalArgsFlowThroughToPostParams() {
|
||||||
run(getParamsMap("forEachTestTld", "", "newkey", "newval"));
|
run(getParamsMap("forEachTestTld", "", "newkey", "newval"));
|
||||||
assertTasksEnqueued(QUEUE,
|
assertTasksEnqueued(QUEUE,
|
||||||
new TaskMatcher().url("/the/servlet").param("newkey", "newval"));
|
new TaskMatcher().url("/the/servlet").param("newkey", "newval"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_returnHttpResponse() throws Exception {
|
public void testSuccess_returnHttpResponse() {
|
||||||
run(getParamsMap("forEachRealTld", "", "endpoint", "/the/servlet"));
|
run(getParamsMap("forEachRealTld", "", "endpoint", "/the/servlet"));
|
||||||
|
|
||||||
List<TaskStateInfo> taskList =
|
List<TaskStateInfo> taskList =
|
||||||
|
@ -247,7 +247,7 @@ public class TldFanoutActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_returnHttpResponse_runInEmpty() throws Exception {
|
public void testSuccess_returnHttpResponse_runInEmpty() {
|
||||||
run(getParamsMap("runInEmpty", "", "endpoint", "/the/servlet"));
|
run(getParamsMap("runInEmpty", "", "endpoint", "/the/servlet"));
|
||||||
|
|
||||||
List<TaskStateInfo> taskList =
|
List<TaskStateInfo> taskList =
|
||||||
|
|
|
@ -73,7 +73,7 @@ public final class DnsInjectionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadDnsQueueAction_injectsAndWorks() throws Exception {
|
public void testReadDnsQueueAction_injectsAndWorks() {
|
||||||
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
|
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
dnsQueue.addDomainRefreshTask("example.lol");
|
dnsQueue.addDomainRefreshTask("example.lol");
|
||||||
|
@ -83,7 +83,7 @@ public final class DnsInjectionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRefreshDns_domain_injectsAndWorks() throws Exception {
|
public void testRefreshDns_domain_injectsAndWorks() {
|
||||||
persistActiveDomain("example.lol");
|
persistActiveDomain("example.lol");
|
||||||
when(req.getParameter("type")).thenReturn("domain");
|
when(req.getParameter("type")).thenReturn("domain");
|
||||||
when(req.getParameter("name")).thenReturn("example.lol");
|
when(req.getParameter("name")).thenReturn("example.lol");
|
||||||
|
@ -101,7 +101,7 @@ public final class DnsInjectionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRefreshDns_host_injectsAndWorks() throws Exception {
|
public void testRefreshDns_host_injectsAndWorks() {
|
||||||
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
|
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
|
||||||
when(req.getParameter("type")).thenReturn("host");
|
when(req.getParameter("type")).thenReturn("host");
|
||||||
when(req.getParameter("name")).thenReturn("ns1.example.lol");
|
when(req.getParameter("name")).thenReturn("ns1.example.lol");
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class DnsQueueTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_addHostRefreshTask_success() throws Exception {
|
public void test_addHostRefreshTask_success() {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
dnsQueue.addHostRefreshTask("octopus.tld");
|
dnsQueue.addHostRefreshTask("octopus.tld");
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
@ -79,7 +79,7 @@ public class DnsQueueTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_addDomainRefreshTask_success() throws Exception {
|
public void test_addDomainRefreshTask_success() {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
dnsQueue.addDomainRefreshTask("octopus.tld");
|
dnsQueue.addDomainRefreshTask("octopus.tld");
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHost_published() throws Exception {
|
public void testHost_published() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.hosts = ImmutableSet.of("ns1.example.xn--q9jyb4c");
|
action.hosts = ImmutableSet.of("ns1.example.xn--q9jyb4c");
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDomain_published() throws Exception {
|
public void testDomain_published() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.xn--q9jyb4c");
|
action.domains = ImmutableSet.of("example.xn--q9jyb4c");
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAction_acquiresCorrectLock() throws Exception {
|
public void testAction_acquiresCorrectLock() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.lockIndex = 2;
|
action.lockIndex = 2;
|
||||||
|
@ -176,7 +176,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPublish_commitFails() throws Exception {
|
public void testPublish_commitFails() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
|
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
|
||||||
action.hosts =
|
action.hosts =
|
||||||
|
@ -203,7 +203,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHostAndDomain_published() throws Exception {
|
public void testHostAndDomain_published() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
|
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
|
||||||
action.hosts = ImmutableSet.of(
|
action.hosts = ImmutableSet.of(
|
||||||
|
@ -235,7 +235,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrongTld_notPublished() throws Exception {
|
public void testWrongTld_notPublished() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.com", "example2.com");
|
action.domains = ImmutableSet.of("example.com", "example2.com");
|
||||||
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
||||||
|
@ -261,7 +261,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLockIsntAvailable() throws Exception {
|
public void testLockIsntAvailable() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.com", "example2.com");
|
action.domains = ImmutableSet.of("example.com", "example2.com");
|
||||||
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
||||||
|
@ -284,7 +284,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParam_invalidLockIndex() throws Exception {
|
public void testParam_invalidLockIndex() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.com");
|
action.domains = ImmutableSet.of("example.com");
|
||||||
|
@ -309,7 +309,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRegistryParam_mismatchedMaxLocks() throws Exception {
|
public void testRegistryParam_mismatchedMaxLocks() {
|
||||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.com");
|
action.domains = ImmutableSet.of("example.com");
|
||||||
|
@ -334,7 +334,7 @@ public class PublishDnsUpdatesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrongDnsWriter() throws Exception {
|
public void testWrongDnsWriter() {
|
||||||
action = createAction("xn--q9jyb4c");
|
action = createAction("xn--q9jyb4c");
|
||||||
action.domains = ImmutableSet.of("example.com", "example2.com");
|
action.domains = ImmutableSet.of("example.com", "example2.com");
|
||||||
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
||||||
|
|
|
@ -147,8 +147,7 @@ public class ReadDnsQueueActionTest {
|
||||||
.param(DNS_TARGET_TYPE_PARAM, TargetType.DOMAIN.toString());
|
.param(DNS_TARGET_TYPE_PARAM, TargetType.DOMAIN.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertTldsEnqueuedInPushQueue(ImmutableMultimap<String, String> tldsToDnsWriters)
|
private void assertTldsEnqueuedInPushQueue(ImmutableMultimap<String, String> tldsToDnsWriters) {
|
||||||
throws Exception {
|
|
||||||
// By default, the publishDnsUpdates tasks will be enqueued one hour after the update items were
|
// By default, the publishDnsUpdates tasks will be enqueued one hour after the update items were
|
||||||
// created in the pull queue. This is because of the clock.advanceBy in run()
|
// created in the pull queue. This is because of the clock.advanceBy in run()
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
@ -169,7 +168,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_methodPostIsDefault() throws Exception {
|
public void testSuccess_methodPostIsDefault() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.net");
|
dnsQueue.addDomainRefreshTask("domain.net");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
|
@ -185,7 +184,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_allSingleLockTlds() throws Exception {
|
public void testSuccess_allSingleLockTlds() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.net");
|
dnsQueue.addDomainRefreshTask("domain.net");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
|
@ -198,7 +197,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_moreUpdatesThanQueueBatchSize() throws Exception {
|
public void testSuccess_moreUpdatesThanQueueBatchSize() {
|
||||||
// The task queue has a batch size of 1000 (that's the maximum number of items you can lease at
|
// The task queue has a batch size of 1000 (that's the maximum number of items you can lease at
|
||||||
// once).
|
// once).
|
||||||
ImmutableList<String> domains =
|
ImmutableList<String> domains =
|
||||||
|
@ -225,7 +224,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_twoDnsWriters() throws Exception {
|
public void testSuccess_twoDnsWriters() {
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("com")
|
Registry.get("com")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -240,7 +239,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_differentUpdateTimes_usesMinimum() throws Exception {
|
public void testSuccess_differentUpdateTimes_usesMinimum() {
|
||||||
clock.setTo(DateTime.parse("3000-02-03TZ"));
|
clock.setTo(DateTime.parse("3000-02-03TZ"));
|
||||||
dnsQueue.addDomainRefreshTask("domain1.com");
|
dnsQueue.addDomainRefreshTask("domain1.com");
|
||||||
clock.setTo(DateTime.parse("3000-02-04TZ"));
|
clock.setTo(DateTime.parse("3000-02-04TZ"));
|
||||||
|
@ -265,7 +264,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_oneTldPaused_returnedToQueue() throws Exception {
|
public void testSuccess_oneTldPaused_returnedToQueue() {
|
||||||
persistResource(Registry.get("net").asBuilder().setDnsPaused(true).build());
|
persistResource(Registry.get("net").asBuilder().setDnsPaused(true).build());
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.net");
|
dnsQueue.addDomainRefreshTask("domain.net");
|
||||||
|
@ -279,7 +278,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_oneTldUnknown_returnedToQueue() throws Exception {
|
public void testSuccess_oneTldUnknown_returnedToQueue() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
||||||
|
@ -299,7 +298,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_corruptTaskTldMismatch_published() throws Exception {
|
public void testSuccess_corruptTaskTldMismatch_published() {
|
||||||
// TODO(mcilwain): what's the correct action to take in this case?
|
// TODO(mcilwain): what's the correct action to take in this case?
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
|
@ -320,7 +319,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_corruptTaskNoTld_discarded() throws Exception {
|
public void testSuccess_corruptTaskNoTld_discarded() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
||||||
|
@ -339,7 +338,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_corruptTaskNoName_discarded() throws Exception {
|
public void testSuccess_corruptTaskNoName_discarded() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
||||||
|
@ -358,7 +357,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_corruptTaskNoType_discarded() throws Exception {
|
public void testSuccess_corruptTaskNoType_discarded() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
||||||
|
@ -377,7 +376,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_corruptTaskWrongType_discarded() throws Exception {
|
public void testSuccess_corruptTaskWrongType_discarded() {
|
||||||
dnsQueue.addDomainRefreshTask("domain.com");
|
dnsQueue.addDomainRefreshTask("domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.example");
|
dnsQueue.addDomainRefreshTask("domain.example");
|
||||||
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
|
||||||
|
@ -397,7 +396,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_zone_getsIgnored() throws Exception {
|
public void testSuccess_zone_getsIgnored() {
|
||||||
dnsQueue.addHostRefreshTask("ns1.domain.com");
|
dnsQueue.addHostRefreshTask("ns1.domain.com");
|
||||||
dnsQueue.addDomainRefreshTask("domain.net");
|
dnsQueue.addDomainRefreshTask("domain.net");
|
||||||
dnsQueue.addZoneRefreshTask("example");
|
dnsQueue.addZoneRefreshTask("example");
|
||||||
|
@ -418,7 +417,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_manyDomainsAndHosts() throws Exception {
|
public void testSuccess_manyDomainsAndHosts() {
|
||||||
for (int i = 0; i < 150; i++) {
|
for (int i = 0; i < 150; i++) {
|
||||||
// 0: domain; 1: host 1; 2: host 2
|
// 0: domain; 1: host 1; 2: host 2
|
||||||
for (int thingType = 0; thingType < 3; thingType++) {
|
for (int thingType = 0; thingType < 3; thingType++) {
|
||||||
|
@ -489,7 +488,7 @@ public class ReadDnsQueueActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_lockGroupsHostBySuperordinateDomain() throws Exception {
|
public void testSuccess_lockGroupsHostBySuperordinateDomain() {
|
||||||
dnsQueue.addDomainRefreshTask("hello.multilock.uk");
|
dnsQueue.addDomainRefreshTask("hello.multilock.uk");
|
||||||
dnsQueue.addHostRefreshTask("ns1.abc.hello.multilock.uk");
|
dnsQueue.addHostRefreshTask("ns1.abc.hello.multilock.uk");
|
||||||
dnsQueue.addHostRefreshTask("ns2.hello.multilock.uk");
|
dnsQueue.addHostRefreshTask("ns2.hello.multilock.uk");
|
||||||
|
|
|
@ -310,14 +310,14 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_nonExistentDomain() throws Exception {
|
public void testLoadDomain_nonExistentDomain() {
|
||||||
writer.publishDomain("example.tld");
|
writer.publishDomain("example.tld");
|
||||||
|
|
||||||
verifyZone(ImmutableSet.of());
|
verifyZone(ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_noDsDataOrNameservers() throws Exception {
|
public void testLoadDomain_noDsDataOrNameservers() {
|
||||||
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
|
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
|
||||||
writer.publishDomain("example.tld");
|
writer.publishDomain("example.tld");
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_deleteOldData() throws Exception {
|
public void testLoadDomain_deleteOldData() {
|
||||||
stubZone = fakeDomainRecords("example.tld", 2, 2, 2, 2);
|
stubZone = fakeDomainRecords("example.tld", 2, 2, 2, 2);
|
||||||
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
|
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
|
||||||
writer.publishDomain("example.tld");
|
writer.publishDomain("example.tld");
|
||||||
|
@ -334,7 +334,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withExternalNs() throws Exception {
|
public void testLoadDomain_withExternalNs() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 0));
|
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 0));
|
||||||
writer.publishDomain("example.tld");
|
writer.publishDomain("example.tld");
|
||||||
|
@ -343,7 +343,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withDsData() throws Exception {
|
public void testLoadDomain_withDsData() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 1));
|
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 1));
|
||||||
writer.publishDomain("example.tld");
|
writer.publishDomain("example.tld");
|
||||||
|
@ -352,7 +352,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withInBailiwickNs_IPv4() throws Exception {
|
public void testLoadDomain_withInBailiwickNs_IPv4() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -367,7 +367,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withInBailiwickNs_IPv6() throws Exception {
|
public void testLoadDomain_withInBailiwickNs_IPv6() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -382,7 +382,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withNameserveThatEndsWithDomainName() throws Exception {
|
public void testLoadDomain_withNameserveThatEndsWithDomainName() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -394,7 +394,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadHost_externalHost() throws Exception {
|
public void testLoadHost_externalHost() {
|
||||||
writer.publishHost("ns1.example.com");
|
writer.publishHost("ns1.example.com");
|
||||||
|
|
||||||
// external hosts should not be published in our zone
|
// external hosts should not be published in our zone
|
||||||
|
@ -402,7 +402,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadHost_removeStaleNsRecords() throws Exception {
|
public void testLoadHost_removeStaleNsRecords() {
|
||||||
// Initialize the zone with both NS records
|
// Initialize the zone with both NS records
|
||||||
stubZone = fakeDomainRecords("example.tld", 2, 0, 0, 0);
|
stubZone = fakeDomainRecords("example.tld", 2, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withClientHold() throws Exception {
|
public void testLoadDomain_withClientHold() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -450,7 +450,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withServerHold() throws Exception {
|
public void testLoadDomain_withServerHold() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -466,7 +466,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDomain_withPendingDelete() throws Exception {
|
public void testLoadDomain_withPendingDelete() {
|
||||||
persistResource(
|
persistResource(
|
||||||
fakeDomain(
|
fakeDomain(
|
||||||
"example.tld",
|
"example.tld",
|
||||||
|
@ -481,7 +481,7 @@ public class CloudDnsWriterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDuplicateRecords() throws Exception {
|
public void testDuplicateRecords() {
|
||||||
// In publishing DNS records, we can end up publishing information on the same host twice
|
// In publishing DNS records, we can end up publishing information on the same host twice
|
||||||
// (through a domain change and a host change), so this scenario needs to work.
|
// (through a domain change and a host change), so this scenario needs to work.
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class BigqueryPollJobActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_enqueuePollTask() throws Exception {
|
public void testSuccess_enqueuePollTask() {
|
||||||
new BigqueryPollJobEnqueuer(TASK_QUEUE_UTILS).enqueuePollTask(
|
new BigqueryPollJobEnqueuer(TASK_QUEUE_UTILS).enqueuePollTask(
|
||||||
new JobReference().setProjectId(PROJECT_ID).setJobId(JOB_ID));
|
new JobReference().setProjectId(PROJECT_ID).setJobId(JOB_ID));
|
||||||
assertTasksEnqueued(BigqueryPollJobAction.QUEUE, newPollJobTaskMatcher("GET"));
|
assertTasksEnqueued(BigqueryPollJobAction.QUEUE, newPollJobTaskMatcher("GET"));
|
||||||
|
|
|
@ -93,8 +93,7 @@ public class CheckSnapshotActionTest {
|
||||||
when(backupService.findByName("some_backup")).thenReturn(backupInfo);
|
when(backupService.findByName("some_backup")).thenReturn(backupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertLoadTaskEnqueued(String id, String file, String kinds)
|
private static void assertLoadTaskEnqueued(String id, String file, String kinds) {
|
||||||
throws Exception {
|
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
"export-snapshot",
|
"export-snapshot",
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
|
@ -106,7 +105,7 @@ public class CheckSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_enqueuePollTask() throws Exception {
|
public void testSuccess_enqueuePollTask() {
|
||||||
CheckSnapshotAction.enqueuePollTask(
|
CheckSnapshotAction.enqueuePollTask(
|
||||||
"some_snapshot_name", ImmutableSet.of("one", "two", "three"));
|
"some_snapshot_name", ImmutableSet.of("one", "two", "three"));
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
@ -147,7 +146,7 @@ public class CheckSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_forCompleteBackup_enqueuesLoadTask() throws Exception {
|
public void testPost_forCompleteBackup_enqueuesLoadTask() {
|
||||||
|
|
||||||
action.run();
|
action.run();
|
||||||
assertLoadTaskEnqueued(
|
assertLoadTaskEnqueued(
|
||||||
|
@ -155,7 +154,7 @@ public class CheckSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_forCompleteAutoBackup_enqueuesLoadTask_usingBackupName() throws Exception {
|
public void testPost_forCompleteAutoBackup_enqueuesLoadTask_usingBackupName() {
|
||||||
action.snapshotName = "auto_snapshot_somestring";
|
action.snapshotName = "auto_snapshot_somestring";
|
||||||
when(backupService.findByName("auto_snapshot_somestring")).thenReturn(backupInfo);
|
when(backupService.findByName("auto_snapshot_somestring")).thenReturn(backupInfo);
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ public class CheckSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_forCompleteBackup_withExtraKindsToLoad_enqueuesLoadTask() throws Exception {
|
public void testPost_forCompleteBackup_withExtraKindsToLoad_enqueuesLoadTask() {
|
||||||
action.kindsToLoadParam = "one,foo";
|
action.kindsToLoadParam = "one,foo";
|
||||||
|
|
||||||
action.run();
|
action.run();
|
||||||
|
@ -174,7 +173,7 @@ public class CheckSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_forCompleteBackup_withEmptyKindsToLoad_skipsLoadTask() throws Exception {
|
public void testPost_forCompleteBackup_withEmptyKindsToLoad_skipsLoadTask() {
|
||||||
action.kindsToLoadParam = "";
|
action.kindsToLoadParam = "";
|
||||||
|
|
||||||
action.run();
|
action.run();
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class DatastoreBackupServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_launchBackup() throws Exception {
|
public void testSuccess_launchBackup() {
|
||||||
backupService.launchNewBackup(
|
backupService.launchNewBackup(
|
||||||
"export-snapshot", "backup1", "somebucket", ImmutableSet.of("foo", "bar"));
|
"export-snapshot", "backup1", "somebucket", ImmutableSet.of("foo", "bar"));
|
||||||
assertTasksEnqueued("export-snapshot",
|
assertTasksEnqueued("export-snapshot",
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ExportSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_launchesBackup_andEnqueuesPollTask() throws Exception {
|
public void testPost_launchesBackup_andEnqueuesPollTask() {
|
||||||
action.run();
|
action.run();
|
||||||
verify(backupService)
|
verify(backupService)
|
||||||
.launchNewBackup(
|
.launchNewBackup(
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class LoadSnapshotActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_enqueueLoadTask() throws Exception {
|
public void testSuccess_enqueueLoadTask() {
|
||||||
enqueueLoadSnapshotTask(
|
enqueueLoadSnapshotTask(
|
||||||
"id12345", "gs://bucket/snapshot.backup_info", ImmutableSet.of("one", "two", "three"));
|
"id12345", "gs://bucket/snapshot.backup_info", ImmutableSet.of("one", "two", "three"));
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class UpdateSnapshotViewActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_createViewUpdateTask() throws Exception {
|
public void testSuccess_createViewUpdateTask() {
|
||||||
getQueue(QUEUE).add(createViewUpdateTask("some_dataset", "12345_fookind", "fookind"));
|
getQueue(QUEUE).add(createViewUpdateTask("some_dataset", "12345_fookind", "fookind"));
|
||||||
assertTasksEnqueued(QUEUE,
|
assertTasksEnqueued(QUEUE,
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
|
|
|
@ -246,18 +246,18 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
||||||
|
|
||||||
public void assertPollMessages(
|
public void assertPollMessages(
|
||||||
String clientId,
|
String clientId,
|
||||||
PollMessage... expected) throws Exception {
|
PollMessage... expected) {
|
||||||
assertPollMessagesHelper(getPollMessages(clientId), expected);
|
assertPollMessagesHelper(getPollMessages(clientId), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertPollMessages(
|
public void assertPollMessages(
|
||||||
String clientId,
|
String clientId,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
PollMessage... expected) throws Exception {
|
PollMessage... expected) {
|
||||||
assertPollMessagesHelper(getPollMessages(clientId, now), expected);
|
assertPollMessagesHelper(getPollMessages(clientId, now), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assertPollMessages(PollMessage... expected) throws Exception {
|
public void assertPollMessages(PollMessage... expected) {
|
||||||
assertPollMessagesHelper(getPollMessages(), expected);
|
assertPollMessagesHelper(getPollMessages(), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
||||||
|
|
||||||
/** Asserts the presence of a single enqueued async contact or host deletion */
|
/** Asserts the presence of a single enqueued async contact or host deletion */
|
||||||
protected <T extends EppResource> void assertAsyncDeletionTaskEnqueued(
|
protected <T extends EppResource> void assertAsyncDeletionTaskEnqueued(
|
||||||
T resource, String requestingClientId, Trid trid, boolean isSuperuser) throws Exception {
|
T resource, String requestingClientId, Trid trid, boolean isSuperuser) {
|
||||||
TaskMatcher expected = new TaskMatcher()
|
TaskMatcher expected = new TaskMatcher()
|
||||||
.etaDelta(Duration.standardSeconds(75), Duration.standardSeconds(105)) // expected: 90
|
.etaDelta(Duration.standardSeconds(75), Duration.standardSeconds(105)) // expected: 90
|
||||||
.param("resourceKey", Key.create(resource).getString())
|
.param("resourceKey", Key.create(resource).getString())
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ContactTransferApproveFlowTest
|
||||||
extends ContactTransferFlowTestCase<ContactTransferApproveFlow, ContactResource> {
|
extends ContactTransferFlowTestCase<ContactTransferApproveFlow, ContactResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("contact_transfer_approve.xml");
|
setEppInput("contact_transfer_approve.xml");
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
setupContactWithPendingTransfer();
|
setupContactWithPendingTransfer();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ContactTransferCancelFlowTest
|
||||||
extends ContactTransferFlowTestCase<ContactTransferCancelFlow, ContactResource> {
|
extends ContactTransferFlowTestCase<ContactTransferCancelFlow, ContactResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
this.setEppInput("contact_transfer_cancel.xml");
|
this.setEppInput("contact_transfer_cancel.xml");
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
setupContactWithPendingTransfer();
|
setupContactWithPendingTransfer();
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ContactTransferQueryFlowTest
|
||||||
extends ContactTransferFlowTestCase<ContactTransferQueryFlow, ContactResource> {
|
extends ContactTransferFlowTestCase<ContactTransferQueryFlow, ContactResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("contact_transfer_query.xml");
|
setEppInput("contact_transfer_query.xml");
|
||||||
clock.setTo(DateTime.parse("2000-06-10T22:00:00.0Z"));
|
clock.setTo(DateTime.parse("2000-06-10T22:00:00.0Z"));
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ContactTransferRejectFlowTest
|
||||||
extends ContactTransferFlowTestCase<ContactTransferRejectFlow, ContactResource> {
|
extends ContactTransferFlowTestCase<ContactTransferRejectFlow, ContactResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("contact_transfer_reject.xml");
|
setEppInput("contact_transfer_reject.xml");
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
setupContactWithPendingTransfer();
|
setupContactWithPendingTransfer();
|
||||||
|
|
|
@ -1845,79 +1845,79 @@ public class DomainApplicationCreateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_uppercase() throws Exception {
|
public void testFailure_uppercase() {
|
||||||
doFailingDomainNameTest("Example.tld", BadDomainNameCharacterException.class);
|
doFailingDomainNameTest("Example.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badCharacter() throws Exception {
|
public void testFailure_badCharacter() {
|
||||||
doFailingDomainNameTest("test_example.tld", BadDomainNameCharacterException.class);
|
doFailingDomainNameTest("test_example.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDash() throws Exception {
|
public void testFailure_leadingDash() {
|
||||||
doFailingDomainNameTest("-example.tld", LeadingDashException.class);
|
doFailingDomainNameTest("-example.tld", LeadingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_trailingDash() throws Exception {
|
public void testFailure_trailingDash() {
|
||||||
doFailingDomainNameTest("example-.tld", TrailingDashException.class);
|
doFailingDomainNameTest("example-.tld", TrailingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooLong() throws Exception {
|
public void testFailure_tooLong() {
|
||||||
doFailingDomainNameTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
doFailingDomainNameTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDot() throws Exception {
|
public void testFailure_leadingDot() {
|
||||||
doFailingDomainNameTest(".example.tld", EmptyDomainNamePartException.class);
|
doFailingDomainNameTest(".example.tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDotTld() throws Exception {
|
public void testFailure_leadingDotTld() {
|
||||||
doFailingDomainNameTest("foo..tld", EmptyDomainNamePartException.class);
|
doFailingDomainNameTest("foo..tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooManyParts() throws Exception {
|
public void testFailure_tooManyParts() {
|
||||||
doFailingDomainNameTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
doFailingDomainNameTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooFewParts() throws Exception {
|
public void testFailure_tooFewParts() {
|
||||||
doFailingDomainNameTest("tld", BadDomainNamePartsCountException.class);
|
doFailingDomainNameTest("tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameExistsAsTld_lowercase() throws Exception {
|
public void testFailure_domainNameExistsAsTld_lowercase() {
|
||||||
createTlds("foo.tld", "tld");
|
createTlds("foo.tld", "tld");
|
||||||
doFailingDomainNameTest("foo.tld", DomainNameExistsAsTldException.class);
|
doFailingDomainNameTest("foo.tld", DomainNameExistsAsTldException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameExistsAsTld_uppercase() throws Exception {
|
public void testFailure_domainNameExistsAsTld_uppercase() {
|
||||||
createTlds("foo.tld", "tld");
|
createTlds("foo.tld", "tld");
|
||||||
doFailingDomainNameTest("FOO.TLD", BadDomainNameCharacterException.class);
|
doFailingDomainNameTest("FOO.TLD", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidPunycode() throws Exception {
|
public void testFailure_invalidPunycode() {
|
||||||
doFailingDomainNameTest("xn--abcdefg.tld", InvalidPunycodeException.class);
|
doFailingDomainNameTest("xn--abcdefg.tld", InvalidPunycodeException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_dashesInThirdAndFourthPosition() throws Exception {
|
public void testFailure_dashesInThirdAndFourthPosition() {
|
||||||
doFailingDomainNameTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
doFailingDomainNameTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tldDoesNotExist() throws Exception {
|
public void testFailure_tldDoesNotExist() {
|
||||||
doFailingDomainNameTest("foo.nosuchtld", TldDoesNotExistException.class);
|
doFailingDomainNameTest("foo.nosuchtld", TldDoesNotExistException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidIdnCodePoints() throws Exception {
|
public void testFailure_invalidIdnCodePoints() {
|
||||||
// ❤☀☆☂☻♞☯.tld
|
// ❤☀☆☂☻♞☯.tld
|
||||||
doFailingDomainNameTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
doFailingDomainNameTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
unusedContact = persistActiveContact("unused");
|
unusedContact = persistActiveContact("unused");
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainApplication persistApplication() throws Exception {
|
private DomainApplication persistApplication() {
|
||||||
return persistResource(
|
return persistResource(
|
||||||
newApplicationBuilder()
|
newApplicationBuilder()
|
||||||
.setContacts(
|
.setContacts(
|
||||||
|
@ -129,7 +129,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
return newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD");
|
return newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD");
|
||||||
}
|
}
|
||||||
|
|
||||||
private DomainApplication persistNewApplication() throws Exception {
|
private DomainApplication persistNewApplication() {
|
||||||
return persistResource(newApplicationBuilder().build());
|
return persistResource(newApplicationBuilder().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSecDnsFailingTest(
|
private void doSecDnsFailingTest(
|
||||||
Class<? extends EppException> expectedException, String xmlFilename) throws Exception {
|
Class<? extends EppException> expectedException, String xmlFilename) {
|
||||||
setEppInput(xmlFilename);
|
setEppInput(xmlFilename);
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistNewApplication();
|
persistNewApplication();
|
||||||
|
@ -369,30 +369,30 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsAllCannotBeFalse() throws Exception {
|
public void testFailure_secDnsAllCannotBeFalse() {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(
|
||||||
SecDnsAllUsageException.class, "domain_update_sunrise_dsdata_rem_all_false.xml");
|
SecDnsAllUsageException.class, "domain_update_sunrise_dsdata_rem_all_false.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsEmptyNotAllowed() throws Exception {
|
public void testFailure_secDnsEmptyNotAllowed() {
|
||||||
doSecDnsFailingTest(EmptySecDnsUpdateException.class, "domain_update_sunrise_dsdata_empty.xml");
|
doSecDnsFailingTest(EmptySecDnsUpdateException.class, "domain_update_sunrise_dsdata_empty.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsUrgentNotSupported() throws Exception {
|
public void testFailure_secDnsUrgentNotSupported() {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(
|
||||||
UrgentAttributeNotSupportedException.class, "domain_update_sunrise_dsdata_urgent.xml");
|
UrgentAttributeNotSupportedException.class, "domain_update_sunrise_dsdata_urgent.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsChangeNotSupported() throws Exception {
|
public void testFailure_secDnsChangeNotSupported() {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(
|
||||||
MaxSigLifeChangeNotSupportedException.class, "domain_update_sunrise_maxsiglife.xml");
|
MaxSigLifeChangeNotSupportedException.class, "domain_update_sunrise_maxsiglife.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsTooManyDsRecords() throws Exception {
|
public void testFailure_secDnsTooManyDsRecords() {
|
||||||
ImmutableSet.Builder<DelegationSignerData> builder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DelegationSignerData> builder = new ImmutableSet.Builder<>();
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
builder.add(DelegationSignerData.create(i, 2, 3, new byte[] {0, 1, 2}));
|
builder.add(DelegationSignerData.create(i, 2, 3, new byte[] {0, 1, 2}));
|
||||||
|
@ -437,7 +437,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_applicationDomainNameMismatch() throws Exception {
|
public void testFailure_applicationDomainNameMismatch() {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
|
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
|
||||||
EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
|
EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
|
||||||
|
@ -462,7 +462,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientUpdateProhibited() throws Exception {
|
public void testFailure_clientUpdateProhibited() {
|
||||||
setEppInput("domain_update_sunrise_authinfo.xml");
|
setEppInput("domain_update_sunrise_authinfo.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -475,7 +475,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverUpdateProhibited() throws Exception {
|
public void testFailure_serverUpdateProhibited() {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newApplicationBuilder()
|
newApplicationBuilder()
|
||||||
|
@ -486,7 +486,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
|
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doIllegalApplicationStatusTest(ApplicationStatus status) throws Exception {
|
private void doIllegalApplicationStatusTest(ApplicationStatus status) {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(newApplicationBuilder().setApplicationStatus(status).build());
|
persistResource(newApplicationBuilder().setApplicationStatus(status).build());
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
|
@ -495,22 +495,22 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_allocatedApplicationStatus() throws Exception {
|
public void testFailure_allocatedApplicationStatus() {
|
||||||
doIllegalApplicationStatusTest(ApplicationStatus.ALLOCATED);
|
doIllegalApplicationStatusTest(ApplicationStatus.ALLOCATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidApplicationStatus() throws Exception {
|
public void testFailure_invalidApplicationStatus() {
|
||||||
doIllegalApplicationStatusTest(ApplicationStatus.INVALID);
|
doIllegalApplicationStatusTest(ApplicationStatus.INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_rejectedApplicationStatus() throws Exception {
|
public void testFailure_rejectedApplicationStatus() {
|
||||||
doIllegalApplicationStatusTest(ApplicationStatus.REJECTED);
|
doIllegalApplicationStatusTest(ApplicationStatus.REJECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingHost() throws Exception {
|
public void testFailure_missingHost() {
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
persistActiveContact("sh8013");
|
persistActiveContact("sh8013");
|
||||||
persistActiveContact("mak21");
|
persistActiveContact("mak21");
|
||||||
|
@ -521,7 +521,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingContact() throws Exception {
|
public void testFailure_missingContact() {
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
persistActiveHost("ns2.example.tld");
|
persistActiveHost("ns2.example.tld");
|
||||||
persistActiveContact("mak21");
|
persistActiveContact("mak21");
|
||||||
|
@ -553,7 +553,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientProhibitedStatusValue() throws Exception {
|
public void testFailure_clientProhibitedStatusValue() {
|
||||||
setEppInput("domain_update_sunrise_prohibited_status.xml");
|
setEppInput("domain_update_sunrise_prohibited_status.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistNewApplication();
|
persistNewApplication();
|
||||||
|
@ -572,7 +572,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_duplicateContactInCommand() throws Exception {
|
public void testFailure_duplicateContactInCommand() {
|
||||||
setEppInput("domain_update_sunrise_duplicate_contact.xml");
|
setEppInput("domain_update_sunrise_duplicate_contact.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistNewApplication();
|
persistNewApplication();
|
||||||
|
@ -581,7 +581,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingContactType() throws Exception {
|
public void testFailure_missingContactType() {
|
||||||
setEppInput("domain_update_sunrise_missing_contact_type.xml");
|
setEppInput("domain_update_sunrise_missing_contact_type.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistNewApplication();
|
persistNewApplication();
|
||||||
|
@ -591,7 +591,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unauthorizedClient() throws Exception {
|
public void testFailure_unauthorizedClient() {
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
|
@ -610,7 +610,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
public void testFailure_notAuthorizedForTld() {
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
|
@ -631,7 +631,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_sameNameserverAddedAndRemoved() throws Exception {
|
public void testFailure_sameNameserverAddedAndRemoved() {
|
||||||
setEppInput("domain_update_sunrise_add_remove_same_host.xml");
|
setEppInput("domain_update_sunrise_add_remove_same_host.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -646,7 +646,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_sameContactAddedAndRemoved() throws Exception {
|
public void testFailure_sameContactAddedAndRemoved() {
|
||||||
setEppInput("domain_update_sunrise_add_remove_same_contact.xml");
|
setEppInput("domain_update_sunrise_add_remove_same_contact.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -663,7 +663,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_removeAdmin() throws Exception {
|
public void testFailure_removeAdmin() {
|
||||||
setEppInput("domain_update_sunrise_remove_admin.xml");
|
setEppInput("domain_update_sunrise_remove_admin.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -678,7 +678,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_removeTech() throws Exception {
|
public void testFailure_removeTech() {
|
||||||
setEppInput("domain_update_sunrise_remove_tech.xml");
|
setEppInput("domain_update_sunrise_remove_tech.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -693,7 +693,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_newRegistrantNotWhitelisted() throws Exception {
|
public void testFailure_newRegistrantNotWhitelisted() {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -707,7 +707,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_newNameserverNotWhitelisted() throws Exception {
|
public void testFailure_newNameserverNotWhitelisted() {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -734,7 +734,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tldWithNameserverWhitelist_removeLastNameserver() throws Exception {
|
public void testFailure_tldWithNameserverWhitelist_removeLastNameserver() {
|
||||||
setEppInput("domain_update_sunrise_remove_nameserver.xml");
|
setEppInput("domain_update_sunrise_remove_nameserver.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
|
@ -790,7 +790,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameserverRestricted_addedNameserverDisallowed() throws Exception {
|
public void testFailure_domainNameserverRestricted_addedNameserverDisallowed() {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -807,7 +807,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameserverRestricted_removeLastNameserver() throws Exception {
|
public void testFailure_domainNameserverRestricted_removeLastNameserver() {
|
||||||
setEppInput("domain_update_sunrise_remove_nameserver.xml");
|
setEppInput("domain_update_sunrise_remove_nameserver.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
|
@ -868,8 +868,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_addedNameserversAllowedInTld_disallowedInDomainNameserversWhitelists()
|
public void testFailure_addedNameserversAllowedInTld_disallowedInDomainNameserversWhitelists() {
|
||||||
throws Exception {
|
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -888,8 +887,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_addedNameserversDisallowedInTld_AllowedInDomainNameserversWhitelists()
|
public void testFailure_addedNameserversDisallowedInTld_AllowedInDomainNameserversWhitelists() {
|
||||||
throws Exception {
|
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistApplication();
|
persistApplication();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class DomainCheckFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initCheckTest() throws Exception {
|
public void initCheckTest() {
|
||||||
createTld("tld", TldState.QUIET_PERIOD);
|
createTld("tld", TldState.QUIET_PERIOD);
|
||||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||||
}
|
}
|
||||||
|
@ -366,79 +366,79 @@ public class DomainCheckFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_uppercase() throws Exception {
|
public void testFailure_uppercase() {
|
||||||
doFailingBadLabelTest("FOO.tld", BadDomainNameCharacterException.class);
|
doFailingBadLabelTest("FOO.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badCharacter() throws Exception {
|
public void testFailure_badCharacter() {
|
||||||
doFailingBadLabelTest("test_example.tld", BadDomainNameCharacterException.class);
|
doFailingBadLabelTest("test_example.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDash() throws Exception {
|
public void testFailure_leadingDash() {
|
||||||
doFailingBadLabelTest("-example.tld", LeadingDashException.class);
|
doFailingBadLabelTest("-example.tld", LeadingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_trailingDash() throws Exception {
|
public void testFailure_trailingDash() {
|
||||||
doFailingBadLabelTest("example-.tld", TrailingDashException.class);
|
doFailingBadLabelTest("example-.tld", TrailingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooLong() throws Exception {
|
public void testFailure_tooLong() {
|
||||||
doFailingBadLabelTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
doFailingBadLabelTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDot() throws Exception {
|
public void testFailure_leadingDot() {
|
||||||
doFailingBadLabelTest(".example.tld", EmptyDomainNamePartException.class);
|
doFailingBadLabelTest(".example.tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDotTld() throws Exception {
|
public void testFailure_leadingDotTld() {
|
||||||
doFailingBadLabelTest("foo..tld", EmptyDomainNamePartException.class);
|
doFailingBadLabelTest("foo..tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooManyParts() throws Exception {
|
public void testFailure_tooManyParts() {
|
||||||
doFailingBadLabelTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
doFailingBadLabelTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooFewParts() throws Exception {
|
public void testFailure_tooFewParts() {
|
||||||
doFailingBadLabelTest("tld", BadDomainNamePartsCountException.class);
|
doFailingBadLabelTest("tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameExistsAsTld_lowercase() throws Exception {
|
public void testFailure_domainNameExistsAsTld_lowercase() {
|
||||||
createTlds("foo.tld", "tld");
|
createTlds("foo.tld", "tld");
|
||||||
doFailingBadLabelTest("foo.tld", DomainNameExistsAsTldException.class);
|
doFailingBadLabelTest("foo.tld", DomainNameExistsAsTldException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_domainNameExistsAsTld_uppercase() throws Exception {
|
public void testFailure_domainNameExistsAsTld_uppercase() {
|
||||||
createTlds("foo.tld", "tld");
|
createTlds("foo.tld", "tld");
|
||||||
doFailingBadLabelTest("FOO.TLD", BadDomainNameCharacterException.class);
|
doFailingBadLabelTest("FOO.TLD", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidPunycode() throws Exception {
|
public void testFailure_invalidPunycode() {
|
||||||
doFailingBadLabelTest("xn--abcdefg.tld", InvalidPunycodeException.class);
|
doFailingBadLabelTest("xn--abcdefg.tld", InvalidPunycodeException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_dashesInThirdAndFourthPosition() throws Exception {
|
public void testFailure_dashesInThirdAndFourthPosition() {
|
||||||
doFailingBadLabelTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
doFailingBadLabelTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tldDoesNotExist() throws Exception {
|
public void testFailure_tldDoesNotExist() {
|
||||||
doFailingBadLabelTest("foo.nosuchtld", TldDoesNotExistException.class);
|
doFailingBadLabelTest("foo.nosuchtld", TldDoesNotExistException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidIdnCodePoints() throws Exception {
|
public void testFailure_invalidIdnCodePoints() {
|
||||||
// ❤☀☆☂☻♞☯.tld
|
// ❤☀☆☂☻♞☯.tld
|
||||||
doFailingBadLabelTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
doFailingBadLabelTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -883,7 +883,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingClaimsNotice() throws Exception {
|
public void testFailure_missingClaimsNotice() {
|
||||||
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
||||||
setEppInput("domain_create.xml");
|
setEppInput("domain_create.xml");
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
|
@ -1634,68 +1634,68 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_uppercase() throws Exception {
|
public void testFailure_uppercase() {
|
||||||
doFailingDomainNameTest("Example.tld", BadDomainNameCharacterException.class);
|
doFailingDomainNameTest("Example.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badCharacter() throws Exception {
|
public void testFailure_badCharacter() {
|
||||||
doFailingDomainNameTest("test_example.tld", BadDomainNameCharacterException.class);
|
doFailingDomainNameTest("test_example.tld", BadDomainNameCharacterException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDash() throws Exception {
|
public void testFailure_leadingDash() {
|
||||||
doFailingDomainNameTest("-example.tld", LeadingDashException.class);
|
doFailingDomainNameTest("-example.tld", LeadingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_trailingDash() throws Exception {
|
public void testFailure_trailingDash() {
|
||||||
doFailingDomainNameTest("example-.tld", TrailingDashException.class);
|
doFailingDomainNameTest("example-.tld", TrailingDashException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooLong() throws Exception {
|
public void testFailure_tooLong() {
|
||||||
doFailingDomainNameTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
doFailingDomainNameTest(Strings.repeat("a", 64) + ".tld", DomainLabelTooLongException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDot() throws Exception {
|
public void testFailure_leadingDot() {
|
||||||
doFailingDomainNameTest(".example.tld", EmptyDomainNamePartException.class);
|
doFailingDomainNameTest(".example.tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_leadingDotTld() throws Exception {
|
public void testFailure_leadingDotTld() {
|
||||||
doFailingDomainNameTest("foo..tld", EmptyDomainNamePartException.class);
|
doFailingDomainNameTest("foo..tld", EmptyDomainNamePartException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooManyParts() throws Exception {
|
public void testFailure_tooManyParts() {
|
||||||
doFailingDomainNameTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
doFailingDomainNameTest("foo.example.tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooFewParts() throws Exception {
|
public void testFailure_tooFewParts() {
|
||||||
doFailingDomainNameTest("tld", BadDomainNamePartsCountException.class);
|
doFailingDomainNameTest("tld", BadDomainNamePartsCountException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidPunycode() throws Exception {
|
public void testFailure_invalidPunycode() {
|
||||||
// You don't want to know what this string (might?) mean.
|
// You don't want to know what this string (might?) mean.
|
||||||
doFailingDomainNameTest("xn--uxa129t5ap4f1h1bc3p.tld", InvalidPunycodeException.class);
|
doFailingDomainNameTest("xn--uxa129t5ap4f1h1bc3p.tld", InvalidPunycodeException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_dashesInThirdAndFourthPosition() throws Exception {
|
public void testFailure_dashesInThirdAndFourthPosition() {
|
||||||
doFailingDomainNameTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
doFailingDomainNameTest("ab--cdefg.tld", DashesInThirdAndFourthException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tldDoesNotExist() throws Exception {
|
public void testFailure_tldDoesNotExist() {
|
||||||
doFailingDomainNameTest("foo.nosuchtld", TldDoesNotExistException.class);
|
doFailingDomainNameTest("foo.nosuchtld", TldDoesNotExistException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidIdnCodePoints() throws Exception {
|
public void testFailure_invalidIdnCodePoints() {
|
||||||
// ❤☀☆☂☻♞☯.tld
|
// ❤☀☆☂☻♞☯.tld
|
||||||
doFailingDomainNameTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
doFailingDomainNameTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,8 +195,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertAutorenewClosedAndCancellationCreatedFor(
|
private void assertAutorenewClosedAndCancellationCreatedFor(
|
||||||
BillingEvent.OneTime graceBillingEvent, HistoryEntry historyEntryDomainDelete)
|
BillingEvent.OneTime graceBillingEvent, HistoryEntry historyEntryDomainDelete) {
|
||||||
throws Exception {
|
|
||||||
DateTime eventTime = clock.nowUtc();
|
DateTime eventTime = clock.nowUtc();
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
createAutorenewBillingEvent("TheRegistrar").setRecurrenceEndTime(eventTime).build(),
|
createAutorenewBillingEvent("TheRegistrar").setRecurrenceEndTime(eventTime).build(),
|
||||||
|
@ -212,7 +211,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertOnlyBillingEventIsClosedAutorenew(String clientId) throws Exception {
|
private void assertOnlyBillingEventIsClosedAutorenew(String clientId) {
|
||||||
// There should be no billing events (even timed to when the transfer would have expired) except
|
// There should be no billing events (even timed to when the transfer would have expired) except
|
||||||
// for the now closed autorenew one.
|
// for the now closed autorenew one.
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class DomainTransferApproveFlowTest
|
||||||
extends DomainTransferFlowTestCase<DomainTransferApproveFlow, DomainResource> {
|
extends DomainTransferFlowTestCase<DomainTransferApproveFlow, DomainResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("domain_transfer_approve.xml");
|
setEppInput("domain_transfer_approve.xml");
|
||||||
// Change the registry so that the renew price changes a day minus 1 millisecond before the
|
// Change the registry so that the renew price changes a day minus 1 millisecond before the
|
||||||
// transfer (right after there will be an autorenew in the test case that has one) and then
|
// transfer (right after there will be an autorenew in the test case that has one) and then
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class DomainTransferCancelFlowTest
|
||||||
extends DomainTransferFlowTestCase<DomainTransferCancelFlow, DomainResource> {
|
extends DomainTransferFlowTestCase<DomainTransferCancelFlow, DomainResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("domain_transfer_cancel.xml");
|
setEppInput("domain_transfer_cancel.xml");
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
setupDomainWithPendingTransfer("example", "tld");
|
setupDomainWithPendingTransfer("example", "tld");
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a domain that has a pending transfer on it from TheRegistrar to NewRegistrar. */
|
/** Adds a domain that has a pending transfer on it from TheRegistrar to NewRegistrar. */
|
||||||
protected void setupDomainWithPendingTransfer(String label, String tld) throws Exception {
|
protected void setupDomainWithPendingTransfer(String label, String tld) {
|
||||||
setupDomain(label, tld);
|
setupDomain(label, tld);
|
||||||
domain = persistWithPendingTransfer(domain);
|
domain = persistWithPendingTransfer(domain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DomainTransferQueryFlowTest
|
||||||
extends DomainTransferFlowTestCase<DomainTransferQueryFlow, DomainResource> {
|
extends DomainTransferFlowTestCase<DomainTransferQueryFlow, DomainResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("domain_transfer_query.xml");
|
setEppInput("domain_transfer_query.xml");
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
setupDomainWithPendingTransfer("example", "tld");
|
setupDomainWithPendingTransfer("example", "tld");
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class DomainTransferRejectFlowTest
|
||||||
extends DomainTransferFlowTestCase<DomainTransferRejectFlow, DomainResource> {
|
extends DomainTransferFlowTestCase<DomainTransferRejectFlow, DomainResource> {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
setEppInput("domain_transfer_reject.xml");
|
setEppInput("domain_transfer_reject.xml");
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
setupDomainWithPendingTransfer("example", "tld");
|
setupDomainWithPendingTransfer("example", "tld");
|
||||||
|
|
|
@ -209,8 +209,7 @@ public class DomainTransferRequestFlowTest
|
||||||
Optional<Money> transferCost,
|
Optional<Money> transferCost,
|
||||||
ImmutableSet<GracePeriod> originalGracePeriods,
|
ImmutableSet<GracePeriod> originalGracePeriods,
|
||||||
boolean expectTransferBillingEvent,
|
boolean expectTransferBillingEvent,
|
||||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents)
|
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) {
|
||||||
throws Exception {
|
|
||||||
Registry registry = Registry.get(domain.getTld());
|
Registry registry = Registry.get(domain.getTld());
|
||||||
final HistoryEntry historyEntryTransferRequest =
|
final HistoryEntry historyEntryTransferRequest =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
||||||
|
@ -668,7 +667,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v06() throws Exception {
|
public void testFailure_refundableFee_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -678,7 +677,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v11() throws Exception {
|
public void testFailure_refundableFee_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -688,7 +687,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v12() throws Exception {
|
public void testFailure_refundableFee_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -698,7 +697,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v06() throws Exception {
|
public void testFailure_gracePeriodFee_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -708,7 +707,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v11() throws Exception {
|
public void testFailure_gracePeriodFee_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -718,7 +717,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v12() throws Exception {
|
public void testFailure_gracePeriodFee_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -728,7 +727,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v06() throws Exception {
|
public void testFailure_appliedFee_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -738,7 +737,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v11() throws Exception {
|
public void testFailure_appliedFee_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -748,7 +747,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v12() throws Exception {
|
public void testFailure_appliedFee_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -788,7 +787,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_multiYearPeriod() throws Exception {
|
public void testFailure_multiYearPeriod() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
|
@ -879,7 +878,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_superuserExtension_twoYearPeriod() throws Exception {
|
public void testFailure_superuserExtension_twoYearPeriod() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
eppRequestSource = EppRequestSource.TOOL;
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -893,7 +892,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() throws Exception {
|
public void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
eppRequestSource = EppRequestSource.TOOL;
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -950,7 +949,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
public void testFailure_notAuthorizedForTld() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
|
@ -1091,7 +1090,7 @@ public class DomainTransferRequestFlowTest
|
||||||
runTest("domain_transfer_request_premium.xml", UserPrivileges.SUPERUSER);
|
runTest("domain_transfer_request_premium.xml", UserPrivileges.SUPERUSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runWrongCurrencyTest(Map<String, String> substitutions) throws Exception {
|
private void runWrongCurrencyTest(Map<String, String> substitutions) {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Registry.get("tld")
|
||||||
|
@ -1111,25 +1110,25 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongCurrency_v06() throws Exception {
|
public void testFailure_wrongCurrency_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongCurrencyTest(FEE_06_MAP);
|
runWrongCurrencyTest(FEE_06_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongCurrency_v11() throws Exception {
|
public void testFailure_wrongCurrency_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongCurrencyTest(FEE_11_MAP);
|
runWrongCurrencyTest(FEE_11_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongCurrency_v12() throws Exception {
|
public void testFailure_wrongCurrency_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongCurrencyTest(FEE_12_MAP);
|
runWrongCurrencyTest(FEE_12_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1139,7 +1138,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1149,7 +1148,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1172,25 +1171,25 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongFeeAmount_v06() throws Exception {
|
public void testFailure_wrongFeeAmount_v06() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongFeeAmountTest(FEE_06_MAP);
|
runWrongFeeAmountTest(FEE_06_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongFeeAmount_v11() throws Exception {
|
public void testFailure_wrongFeeAmount_v11() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongFeeAmountTest(FEE_11_MAP);
|
runWrongFeeAmountTest(FEE_11_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_wrongFeeAmount_v12() throws Exception {
|
public void testFailure_wrongFeeAmount_v12() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
runWrongFeeAmountTest(FEE_12_MAP);
|
runWrongFeeAmountTest(FEE_12_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_premiumBlocked() throws Exception {
|
public void testFailure_premiumBlocked() {
|
||||||
setupDomain("rich", "example");
|
setupDomain("rich", "example");
|
||||||
// Modify the Registrar to block premium names.
|
// Modify the Registrar to block premium names.
|
||||||
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||||
|
@ -1202,7 +1201,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() throws Exception {
|
public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() {
|
||||||
setupDomain("rich", "example");
|
setupDomain("rich", "example");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1212,7 +1211,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_registrarRequiresAcking_feeNotProvidedOnPremiumName() throws Exception {
|
public void testFailure_registrarRequiresAcking_feeNotProvidedOnPremiumName() {
|
||||||
setupDomain("rich", "example");
|
setupDomain("rich", "example");
|
||||||
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
|
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -1226,7 +1225,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_noAuthInfo() throws Exception {
|
public void testFailure_noAuthInfo() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1236,7 +1235,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact =
|
contact =
|
||||||
|
@ -1253,7 +1252,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactRepoId() throws Exception {
|
public void testFailure_badContactRepoId() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Set the contact to a different ROID, but don't persist it; this is just so the substitution
|
// Set the contact to a different ROID, but don't persist it; this is just so the substitution
|
||||||
// code above will write the wrong ROID into the file.
|
// code above will write the wrong ROID into the file.
|
||||||
|
@ -1301,7 +1300,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pending() throws Exception {
|
public void testFailure_pending() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain =
|
domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -1323,7 +1322,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
domain =
|
domain =
|
||||||
|
@ -1340,7 +1339,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_sponsoringClient() throws Exception {
|
public void testFailure_sponsoringClient() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
|
@ -1389,7 +1388,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_periodInMonths() throws Exception {
|
public void testFailure_periodInMonths() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -1399,7 +1398,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientTransferProhibited() throws Exception {
|
public void testFailure_clientTransferProhibited() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain =
|
domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -1412,7 +1411,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverTransferProhibited() throws Exception {
|
public void testFailure_serverTransferProhibited() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain =
|
domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -1425,7 +1424,7 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pendingDelete() throws Exception {
|
public void testFailure_pendingDelete() {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
|
|
|
@ -255,32 +255,32 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badCharacter() throws Exception {
|
public void testFailure_badCharacter() {
|
||||||
doFailingHostNameTest("foo bar", InvalidHostNameException.class);
|
doFailingHostNameTest("foo bar", InvalidHostNameException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooShallowPublicSuffix() throws Exception {
|
public void testFailure_tooShallowPublicSuffix() {
|
||||||
doFailingHostNameTest("example.tld", HostNameTooShallowException.class);
|
doFailingHostNameTest("example.tld", HostNameTooShallowException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooShallowCcTld() throws Exception {
|
public void testFailure_tooShallowCcTld() {
|
||||||
doFailingHostNameTest("foo.co.uk", HostNameTooShallowException.class);
|
doFailingHostNameTest("foo.co.uk", HostNameTooShallowException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_barePublicSuffix() throws Exception {
|
public void testFailure_barePublicSuffix() {
|
||||||
doFailingHostNameTest("com", HostNameTooShallowException.class);
|
doFailingHostNameTest("com", HostNameTooShallowException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_bareCcTld() throws Exception {
|
public void testFailure_bareCcTld() {
|
||||||
doFailingHostNameTest("co.uk", HostNameTooShallowException.class);
|
doFailingHostNameTest("co.uk", HostNameTooShallowException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooShallowNewTld() throws Exception {
|
public void testFailure_tooShallowNewTld() {
|
||||||
doFailingHostNameTest("example.lol", HostNameTooShallowException.class);
|
doFailingHostNameTest("example.lol", HostNameTooShallowException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,19 +129,19 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_existedButWasClientDeleteProhibited() throws Exception {
|
public void testFailure_existedButWasClientDeleteProhibited() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_existedButWasServerDeleteProhibited() throws Exception {
|
public void testFailure_existedButWasServerDeleteProhibited() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_existedButWasPendingDelete() throws Exception {
|
public void testFailure_existedButWasPendingDelete() {
|
||||||
doFailingStatusTest(
|
doFailingStatusTest(
|
||||||
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,50 +87,50 @@ public abstract class LoginFlowTestCase extends FlowTestCase<LoginFlow> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidVersion() throws Exception {
|
public void testFailure_invalidVersion() {
|
||||||
doFailingTest("login_invalid_version.xml", UnimplementedProtocolVersionException.class);
|
doFailingTest("login_invalid_version.xml", UnimplementedProtocolVersionException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidLanguage() throws Exception {
|
public void testFailure_invalidLanguage() {
|
||||||
doFailingTest("login_invalid_language.xml", UnsupportedLanguageException.class);
|
doFailingTest("login_invalid_language.xml", UnsupportedLanguageException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidExtension() throws Exception {
|
public void testFailure_invalidExtension() {
|
||||||
doFailingTest("login_invalid_extension.xml", UnimplementedExtensionException.class);
|
doFailingTest("login_invalid_extension.xml", UnimplementedExtensionException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_invalidTypes() throws Exception {
|
public void testFailure_invalidTypes() {
|
||||||
doFailingTest("login_invalid_types.xml", UnimplementedObjectServiceException.class);
|
doFailingTest("login_invalid_types.xml", UnimplementedObjectServiceException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_newPassword() throws Exception {
|
public void testFailure_newPassword() {
|
||||||
doFailingTest("login_invalid_newpw.xml", PasswordChangesNotSupportedException.class);
|
doFailingTest("login_invalid_newpw.xml", PasswordChangesNotSupportedException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unknownRegistrar() throws Exception {
|
public void testFailure_unknownRegistrar() {
|
||||||
deleteResource(getRegistrarBuilder().build());
|
deleteResource(getRegistrarBuilder().build());
|
||||||
doFailingTest("login_valid.xml", BadRegistrarClientIdException.class);
|
doFailingTest("login_valid.xml", BadRegistrarClientIdException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pendingRegistrar() throws Exception {
|
public void testFailure_pendingRegistrar() {
|
||||||
persistResource(getRegistrarBuilder().setState(State.PENDING).build());
|
persistResource(getRegistrarBuilder().setState(State.PENDING).build());
|
||||||
doFailingTest("login_valid.xml", RegistrarAccountNotActiveException.class);
|
doFailingTest("login_valid.xml", RegistrarAccountNotActiveException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_incorrectPassword() throws Exception {
|
public void testFailure_incorrectPassword() {
|
||||||
persistResource(getRegistrarBuilder().setPassword("diff password").build());
|
persistResource(getRegistrarBuilder().setPassword("diff password").build());
|
||||||
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_tooManyFailedLogins() throws Exception {
|
public void testFailure_tooManyFailedLogins() {
|
||||||
persistResource(getRegistrarBuilder().setPassword("diff password").build());
|
persistResource(getRegistrarBuilder().setPassword("diff password").build());
|
||||||
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
||||||
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
doFailingTest("login_valid.xml", BadRegistrarPasswordException.class);
|
||||||
|
@ -139,7 +139,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase<LoginFlow> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_alreadyLoggedIn() throws Exception {
|
public void testFailure_alreadyLoggedIn() {
|
||||||
sessionMetadata.setClientId("something");
|
sessionMetadata.setClientId("something");
|
||||||
doFailingTest("login_valid.xml", AlreadyLoggedInException.class);
|
doFailingTest("login_valid.xml", AlreadyLoggedInException.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,27 +44,27 @@ public class LoginFlowViaConsoleTest extends LoginFlowTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_withoutLoginAndLinkedAccount() throws Exception {
|
public void testFailure_withoutLoginAndLinkedAccount() {
|
||||||
persistLinkedAccount("person@example.com", GAE_USER_ID1);
|
persistLinkedAccount("person@example.com", GAE_USER_ID1);
|
||||||
credentials = GaeUserCredentials.forLoggedOutUser();
|
credentials = GaeUserCredentials.forLoggedOutUser();
|
||||||
doFailingTest("login_valid.xml", UserNotLoggedInException.class);
|
doFailingTest("login_valid.xml", UserNotLoggedInException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_withoutLoginAndWithoutLinkedAccount() throws Exception {
|
public void testFailure_withoutLoginAndWithoutLinkedAccount() {
|
||||||
credentials = GaeUserCredentials.forLoggedOutUser();
|
credentials = GaeUserCredentials.forLoggedOutUser();
|
||||||
doFailingTest("login_valid.xml", UserNotLoggedInException.class);
|
doFailingTest("login_valid.xml", UserNotLoggedInException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_withLoginAndWithoutLinkedAccount() throws Exception {
|
public void testFailure_withLoginAndWithoutLinkedAccount() {
|
||||||
credentials =
|
credentials =
|
||||||
GaeUserCredentials.forTestingUser(new User("person", "example.com", GAE_USER_ID1), false);
|
GaeUserCredentials.forTestingUser(new User("person", "example.com", GAE_USER_ID1), false);
|
||||||
doFailingTest("login_valid.xml", BadGaeUserIdException.class);
|
doFailingTest("login_valid.xml", BadGaeUserIdException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_withLoginAndNoMatchingLinkedAccount() throws Exception {
|
public void testFailure_withLoginAndNoMatchingLinkedAccount() {
|
||||||
persistLinkedAccount("joe@example.com", GAE_USER_ID2);
|
persistLinkedAccount("joe@example.com", GAE_USER_ID2);
|
||||||
credentials =
|
credentials =
|
||||||
GaeUserCredentials.forTestingUser(new User("person", "example.com", GAE_USER_ID1), false);
|
GaeUserCredentials.forTestingUser(new User("person", "example.com", GAE_USER_ID1), false);
|
||||||
|
|
|
@ -88,28 +88,28 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_incorrectClientCertificateHash() throws Exception {
|
public void testFailure_incorrectClientCertificateHash() {
|
||||||
persistResource(getRegistrarBuilder().build());
|
persistResource(getRegistrarBuilder().build());
|
||||||
credentials = new TlsCredentials(BAD_CERT, GOOD_IP, "goo.example");
|
credentials = new TlsCredentials(BAD_CERT, GOOD_IP, "goo.example");
|
||||||
doFailingTest("login_valid.xml", BadRegistrarCertificateException.class);
|
doFailingTest("login_valid.xml", BadRegistrarCertificateException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingClientCertificateHash() throws Exception {
|
public void testFailure_missingClientCertificateHash() {
|
||||||
persistResource(getRegistrarBuilder().build());
|
persistResource(getRegistrarBuilder().build());
|
||||||
credentials = new TlsCredentials(null, GOOD_IP, "goo.example");
|
credentials = new TlsCredentials(null, GOOD_IP, "goo.example");
|
||||||
doFailingTest("login_valid.xml", MissingRegistrarCertificateException.class);
|
doFailingTest("login_valid.xml", MissingRegistrarCertificateException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_noSniAndCertRequired() throws Exception {
|
public void testFailure_noSniAndCertRequired() {
|
||||||
persistResource(getRegistrarBuilder().build());
|
persistResource(getRegistrarBuilder().build());
|
||||||
credentials = new TlsCredentials(null, GOOD_IP, null);
|
credentials = new TlsCredentials(null, GOOD_IP, null);
|
||||||
doFailingTest("login_valid.xml", NoSniException.class);
|
doFailingTest("login_valid.xml", NoSniException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingClientIpAddress() throws Exception {
|
public void testFailure_missingClientIpAddress() {
|
||||||
persistResource(
|
persistResource(
|
||||||
getRegistrarBuilder()
|
getRegistrarBuilder()
|
||||||
.setIpAddressWhitelist(ImmutableList.of(
|
.setIpAddressWhitelist(ImmutableList.of(
|
||||||
|
@ -121,7 +121,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_incorrectClientIpv4Address() throws Exception {
|
public void testFailure_incorrectClientIpv4Address() {
|
||||||
persistResource(
|
persistResource(
|
||||||
getRegistrarBuilder()
|
getRegistrarBuilder()
|
||||||
.setIpAddressWhitelist(ImmutableList.of(
|
.setIpAddressWhitelist(ImmutableList.of(
|
||||||
|
@ -133,7 +133,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_incorrectClientIpv6Address() throws Exception {
|
public void testFailure_incorrectClientIpv6Address() {
|
||||||
persistResource(
|
persistResource(
|
||||||
getRegistrarBuilder()
|
getRegistrarBuilder()
|
||||||
.setIpAddressWhitelist(ImmutableList.of(
|
.setIpAddressWhitelist(ImmutableList.of(
|
||||||
|
|
|
@ -24,7 +24,6 @@ import google.registry.model.server.KmsSecretRevision;
|
||||||
import google.registry.model.server.KmsSecretRevision.Builder;
|
import google.registry.model.server.KmsSecretRevision.Builder;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.BouncyCastleProviderRule;
|
import google.registry.testing.BouncyCastleProviderRule;
|
||||||
import java.io.IOException;
|
|
||||||
import org.bouncycastle.openpgp.PGPKeyPair;
|
import org.bouncycastle.openpgp.PGPKeyPair;
|
||||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
|
@ -112,7 +111,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getRdeSshClientPublicKey() throws Exception {
|
public void test_getRdeSshClientPublicKey() {
|
||||||
saveCleartextSecret("rde-ssh-client-public-string");
|
saveCleartextSecret("rde-ssh-client-public-string");
|
||||||
|
|
||||||
String rdeSshClientPublicKey = keyring.getRdeSshClientPublicKey();
|
String rdeSshClientPublicKey = keyring.getRdeSshClientPublicKey();
|
||||||
|
@ -121,7 +120,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getRdeSshClientPrivateKey() throws Exception {
|
public void test_getRdeSshClientPrivateKey() {
|
||||||
saveCleartextSecret("rde-ssh-client-private-string");
|
saveCleartextSecret("rde-ssh-client-private-string");
|
||||||
|
|
||||||
String rdeSshClientPrivateKey = keyring.getRdeSshClientPrivateKey();
|
String rdeSshClientPrivateKey = keyring.getRdeSshClientPrivateKey();
|
||||||
|
@ -130,7 +129,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getIcannReportingPassword() throws Exception {
|
public void test_getIcannReportingPassword() {
|
||||||
saveCleartextSecret("icann-reporting-password-string");
|
saveCleartextSecret("icann-reporting-password-string");
|
||||||
|
|
||||||
String icannReportingPassword = keyring.getIcannReportingPassword();
|
String icannReportingPassword = keyring.getIcannReportingPassword();
|
||||||
|
@ -139,7 +138,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getMarksdbDnlLogin() throws Exception {
|
public void test_getMarksdbDnlLogin() {
|
||||||
saveCleartextSecret("marksdb-dnl-login-string");
|
saveCleartextSecret("marksdb-dnl-login-string");
|
||||||
|
|
||||||
String marksdbDnlLogin = keyring.getMarksdbDnlLogin();
|
String marksdbDnlLogin = keyring.getMarksdbDnlLogin();
|
||||||
|
@ -148,7 +147,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getMarksdbLordnPassword() throws Exception {
|
public void test_getMarksdbLordnPassword() {
|
||||||
saveCleartextSecret("marksdb-lordn-password-string");
|
saveCleartextSecret("marksdb-lordn-password-string");
|
||||||
|
|
||||||
String marksdbLordnPassword = keyring.getMarksdbLordnPassword();
|
String marksdbLordnPassword = keyring.getMarksdbLordnPassword();
|
||||||
|
@ -157,7 +156,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getMarksdbSmdrlLogin() throws Exception {
|
public void test_getMarksdbSmdrlLogin() {
|
||||||
saveCleartextSecret("marksdb-smdrl-login-string");
|
saveCleartextSecret("marksdb-smdrl-login-string");
|
||||||
|
|
||||||
String marksdbSmdrlLogin = keyring.getMarksdbSmdrlLogin();
|
String marksdbSmdrlLogin = keyring.getMarksdbSmdrlLogin();
|
||||||
|
@ -167,7 +166,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getJsonCredential() throws Exception {
|
public void test_getJsonCredential() {
|
||||||
saveCleartextSecret("json-credential-string");
|
saveCleartextSecret("json-credential-string");
|
||||||
|
|
||||||
String jsonCredential = keyring.getJsonCredential();
|
String jsonCredential = keyring.getJsonCredential();
|
||||||
|
@ -176,7 +175,7 @@ public class KmsKeyringTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getBraintreePrivateKey() throws Exception {
|
public void test_getBraintreePrivateKey() {
|
||||||
saveCleartextSecret("braintree-private-key-string");
|
saveCleartextSecret("braintree-private-key-string");
|
||||||
|
|
||||||
String braintreePrivateKey = keyring.getBraintreePrivateKey();
|
String braintreePrivateKey = keyring.getBraintreePrivateKey();
|
||||||
|
@ -184,7 +183,7 @@ public class KmsKeyringTest {
|
||||||
assertThat(braintreePrivateKey).isEqualTo("braintree-private-key-stringmoo");
|
assertThat(braintreePrivateKey).isEqualTo("braintree-private-key-stringmoo");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void persistSecret(String secretName, byte[] secretValue) throws IOException {
|
private static void persistSecret(String secretName, byte[] secretValue) {
|
||||||
KmsConnection kmsConnection = new FakeKmsConnection();
|
KmsConnection kmsConnection = new FakeKmsConnection();
|
||||||
|
|
||||||
KmsSecretRevision secretRevision =
|
KmsSecretRevision secretRevision =
|
||||||
|
@ -197,7 +196,7 @@ public class KmsKeyringTest {
|
||||||
persistResources(ImmutableList.of(secretRevision, secret));
|
persistResources(ImmutableList.of(secretRevision, secret));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void saveCleartextSecret(String secretName) throws Exception {
|
private static void saveCleartextSecret(String secretName) {
|
||||||
persistSecret(secretName, KeySerializer.serializeString(secretName + "moo"));
|
persistSecret(secretName, KeySerializer.serializeString(secretName + "moo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setMultipleSecrets() throws Exception {
|
public void test_setMultipleSecrets() {
|
||||||
updater
|
updater
|
||||||
.setBraintreePrivateKey("value1")
|
.setBraintreePrivateKey("value1")
|
||||||
.setIcannReportingPassword("value2")
|
.setIcannReportingPassword("value2")
|
||||||
|
@ -68,7 +68,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setBraintreePrivateKey() throws Exception {
|
public void test_setBraintreePrivateKey() {
|
||||||
updater.setBraintreePrivateKey("value1").update();
|
updater.setBraintreePrivateKey("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -102,7 +102,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setIcannReportingPassword() throws Exception {
|
public void test_setIcannReportingPassword() {
|
||||||
updater.setIcannReportingPassword("value1").update();
|
updater.setIcannReportingPassword("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -112,7 +112,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setJsonCredential() throws Exception {
|
public void test_setJsonCredential() {
|
||||||
updater.setJsonCredential("value1").update();
|
updater.setJsonCredential("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -120,7 +120,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setMarksdbDnlLogin() throws Exception {
|
public void test_setMarksdbDnlLogin() {
|
||||||
updater.setMarksdbDnlLogin("value1").update();
|
updater.setMarksdbDnlLogin("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -128,7 +128,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setMarksdbLordnPassword() throws Exception {
|
public void test_setMarksdbLordnPassword() {
|
||||||
updater.setMarksdbLordnPassword("value1").update();
|
updater.setMarksdbLordnPassword("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -138,7 +138,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setMarksdbSmdrlLogin() throws Exception {
|
public void test_setMarksdbSmdrlLogin() {
|
||||||
updater.setMarksdbSmdrlLogin("value1").update();
|
updater.setMarksdbSmdrlLogin("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -171,7 +171,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setRdeSshClientPrivateKey() throws Exception {
|
public void test_setRdeSshClientPrivateKey() {
|
||||||
updater.setRdeSshClientPrivateKey("value1").update();
|
updater.setRdeSshClientPrivateKey("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -181,7 +181,7 @@ public class KmsUpdaterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_setRdeSshClientPublicKey() throws Exception {
|
public void test_setRdeSshClientPublicKey() {
|
||||||
updater.setRdeSshClientPublicKey("value1").update();
|
updater.setRdeSshClientPublicKey("value1").update();
|
||||||
|
|
||||||
verifySecretAndSecretRevisionWritten(
|
verifySecretAndSecretRevisionWritten(
|
||||||
|
@ -215,11 +215,11 @@ public class KmsUpdaterTest {
|
||||||
assertThat(secretRevision.getEncryptedValue()).isEqualTo(expectedEncryptedValue);
|
assertThat(secretRevision.getEncryptedValue()).isEqualTo(expectedEncryptedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getCiphertext(byte[] plaintext) throws IOException {
|
private static String getCiphertext(byte[] plaintext) {
|
||||||
return new FakeKmsConnection().encrypt("blah", plaintext).ciphertext();
|
return new FakeKmsConnection().encrypt("blah", plaintext).ciphertext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getCiphertext(String plaintext) throws IOException {
|
private static String getCiphertext(String plaintext) {
|
||||||
return getCiphertext(KeySerializer.serializeString(plaintext));
|
return getCiphertext(KeySerializer.serializeString(plaintext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class TimedTransitionPropertyTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_getValueAtTime() throws Exception {
|
public void testSuccess_getValueAtTime() {
|
||||||
testGetValueAtTime(timedString);
|
testGetValueAtTime(timedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class TimedTransitionPropertyTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_simulatedLoad() throws Exception {
|
public void testSuccess_simulatedLoad() {
|
||||||
// Just for testing, don't extract transitions from a TimedTransitionProperty in real code.
|
// Just for testing, don't extract transitions from a TimedTransitionProperty in real code.
|
||||||
Set<Map.Entry<DateTime, StringTimedTransition>> transitions = timedString.entrySet();
|
Set<Map.Entry<DateTime, StringTimedTransition>> transitions = timedString.entrySet();
|
||||||
timedString = forMapify("0", StringTimedTransition.class);
|
timedString = forMapify("0", StringTimedTransition.class);
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class OfyFilterTest {
|
||||||
|
|
||||||
/** The filter should register all types for us. */
|
/** The filter should register all types for us. */
|
||||||
@Test
|
@Test
|
||||||
public void testKeyCreateAfterFilter() throws Exception {
|
public void testKeyCreateAfterFilter() {
|
||||||
new OfyFilter().init(null);
|
new OfyFilter().init(null);
|
||||||
ContactResource contact = newContactResource("contact1234");
|
ContactResource contact = newContactResource("contact1234");
|
||||||
Key.create(contact);
|
Key.create(contact);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class PremiumListUtilsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSave_largeNumberOfEntries_succeeds() throws Exception {
|
public void testSave_largeNumberOfEntries_succeeds() {
|
||||||
PremiumList premiumList = persistHumongousPremiumList("tld", 2500);
|
PremiumList premiumList = persistHumongousPremiumList("tld", 2500);
|
||||||
assertThat(loadPremiumListEntries(premiumList)).hasSize(2500);
|
assertThat(loadPremiumListEntries(premiumList)).hasSize(2500);
|
||||||
assertThat(getPremiumPrice("7", Registry.get("tld"))).hasValue(Money.parse("USD 100"));
|
assertThat(getPremiumPrice("7", Registry.get("tld"))).hasValue(Money.parse("USD 100"));
|
||||||
|
@ -258,7 +258,7 @@ public class PremiumListUtilsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPremiumPrice_allLabelsAreNonPremium_whenNotInList() throws Exception {
|
public void testGetPremiumPrice_allLabelsAreNonPremium_whenNotInList() {
|
||||||
assertThat(getPremiumPrice("blah", Registry.get("tld"))).isEmpty();
|
assertThat(getPremiumPrice("blah", Registry.get("tld"))).isEmpty();
|
||||||
assertThat(getPremiumPrice("slinge", Registry.get("tld"))).isEmpty();
|
assertThat(getPremiumPrice("slinge", Registry.get("tld"))).isEmpty();
|
||||||
assertMetricOutcomeCount(2, BLOOM_FILTER_NEGATIVE);
|
assertMetricOutcomeCount(2, BLOOM_FILTER_NEGATIVE);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class BigQueryMetricsEnqueuerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExport() throws Exception {
|
public void testExport() {
|
||||||
TestMetric metric =
|
TestMetric metric =
|
||||||
TestMetric.create(
|
TestMetric.create(
|
||||||
DateTime.parse("1984-12-18TZ"), DateTime.parse("1984-12-18TZ").plusMillis(1));
|
DateTime.parse("1984-12-18TZ"), DateTime.parse("1984-12-18TZ").plusMillis(1));
|
||||||
|
|
|
@ -187,14 +187,14 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_noTlds_returns204() throws Exception {
|
public void testRun_noTlds_returns204() {
|
||||||
action.run();
|
action.run();
|
||||||
assertThat(response.getStatus()).isEqualTo(204);
|
assertThat(response.getStatus()).isEqualTo(204);
|
||||||
assertNoTasksEnqueued("mapreduce");
|
assertNoTasksEnqueued("mapreduce");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_tldWithoutEscrowEnabled_returns204() throws Exception {
|
public void testRun_tldWithoutEscrowEnabled_returns204() {
|
||||||
createTld("lol");
|
createTld("lol");
|
||||||
persistResource(Registry.get("lol").asBuilder().setEscrowEnabled(false).build());
|
persistResource(Registry.get("lol").asBuilder().setEscrowEnabled(false).build());
|
||||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||||
|
@ -204,7 +204,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_tldWithEscrowEnabled_runsMapReduce() throws Exception {
|
public void testRun_tldWithEscrowEnabled_runsMapReduce() {
|
||||||
createTldWithEscrowEnabled("lol");
|
createTldWithEscrowEnabled("lol");
|
||||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||||
action.run();
|
action.run();
|
||||||
|
@ -214,7 +214,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_withinTransactionCooldown_getsExcludedAndReturns204() throws Exception {
|
public void testRun_withinTransactionCooldown_getsExcludedAndReturns204() {
|
||||||
createTldWithEscrowEnabled("lol");
|
createTldWithEscrowEnabled("lol");
|
||||||
clock.setTo(DateTime.parse("2000-01-01T00:04:59Z"));
|
clock.setTo(DateTime.parse("2000-01-01T00:04:59Z"));
|
||||||
action.transactionCooldown = Duration.standardMinutes(5);
|
action.transactionCooldown = Duration.standardMinutes(5);
|
||||||
|
@ -224,7 +224,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_afterTransactionCooldown_runsMapReduce() throws Exception {
|
public void testRun_afterTransactionCooldown_runsMapReduce() {
|
||||||
createTldWithEscrowEnabled("lol");
|
createTldWithEscrowEnabled("lol");
|
||||||
clock.setTo(DateTime.parse("2000-01-01T00:05:00Z"));
|
clock.setTo(DateTime.parse("2000-01-01T00:05:00Z"));
|
||||||
action.transactionCooldown = Duration.standardMinutes(5);
|
action.transactionCooldown = Duration.standardMinutes(5);
|
||||||
|
@ -306,7 +306,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManualRun_validParameters_runsMapReduce() throws Exception {
|
public void testManualRun_validParameters_runsMapReduce() {
|
||||||
createTldWithEscrowEnabled("lol");
|
createTldWithEscrowEnabled("lol");
|
||||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||||
action.manual = true;
|
action.manual = true;
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class RdeUploadActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun() throws Exception {
|
public void testRun() {
|
||||||
createTld("lol");
|
createTld("lol");
|
||||||
RdeUploadAction action = createAction(null);
|
RdeUploadAction action = createAction(null);
|
||||||
action.tld = "lol";
|
action.tld = "lol";
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class RdeContactInputTest {
|
||||||
Optional<Integer> numberOfShards,
|
Optional<Integer> numberOfShards,
|
||||||
int whichReader,
|
int whichReader,
|
||||||
int expectedOffset,
|
int expectedOffset,
|
||||||
int expectedMaxResults) throws Exception {
|
int expectedMaxResults) {
|
||||||
RdeContactInput input = getInput(numberOfShards);
|
RdeContactInput input = getInput(numberOfShards);
|
||||||
List<?> readers = input.createReaders();
|
List<?> readers = input.createReaders();
|
||||||
RdeContactReader reader = (RdeContactReader) readers.get(whichReader);
|
RdeContactReader reader = (RdeContactReader) readers.get(whichReader);
|
||||||
|
@ -238,7 +238,7 @@ public class RdeContactInputTest {
|
||||||
* @param expectedNumberOfReaders Expected size of the list returned
|
* @param expectedNumberOfReaders Expected size of the list returned
|
||||||
*/
|
*/
|
||||||
private void assertNumberOfReaders(Optional<Integer> numberOfShards,
|
private void assertNumberOfReaders(Optional<Integer> numberOfShards,
|
||||||
int expectedNumberOfReaders) throws Exception {
|
int expectedNumberOfReaders) {
|
||||||
RdeContactInput input = getInput(numberOfShards);
|
RdeContactInput input = getInput(numberOfShards);
|
||||||
List<?> readers = input.createReaders();
|
List<?> readers = input.createReaders();
|
||||||
assertThat(readers).hasSize(expectedNumberOfReaders);
|
assertThat(readers).hasSize(expectedNumberOfReaders);
|
||||||
|
|
|
@ -220,8 +220,10 @@ public class RdeHostInputTest {
|
||||||
* @param expectedMaxResults Expected maxResults of the reader
|
* @param expectedMaxResults Expected maxResults of the reader
|
||||||
*/
|
*/
|
||||||
private void assertReaderConfigurations(
|
private void assertReaderConfigurations(
|
||||||
Optional<Integer> numberOfShards, int whichReader, int expectedOffset, int expectedMaxResults)
|
Optional<Integer> numberOfShards,
|
||||||
throws Exception {
|
int whichReader,
|
||||||
|
int expectedOffset,
|
||||||
|
int expectedMaxResults) {
|
||||||
RdeHostInput input = getInput(numberOfShards);
|
RdeHostInput input = getInput(numberOfShards);
|
||||||
List<?> readers = input.createReaders();
|
List<?> readers = input.createReaders();
|
||||||
RdeHostReader reader = (RdeHostReader) readers.get(whichReader);
|
RdeHostReader reader = (RdeHostReader) readers.get(whichReader);
|
||||||
|
@ -245,8 +247,8 @@ public class RdeHostInputTest {
|
||||||
* @param numberOfShards Number of desired shards ({@link Optional#empty} uses default of 50)
|
* @param numberOfShards Number of desired shards ({@link Optional#empty} uses default of 50)
|
||||||
* @param expectedNumberOfReaders Expected size of the list returned
|
* @param expectedNumberOfReaders Expected size of the list returned
|
||||||
*/
|
*/
|
||||||
private void assertNumberOfReaders(Optional<Integer> numberOfShards, int expectedNumberOfReaders)
|
private void assertNumberOfReaders(
|
||||||
throws Exception {
|
Optional<Integer> numberOfShards, int expectedNumberOfReaders) {
|
||||||
RdeHostInput input = getInput(numberOfShards);
|
RdeHostInput input = getInput(numberOfShards);
|
||||||
List<?> readers = input.createReaders();
|
List<?> readers = input.createReaders();
|
||||||
assertThat(readers).hasSize(expectedNumberOfReaders);
|
assertThat(readers).hasSize(expectedNumberOfReaders);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class PublishInvoicesActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testJobDone_enqueuesCopyAction_emailsResults() throws Exception {
|
public void testJobDone_enqueuesCopyAction_emailsResults() {
|
||||||
expectedJob.setCurrentState("JOB_STATE_DONE");
|
expectedJob.setCurrentState("JOB_STATE_DONE");
|
||||||
uploadAction.run();
|
uploadAction.run();
|
||||||
assertThat(response.getStatus()).isEqualTo(SC_OK);
|
assertThat(response.getStatus()).isEqualTo(SC_OK);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.io.IOException;
|
|
||||||
import org.joda.time.YearMonth;
|
import org.joda.time.YearMonth;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -36,7 +35,7 @@ public class ActivityReportingQueryBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAggregateQueryMatch() throws IOException {
|
public void testAggregateQueryMatch() {
|
||||||
ActivityReportingQueryBuilder queryBuilder = getQueryBuilder();
|
ActivityReportingQueryBuilder queryBuilder = getQueryBuilder();
|
||||||
assertThat(queryBuilder.getReportQuery())
|
assertThat(queryBuilder.getReportQuery())
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
|
@ -45,7 +44,7 @@ public class ActivityReportingQueryBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntermediaryQueryMatch() throws IOException {
|
public void testIntermediaryQueryMatch() {
|
||||||
ImmutableList<String> expectedQueryNames =
|
ImmutableList<String> expectedQueryNames =
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
ActivityReportingQueryBuilder.REGISTRAR_OPERATING_STATUS,
|
ActivityReportingQueryBuilder.REGISTRAR_OPERATING_STATUS,
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class IcannReportingStagingActionTest {
|
||||||
when(stager.stageReports(ReportType.TRANSACTIONS)).thenReturn(ImmutableList.of("c", "d"));
|
when(stager.stageReports(ReportType.TRANSACTIONS)).thenReturn(ImmutableList.of("c", "d"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertUploadTaskEnqueued(String subDir) throws Exception {
|
private static void assertUploadTaskEnqueued(String subDir) {
|
||||||
TaskMatcher matcher =
|
TaskMatcher matcher =
|
||||||
new TaskMatcher()
|
new TaskMatcher()
|
||||||
.url("/_dr/task/icannReportingUpload")
|
.url("/_dr/task/icannReportingUpload")
|
||||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.io.IOException;
|
|
||||||
import org.joda.time.YearMonth;
|
import org.joda.time.YearMonth;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -36,7 +35,7 @@ public class TransactionsReportingQueryBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAggregateQueryMatch() throws IOException {
|
public void testAggregateQueryMatch() {
|
||||||
TransactionsReportingQueryBuilder queryBuilder = getQueryBuilder();
|
TransactionsReportingQueryBuilder queryBuilder = getQueryBuilder();
|
||||||
assertThat(queryBuilder.getReportQuery())
|
assertThat(queryBuilder.getReportQuery())
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
|
@ -45,7 +44,7 @@ public class TransactionsReportingQueryBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntermediaryQueryMatch() throws IOException {
|
public void testIntermediaryQueryMatch() {
|
||||||
ImmutableList<String> expectedQueryNames =
|
ImmutableList<String> expectedQueryNames =
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
TransactionsReportingQueryBuilder.TRANSACTIONS_REPORT_AGGREGATION,
|
TransactionsReportingQueryBuilder.TRANSACTIONS_REPORT_AGGREGATION,
|
||||||
|
|
|
@ -202,14 +202,12 @@ public class TaskQueueHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ensures that the tasks in the named queue are exactly those with the expected names. */
|
/** Ensures that the tasks in the named queue are exactly those with the expected names. */
|
||||||
public static void assertTasksEnqueued(String queueName, String... expectedTaskNames)
|
public static void assertTasksEnqueued(String queueName, String... expectedTaskNames) {
|
||||||
throws Exception {
|
|
||||||
Function<TaskStateInfo, String> nameGetter = TaskStateInfo::getTaskName;
|
Function<TaskStateInfo, String> nameGetter = TaskStateInfo::getTaskName;
|
||||||
assertTasksEnqueuedWithProperty(queueName, nameGetter, expectedTaskNames);
|
assertTasksEnqueuedWithProperty(queueName, nameGetter, expectedTaskNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertTasksEnqueued(String queueName, Iterable<TaskStateInfo> taskStateInfos)
|
public static void assertTasksEnqueued(String queueName, Iterable<TaskStateInfo> taskStateInfos) {
|
||||||
throws Exception {
|
|
||||||
ImmutableList.Builder<TaskMatcher> taskMatchers = new ImmutableList.Builder<>();
|
ImmutableList.Builder<TaskMatcher> taskMatchers = new ImmutableList.Builder<>();
|
||||||
for (TaskStateInfo taskStateInfo : taskStateInfos) {
|
for (TaskStateInfo taskStateInfo : taskStateInfos) {
|
||||||
taskMatchers.add(new TaskMatcher(taskStateInfo));
|
taskMatchers.add(new TaskMatcher(taskStateInfo));
|
||||||
|
@ -221,8 +219,7 @@ public class TaskQueueHelper {
|
||||||
* Ensures that the only tasks in the named queue are exactly those that match the expected
|
* Ensures that the only tasks in the named queue are exactly those that match the expected
|
||||||
* matchers.
|
* matchers.
|
||||||
*/
|
*/
|
||||||
public static void assertTasksEnqueued(String queueName, TaskMatcher... taskMatchers)
|
public static void assertTasksEnqueued(String queueName, TaskMatcher... taskMatchers) {
|
||||||
throws Exception {
|
|
||||||
assertTasksEnqueued(queueName, Arrays.asList(taskMatchers));
|
assertTasksEnqueued(queueName, Arrays.asList(taskMatchers));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +287,7 @@ public class TaskQueueHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ensures that the DNS queue tasks are exactly those for the expected target names. */
|
/** Ensures that the DNS queue tasks are exactly those for the expected target names. */
|
||||||
public static void assertDnsTasksEnqueued(String... expectedTaskTargetNames) throws Exception {
|
public static void assertDnsTasksEnqueued(String... expectedTaskTargetNames) {
|
||||||
assertTasksEnqueuedWithProperty(
|
assertTasksEnqueuedWithProperty(
|
||||||
DnsConstants.DNS_PULL_QUEUE_NAME,
|
DnsConstants.DNS_PULL_QUEUE_NAME,
|
||||||
taskStateInfo -> getParamFromTaskInfo(taskStateInfo, DnsConstants.DNS_TARGET_NAME_PARAM),
|
taskStateInfo -> getParamFromTaskInfo(taskStateInfo, DnsConstants.DNS_TARGET_NAME_PARAM),
|
||||||
|
@ -298,7 +295,7 @@ public class TaskQueueHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ensures that the DNS queue does not contain any tasks. */
|
/** Ensures that the DNS queue does not contain any tasks. */
|
||||||
public static void assertNoDnsTasksEnqueued() throws Exception {
|
public static void assertNoDnsTasksEnqueued() {
|
||||||
assertNoTasksEnqueued(DnsConstants.DNS_PULL_QUEUE_NAME);
|
assertNoTasksEnqueued(DnsConstants.DNS_PULL_QUEUE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class LordnTaskTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_enqueueDomainResourceTask_sunrise() throws Exception {
|
public void test_enqueueDomainResourceTask_sunrise() {
|
||||||
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
||||||
.setRepoId("A-EXAMPLE")
|
.setRepoId("A-EXAMPLE")
|
||||||
.build();
|
.build();
|
||||||
|
@ -120,7 +120,7 @@ public class LordnTaskTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_enqueueDomainResourceTask_claims() throws Exception {
|
public void test_enqueueDomainResourceTask_claims() {
|
||||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||||
DomainResource domain = newDomainBuilder(time)
|
DomainResource domain = newDomainBuilder(time)
|
||||||
.setRepoId("11-EXAMPLE")
|
.setRepoId("11-EXAMPLE")
|
||||||
|
@ -134,7 +134,7 @@ public class LordnTaskTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_oteRegistrarWithNullIanaId() throws Exception {
|
public void test_oteRegistrarWithNullIanaId() {
|
||||||
ofy()
|
ofy()
|
||||||
.transact(
|
.transact(
|
||||||
() ->
|
() ->
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class NordnUploadActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_claimsMode_verifyTaskGetsEnqueuedWithClaimsCsv() throws Exception {
|
public void testRun_claimsMode_verifyTaskGetsEnqueuedWithClaimsCsv() {
|
||||||
persistClaimsModeDomain();
|
persistClaimsModeDomain();
|
||||||
action.run();
|
action.run();
|
||||||
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
||||||
|
@ -182,7 +182,7 @@ public class NordnUploadActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_sunriseMode_verifyTaskGetsEnqueuedWithSunriseCsv() throws Exception {
|
public void testRun_sunriseMode_verifyTaskGetsEnqueuedWithSunriseCsv() {
|
||||||
persistSunriseModeDomain();
|
persistSunriseModeDomain();
|
||||||
action.run();
|
action.run();
|
||||||
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_tldThatDoesNotExist_failsWithoutOverride() throws Exception {
|
public void testNamingRules_tldThatDoesNotExist_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("footld_reserved-list", "TLD footld does not exist");
|
runNameTestExpectedFailure("footld_reserved-list", "TLD footld does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_underscoreIsMissing_failsWithoutOverride() throws Exception {
|
public void testNamingRules_underscoreIsMissing_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("random-reserved-list", INVALID_FORMAT_ERROR_MESSAGE);
|
runNameTestExpectedFailure("random-reserved-list", INVALID_FORMAT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_secondHalfOfNameIsMissing_failsWithoutOverride() throws Exception {
|
public void testNamingRules_secondHalfOfNameIsMissing_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("soy_", INVALID_FORMAT_ERROR_MESSAGE);
|
runNameTestExpectedFailure("soy_", INVALID_FORMAT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_onlyTldIsSpecifiedAsName_failsWithoutOverride() throws Exception {
|
public void testNamingRules_onlyTldIsSpecifiedAsName_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("soy", INVALID_FORMAT_ERROR_MESSAGE);
|
runNameTestExpectedFailure("soy", INVALID_FORMAT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_commonAsListName_failsWithoutOverride() throws Exception {
|
public void testNamingRules_commonAsListName_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("invalidtld_common", "TLD invalidtld does not exist");
|
runNameTestExpectedFailure("invalidtld_common", "TLD invalidtld does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_too_many_underscores_failsWithoutOverride() throws Exception {
|
public void testNamingRules_too_many_underscores_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("soy_buffalo_buffalo_buffalo", INVALID_FORMAT_ERROR_MESSAGE);
|
runNameTestExpectedFailure("soy_buffalo_buffalo_buffalo", INVALID_FORMAT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class CreateReservedListCommandTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamingRules_withWeirdCharacters_failsWithoutOverride() throws Exception {
|
public void testNamingRules_withWeirdCharacters_failsWithoutOverride() {
|
||||||
runNameTestExpectedFailure("soy_$oy", INVALID_FORMAT_ERROR_MESSAGE);
|
runNameTestExpectedFailure("soy_$oy", INVALID_FORMAT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setReservedListFromOtherTld() throws Exception {
|
public void testFailure_setReservedListFromOtherTld() {
|
||||||
runFailureReservedListsTest(
|
runFailureReservedListsTest(
|
||||||
"tld_banned",
|
"tld_banned",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
@ -527,7 +527,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setCommonAndReservedListFromOtherTld() throws Exception {
|
public void testFailure_setCommonAndReservedListFromOtherTld() {
|
||||||
runFailureReservedListsTest(
|
runFailureReservedListsTest(
|
||||||
"common_abuse,tld_banned",
|
"common_abuse,tld_banned",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
@ -547,7 +547,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setMultipleReservedListsFromOtherTld() throws Exception {
|
public void testFailure_setMultipleReservedListsFromOtherTld() {
|
||||||
runFailureReservedListsTest(
|
runFailureReservedListsTest(
|
||||||
"tld_banned,soy_expurgated",
|
"tld_banned,soy_expurgated",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
@ -560,7 +560,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setNonExistentReservedLists() throws Exception {
|
public void testFailure_setNonExistentReservedLists() {
|
||||||
runFailureReservedListsTest(
|
runFailureReservedListsTest(
|
||||||
"xn--q9jyb4c_asdf,common_asdsdgh",
|
"xn--q9jyb4c_asdf,common_asdsdgh",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
|
|
@ -940,7 +940,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setReservedListFromOtherTld() throws Exception {
|
public void testFailure_setReservedListFromOtherTld() {
|
||||||
runFailureReservedListsTest("tld_banned",
|
runFailureReservedListsTest("tld_banned",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
"The reserved list(s) tld_banned cannot be applied to the tld xn--q9jyb4c");
|
"The reserved list(s) tld_banned cannot be applied to the tld xn--q9jyb4c");
|
||||||
|
@ -952,7 +952,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setCommonAndReservedListFromOtherTld() throws Exception {
|
public void testFailure_setCommonAndReservedListFromOtherTld() {
|
||||||
runFailureReservedListsTest("common_abuse,tld_banned",
|
runFailureReservedListsTest("common_abuse,tld_banned",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
"The reserved list(s) tld_banned cannot be applied to the tld xn--q9jyb4c");
|
"The reserved list(s) tld_banned cannot be applied to the tld xn--q9jyb4c");
|
||||||
|
@ -971,7 +971,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_setMultipleReservedListsFromOtherTld() throws Exception {
|
public void testFailure_setMultipleReservedListsFromOtherTld() {
|
||||||
runFailureReservedListsTest("tld_banned,soy_expurgated",
|
runFailureReservedListsTest("tld_banned,soy_expurgated",
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
"The reserved list(s) tld_banned, soy_expurgated cannot be applied to the tld xn--q9jyb4c");
|
"The reserved list(s) tld_banned, soy_expurgated cannot be applied to the tld xn--q9jyb4c");
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_updateRegistrarInfo_duplicateContacts() throws Exception {
|
public void testFailure_updateRegistrarInfo_duplicateContacts() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(
|
Map<String, Object> response = action.handleJsonRequest(
|
||||||
readJsonFromFile("update_registrar_duplicate_contacts.json", getLastUpdateTime()));
|
readJsonFromFile("update_registrar_duplicate_contacts.json", getLastUpdateTime()));
|
||||||
assertThat(response).containsExactly(
|
assertThat(response).containsExactly(
|
||||||
|
@ -82,7 +82,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead_notAuthorized_failure() throws Exception {
|
public void testRead_notAuthorized_failure() {
|
||||||
when(sessionUtils.getRegistrarForAuthResult(
|
when(sessionUtils.getRegistrarForAuthResult(
|
||||||
any(HttpServletRequest.class), any(AuthResult.class)))
|
any(HttpServletRequest.class), any(AuthResult.class)))
|
||||||
.thenThrow(new ForbiddenException("Not authorized to access Registrar Console"));
|
.thenThrow(new ForbiddenException("Not authorized to access Registrar Console"));
|
||||||
|
@ -103,7 +103,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdate_emptyJsonObject_errorLastUpdateTimeFieldRequired() throws Exception {
|
public void testUpdate_emptyJsonObject_errorLastUpdateTimeFieldRequired() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of()));
|
"args", ImmutableMap.of()));
|
||||||
|
@ -116,7 +116,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdate_noEmail_errorEmailFieldRequired() throws Exception {
|
public void testUpdate_noEmail_errorEmailFieldRequired() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
||||||
|
@ -142,7 +142,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdate_badEmail_errorEmailField() throws Exception {
|
public void testUpdate_badEmail_errorEmailField() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of(
|
"args", ImmutableMap.of(
|
||||||
|
@ -157,7 +157,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_nonParsableTime_getsAngry() throws Exception {
|
public void testPost_nonParsableTime_getsAngry() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", "cookies")));
|
"args", ImmutableMap.of("lastUpdateTime", "cookies")));
|
||||||
|
@ -170,7 +170,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_nonAsciiCharacters_getsAngry() throws Exception {
|
public void testPost_nonAsciiCharacters_getsAngry() {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of(
|
"args", ImmutableMap.of(
|
||||||
|
|
Loading…
Add table
Reference in a new issue