mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Remove unnecessary type specifications
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179585680
This commit is contained in:
parent
f1ae66d148
commit
ed0670b614
52 changed files with 193 additions and 221 deletions
|
@ -65,7 +65,7 @@ abstract class AugmentedDeleter implements Deleter {
|
||||||
// homogeneous iterables of a fixed Key<T> type, e.g. List<Key<Lock>>, and is convenient for
|
// homogeneous iterables of a fixed Key<T> type, e.g. List<Key<Lock>>, and is convenient for
|
||||||
// callers) into the type Iterable<Key<?>> (a concrete type of heterogeneous keys, which is
|
// callers) into the type Iterable<Key<?>> (a concrete type of heterogeneous keys, which is
|
||||||
// convenient for users).
|
// convenient for users).
|
||||||
handleDeletion(ImmutableList.<Key<?>>copyOf(keys));
|
handleDeletion(ImmutableList.copyOf(keys));
|
||||||
return delegate.keys(keys);
|
return delegate.keys(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,13 +112,13 @@ public class RestoreCommitLogsActionTest {
|
||||||
CommitLogManifest.create(
|
CommitLogManifest.create(
|
||||||
getBucketKey(1),
|
getBucketKey(1),
|
||||||
now.minusMinutes(3),
|
now.minusMinutes(3),
|
||||||
ImmutableSet.<Key<?>>of(Key.create(TestObject.create("previous to delete")))),
|
ImmutableSet.of(Key.create(TestObject.create("previous to delete")))),
|
||||||
CommitLogMutation.create(manifest1aKey, TestObject.create("a")),
|
CommitLogMutation.create(manifest1aKey, TestObject.create("a")),
|
||||||
CommitLogMutation.create(manifest1aKey, TestObject.create("b")),
|
CommitLogMutation.create(manifest1aKey, TestObject.create("b")),
|
||||||
CommitLogManifest.create(
|
CommitLogManifest.create(
|
||||||
getBucketKey(2),
|
getBucketKey(2),
|
||||||
now.minusMinutes(2),
|
now.minusMinutes(2),
|
||||||
ImmutableSet.<Key<?>>of(Key.create(TestObject.create("a")))),
|
ImmutableSet.of(Key.create(TestObject.create("a")))),
|
||||||
CommitLogMutation.create(manifest1bKey, TestObject.create("c")),
|
CommitLogMutation.create(manifest1bKey, TestObject.create("c")),
|
||||||
CommitLogMutation.create(manifest1bKey, TestObject.create("d")));
|
CommitLogMutation.create(manifest1bKey, TestObject.create("d")));
|
||||||
Iterable<ImmutableObject> file2CommitLogs = saveDiffFile(
|
Iterable<ImmutableObject> file2CommitLogs = saveDiffFile(
|
||||||
|
@ -126,7 +126,7 @@ public class RestoreCommitLogsActionTest {
|
||||||
CommitLogManifest.create(
|
CommitLogManifest.create(
|
||||||
getBucketKey(1),
|
getBucketKey(1),
|
||||||
now.minusMinutes(1),
|
now.minusMinutes(1),
|
||||||
ImmutableSet.<Key<?>>of(Key.create(TestObject.create("c")))),
|
ImmutableSet.of(Key.create(TestObject.create("c")))),
|
||||||
CommitLogMutation.create(manifest2Key, TestObject.create("e")),
|
CommitLogMutation.create(manifest2Key, TestObject.create("e")),
|
||||||
CommitLogMutation.create(manifest2Key, TestObject.create("f")));
|
CommitLogMutation.create(manifest2Key, TestObject.create("f")));
|
||||||
action.fromTime = now.minusMinutes(1).minusMillis(1);
|
action.fromTime = now.minusMinutes(1).minusMillis(1);
|
||||||
|
@ -150,7 +150,7 @@ public class RestoreCommitLogsActionTest {
|
||||||
assertExpectedIds("previous to keep");
|
assertExpectedIds("previous to keep");
|
||||||
assertInDatastore(commitLogs);
|
assertInDatastore(commitLogs);
|
||||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||||
assertCommitLogBuckets(ImmutableMap.<Integer, DateTime>of());
|
assertCommitLogBuckets(ImmutableMap.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -183,7 +183,7 @@ public class RestoreCommitLogsActionTest {
|
||||||
CommitLogManifest.create(
|
CommitLogManifest.create(
|
||||||
getBucketKey(1),
|
getBucketKey(1),
|
||||||
now,
|
now,
|
||||||
ImmutableSet.<Key<?>>of(Key.create(TestObject.create("previous to delete")))));
|
ImmutableSet.of(Key.create(TestObject.create("previous to delete")))));
|
||||||
action.run();
|
action.run();
|
||||||
ofy().clearSessionCache();
|
ofy().clearSessionCache();
|
||||||
assertExpectedIds("previous to keep");
|
assertExpectedIds("previous to keep");
|
||||||
|
@ -236,7 +236,7 @@ public class RestoreCommitLogsActionTest {
|
||||||
CommitLogManifest.create(
|
CommitLogManifest.create(
|
||||||
getBucketKey(1),
|
getBucketKey(1),
|
||||||
now,
|
now,
|
||||||
ImmutableSet.<Key<?>>of(Key.create(TestObject.create("previous to delete")))));
|
ImmutableSet.of(Key.create(TestObject.create("previous to delete")))));
|
||||||
action.run();
|
action.run();
|
||||||
ofy().clearSessionCache();
|
ofy().clearSessionCache();
|
||||||
assertExpectedIds("previous to keep");
|
assertExpectedIds("previous to keep");
|
||||||
|
@ -252,7 +252,7 @@ public class RestoreCommitLogsActionTest {
|
||||||
private Iterable<ImmutableObject> saveDiffFile(
|
private Iterable<ImmutableObject> saveDiffFile(
|
||||||
CommitLogCheckpoint checkpoint, ImmutableObject... entities) throws IOException {
|
CommitLogCheckpoint checkpoint, ImmutableObject... entities) throws IOException {
|
||||||
DateTime now = checkpoint.getCheckpointTime();
|
DateTime now = checkpoint.getCheckpointTime();
|
||||||
List<ImmutableObject> allEntities = Lists.<ImmutableObject>asList(checkpoint, entities);
|
List<ImmutableObject> allEntities = Lists.asList(checkpoint, entities);
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
for (ImmutableObject entity : allEntities) {
|
for (ImmutableObject entity : allEntities) {
|
||||||
serializeEntity(entity, output);
|
serializeEntity(entity, output);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class CheckSnapshotActionTest {
|
||||||
new DatastoreBackupInfo(
|
new DatastoreBackupInfo(
|
||||||
backupInfo.getName(),
|
backupInfo.getName(),
|
||||||
backupInfo.getStartTime(),
|
backupInfo.getStartTime(),
|
||||||
Optional.<DateTime>empty(),
|
Optional.empty(),
|
||||||
backupInfo.getKinds(),
|
backupInfo.getKinds(),
|
||||||
backupInfo.getGcsFilename());
|
backupInfo.getGcsFilename());
|
||||||
|
|
||||||
|
|
|
@ -96,10 +96,12 @@ public class ExportReservedTermsActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() throws Exception {
|
public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() throws Exception {
|
||||||
persistResource(Registry.get("tld").asBuilder()
|
persistResource(
|
||||||
.setReservedLists(ImmutableSet.<ReservedList>of())
|
Registry.get("tld")
|
||||||
.setDriveFolderId(null)
|
.asBuilder()
|
||||||
.build());
|
.setReservedLists(ImmutableSet.of())
|
||||||
|
.setDriveFolderId(null)
|
||||||
|
.build());
|
||||||
runAction("tld");
|
runAction("tld");
|
||||||
verify(response).setStatus(SC_OK);
|
verify(response).setStatus(SC_OK);
|
||||||
verify(response).setPayload("No reserved lists configured");
|
verify(response).setPayload("No reserved lists configured");
|
||||||
|
|
|
@ -154,11 +154,11 @@ public class SyncGroupMembersActionTest {
|
||||||
when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example"))
|
||||||
.thenReturn(ImmutableSet.of("defunct@example.com", "janedoe@theregistrar.com"));
|
.thenReturn(ImmutableSet.of("defunct@example.com", "janedoe@theregistrar.com"));
|
||||||
when(connection.getMembersOfGroup("newregistrar-marketing-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("newregistrar-marketing-contacts@domain-registry.example"))
|
||||||
.thenReturn(ImmutableSet.<String> of());
|
.thenReturn(ImmutableSet.of());
|
||||||
when(connection.getMembersOfGroup("theregistrar-technical-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("theregistrar-technical-contacts@domain-registry.example"))
|
||||||
.thenReturn(ImmutableSet.<String> of());
|
.thenReturn(ImmutableSet.of());
|
||||||
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
|
||||||
.thenReturn(ImmutableSet.<String> of());
|
.thenReturn(ImmutableSet.of());
|
||||||
persistResource(
|
persistResource(
|
||||||
new RegistrarContact.Builder()
|
new RegistrarContact.Builder()
|
||||||
.setParent(loadRegistrar("NewRegistrar"))
|
.setParent(loadRegistrar("NewRegistrar"))
|
||||||
|
@ -200,7 +200,7 @@ public class SyncGroupMembersActionTest {
|
||||||
@Test
|
@Test
|
||||||
public void test_doPost_gracefullyHandlesExceptionForSingleRegistrar() throws Exception {
|
public void test_doPost_gracefullyHandlesExceptionForSingleRegistrar() throws Exception {
|
||||||
when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example"))
|
||||||
.thenReturn(ImmutableSet.<String> of());
|
.thenReturn(ImmutableSet.of());
|
||||||
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
|
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
|
||||||
.thenThrow(new IOException("Internet was deleted"));
|
.thenThrow(new IOException("Internet was deleted"));
|
||||||
runAction();
|
runAction();
|
||||||
|
|
|
@ -101,8 +101,7 @@ public class EppControllerTest extends ShardableTestCase {
|
||||||
loggerToIntercept.addHandler(logHandler);
|
loggerToIntercept.addHandler(logHandler);
|
||||||
|
|
||||||
when(sessionMetadata.getClientId()).thenReturn("some-client");
|
when(sessionMetadata.getClientId()).thenReturn("some-client");
|
||||||
when(flowComponentBuilder.flowModule(Matchers.<FlowModule>any()))
|
when(flowComponentBuilder.flowModule(Matchers.any())).thenReturn(flowComponentBuilder);
|
||||||
.thenReturn(flowComponentBuilder);
|
|
||||||
when(flowComponentBuilder.build()).thenReturn(flowComponent);
|
when(flowComponentBuilder.build()).thenReturn(flowComponent);
|
||||||
when(flowComponent.flowRunner()).thenReturn(flowRunner);
|
when(flowComponent.flowRunner()).thenReturn(flowRunner);
|
||||||
when(eppOutput.isResponse()).thenReturn(true);
|
when(eppOutput.isResponse()).thenReturn(true);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class EppLifecycleContactTest extends EppTestCase {
|
||||||
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"contact_create_sh8013.xml",
|
"contact_create_sh8013.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"contact_create_response_sh8013.xml",
|
"contact_create_response_sh8013.xml",
|
||||||
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
||||||
DateTime.parse("2000-06-01T00:00:00Z"));
|
DateTime.parse("2000-06-01T00:00:00Z"));
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class EppLifecycleDomainApplicationTest extends EppTestCase {
|
||||||
DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z");
|
DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z");
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"contact_create_sh8013.xml",
|
"contact_create_sh8013.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"contact_create_response_sh8013.xml",
|
"contact_create_response_sh8013.xml",
|
||||||
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
||||||
startTime);
|
startTime);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
||||||
DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z");
|
DateTime startTime = DateTime.parse("2000-06-01T00:00:00Z");
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"contact_create_sh8013.xml",
|
"contact_create_sh8013.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"contact_create_response_sh8013.xml",
|
"contact_create_response_sh8013.xml",
|
||||||
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
||||||
startTime);
|
startTime);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"hello.xml",
|
"hello.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"greeting.xml",
|
"greeting.xml",
|
||||||
ImmutableMap.of("DATE", "2000-06-02T00:00:00Z"),
|
ImmutableMap.of("DATE", "2000-06-02T00:00:00Z"),
|
||||||
DateTime.parse("2000-06-02T00:00:00Z"));
|
DateTime.parse("2000-06-02T00:00:00Z"));
|
||||||
|
@ -78,7 +78,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
"host_info.xml",
|
"host_info.xml",
|
||||||
ImmutableMap.of("HOSTNAME", "ns1.example.tld"),
|
ImmutableMap.of("HOSTNAME", "ns1.example.tld"),
|
||||||
"host_info_response.xml",
|
"host_info_response.xml",
|
||||||
ImmutableMap.<String, String>of(
|
ImmutableMap.of(
|
||||||
"HOSTNAME", "ns1.example.tld", "ROID", "1-ROID", "CRDATE", "2000-06-02T00:01:00Z"),
|
"HOSTNAME", "ns1.example.tld", "ROID", "1-ROID", "CRDATE", "2000-06-02T00:01:00Z"),
|
||||||
DateTime.parse("2000-06-02T00:02:00Z"));
|
DateTime.parse("2000-06-02T00:02:00Z"));
|
||||||
assertThat(getRecordedEppMetric())
|
assertThat(getRecordedEppMetric())
|
||||||
|
@ -93,7 +93,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
"host_delete.xml",
|
"host_delete.xml",
|
||||||
ImmutableMap.of("HOSTNAME", "ns1.example.tld"),
|
ImmutableMap.of("HOSTNAME", "ns1.example.tld"),
|
||||||
"generic_success_action_pending_response.xml",
|
"generic_success_action_pending_response.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
DateTime.parse("2000-06-02T00:03:00Z"));
|
DateTime.parse("2000-06-02T00:03:00Z"));
|
||||||
assertThat(getRecordedEppMetric())
|
assertThat(getRecordedEppMetric())
|
||||||
.hasClientId("NewRegistrar")
|
.hasClientId("NewRegistrar")
|
||||||
|
@ -113,7 +113,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
// Create the fakesite domain.
|
// Create the fakesite domain.
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"contact_create_sh8013.xml",
|
"contact_create_sh8013.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"contact_create_response_sh8013.xml",
|
"contact_create_response_sh8013.xml",
|
||||||
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
||||||
DateTime.parse("2000-06-01T00:00:00Z"));
|
DateTime.parse("2000-06-01T00:00:00Z"));
|
||||||
|
@ -164,7 +164,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
|
|
||||||
assertCommandAndResponse(
|
assertCommandAndResponse(
|
||||||
"contact_create_sh8013.xml",
|
"contact_create_sh8013.xml",
|
||||||
ImmutableMap.<String, String>of(),
|
ImmutableMap.of(),
|
||||||
"contact_create_response_sh8013.xml",
|
"contact_create_response_sh8013.xml",
|
||||||
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
ImmutableMap.of("CRDATE", "2000-06-01T00:00:00Z"),
|
||||||
DateTime.parse("2000-06-01T00:00:00Z"));
|
DateTime.parse("2000-06-01T00:00:00Z"));
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testRecordToLogs_metadata_notResourceFlow_noResourceTypeOrTld() throws Exception {
|
public void testRecordToLogs_metadata_notResourceFlow_noResourceTypeOrTld() throws Exception {
|
||||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(false);
|
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(false);
|
||||||
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.<String>empty());
|
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.empty());
|
||||||
flowReporter.recordToLogs();
|
flowReporter.recordToLogs();
|
||||||
Map<String, Object> json =
|
Map<String, Object> json =
|
||||||
parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-METADATA: "));
|
parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-METADATA: "));
|
||||||
|
@ -177,7 +177,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testRecordToLogs_metadata_multipleTargetIds_uniqueTldSet() throws Exception {
|
public void testRecordToLogs_metadata_multipleTargetIds_uniqueTldSet() throws Exception {
|
||||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.<String>empty());
|
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.empty());
|
||||||
when(flowReporter.eppInput.getTargetIds())
|
when(flowReporter.eppInput.getTargetIds())
|
||||||
.thenReturn(ImmutableList.of("target.co.uk", "foo.uk", "bar.uk", "baz.com"));
|
.thenReturn(ImmutableList.of("target.co.uk", "foo.uk", "bar.uk", "baz.com"));
|
||||||
flowReporter.recordToLogs();
|
flowReporter.recordToLogs();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class FlowRunnerTest extends ShardableTestCase {
|
||||||
flowRunner.isSuperuser = false;
|
flowRunner.isSuperuser = false;
|
||||||
flowRunner.isTransactional = false;
|
flowRunner.isTransactional = false;
|
||||||
flowRunner.sessionMetadata =
|
flowRunner.sessionMetadata =
|
||||||
new StatelessRequestSessionMetadata("TheRegistrar", ImmutableSet.<String>of());
|
new StatelessRequestSessionMetadata("TheRegistrar", ImmutableSet.of());
|
||||||
flowRunner.trid = Trid.create("client-123", "server-456");
|
flowRunner.trid = Trid.create("client-123", "server-456");
|
||||||
flowRunner.flowReporter = Mockito.mock(FlowReporter.class);
|
flowRunner.flowReporter = Mockito.mock(FlowReporter.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setEppInput(String inputFilename) {
|
protected void setEppInput(String inputFilename) {
|
||||||
eppLoader = new EppLoader(this, inputFilename, ImmutableMap.<String, String>of());
|
eppLoader = new EppLoader(this, inputFilename, ImmutableMap.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setEppInput(String inputFilename, Map<String, String> substitutions) {
|
protected void setEppInput(String inputFilename, Map<String, String> substitutions) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class ChildEntityInputTest {
|
||||||
setupSecondDomainResources();
|
setupSecondDomainResources();
|
||||||
Set<ImmutableObject> seen = new HashSet<>();
|
Set<ImmutableObject> seen = new HashSet<>();
|
||||||
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
ImmutableSet.of(EppResource.class),
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
||||||
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
||||||
.createReaders().get(0);
|
.createReaders().get(0);
|
||||||
|
@ -188,16 +188,14 @@ public class ChildEntityInputTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_childEntityInput_polymorphicBaseType() throws Exception {
|
public void testSuccess_childEntityInput_polymorphicBaseType() throws Exception {
|
||||||
createChildEntityInput(
|
createChildEntityInput(ImmutableSet.of(EppResource.class), ImmutableSet.of(BillingEvent.class));
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(BillingEvent.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_childEntityReader_multipleChildTypes() throws Exception {
|
public void testSuccess_childEntityReader_multipleChildTypes() throws Exception {
|
||||||
setupResources();
|
setupResources();
|
||||||
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
ImmutableSet.of(EppResource.class),
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
||||||
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
||||||
.createReaders().get(0);
|
.createReaders().get(0);
|
||||||
|
@ -235,7 +233,7 @@ public class ChildEntityInputTest {
|
||||||
public void testSuccess_childEntityReader_polymorphicChildFiltering() throws Exception {
|
public void testSuccess_childEntityReader_polymorphicChildFiltering() throws Exception {
|
||||||
setupResources();
|
setupResources();
|
||||||
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
ImmutableSet.of(EppResource.class),
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(BillingEvent.OneTime.class))
|
ImmutableSet.<Class<? extends ImmutableObject>>of(BillingEvent.OneTime.class))
|
||||||
.createReaders().get(0);
|
.createReaders().get(0);
|
||||||
assertThat(getAllFromReader(reader)).containsExactly(oneTimeA);
|
assertThat(getAllFromReader(reader)).containsExactly(oneTimeA);
|
||||||
|
@ -245,7 +243,7 @@ public class ChildEntityInputTest {
|
||||||
public void testSuccess_childEntityReader_polymorphicChildClass() throws Exception {
|
public void testSuccess_childEntityReader_polymorphicChildClass() throws Exception {
|
||||||
setupResources();
|
setupResources();
|
||||||
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
ImmutableSet.of(EppResource.class),
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(BillingEvent.class))
|
ImmutableSet.<Class<? extends ImmutableObject>>of(BillingEvent.class))
|
||||||
.createReaders().get(0);
|
.createReaders().get(0);
|
||||||
assertThat(getAllFromReader(reader)).containsExactly(oneTimeA, recurringA);
|
assertThat(getAllFromReader(reader)).containsExactly(oneTimeA, recurringA);
|
||||||
|
@ -303,11 +301,13 @@ public class ChildEntityInputTest {
|
||||||
public void testSuccess_childEntityReader_survivesAcrossSerialization() throws Exception {
|
public void testSuccess_childEntityReader_survivesAcrossSerialization() throws Exception {
|
||||||
setupResources();
|
setupResources();
|
||||||
Set<ImmutableObject> seen = new HashSet<>();
|
Set<ImmutableObject> seen = new HashSet<>();
|
||||||
InputReader<ImmutableObject> reader = EppResourceInputs.createChildEntityInput(
|
InputReader<ImmutableObject> reader =
|
||||||
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class),
|
EppResourceInputs.createChildEntityInput(
|
||||||
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
ImmutableSet.of(EppResource.class),
|
||||||
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
ImmutableSet.<Class<? extends ImmutableObject>>of(
|
||||||
.createReaders().get(0);
|
HistoryEntry.class, BillingEvent.OneTime.class, BillingEvent.Recurring.class))
|
||||||
|
.createReaders()
|
||||||
|
.get(0);
|
||||||
reader.beginShard();
|
reader.beginShard();
|
||||||
reader.beginSlice();
|
reader.beginSlice();
|
||||||
seen.add(reader.next());
|
seen.add(reader.next());
|
||||||
|
|
|
@ -269,7 +269,7 @@ public class ImmutableObjectTest {
|
||||||
assertThat((List<?>) diffableFieldMap.get("array")).containsExactly((Object) null);
|
assertThat((List<?>) diffableFieldMap.get("array")).containsExactly((Object) null);
|
||||||
assertThat((List<?>) diffableFieldMap.get("list")).containsExactly((Object) null);
|
assertThat((List<?>) diffableFieldMap.get("list")).containsExactly((Object) null);
|
||||||
assertThat((Set<?>) diffableFieldMap.get("set")).containsExactly((Object) null);
|
assertThat((Set<?>) diffableFieldMap.get("set")).containsExactly((Object) null);
|
||||||
assertThat((Map<?, ?>) diffableFieldMap.get("map")).containsExactly("a", (Object) null);
|
assertThat((Map<?, ?>) diffableFieldMap.get("map")).containsExactly("a", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subclass of ImmutableObject with keys to other objects. */
|
/** Subclass of ImmutableObject with keys to other objects. */
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class ModelUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllFields() throws Exception {
|
public void testGetAllFields() throws Exception {
|
||||||
Map<String, Field> expected = ImmutableMap.<String, Field>of(
|
Map<String, Field> expected = ImmutableMap.of(
|
||||||
"id", TestClass.class.getDeclaredField("id"),
|
"id", TestClass.class.getDeclaredField("id"),
|
||||||
"a", TestClass.class.getDeclaredField("a"),
|
"a", TestClass.class.getDeclaredField("a"),
|
||||||
"b", TestClass.class.getDeclaredField("b"));
|
"b", TestClass.class.getDeclaredField("b"));
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_balanceMap_getActiveBalance_emptyMap() throws Exception {
|
public void testSuccess_balanceMap_getActiveBalance_emptyMap() throws Exception {
|
||||||
BalanceMap map = new BalanceMap(ImmutableMap.<DateTime, Map<DateTime, Money>>of());
|
BalanceMap map = new BalanceMap(ImmutableMap.of());
|
||||||
assertThat(map.getActiveBalanceAtTime(START_OF_TIME)).isEmpty();
|
assertThat(map.getActiveBalanceAtTime(START_OF_TIME)).isEmpty();
|
||||||
assertThat(map.getActiveBalanceAtTime(clock.nowUtc())).isEmpty();
|
assertThat(map.getActiveBalanceAtTime(clock.nowUtc())).isEmpty();
|
||||||
assertThat(map.getActiveBalanceAtTime(END_OF_TIME)).isEmpty();
|
assertThat(map.getActiveBalanceAtTime(END_OF_TIME)).isEmpty();
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class TimeOfYearTest {
|
||||||
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
||||||
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected = ImmutableSet.of(
|
||||||
DateTime.parse("2012-05-01T00:00:00Z"),
|
DateTime.parse("2012-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2013-05-01T00:00:00Z"),
|
DateTime.parse("2013-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2014-05-01T00:00:00Z"),
|
DateTime.parse("2014-05-01T00:00:00Z"),
|
||||||
|
@ -78,7 +78,7 @@ public class TimeOfYearTest {
|
||||||
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
||||||
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected = ImmutableSet.of(
|
||||||
DateTime.parse("2013-05-01T00:00:00Z"),
|
DateTime.parse("2013-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2014-05-01T00:00:00Z"),
|
DateTime.parse("2014-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2015-05-01T00:00:00Z"),
|
DateTime.parse("2015-05-01T00:00:00Z"),
|
||||||
|
@ -92,7 +92,7 @@ public class TimeOfYearTest {
|
||||||
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
||||||
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected = ImmutableSet.of(
|
||||||
DateTime.parse("2012-05-01T00:00:00Z"),
|
DateTime.parse("2012-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2013-05-01T00:00:00Z"),
|
DateTime.parse("2013-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2014-05-01T00:00:00Z"),
|
DateTime.parse("2014-05-01T00:00:00Z"),
|
||||||
|
@ -106,7 +106,7 @@ public class TimeOfYearTest {
|
||||||
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
DateTime startDate = DateTime.parse("2012-05-01T00:00:00Z");
|
||||||
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
DateTime endDate = DateTime.parse("2016-05-01T00:00:00Z");
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(DateTime.parse("2012-05-01T00:00:00Z"));
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected = ImmutableSet.of(
|
||||||
DateTime.parse("2013-05-01T00:00:00Z"),
|
DateTime.parse("2013-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2014-05-01T00:00:00Z"),
|
DateTime.parse("2014-05-01T00:00:00Z"),
|
||||||
DateTime.parse("2015-05-01T00:00:00Z"));
|
DateTime.parse("2015-05-01T00:00:00Z"));
|
||||||
|
@ -117,10 +117,8 @@ public class TimeOfYearTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_getInstancesInRange_normalizedLowerBound() {
|
public void testSuccess_getInstancesInRange_normalizedLowerBound() {
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(START_OF_TIME);
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(START_OF_TIME);
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected =
|
||||||
START_OF_TIME,
|
ImmutableSet.of(START_OF_TIME, START_OF_TIME.plusYears(1), START_OF_TIME.plusYears(2));
|
||||||
START_OF_TIME.plusYears(1),
|
|
||||||
START_OF_TIME.plusYears(2));
|
|
||||||
assertThat(timeOfYear.getInstancesInRange(Range.atMost(START_OF_TIME.plusYears(2))))
|
assertThat(timeOfYear.getInstancesInRange(Range.atMost(START_OF_TIME.plusYears(2))))
|
||||||
.containsExactlyElementsIn(expected);
|
.containsExactlyElementsIn(expected);
|
||||||
}
|
}
|
||||||
|
@ -128,10 +126,8 @@ public class TimeOfYearTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_getInstancesInRange_normalizedUpperBound() {
|
public void testSuccess_getInstancesInRange_normalizedUpperBound() {
|
||||||
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(END_OF_TIME);
|
TimeOfYear timeOfYear = TimeOfYear.fromDateTime(END_OF_TIME);
|
||||||
ImmutableSet<DateTime> expected = ImmutableSet.<DateTime>of(
|
ImmutableSet<DateTime> expected =
|
||||||
END_OF_TIME.minusYears(2),
|
ImmutableSet.of(END_OF_TIME.minusYears(2), END_OF_TIME.minusYears(1), END_OF_TIME);
|
||||||
END_OF_TIME.minusYears(1),
|
|
||||||
END_OF_TIME);
|
|
||||||
assertThat(timeOfYear.getInstancesInRange(Range.atLeast(END_OF_TIME.minusYears(2))))
|
assertThat(timeOfYear.getInstancesInRange(Range.atLeast(END_OF_TIME.minusYears(2))))
|
||||||
.containsExactlyElementsIn(expected);
|
.containsExactlyElementsIn(expected);
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class TimedTransitionPropertyTest {
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() ->
|
() ->
|
||||||
TimedTransitionProperty.fromValueMap(
|
TimedTransitionProperty.fromValueMap(
|
||||||
ImmutableSortedMap.<DateTime, String>of(), StringTimedTransition.class));
|
ImmutableSortedMap.of(), StringTimedTransition.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -35,7 +35,6 @@ import google.registry.model.eppcommon.PresenceMarker;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -101,8 +100,7 @@ public class ContactResourceTest extends EntityTestCase {
|
||||||
.setLosingClientId("losing")
|
.setLosingClientId("losing")
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||||
.setServerApproveEntities(
|
.setServerApproveEntities(
|
||||||
ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
ImmutableSet.of(Key.create(BillingEvent.OneTime.class, 1)))
|
||||||
Key.create(BillingEvent.OneTime.class, 1)))
|
|
||||||
.setTransferRequestTime(clock.nowUtc())
|
.setTransferRequestTime(clock.nowUtc())
|
||||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||||
.setTransferRequestTrid(Trid.create("client-trid", "server-trid"))
|
.setTransferRequestTrid(Trid.create("client-trid", "server-trid"))
|
||||||
|
|
|
@ -37,7 +37,6 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.smd.EncodedSignedMark;
|
import google.registry.model.smd.EncodedSignedMark;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -123,16 +122,13 @@ public class DomainApplicationTest extends EntityTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testEmptySetsAndArraysBecomeNull() {
|
public void testEmptySetsAndArraysBecomeNull() {
|
||||||
assertThat(emptyBuilder().setNameservers(null).build().nsHosts).isNull();
|
assertThat(emptyBuilder().setNameservers(null).build().nsHosts).isNull();
|
||||||
assertThat(emptyBuilder()
|
assertThat(emptyBuilder().setNameservers(ImmutableSet.of()).build().nsHosts).isNull();
|
||||||
.setNameservers(ImmutableSet.<Key<HostResource>>of())
|
assertThat(
|
||||||
.build()
|
emptyBuilder()
|
||||||
.nsHosts)
|
.setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld"))))
|
||||||
.isNull();
|
.build()
|
||||||
assertThat(emptyBuilder()
|
.nsHosts)
|
||||||
.setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld"))))
|
.isNotNull();
|
||||||
.build()
|
|
||||||
.nsHosts)
|
|
||||||
.isNotNull();
|
|
||||||
// This behavior should also hold true for ImmutableObjects nested in collections.
|
// This behavior should also hold true for ImmutableObjects nested in collections.
|
||||||
assertThat(emptyBuilder()
|
assertThat(emptyBuilder()
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, null)))
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, null)))
|
||||||
|
|
|
@ -50,7 +50,6 @@ import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
|
@ -124,10 +123,7 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
.setLosingClientId("losing")
|
.setLosingClientId("losing")
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||||
.setServerApproveEntities(
|
.setServerApproveEntities(
|
||||||
ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
ImmutableSet.of(oneTimeBillKey, recurringBillKey, autorenewPollKey))
|
||||||
oneTimeBillKey,
|
|
||||||
recurringBillKey,
|
|
||||||
autorenewPollKey))
|
|
||||||
.setServerApproveBillingEvent(oneTimeBillKey)
|
.setServerApproveBillingEvent(oneTimeBillKey)
|
||||||
.setServerApproveAutorenewEvent(recurringBillKey)
|
.setServerApproveAutorenewEvent(recurringBillKey)
|
||||||
.setServerApproveAutorenewPollMessage(autorenewPollKey)
|
.setServerApproveAutorenewPollMessage(autorenewPollKey)
|
||||||
|
@ -186,11 +182,15 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptySetsAndArraysBecomeNull() {
|
public void testEmptySetsAndArraysBecomeNull() {
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(newDomainResource("example.com").asBuilder().setNameservers(null).build().nsHosts)
|
||||||
.setNameservers(null).build().nsHosts).isNull();
|
.isNull();
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(
|
||||||
.setNameservers(ImmutableSet.<Key<HostResource>>of()).build().nsHosts)
|
newDomainResource("example.com")
|
||||||
.isNull();
|
.asBuilder()
|
||||||
|
.setNameservers(ImmutableSet.of())
|
||||||
|
.build()
|
||||||
|
.nsHosts)
|
||||||
|
.isNull();
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(newDomainResource("example.com").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld"))))
|
.setNameservers(ImmutableSet.of(Key.create(newHostResource("foo.example.tld"))))
|
||||||
.build().nsHosts)
|
.build().nsHosts)
|
||||||
|
@ -292,22 +292,27 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
.setPeriodYears(1)
|
.setPeriodYears(1)
|
||||||
.setParent(historyEntry)
|
.setParent(historyEntry)
|
||||||
.build());
|
.build());
|
||||||
domain = domain.asBuilder()
|
domain =
|
||||||
.setRegistrationExpirationTime(oldExpirationTime)
|
domain
|
||||||
.setTransferData(domain.getTransferData().asBuilder()
|
.asBuilder()
|
||||||
.setTransferStatus(TransferStatus.PENDING)
|
.setRegistrationExpirationTime(oldExpirationTime)
|
||||||
.setTransferRequestTime(clock.nowUtc().minusDays(4))
|
.setTransferData(
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc().plusDays(1))
|
domain
|
||||||
.setGainingClientId("winner")
|
.getTransferData()
|
||||||
.setServerApproveBillingEvent(Key.create(transferBillingEvent))
|
.asBuilder()
|
||||||
.setServerApproveEntities(ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
.setTransferStatus(TransferStatus.PENDING)
|
||||||
Key.create(transferBillingEvent)))
|
.setTransferRequestTime(clock.nowUtc().minusDays(4))
|
||||||
.build())
|
.setPendingTransferExpirationTime(clock.nowUtc().plusDays(1))
|
||||||
.addGracePeriod(
|
.setGainingClientId("winner")
|
||||||
// Okay for billing event to be null since the point of this grace period is just
|
.setServerApproveBillingEvent(Key.create(transferBillingEvent))
|
||||||
// to check that the transfer will clear all existing grace periods.
|
.setServerApproveEntities(ImmutableSet.of(Key.create(transferBillingEvent)))
|
||||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(100), "foo", null))
|
.build())
|
||||||
.build();
|
.addGracePeriod(
|
||||||
|
// Okay for billing event to be null since the point of this grace period is just
|
||||||
|
// to check that the transfer will clear all existing grace periods.
|
||||||
|
GracePeriod.create(
|
||||||
|
GracePeriodStatus.ADD, clock.nowUtc().plusDays(100), "foo", null))
|
||||||
|
.build();
|
||||||
DomainResource afterTransfer = domain.cloneProjectedAtTime(clock.nowUtc().plusDays(1));
|
DomainResource afterTransfer = domain.cloneProjectedAtTime(clock.nowUtc().plusDays(1));
|
||||||
DateTime newExpirationTime = oldExpirationTime.plusYears(1);
|
DateTime newExpirationTime = oldExpirationTime.plusYears(1);
|
||||||
Key<BillingEvent.Recurring> serverApproveAutorenewEvent =
|
Key<BillingEvent.Recurring> serverApproveAutorenewEvent =
|
||||||
|
|
|
@ -32,9 +32,7 @@ import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import java.net.InetAddress;
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -52,21 +50,23 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
createTld("com");
|
createTld("com");
|
||||||
// Set up a new persisted registrar entity.
|
// Set up a new persisted registrar entity.
|
||||||
domain = persistResource(
|
domain =
|
||||||
newDomainResource("example.com").asBuilder()
|
persistResource(
|
||||||
.setRepoId("1-COM")
|
newDomainResource("example.com")
|
||||||
.setTransferData(new TransferData.Builder()
|
.asBuilder()
|
||||||
.setGainingClientId("gaining")
|
.setRepoId("1-COM")
|
||||||
.setLosingClientId("losing")
|
.setTransferData(
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
new TransferData.Builder()
|
||||||
.setServerApproveEntities(
|
.setGainingClientId("gaining")
|
||||||
ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
.setLosingClientId("losing")
|
||||||
Key.create(BillingEvent.OneTime.class, 1)))
|
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||||
.setTransferRequestTime(clock.nowUtc())
|
.setServerApproveEntities(
|
||||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
ImmutableSet.of(Key.create(BillingEvent.OneTime.class, 1)))
|
||||||
.setTransferRequestTrid(Trid.create("client-trid", "server-trid"))
|
.setTransferRequestTime(clock.nowUtc())
|
||||||
.build())
|
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||||
.build());
|
.setTransferRequestTrid(Trid.create("client-trid", "server-trid"))
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
host =
|
host =
|
||||||
persistResource(
|
persistResource(
|
||||||
cloneAndSetAutoTimestamps(
|
cloneAndSetAutoTimestamps(
|
||||||
|
@ -119,9 +119,8 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testEmptySetsBecomeNull() throws Exception {
|
public void testEmptySetsBecomeNull() throws Exception {
|
||||||
assertThat(new HostResource.Builder().setInetAddresses(null).build().inetAddresses).isNull();
|
assertThat(new HostResource.Builder().setInetAddresses(null).build().inetAddresses).isNull();
|
||||||
assertThat(new HostResource.Builder()
|
assertThat(new HostResource.Builder().setInetAddresses(ImmutableSet.of()).build().inetAddresses)
|
||||||
.setInetAddresses(ImmutableSet.<InetAddress>of()).build().inetAddresses)
|
.isNull();
|
||||||
.isNull();
|
|
||||||
assertThat(
|
assertThat(
|
||||||
new HostResource.Builder()
|
new HostResource.Builder()
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class DomainApplicationIndexTest extends EntityTestCase {
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() -> createWithSpecifiedKeys("blah.com", ImmutableSet.<Key<DomainApplication>>of()));
|
() -> createWithSpecifiedKeys("blah.com", ImmutableSet.of()));
|
||||||
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
|
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class OfyCommitLogTest {
|
||||||
@Test
|
@Test
|
||||||
public void testTransactNew_deleteNotBackedUpKind_throws() throws Exception {
|
public void testTransactNew_deleteNotBackedUpKind_throws() throws Exception {
|
||||||
final CommitLogManifest backupsArentAllowedOnMe =
|
final CommitLogManifest backupsArentAllowedOnMe =
|
||||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.<Key<?>>of());
|
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
@ -170,7 +170,7 @@ public class OfyCommitLogTest {
|
||||||
@Test
|
@Test
|
||||||
public void testTransactNew_saveNotBackedUpKind_throws() throws Exception {
|
public void testTransactNew_saveNotBackedUpKind_throws() throws Exception {
|
||||||
final CommitLogManifest backupsArentAllowedOnMe =
|
final CommitLogManifest backupsArentAllowedOnMe =
|
||||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.<Key<?>>of());
|
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class RegistryTest extends EntityTestCase {
|
||||||
.asBuilder().setReservedLists(ImmutableSet.of(rl5, rl6)).build();
|
.asBuilder().setReservedLists(ImmutableSet.of(rl5, rl6)).build();
|
||||||
assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList()))
|
assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList()))
|
||||||
.containsExactly("tld-reserved5", "tld-reserved6");
|
.containsExactly("tld-reserved5", "tld-reserved6");
|
||||||
r = Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.<ReservedList> of()).build();
|
r = Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of()).build();
|
||||||
assertThat(r.getReservedLists()).isEmpty();
|
assertThat(r.getReservedLists()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class RegistryTest extends EntityTestCase {
|
||||||
.build();
|
.build();
|
||||||
assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList()))
|
assertThat(r.getReservedLists().stream().map(Key::getName).collect(toImmutableList()))
|
||||||
.containsExactly("tld-reserved24", "tld-reserved25");
|
.containsExactly("tld-reserved24", "tld-reserved25");
|
||||||
r = Registry.get("tld").asBuilder().setReservedListsByName(ImmutableSet.<String> of()).build();
|
r = Registry.get("tld").asBuilder().setReservedListsByName(ImmutableSet.of()).build();
|
||||||
assertThat(r.getReservedLists()).isEmpty();
|
assertThat(r.getReservedLists()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,7 @@ public class SignedMarkRevocationListTest {
|
||||||
public void testEmpty() throws Exception {
|
public void testEmpty() throws Exception {
|
||||||
// When Datastore is empty, it should give us an empty thing.
|
// When Datastore is empty, it should give us an empty thing.
|
||||||
assertThat(SignedMarkRevocationList.get())
|
assertThat(SignedMarkRevocationList.get())
|
||||||
.isEqualTo(SignedMarkRevocationList.create(
|
.isEqualTo(SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of()));
|
||||||
START_OF_TIME, ImmutableMap.<String, DateTime>of()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -114,7 +113,7 @@ public class SignedMarkRevocationListTest {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
NullPointerException.class,
|
NullPointerException.class,
|
||||||
() ->
|
() ->
|
||||||
SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.<String, DateTime>of())
|
SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of())
|
||||||
.isSmdRevoked(null, clock.nowUtc()));
|
.isSmdRevoked(null, clock.nowUtc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import google.registry.model.billing.BillingEvent;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -74,7 +73,7 @@ public class TransferDataTest {
|
||||||
.setPendingTransferExpirationTime(now)
|
.setPendingTransferExpirationTime(now)
|
||||||
.setTransferStatus(TransferStatus.PENDING)
|
.setTransferStatus(TransferStatus.PENDING)
|
||||||
.setServerApproveEntities(
|
.setServerApproveEntities(
|
||||||
ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
ImmutableSet.of(
|
||||||
transferBillingEventKey,
|
transferBillingEventKey,
|
||||||
otherServerApproveBillingEventKey,
|
otherServerApproveBillingEventKey,
|
||||||
recurringBillingEventKey,
|
recurringBillingEventKey,
|
||||||
|
|
|
@ -31,7 +31,6 @@ import google.registry.model.host.HostInfoData;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.EppLoader;
|
import google.registry.testing.EppLoader;
|
||||||
import google.registry.xml.ValidationMode;
|
import google.registry.xml.ValidationMode;
|
||||||
import java.net.InetAddress;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -58,7 +57,7 @@ public class StatusValueAdapterTest {
|
||||||
.setCreationTime(START_OF_TIME)
|
.setCreationTime(START_OF_TIME)
|
||||||
.setCurrentSponsorClientId("")
|
.setCurrentSponsorClientId("")
|
||||||
.setFullyQualifiedHostName("")
|
.setFullyQualifiedHostName("")
|
||||||
.setInetAddresses(ImmutableSet.<InetAddress>of())
|
.setInetAddresses(ImmutableSet.of())
|
||||||
.setRepoId("")
|
.setRepoId("")
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build())
|
.build())
|
||||||
|
|
|
@ -26,11 +26,11 @@ import org.junit.runners.JUnit4;
|
||||||
/** Tests for {@link CustomFitter}. */
|
/** Tests for {@link CustomFitter}. */
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class CustomFitterTest {
|
public class CustomFitterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCustomFitter_emptyBounds_throwsException() throws Exception {
|
public void testCreateCustomFitter_emptyBounds_throwsException() throws Exception {
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
expectThrows(
|
expectThrows(IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.of()));
|
||||||
IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.<Double>of()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("boundaries must not be empty");
|
assertThat(thrown).hasMessageThat().contains("boundaries must not be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ public class CustomFitterTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCustomFitter_hasGivenBounds() {
|
public void testCreateCustomFitter_hasGivenBounds() {
|
||||||
CustomFitter fitter = CustomFitter.create(ImmutableSortedSet.of(1.0, 2.0));
|
CustomFitter fitter = CustomFitter.create(ImmutableSortedSet.of(1.0, 2.0));
|
||||||
|
|
||||||
assertThat(fitter.boundaries()).containsExactly(1.0, 2.0).inOrder();
|
assertThat(fitter.boundaries()).containsExactly(1.0, 2.0).inOrder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,20 +43,19 @@ public class MetricReporterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRunOneIteration_enqueuesBatch() throws Exception {
|
public void testRunOneIteration_enqueuesBatch() throws Exception {
|
||||||
Metric<?> metric =
|
Metric<?> metric = new Counter("/name", "description", "vdn", ImmutableSet.of());
|
||||||
new Counter("/name", "description", "vdn", ImmutableSet.<LabelDescriptor>of());
|
|
||||||
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of(metric, metric));
|
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of(metric, metric));
|
||||||
MetricReporter reporter = new MetricReporter(writer, 10L, threadFactory, registry, writeQueue);
|
MetricReporter reporter = new MetricReporter(writer, 10L, threadFactory, registry, writeQueue);
|
||||||
|
|
||||||
reporter.runOneIteration();
|
reporter.runOneIteration();
|
||||||
|
|
||||||
verify(writeQueue).offer(Optional.of(ImmutableList.<MetricPoint<?>>of()));
|
verify(writeQueue).offer(Optional.of(ImmutableList.of()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShutDown_enqueuesBatchAndPoisonPill() throws Exception {
|
public void testShutDown_enqueuesBatchAndPoisonPill() throws Exception {
|
||||||
// Set up a registry with no metrics.
|
// Set up a registry with no metrics.
|
||||||
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.<Metric<?>>of());
|
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of());
|
||||||
MetricReporter reporter =
|
MetricReporter reporter =
|
||||||
spy(new MetricReporter(writer, 10L, threadFactory, registry, writeQueue));
|
spy(new MetricReporter(writer, 10L, threadFactory, registry, writeQueue));
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ public class MetricReporterTest {
|
||||||
|
|
||||||
verify(reporter).runOneIteration();
|
verify(reporter).runOneIteration();
|
||||||
InOrder interactions = Mockito.inOrder(writeQueue);
|
InOrder interactions = Mockito.inOrder(writeQueue);
|
||||||
interactions.verify(writeQueue).offer(Optional.of(ImmutableList.<MetricPoint<?>>of()));
|
interactions.verify(writeQueue).offer(Optional.of(ImmutableList.of()));
|
||||||
interactions.verify(writeQueue).offer(Optional.<ImmutableList<MetricPoint<?>>>empty());
|
interactions.verify(writeQueue).offer(Optional.empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class MetricSchemaTest {
|
||||||
"description",
|
"description",
|
||||||
"valueDisplayName",
|
"valueDisplayName",
|
||||||
Kind.GAUGE,
|
Kind.GAUGE,
|
||||||
ImmutableSet.<LabelDescriptor>of()));
|
ImmutableSet.of()));
|
||||||
assertThat(thrown).hasMessageThat().contains("Name must not be blank");
|
assertThat(thrown).hasMessageThat().contains("Name must not be blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,7 @@ public class MetricSchemaTest {
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() ->
|
() ->
|
||||||
MetricSchema.create(
|
MetricSchema.create(
|
||||||
"/name",
|
"/name", "", "valueDisplayName", Kind.GAUGE, ImmutableSet.of()));
|
||||||
"",
|
|
||||||
"valueDisplayName",
|
|
||||||
Kind.GAUGE,
|
|
||||||
ImmutableSet.<LabelDescriptor>of()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("Description must not be blank");
|
assertThat(thrown).hasMessageThat().contains("Description must not be blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,9 +58,7 @@ public class MetricSchemaTest {
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() ->
|
() -> MetricSchema.create("/name", "description", "", Kind.GAUGE, ImmutableSet.of()));
|
||||||
MetricSchema.create(
|
|
||||||
"/name", "description", "", Kind.GAUGE, ImmutableSet.<LabelDescriptor>of()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("Value Display Name must not be empty");
|
assertThat(thrown).hasMessageThat().contains("Value Display Name must not be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,11 +69,7 @@ public class MetricSchemaTest {
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() ->
|
() ->
|
||||||
MetricSchema.create(
|
MetricSchema.create(
|
||||||
"foo",
|
"foo", "description", "valueDisplayName", Kind.GAUGE, ImmutableSet.of()));
|
||||||
"description",
|
|
||||||
"valueDisplayName",
|
|
||||||
Kind.GAUGE,
|
|
||||||
ImmutableSet.<LabelDescriptor>of()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("Name must be URL-like and start with a '/'");
|
assertThat(thrown).hasMessageThat().contains("Name must be URL-like and start with a '/'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,7 @@ public class StoredMetricTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGetCardinality_reflectsCurrentCardinality() {
|
public void testGetCardinality_reflectsCurrentCardinality() {
|
||||||
StoredMetric<Boolean> smallMetric =
|
StoredMetric<Boolean> smallMetric =
|
||||||
new StoredMetric<>(
|
new StoredMetric<>("/metric", "description", "vdn", ImmutableSet.of(), Boolean.class);
|
||||||
"/metric", "description", "vdn", ImmutableSet.<LabelDescriptor>of(), Boolean.class);
|
|
||||||
assertThat(smallMetric.getCardinality()).isEqualTo(0);
|
assertThat(smallMetric.getCardinality()).isEqualTo(0);
|
||||||
|
|
||||||
smallMetric.set(true);
|
smallMetric.set(true);
|
||||||
|
|
|
@ -113,7 +113,7 @@ public final class SheepCounterExample {
|
||||||
"/is_sleeping",
|
"/is_sleeping",
|
||||||
"Tracks sleep state.",
|
"Tracks sleep state.",
|
||||||
"Sleeping?",
|
"Sleeping?",
|
||||||
ImmutableSet.<LabelDescriptor>of(),
|
ImmutableSet.of(),
|
||||||
Boolean.class);
|
Boolean.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,8 +128,8 @@ public final class SheepCounterExample {
|
||||||
"/sleep_quality",
|
"/sleep_quality",
|
||||||
"Quality of the sleep.",
|
"Quality of the sleep.",
|
||||||
"Quality",
|
"Quality",
|
||||||
ImmutableSet.<LabelDescriptor>of(),
|
ImmutableSet.of(),
|
||||||
() -> ImmutableMap.of(ImmutableList.<String>of(), new Random().nextDouble()),
|
() -> ImmutableMap.of(ImmutableList.of(), new Random().nextDouble()),
|
||||||
Double.class);
|
Double.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class EppMetricTest {
|
||||||
public void test_zeroTlds_areRecordedAsAbsent() throws Exception {
|
public void test_zeroTlds_areRecordedAsAbsent() throws Exception {
|
||||||
EppMetric metric =
|
EppMetric metric =
|
||||||
EppMetric.builderForRequest("request-id-1", new FakeClock())
|
EppMetric.builderForRequest("request-id-1", new FakeClock())
|
||||||
.setTlds(ImmutableSet.<String>of())
|
.setTlds(ImmutableSet.of())
|
||||||
.build();
|
.build();
|
||||||
assertThat(metric.getTld()).isEmpty();
|
assertThat(metric.getTld()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class MetricsExportActionTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_emptyErrors() throws Exception {
|
public void testSuccess_emptyErrors() throws Exception {
|
||||||
when(insertAll.execute()).thenReturn(response);
|
when(insertAll.execute()).thenReturn(response);
|
||||||
response.setInsertErrors(ImmutableList.<InsertErrors>of());
|
response.setInsertErrors(ImmutableList.of());
|
||||||
action.run();
|
action.run();
|
||||||
verify(insertAll).execute();
|
verify(insertAll).execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ public final class RequestHandlerTest {
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
// Initialize here, not inline, so that we pick up the mocked UserService.
|
// Initialize here, not inline, so that we pick up the mocked UserService.
|
||||||
handler = RequestHandler.<Component>createForTest(
|
handler = RequestHandler.createForTest(
|
||||||
Component.class,
|
Component.class,
|
||||||
Providers.<Builder>of(new Builder() {
|
Providers.<Builder>of(new Builder() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -421,7 +421,7 @@ public final class RequestHandlerTest {
|
||||||
when(req.getMethod()).thenReturn("GET");
|
when(req.getMethod()).thenReturn("GET");
|
||||||
when(req.getRequestURI()).thenReturn("/auth/adminUser");
|
when(req.getRequestURI()).thenReturn("/auth/adminUser");
|
||||||
when(requestAuthenticator.authorize(AUTH_INTERNAL_OR_ADMIN.authSettings(), req))
|
when(requestAuthenticator.authorize(AUTH_INTERNAL_OR_ADMIN.authSettings(), req))
|
||||||
.thenReturn(Optional.<AuthResult>empty());
|
.thenReturn(Optional.empty());
|
||||||
|
|
||||||
handler.handleRequest(req, rsp);
|
handler.handleRequest(req, rsp);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class RequestAuthenticatorTest {
|
||||||
UserPolicy.ADMIN);
|
UserPolicy.ADMIN);
|
||||||
|
|
||||||
private static final AuthSettings AUTH_NO_METHODS = AuthSettings.create(
|
private static final AuthSettings AUTH_NO_METHODS = AuthSettings.create(
|
||||||
ImmutableList.<AuthMethod>of(),
|
ImmutableList.of(),
|
||||||
AuthLevel.APP,
|
AuthLevel.APP,
|
||||||
UserPolicy.IGNORED);
|
UserPolicy.IGNORED);
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class RequestAuthenticatorTest {
|
||||||
private RequestAuthenticator createRequestAuthenticator(UserService userService) {
|
private RequestAuthenticator createRequestAuthenticator(UserService userService) {
|
||||||
return new RequestAuthenticator(
|
return new RequestAuthenticator(
|
||||||
new AppEngineInternalAuthenticationMechanism(),
|
new AppEngineInternalAuthenticationMechanism(),
|
||||||
ImmutableList.<AuthenticationMechanism>of(
|
ImmutableList.of(
|
||||||
new OAuthAuthenticationMechanism(
|
new OAuthAuthenticationMechanism(
|
||||||
fakeOAuthService,
|
fakeOAuthService,
|
||||||
ImmutableSet.of("test-scope1", "test-scope2", "test-scope3"),
|
ImmutableSet.of("test-scope1", "test-scope2", "test-scope3"),
|
||||||
|
|
|
@ -170,9 +170,7 @@ public class DriveConnectionTest {
|
||||||
.setParents(ImmutableList.of(new ParentReference().setId("driveFolderId")))),
|
.setParents(ImmutableList.of(new ParentReference().setId("driveFolderId")))),
|
||||||
argThat(hasByteArrayContent(DATA))))
|
argThat(hasByteArrayContent(DATA))))
|
||||||
.thenReturn(insert);
|
.thenReturn(insert);
|
||||||
ChildList emptyChildList = new ChildList()
|
ChildList emptyChildList = new ChildList().setItems(ImmutableList.of()).setNextPageToken(null);
|
||||||
.setItems(ImmutableList.<ChildReference> of())
|
|
||||||
.setNextPageToken(null);
|
|
||||||
when(childrenList.execute()).thenReturn(emptyChildList);
|
when(childrenList.execute()).thenReturn(emptyChildList);
|
||||||
assertThat(driveConnection.createOrUpdateFile(
|
assertThat(driveConnection.createOrUpdateFile(
|
||||||
"title",
|
"title",
|
||||||
|
|
|
@ -95,7 +95,6 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.smd.EncodedSignedMark;
|
import google.registry.model.smd.EncodedSignedMark;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferData.Builder;
|
import google.registry.model.transfer.TransferData.Builder;
|
||||||
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
|
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import google.registry.tmch.LordnTask;
|
import google.registry.tmch.LordnTask;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -513,7 +512,7 @@ public class DatastoreHelper {
|
||||||
.setTransferData(createTransferDataBuilder(requestTime, expirationTime)
|
.setTransferData(createTransferDataBuilder(requestTime, expirationTime)
|
||||||
.setPendingTransferExpirationTime(now.plus(getContactAutomaticTransferLength()))
|
.setPendingTransferExpirationTime(now.plus(getContactAutomaticTransferLength()))
|
||||||
.setServerApproveEntities(
|
.setServerApproveEntities(
|
||||||
ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
ImmutableSet.of(
|
||||||
// Pretend it's 3 days since the request
|
// Pretend it's 3 days since the request
|
||||||
Key.create(persistResource(
|
Key.create(persistResource(
|
||||||
createPollMessageForImplicitTransfer(
|
createPollMessageForImplicitTransfer(
|
||||||
|
@ -600,7 +599,7 @@ public class DatastoreHelper {
|
||||||
.setServerApproveBillingEvent(Key.create(transferBillingEvent))
|
.setServerApproveBillingEvent(Key.create(transferBillingEvent))
|
||||||
.setServerApproveAutorenewEvent(Key.create(gainingClientAutorenewEvent))
|
.setServerApproveAutorenewEvent(Key.create(gainingClientAutorenewEvent))
|
||||||
.setServerApproveAutorenewPollMessage(Key.create(gainingClientAutorenewPollMessage))
|
.setServerApproveAutorenewPollMessage(Key.create(gainingClientAutorenewPollMessage))
|
||||||
.setServerApproveEntities(ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
|
.setServerApproveEntities(ImmutableSet.of(
|
||||||
Key.create(transferBillingEvent),
|
Key.create(transferBillingEvent),
|
||||||
Key.create(gainingClientAutorenewEvent),
|
Key.create(gainingClientAutorenewEvent),
|
||||||
Key.create(gainingClientAutorenewPollMessage),
|
Key.create(gainingClientAutorenewPollMessage),
|
||||||
|
@ -646,14 +645,14 @@ public class DatastoreHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Iterable<BillingEvent> getBillingEvents() {
|
private static Iterable<BillingEvent> getBillingEvents() {
|
||||||
return Iterables.<BillingEvent>concat(
|
return Iterables.concat(
|
||||||
ofy().load().type(BillingEvent.OneTime.class),
|
ofy().load().type(BillingEvent.OneTime.class),
|
||||||
ofy().load().type(BillingEvent.Recurring.class),
|
ofy().load().type(BillingEvent.Recurring.class),
|
||||||
ofy().load().type(BillingEvent.Cancellation.class));
|
ofy().load().type(BillingEvent.Cancellation.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Iterable<BillingEvent> getBillingEvents(EppResource resource) {
|
private static Iterable<BillingEvent> getBillingEvents(EppResource resource) {
|
||||||
return Iterables.<BillingEvent>concat(
|
return Iterables.concat(
|
||||||
ofy().load().type(BillingEvent.OneTime.class).ancestor(resource),
|
ofy().load().type(BillingEvent.OneTime.class).ancestor(resource),
|
||||||
ofy().load().type(BillingEvent.Recurring.class).ancestor(resource),
|
ofy().load().type(BillingEvent.Recurring.class).ancestor(resource),
|
||||||
ofy().load().type(BillingEvent.Cancellation.class).ancestor(resource));
|
ofy().load().type(BillingEvent.Cancellation.class).ancestor(resource));
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class EppLoader {
|
||||||
private String eppXml;
|
private String eppXml;
|
||||||
|
|
||||||
public EppLoader(Object context, String eppXmlFilename) {
|
public EppLoader(Object context, String eppXmlFilename) {
|
||||||
this(context, eppXmlFilename, ImmutableMap.<String, String>of());
|
this(context, eppXmlFilename, ImmutableMap.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
public EppLoader(Object context, String eppXmlFilename, Map<String, String> substitutions) {
|
public EppLoader(Object context, String eppXmlFilename, Map<String, String> substitutions) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FakeOAuthService implements OAuthService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorizedScopes(String... scopes) {
|
public void setAuthorizedScopes(String... scopes) {
|
||||||
this.authorizedScopes = ImmutableList.<String>copyOf(scopes);
|
this.authorizedScopes = ImmutableList.copyOf(scopes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
package google.registry.testing;
|
package google.registry.testing;
|
||||||
|
|
||||||
import com.google.appengine.api.urlfetch.HTTPHeader;
|
|
||||||
import com.google.appengine.api.urlfetch.HTTPRequest;
|
import com.google.appengine.api.urlfetch.HTTPRequest;
|
||||||
import com.google.appengine.api.urlfetch.HTTPResponse;
|
import com.google.appengine.api.urlfetch.HTTPResponse;
|
||||||
import com.google.appengine.api.urlfetch.URLFetchService;
|
import com.google.appengine.api.urlfetch.URLFetchService;
|
||||||
|
@ -42,8 +41,7 @@ public class FakeURLFetchService extends ForwardingURLFetchService {
|
||||||
if (backingMap.containsKey(requestURL)) {
|
if (backingMap.containsKey(requestURL)) {
|
||||||
return backingMap.get(requestURL);
|
return backingMap.get(requestURL);
|
||||||
} else {
|
} else {
|
||||||
return new HTTPResponse(
|
return new HTTPResponse(HttpURLConnection.HTTP_NOT_FOUND, null, null, ImmutableList.of());
|
||||||
HttpURLConnection.HTTP_NOT_FOUND, null, null, ImmutableList.<HTTPHeader>of());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class LogsSubject extends Subject<LogsSubject, TestLogHandler> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private List<String> getMessagesAtLevel(Level level) {
|
private List<String> getMessagesAtLevel(Level level) {
|
||||||
ImmutableList.Builder<String> builder = ImmutableList.<String>builder();
|
ImmutableList.Builder<String> builder = new ImmutableList.Builder<>();
|
||||||
for (LogRecord log : actual().getStoredLogRecords()) {
|
for (LogRecord log : actual().getStoredLogRecords()) {
|
||||||
if (log.getLevel().equals(level)) {
|
if (log.getLevel().equals(level)) {
|
||||||
builder.add(log.getMessage());
|
builder.add(log.getMessage());
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class TaskQueueHelper {
|
||||||
|
|
||||||
public static void assertTasksEnqueued(String queueName, Iterable<TaskStateInfo> taskStateInfos)
|
public static void assertTasksEnqueued(String queueName, Iterable<TaskStateInfo> taskStateInfos)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
ImmutableList.Builder<TaskMatcher> taskMatchers = 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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,7 @@ public abstract class MapreduceTestCase<T> extends ShardableTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MapreduceRunner makeDefaultRunner() {
|
protected MapreduceRunner makeDefaultRunner() {
|
||||||
return new MapreduceRunner(
|
return new MapreduceRunner(Optional.of(getEppResourceIndexBucketCount()), Optional.of(1));
|
||||||
Optional.<Integer>of(getEppResourceIndexBucketCount()), Optional.<Integer>of(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<QueueStateInfo.TaskStateInfo> getTasks(String queueName) {
|
protected List<QueueStateInfo.TaskStateInfo> getTasks(String queueName) {
|
||||||
|
@ -178,7 +177,7 @@ public abstract class MapreduceTestCase<T> extends ShardableTestCase {
|
||||||
*/
|
*/
|
||||||
protected void executeTasksUntilEmpty(String queueName, @Nullable FakeClock clock)
|
protected void executeTasksUntilEmpty(String queueName, @Nullable FakeClock clock)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
executeTasks(queueName, clock, Optional.<Integer>empty());
|
executeTasks(queueName, clock, Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.junit.runners.JUnit4;
|
||||||
public class IdnTableTest {
|
public class IdnTableTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDigits() {
|
public void testDigits() {
|
||||||
ImmutableList<String> of = ImmutableList.<String>of(
|
ImmutableList<String> of = ImmutableList.of(
|
||||||
"# URL: https://love.example/lolcatattack.txt",
|
"# URL: https://love.example/lolcatattack.txt",
|
||||||
"# Policy: https://love.example/policy.html",
|
"# Policy: https://love.example/policy.html",
|
||||||
"U+0030",
|
"U+0030",
|
||||||
|
@ -42,8 +42,7 @@ public class IdnTableTest {
|
||||||
"U+0037",
|
"U+0037",
|
||||||
"U+0038",
|
"U+0038",
|
||||||
"U+0039");
|
"U+0039");
|
||||||
IdnTable idnTable =
|
IdnTable idnTable = IdnTable.createFrom("lolcatattack", of, Optional.empty());
|
||||||
IdnTable.createFrom("lolcatattack", of, Optional.<LanguageValidator>empty());
|
|
||||||
assertThat(idnTable.isValidLabel("0123456789")).isTrue();
|
assertThat(idnTable.isValidLabel("0123456789")).isTrue();
|
||||||
assertThat(idnTable.isValidLabel("54321a")).isFalse();
|
assertThat(idnTable.isValidLabel("54321a")).isFalse();
|
||||||
assertThat(idnTable.isValidLabel("AAA000")).isFalse();
|
assertThat(idnTable.isValidLabel("AAA000")).isFalse();
|
||||||
|
@ -51,7 +50,7 @@ public class IdnTableTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoreCommentAndEmptyLines() {
|
public void testIgnoreCommentAndEmptyLines() {
|
||||||
IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.<String>of(
|
IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.of(
|
||||||
"# URL: https://love.example/lolcatattack.txt",
|
"# URL: https://love.example/lolcatattack.txt",
|
||||||
"# Policy: https://love.example/policy.html",
|
"# Policy: https://love.example/policy.html",
|
||||||
"U+0030",
|
"U+0030",
|
||||||
|
@ -65,21 +64,25 @@ public class IdnTableTest {
|
||||||
"U+0036",
|
"U+0036",
|
||||||
"U+0037",
|
"U+0037",
|
||||||
"U+0038",
|
"U+0038",
|
||||||
"U+0039"), Optional.<LanguageValidator>empty());
|
"U+0039"), Optional.empty());
|
||||||
assertThat(idnTable.isValidLabel("0123456789")).isFalse();
|
assertThat(idnTable.isValidLabel("0123456789")).isFalse();
|
||||||
assertThat(idnTable.isValidLabel("023456789")).isTrue(); // Works when you remove 1
|
assertThat(idnTable.isValidLabel("023456789")).isTrue(); // Works when you remove 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSurrogates() {
|
public void testSurrogates() {
|
||||||
IdnTable idnTable = IdnTable.createFrom("lolcatattack", ImmutableList.<String>of(
|
IdnTable idnTable =
|
||||||
"# URL: https://love.example/lolcatattack.txt",
|
IdnTable.createFrom(
|
||||||
"# Policy: https://love.example/policy.html",
|
"lolcatattack",
|
||||||
"U+0035",
|
ImmutableList.of(
|
||||||
"U+0036",
|
"# URL: https://love.example/lolcatattack.txt",
|
||||||
"U+0037",
|
"# Policy: https://love.example/policy.html",
|
||||||
"U+2070E",
|
"U+0035",
|
||||||
"U+20731"), Optional.<LanguageValidator>empty());
|
"U+0036",
|
||||||
|
"U+0037",
|
||||||
|
"U+2070E",
|
||||||
|
"U+20731"),
|
||||||
|
Optional.empty());
|
||||||
assertThat(idnTable.getName()).isEqualTo("lolcatattack");
|
assertThat(idnTable.getName()).isEqualTo("lolcatattack");
|
||||||
assertThat(idnTable.isValidLabel("𠜎")).isTrue();
|
assertThat(idnTable.isValidLabel("𠜎")).isTrue();
|
||||||
assertThat(idnTable.isValidLabel("𠜱")).isTrue();
|
assertThat(idnTable.isValidLabel("𠜱")).isTrue();
|
||||||
|
@ -90,34 +93,31 @@ public class IdnTableTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSpecialComments_getParsed() {
|
public void testSpecialComments_getParsed() {
|
||||||
ImmutableList<String> of = ImmutableList.<String>of(
|
ImmutableList<String> of =
|
||||||
"# URL: https://love.example/lolcatattack.txt",
|
ImmutableList.of(
|
||||||
"# Policy: https://love.example/policy.html");
|
"# URL: https://love.example/lolcatattack.txt",
|
||||||
|
"# Policy: https://love.example/policy.html");
|
||||||
IdnTable idnTable =
|
IdnTable idnTable =
|
||||||
IdnTable.createFrom("lolcatattack", of, Optional.<LanguageValidator>empty());
|
IdnTable.createFrom("lolcatattack", of, Optional.empty());
|
||||||
assertThat(idnTable.getUrl()).isEqualTo(URI.create("https://love.example/lolcatattack.txt"));
|
assertThat(idnTable.getUrl()).isEqualTo(URI.create("https://love.example/lolcatattack.txt"));
|
||||||
assertThat(idnTable.getPolicy()).isEqualTo(URI.create("https://love.example/policy.html"));
|
assertThat(idnTable.getPolicy()).isEqualTo(URI.create("https://love.example/policy.html"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingUrl_throwsNpe() {
|
public void testMissingUrl_throwsNpe() {
|
||||||
ImmutableList<String> of = ImmutableList.<String>of(
|
ImmutableList<String> of = ImmutableList.of("# Policy: https://love.example/policy.html");
|
||||||
"# Policy: https://love.example/policy.html");
|
|
||||||
NullPointerException thrown =
|
NullPointerException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
NullPointerException.class,
|
NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty()));
|
||||||
() -> IdnTable.createFrom("sloth", of, Optional.<LanguageValidator>empty()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("sloth missing '# URL:");
|
assertThat(thrown).hasMessageThat().contains("sloth missing '# URL:");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingPolicy_throwsNpe() {
|
public void testMissingPolicy_throwsNpe() {
|
||||||
ImmutableList<String> of = ImmutableList.<String>of(
|
ImmutableList<String> of = ImmutableList.of("# URL: https://love.example/sloth.txt");
|
||||||
"# URL: https://love.example/sloth.txt");
|
|
||||||
NullPointerException thrown =
|
NullPointerException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
NullPointerException.class,
|
NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty()));
|
||||||
() -> IdnTable.createFrom("sloth", of, Optional.<LanguageValidator>empty()));
|
|
||||||
assertThat(thrown).hasMessageThat().contains("sloth missing '# Policy:");
|
assertThat(thrown).hasMessageThat().contains("sloth missing '# Policy:");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
||||||
.doThrow(fakeException)
|
.doThrow(fakeException)
|
||||||
.doCallRealMethod()
|
.doCallRealMethod()
|
||||||
.when(spyCommand)
|
.when(spyCommand)
|
||||||
.saveTokens(Mockito.<ImmutableSet<LrpTokenEntity>>any());
|
.saveTokens(Mockito.any());
|
||||||
runCommand("--assignee=domain.tld", "--tlds=tld");
|
runCommand("--assignee=domain.tld", "--tlds=tld");
|
||||||
assertLrpTokens(
|
assertLrpTokens(
|
||||||
createToken("LRP_abcdefghijklmnop", "domain.tld", ImmutableSet.of("tld"), null, null));
|
createToken("LRP_abcdefghijklmnop", "domain.tld", ImmutableSet.of("tld"), null, null));
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class EppToolVerifier {
|
||||||
ArgumentCaptor<byte[]> params = ArgumentCaptor.forClass(byte[].class);
|
ArgumentCaptor<byte[]> params = ArgumentCaptor.forClass(byte[].class);
|
||||||
verify(connection, atLeast(0)).send(
|
verify(connection, atLeast(0)).send(
|
||||||
eq("/_dr/epptool"),
|
eq("/_dr/epptool"),
|
||||||
eq(ImmutableMap.<String, Object>of()),
|
eq(ImmutableMap.of()),
|
||||||
eq(MediaType.FORM_DATA),
|
eq(MediaType.FORM_DATA),
|
||||||
params.capture());
|
params.capture());
|
||||||
capturedParams = ImmutableList.copyOf(params.getAllValues());
|
capturedParams = ImmutableList.copyOf(params.getAllValues());
|
||||||
|
|
|
@ -52,7 +52,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
* The TLD to be used (for those subclasses that use TLDs; defaults to empty).
|
* The TLD to be used (for those subclasses that use TLDs; defaults to empty).
|
||||||
*/
|
*/
|
||||||
protected List<String> getTlds() {
|
protected List<String> getTlds() {
|
||||||
return ImmutableList.<String>of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +101,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand(tldsParameter);
|
runCommand(tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent(null, Optional.<Boolean>empty(), Optional.<Boolean>empty());
|
verifySent(null, Optional.empty(), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -111,7 +111,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand("--fields=fieldName", tldsParameter);
|
runCommand("--fields=fieldName", tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent("fieldName", Optional.<Boolean>empty(), Optional.<Boolean>empty());
|
verifySent("fieldName", Optional.empty(), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -121,7 +121,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand("--fields=*", tldsParameter);
|
runCommand("--fields=*", tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent("*", Optional.<Boolean>empty(), Optional.<Boolean>empty());
|
verifySent("*", Optional.empty(), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -131,7 +131,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand("--fields=fieldName", "--header=true", tldsParameter);
|
runCommand("--fields=fieldName", "--header=true", tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent("fieldName", Optional.of(Boolean.TRUE), Optional.<Boolean>empty());
|
verifySent("fieldName", Optional.of(Boolean.TRUE), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -141,7 +141,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand("--fields=fieldName", "--header=false", tldsParameter);
|
runCommand("--fields=fieldName", "--header=false", tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent("fieldName", Optional.of(Boolean.FALSE), Optional.<Boolean>empty());
|
verifySent("fieldName", Optional.of(Boolean.FALSE), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -151,7 +151,7 @@ public abstract class ListObjectsCommandTestCase<C extends ListObjectsCommand>
|
||||||
} else {
|
} else {
|
||||||
runCommand("--fields=fieldName", "--full_field_names", tldsParameter);
|
runCommand("--fields=fieldName", "--full_field_names", tldsParameter);
|
||||||
}
|
}
|
||||||
verifySent("fieldName", Optional.<Boolean>empty(), Optional.of(Boolean.TRUE));
|
verifySent("fieldName", Optional.empty(), Optional.of(Boolean.TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class PublishDetailReportCommandTest extends CommandTestCase<PublishDetai
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
command.setConnection(connection);
|
command.setConnection(connection);
|
||||||
when(connection.sendJson(anyString(), anyMapOf(String.class, Object.class)))
|
when(connection.sendJson(anyString(), anyMapOf(String.class, Object.class)))
|
||||||
.thenReturn(ImmutableMap.<String, Object>of("driveId", "some123id"));
|
.thenReturn(ImmutableMap.of("driveId", "some123id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -41,10 +41,9 @@ public class VerifyOteCommandTest extends CommandTestCase<VerifyOteCommand> {
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
command.setConnection(connection);
|
command.setConnection(connection);
|
||||||
ImmutableMap<String, Object> response =
|
ImmutableMap<String, Object> response =
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.of("blobio", "Num actions: 19 - Reqs passed: 19/19 - Overall: PASS");
|
||||||
"blobio", "Num actions: 19 - Reqs passed: 19/19 - Overall: PASS");
|
|
||||||
when(connection.sendJson(anyString(), anyMapOf(String.class, Object.class)))
|
when(connection.sendJson(anyString(), anyMapOf(String.class, Object.class)))
|
||||||
.thenReturn(ImmutableMap.<String, Object>of("blobio", response));
|
.thenReturn(ImmutableMap.of("blobio", response));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue