Convert more tests to use @DualDatabaseTest and SQL in general (#1101)

Nothing super crazy here other than persisting the entity changes in
DomainDeleteFlow at the end of the flow rather than almost at the end.
This means that when we return the results we give the results as they
were originally present, rather than the subsequently-changed values.
This commit is contained in:
gbrodman 2021-04-23 18:26:44 -04:00 committed by GitHub
parent 68d3c791f0
commit 1c60c1c416
13 changed files with 152 additions and 142 deletions

View file

@ -262,7 +262,6 @@ public final class DomainDeleteFlow implements TransactionalFlow {
.setHistoryEntry(historyEntry)
.setEntityChanges(EntityChanges.newBuilder().setSaves(entitiesToSave.build()).build())
.build());
persistEntityChanges(entityChanges);
BeforeResponseReturnData responseData =
flowCustomLogic.beforeResponse(
BeforeResponseParameters.newBuilder()
@ -272,6 +271,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
: SUCCESS)
.setResponseExtensions(getResponseExtensions(existingDomain, now))
.build());
persistEntityChanges(entityChanges);
return responseBuilder
.setResultFromCode(responseData.resultCode())
.setExtensions(responseData.responseExtensions())

View file

@ -19,6 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.host.HostFlowUtils.validateHostName;
import static google.registry.model.EppResourceUtils.isLinked;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException;
@ -76,7 +77,8 @@ public final class HostInfoFlow implements Flow {
// there is no superordinate domain, the host's own values for these fields will be correct.
if (host.isSubordinate()) {
DomainBase superordinateDomain =
tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now);
transactIfJpaTm(
() -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now));
hostInfoDataBuilder
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId())
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain));

View file

@ -22,17 +22,23 @@ import static google.registry.testing.EppMetricSubject.assertThat;
import com.google.common.collect.ImmutableMap;
import google.registry.testing.AppEngineExtension;
import org.junit.jupiter.api.Test;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestOfyAndSql;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Tests for contact lifecycle. */
@DualDatabaseTest
class EppLifecycleContactTest extends EppTestCase {
@RegisterExtension
final AppEngineExtension appEngine =
AppEngineExtension.builder().withDatastoreAndCloudSql().withTaskQueue().build();
AppEngineExtension.builder()
.withDatastoreAndCloudSql()
.withClock(clock)
.withTaskQueue()
.build();
@Test
@TestOfyAndSql
void testContactLifecycle() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
assertThatCommand("contact_create_sh8013.xml")
@ -68,7 +74,7 @@ class EppLifecycleContactTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testContactTransferPollMessage() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
assertThatCommand("contact_create_sh8013.xml")

View file

@ -18,7 +18,6 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
@ -26,6 +25,7 @@ import static google.registry.testing.DatabaseHelper.assertBillingEventsForResou
import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.createTlds;
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
import static google.registry.testing.DatabaseHelper.loadByEntity;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.DomainBaseSubject.assertAboutDomains;
import static google.registry.testing.EppMetricSubject.assertThat;
@ -46,13 +46,15 @@ import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldState;
import google.registry.model.reporting.HistoryEntry.Type;
import google.registry.testing.AppEngineExtension;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestOfyAndSql;
import org.joda.money.Money;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Tests for domain lifecycle. */
@DualDatabaseTest
class EppLifecycleDomainTest extends EppTestCase {
private static final ImmutableMap<String, String> DEFAULT_TRANSFER_RESPONSE_PARMS =
@ -63,14 +65,18 @@ class EppLifecycleDomainTest extends EppTestCase {
@RegisterExtension
final AppEngineExtension appEngine =
AppEngineExtension.builder().withDatastoreAndCloudSql().withTaskQueue().build();
AppEngineExtension.builder()
.withDatastoreAndCloudSql()
.withClock(clock)
.withTaskQueue()
.build();
@BeforeEach
void beforeEach() {
createTlds("example", "tld");
}
@Test
@TestOfyAndSql
void testDomainDeleteRestore() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -130,7 +136,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeleteRestore_duringAutorenewGracePeriod() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -204,7 +210,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeleteRestore_duringRenewalGracePeriod() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -286,7 +292,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDelete_duringAddAndRenewalGracePeriod_deletesImmediately() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -375,13 +381,13 @@ class EppLifecycleDomainTest extends EppTestCase {
// entire cost of registration was refunded. We have to do this through the DB instead of EPP
// because domains deleted during the add grace period vanish immediately as far as the world
// outside our system is concerned.
DomainBase deletedDomain = ofy().load().entity(domain).now();
DomainBase deletedDomain = loadByEntity(domain);
assertAboutDomains().that(deletedDomain).hasRegistrationExpirationTime(createTime);
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeletion_withinAddGracePeriod_deletesImmediately() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -431,13 +437,13 @@ class EppLifecycleDomainTest extends EppTestCase {
// entire cost of registration was refunded. We have to do this through the DB instead of EPP
// because domains deleted during the add grace period vanish immediately as far as the world
// outside our system is concerned.
DomainBase deletedDomain = ofy().load().entity(domain).now();
DomainBase deletedDomain = loadByEntity(domain);
assertAboutDomains().that(deletedDomain).hasRegistrationExpirationTime(createTime);
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeletion_outsideAddGracePeriod_showsRedemptionPeriod() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -499,7 +505,7 @@ class EppLifecycleDomainTest extends EppTestCase {
.isEqualTo(createTime.plusYears(2));
}
@Test
@TestOfyAndSql
void testEapDomainDeletion_withinAddGracePeriod_eapFeeIsNotRefunded() throws Exception {
assertThatCommand("login_valid_fee_extension.xml").hasSuccessfulLogin();
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
@ -564,7 +570,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeletionWithSubordinateHost_fails() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createFakesite();
@ -577,7 +583,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDeletionOfDomain_afterRenameOfSubordinateHost_succeeds() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
assertThat(getRecordedEppMetric())
@ -632,7 +638,7 @@ class EppLifecycleDomainTest extends EppTestCase {
.hasStatus(SUCCESS_AND_CLOSE);
}
@Test
@TestOfyAndSql
void testDeletionOfDomain_afterUpdateThatCreatesSubordinateHost_fails() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createFakesite();
@ -675,7 +681,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainCreation_failsBeforeSunrise() throws Exception {
DateTime sunriseDate = DateTime.parse("2000-05-30T00:00:00Z");
createTld(
@ -709,7 +715,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainCheckFee_succeeds() throws Exception {
DateTime gaDate = DateTime.parse("2000-05-30T00:00:00Z");
createTld(
@ -735,7 +741,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainCreate_annualAutoRenewPollMessages_haveUniqueIds() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
// Create the domain.
@ -785,7 +791,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainTransferPollMessage_serverApproved() throws Exception {
// As the losing registrar, create the domain.
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -839,7 +845,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testTransfer_autoRenewGraceActive_onlyAtAutomaticTransferTime_getsSubsumed()
throws Exception {
// Register the domain as the first registrar.
@ -877,7 +883,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testNameserversTransferWithDomain_successfully() throws Exception {
// Log in as the first registrar and set up domains with hosts.
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -914,7 +920,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testRenewalFails_whenTotalTermExceeds10Years() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
// Creates domain with 2 year expiration.
@ -928,7 +934,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainDeletionCancelsPendingTransfer() throws Exception {
// Register the domain as the first registrar.
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -966,7 +972,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainTransfer_subordinateHost_showsChangeInTransferQuery() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
createFakesite();
@ -1002,7 +1008,7 @@ class EppLifecycleDomainTest extends EppTestCase {
* to be subordinate to a different domain, that the host retains the transfer time of the first
* superordinate domain, not whatever the transfer time from the second domain is.
*/
@Test
@TestOfyAndSql
void testSuccess_lastTransferTime_superordinateDomainTransferFollowedByHostUpdate()
throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -1056,7 +1062,7 @@ class EppLifecycleDomainTest extends EppTestCase {
* Tests that when a superordinate domain of a host is transferred, and then the host is updated
* to be external, that the host retains the transfer time of the first superordinate domain.
*/
@Test
@TestOfyAndSql
void testSuccess_lastTransferTime_superordinateDomainTransferThenHostUpdateToExternal()
throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -1099,7 +1105,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testSuccess_multipartTldsWithSharedSuffixes() throws Exception {
createTlds("bar.foo.tld", "foo.tld");
@ -1143,7 +1149,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testSuccess_multipartTldsWithSharedPrefixes() throws Exception {
createTld("tld.foo");
@ -1182,7 +1188,7 @@ class EppLifecycleDomainTest extends EppTestCase {
* during start-date sunrise - which we can then delete "as normal" (no need for a signed mark or
* anything for delete), and then use "regular" create during general-availability.
*/
@Test
@TestOfyAndSql
void testDomainCreation_startDateSunriseFull() throws Exception {
// The signed mark is valid between 2013 and 2017
DateTime sunriseDate = DateTime.parse("2014-09-08T09:09:09Z");
@ -1278,7 +1284,7 @@ class EppLifecycleDomainTest extends EppTestCase {
}
/** Test that missing type= argument on launch create works in start-date sunrise. */
@Test
@TestOfyAndSql
void testDomainCreation_startDateSunrise_noType() throws Exception {
// The signed mark is valid between 2013 and 2017
DateTime sunriseDate = DateTime.parse("2014-09-08T09:09:09Z");
@ -1327,7 +1333,7 @@ class EppLifecycleDomainTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testDomainTransfer_duringAutorenewGrace() throws Exception {
// Creation date of fakesite: 2000-06-01T00:04:00.0Z
// Expiration date: 2002-06-01T00:04:00.0Z
@ -1413,7 +1419,7 @@ class EppLifecycleDomainTest extends EppTestCase {
"EXDATE", "2003-06-01T00:04:00Z"));
}
@Test
@TestOfyAndSql
void testDomainTransfer_queryForServerApproved() throws Exception {
// Creation date of fakesite: 2000-06-01T00:04:00.0Z
// Expiration date: 2002-06-01T00:04:00.0Z

View file

@ -27,18 +27,24 @@ import com.google.common.collect.ImmutableMap;
import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.testing.AppEngineExtension;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestOfyAndSql;
import org.joda.time.DateTime;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Tests for host lifecycle. */
@DualDatabaseTest
class EppLifecycleHostTest extends EppTestCase {
@RegisterExtension
final AppEngineExtension appEngine =
AppEngineExtension.builder().withDatastoreAndCloudSql().withTaskQueue().build();
AppEngineExtension.builder()
.withDatastoreAndCloudSql()
.withClock(clock)
.withTaskQueue()
.build();
@Test
@TestOfyAndSql
void testLifecycle() throws Exception {
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
assertThatCommand("hello.xml")
@ -86,7 +92,7 @@ class EppLifecycleHostTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testRenamingHostToExistingHost_fails() throws Exception {
createTld("example");
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
@ -136,7 +142,7 @@ class EppLifecycleHostTest extends EppTestCase {
assertThatLogoutSucceeds();
}
@Test
@TestOfyAndSql
void testSuccess_multipartTldsWithSharedSuffixes() throws Exception {
createTlds("bar.foo.tld", "foo.tld", "tld");

View file

@ -15,9 +15,10 @@
package google.registry.flows;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
import static google.registry.testing.DatabaseHelper.loadAllOf;
import static google.registry.testing.DatabaseHelper.stripBillingEventId;
import static google.registry.testing.TestDataHelper.loadFile;
import static google.registry.xml.XmlTestUtils.assertXmlEqualsWithMessage;
@ -28,7 +29,6 @@ import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.MediaType;
import com.google.common.truth.Truth8;
import com.googlecode.objectify.Key;
import google.registry.flows.EppTestComponent.FakesAndMocksModule;
import google.registry.model.billing.BillingEvent;
@ -411,17 +411,13 @@ public class EppTestCase {
*/
private static Key<OneTime> findKeyToActualOneTimeBillingEvent(OneTime expectedBillingEvent) {
Optional<OneTime> actualCreateBillingEvent =
ofy()
.load()
.type(BillingEvent.OneTime.class)
.list()
.stream()
loadAllOf(BillingEvent.OneTime.class).stream()
.filter(
b ->
Objects.equals(
stripBillingEventId(b), stripBillingEventId(expectedBillingEvent)))
.findFirst();
Truth8.assertThat(actualCreateBillingEvent).isPresent();
assertThat(actualCreateBillingEvent).isPresent();
return Key.create(actualCreateBillingEvent.get());
}
}

View file

@ -16,13 +16,13 @@ package google.registry.flows.domain;
import static com.google.common.collect.MoreCollectors.onlyElement;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.batch.AsyncTaskEnqueuer.PARAM_REQUESTED_TIME;
import static google.registry.batch.AsyncTaskEnqueuer.PARAM_RESAVE_TIMES;
import static google.registry.batch.AsyncTaskEnqueuer.PARAM_RESOURCE_KEY;
import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_ACTIONS;
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.DELETED_DOMAINS_GRACE;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.DELETED_DOMAINS_NOGRACE;
@ -33,13 +33,16 @@ import static google.registry.model.reporting.DomainTransactionRecord.Transactio
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_DELETE;
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
import static google.registry.testing.DatabaseHelper.assertPollMessages;
import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
import static google.registry.testing.DatabaseHelper.getOnlyPollMessage;
import static google.registry.testing.DatabaseHelper.getPollMessages;
import static google.registry.testing.DatabaseHelper.loadByEntity;
import static google.registry.testing.DatabaseHelper.loadByKey;
import static google.registry.testing.DatabaseHelper.loadByKeyIfPresent;
import static google.registry.testing.DatabaseHelper.loadByKeysIfPresent;
import static google.registry.testing.DatabaseHelper.loadRegistrar;
import static google.registry.testing.DatabaseHelper.newDomainBase;
import static google.registry.testing.DatabaseHelper.newHostResource;
@ -97,19 +100,20 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.DomainTransferData;
import google.registry.model.transfer.TransferResponse;
import google.registry.model.transfer.TransferStatus;
import google.registry.persistence.VKey;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.ReplayExtension;
import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.testing.TestOfyAndSql;
import java.util.Map;
import org.joda.money.Money;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link DomainDeleteFlow}. */
@DualDatabaseTest
class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, DomainBase> {
@Order(value = Order.DEFAULT - 2)
@ -286,7 +290,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.setParent(earlierHistoryEntry);
}
@Test
@TestOfyAndSql
void testSuccess_asyncActionsAreEnqueued() throws Exception {
persistResource(
Registry.get("tld")
@ -311,7 +315,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.etaDelta(when.minus(standardSeconds(30)), when.plus(standardSeconds(30))));
}
@Test
@TestOfyAndSql
void testDryRun() throws Exception {
setUpSuccessfulTest();
setUpGracePeriods(
@ -324,7 +328,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
dryRunFlowAssertResponse(loadFile("generic_success_response.xml"));
}
@Test
@TestOfyAndSql
void testDryRun_noGracePeriods() throws Exception {
setUpSuccessfulTest();
dryRunFlowAssertResponse(loadFile("domain_delete_response_pending.xml"));
@ -360,7 +364,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(getPollMessages("TheRegistrar")).isEmpty();
}
@Test
@TestOfyAndSql
void testSuccess_updatedEppUpdateTimeAfterPendingRedemption() throws Exception {
persistResource(
Registry.get("tld")
@ -384,26 +388,26 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.hasLastEppUpdateTime(redemptionEndTime);
}
@Test
@TestOfyAndSql
void testSuccess_addGracePeriodResultsInImmediateDelete() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
doAddGracePeriodDeleteTest(GracePeriodStatus.ADD, "generic_success_response.xml");
}
@Test
@TestOfyAndSql
void testSuccess_addGracePeriodCredit_v06() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
doAddGracePeriodDeleteTest(GracePeriodStatus.ADD, "domain_delete_response_fee.xml", FEE_06_MAP);
}
@Test
@TestOfyAndSql
void testSuccess_addGracePeriodCredit_v11() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
doAddGracePeriodDeleteTest(GracePeriodStatus.ADD, "domain_delete_response_fee.xml", FEE_11_MAP);
}
@Test
@TestOfyAndSql
void testSuccess_addGracePeriodCredit_v12() throws Exception {
doAddGracePeriodDeleteTest(GracePeriodStatus.ADD, "domain_delete_response_fee.xml", FEE_12_MAP);
}
@ -477,41 +481,41 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(1);
assertThat(domain.getDeletePollMessage().getOfyKey())
.isEqualTo(getOnlyPollMessage("TheRegistrar").createVKey().getOfyKey());
PollMessage.OneTime deletePollMessage = tm().loadByKey(domain.getDeletePollMessage());
PollMessage.OneTime deletePollMessage = loadByKey(domain.getDeletePollMessage());
assertThat(deletePollMessage.getMsg()).isEqualTo(expectedMessage);
}
@Test
@TestOfyAndSql
void testSuccess_noAddGracePeriodResultsInPendingDelete() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
}
@Test
@TestOfyAndSql
void testSuccess_renewGracePeriodCredit_v06() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending_fee.xml", FEE_06_MAP);
}
@Test
@TestOfyAndSql
void testSuccess_renewGracePeriodCredit_v11() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending_fee.xml", FEE_11_MAP);
}
@Test
@TestOfyAndSql
void testSuccess_renewGracePeriodCredit_v12() throws Exception {
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending_fee.xml", FEE_12_MAP);
}
@Test
@TestOfyAndSql
void testSuccess_autorenewPollMessageIsNotDeleted() throws Exception {
setUpSuccessfulTest();
// Modify the autorenew poll message so that it has unacked messages in the past. This should
// prevent it from being deleted when the domain is deleted.
persistResource(
tm().loadByKey(reloadResourceByForeignKey().getAutorenewPollMessage())
loadByKey(reloadResourceByForeignKey().getAutorenewPollMessage())
.asBuilder()
.setEventTime(A_MONTH_FROM_NOW.minusYears(3))
.build());
@ -524,7 +528,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(2);
}
@Test
@TestOfyAndSql
void testSuccess_nonDefaultRedemptionGracePeriod() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
persistResource(
@ -535,7 +539,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
}
@Test
@TestOfyAndSql
void testSuccess_nonDefaultPendingDeleteLength() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
persistResource(
@ -546,7 +550,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_v06() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
@ -555,7 +559,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_v11() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
setUpAutorenewGracePeriod();
@ -563,14 +567,14 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_v12() throws Exception {
setUpAutorenewGracePeriod();
clock.advanceOneMilli();
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_priceChanges_v06() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
@ -589,7 +593,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_06_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_priceChanges_v11() throws Exception {
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
persistResource(
@ -607,7 +611,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_11_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_autoRenewGracePeriod_priceChanges_v12() throws Exception {
persistResource(
Registry.get("tld")
@ -624,7 +628,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(loadFile("domain_delete_response_autorenew_fee.xml", FEE_12_MAP));
}
@Test
@TestOfyAndSql
void testSuccess_noPendingTransfer_deletedAndHasNoTransferData() throws Exception {
setClientIdForFlow("TheRegistrar");
setUpSuccessfulTest();
@ -634,7 +638,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(domain.getTransferData()).isEqualTo(DomainTransferData.EMPTY);
}
@Test
@TestOfyAndSql
void testSuccess_pendingTransfer() throws Exception {
setClientIdForFlow("TheRegistrar");
setUpSuccessfulTest();
@ -707,28 +711,15 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.setPendingTransferExpirationTime(clock.nowUtc())
.build());
// The server-approve entities should all be deleted.
assertThat(ofy().load().key(oldTransferData.getServerApproveBillingEvent().getOfyKey()).now())
.isNull();
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewEvent().getOfyKey()).now())
.isNull();
assertThat(
ofy()
.load()
.key(oldTransferData.getServerApproveAutorenewPollMessage().getOfyKey())
.now())
.isNull();
assertThat(oldTransferData.getServerApproveEntities()).isNotEmpty(); // Just a sanity check.
assertThat(
ofy()
.load()
.keys(
oldTransferData.getServerApproveEntities().stream()
.map(VKey::getOfyKey)
.toArray(Key[]::new)))
assertThat(loadByKeyIfPresent(oldTransferData.getServerApproveBillingEvent())).isEmpty();
assertThat(loadByKeyIfPresent(oldTransferData.getServerApproveAutorenewEvent())).isEmpty();
assertThat(loadByKeyIfPresent(oldTransferData.getServerApproveAutorenewPollMessage()))
.isEmpty();
assertThat(oldTransferData.getServerApproveEntities()).isNotEmpty(); // Just a sanity check.
assertThat(loadByKeysIfPresent(oldTransferData.getServerApproveEntities())).isEmpty();
}
@Test
@TestOfyAndSql
void testUnlinkingOfResources() throws Exception {
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
setUpSuccessfulTest();
@ -764,7 +755,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
graceBillingEvent, getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE), eventTime);
}
@Test
@TestOfyAndSql
void testSuccess_deletedSubordinateDomain() throws Exception {
setUpSuccessfulTest();
persistResource(
@ -779,7 +770,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertOnlyBillingEventIsClosedAutorenew("TheRegistrar");
}
@Test
@TestOfyAndSql
void testFailure_predelegation() throws Exception {
createTld("tld", PREDELEGATION);
setUpSuccessfulTest();
@ -787,7 +778,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@TestOfyAndSql
void testSuccess_superuserPredelegation() throws Exception {
createTld("tld", PREDELEGATION);
setUpSuccessfulTest();
@ -796,14 +787,14 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
}
@Test
@TestOfyAndSql
void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@Test
@TestOfyAndSql
void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
@ -811,7 +802,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@Test
@TestOfyAndSql
void testFailure_hasSubordinateHosts() throws Exception {
DomainBase domain = persistActiveDomain(getUniqueIdFromCommand());
HostResource subordinateHost =
@ -825,7 +816,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@TestOfyAndSql
void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand());
@ -833,7 +824,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@TestOfyAndSql
void testSuccess_superuserUnauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
setUpSuccessfulTest();
@ -866,7 +857,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.build());
}
@Test
@TestOfyAndSql
void testFailure_notAuthorizedForTld() throws Exception {
setUpSuccessfulTest();
persistResource(
@ -875,7 +866,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@TestOfyAndSql
void testSuccess_superuserNotAuthorizedForTld() throws Exception {
setUpSuccessfulTest();
persistResource(
@ -885,7 +876,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response_pending.xml"));
}
@Test
@TestOfyAndSql
void testFailure_clientDeleteProhibited() throws Exception {
persistResource(
newDomainBase(getUniqueIdFromCommand())
@ -897,7 +888,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(thrown).hasMessageThat().contains("clientDeleteProhibited");
}
@Test
@TestOfyAndSql
void testFailure_serverDeleteProhibited() throws Exception {
persistResource(
newDomainBase(getUniqueIdFromCommand())
@ -909,7 +900,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(thrown).hasMessageThat().contains("serverDeleteProhibited");
}
@Test
@TestOfyAndSql
void testFailure_pendingDelete() throws Exception {
persistResource(
newDomainBase(getUniqueIdFromCommand())
@ -921,7 +912,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@Test
@TestOfyAndSql
void testSuccess_metadata() throws Exception {
eppRequestSource = EppRequestSource.TOOL;
setEppInput("domain_delete_metadata.xml");
@ -944,7 +935,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
.hasMetadataRequestedByRegistrar(false);
}
@Test
@TestOfyAndSql
void testFailure_metadataNotFromTool() throws Exception {
setEppInput("domain_delete_metadata.xml");
persistResource(newDomainBase(getUniqueIdFromCommand()));
@ -952,7 +943,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@TestOfyAndSql
void testIcannActivityReportField_getsLogged() throws Exception {
setUpSuccessfulTest();
clock.advanceOneMilli();
@ -961,7 +952,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertTldsFieldLogged("tld");
}
@Test
@TestOfyAndSql
void testIcannTransactionRecord_testTld_notStored() throws Exception {
setUpSuccessfulTest();
setUpGracePeriodDurations();
@ -984,7 +975,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertThat(persistedEntry.getDomainTransactionRecords()).isEmpty();
}
@Test
@TestOfyAndSql
void testIcannTransactionRecord_noGrace_entryOutsideMaxGracePeriod() throws Exception {
setUpSuccessfulTest();
setUpGracePeriodDurations();
@ -1009,7 +1000,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
"tld", clock.nowUtc().plusHours(3), DELETED_DOMAINS_NOGRACE, 1));
}
@Test
@TestOfyAndSql
void testIcannTransactionRecord_noGrace_noAddOrRenewRecords() throws Exception {
setUpSuccessfulTest();
setUpGracePeriodDurations();
@ -1036,7 +1027,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
}
/** Verifies that if there's no add grace period, we still cancel out valid renew records */
@Test
@TestOfyAndSql
void testIcannTransactionRecord_noGrace_hasRenewRecord() throws Exception {
setUpSuccessfulTest();
setUpGracePeriodDurations();
@ -1064,7 +1055,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
renewRecord.asBuilder().setReportAmount(-1).build());
}
@Test
@TestOfyAndSql
void testIcannTransactionRecord_inGrace_noRecords() throws Exception {
setUpSuccessfulTest();
setUpGracePeriods(
@ -1091,7 +1082,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
DomainTransactionRecord.create("tld", clock.nowUtc(), DELETED_DOMAINS_GRACE, 1));
}
@Test
@TestOfyAndSql
void testIcannTransactionRecord_inGrace_multipleRecords() throws Exception {
setUpSuccessfulTest();
setUpGracePeriods(
@ -1134,7 +1125,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
existingRecord.asBuilder().setReportAmount(-1).build());
}
@Test
@TestOfyAndSql
void testSuccess_superuserExtension_nonZeroDayGrace_nonZeroDayPendingDelete() throws Exception {
eppRequestSource = EppRequestSource.TOOL;
setEppInput(
@ -1162,7 +1153,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertDeletionPollMessageFor(resource, "Deleted by registry administrator.");
}
@Test
@TestOfyAndSql
void testSuccess_superuserExtension_zeroDayGrace_nonZeroDayPendingDelete() throws Exception {
eppRequestSource = EppRequestSource.TOOL;
setEppInput(
@ -1182,7 +1173,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertDeletionPollMessageFor(resource, "Deleted by registry administrator.");
}
@Test
@TestOfyAndSql
void testSuccess_superuserExtension_nonZeroDayGrace_zeroDayPendingDelete() throws Exception {
eppRequestSource = EppRequestSource.TOOL;
setEppInput(
@ -1210,7 +1201,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
assertDeletionPollMessageFor(resource, "Deleted by registry administrator.");
}
@Test
@TestOfyAndSql
void testSuccess_superuserExtension_zeroDayGrace_zeroDayPendingDelete() throws Exception {
eppRequestSource = EppRequestSource.TOOL;
setEppInput(
@ -1221,11 +1212,11 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("generic_success_response.xml"));
assertThat(reloadResourceByForeignKey()).isNull();
DomainBase resavedDomain = ofy().load().entity(domain).now();
DomainBase resavedDomain = loadByEntity(domain);
assertDeletionPollMessageFor(resavedDomain, "Deleted by registry administrator.");
}
@Test
@TestOfyAndSql
void testSuccess_immediateDelete_withSuperuserAndMetadataExtension() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
eppRequestSource = EppRequestSource.TOOL;
@ -1238,10 +1229,10 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("generic_success_response.xml"));
assertThat(reloadResourceByForeignKey()).isNull();
assertDeletionPollMessageFor(
ofy().load().entity(domain).now(), "Deleted by registry administrator: Broke world.");
loadByEntity(domain), "Deleted by registry administrator: Broke world.");
}
@Test
@TestOfyAndSql
void testFailure_allocationTokenNotSupportedOnDelete() {
setEppInput("domain_delete_allocationtoken.xml");
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);

View file

@ -16,7 +16,6 @@ package google.registry.keyring.kms;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import com.googlecode.objectify.Key;
@ -24,6 +23,7 @@ import google.registry.keyring.api.KeySerializer;
import google.registry.model.server.KmsSecret;
import google.registry.model.server.KmsSecretRevision;
import google.registry.model.server.KmsSecretRevisionSqlDao;
import google.registry.persistence.VKey;
import google.registry.privileges.secretmanager.FakeSecretManagerClient;
import google.registry.privileges.secretmanager.KeyringSecretStore;
import google.registry.testing.AppEngineExtension;
@ -208,9 +208,12 @@ public class KmsUpdaterTest {
KmsSecretRevision secretRevision;
if (tm().isOfy()) {
KmsSecret secret =
ofy().load().key(Key.create(getCrossTldKey(), KmsSecret.class, secretName)).now();
tm().loadByKey(
VKey.createOfy(
KmsSecret.class, Key.create(getCrossTldKey(), KmsSecret.class, secretName)));
assertThat(secret).isNotNull();
secretRevision = ofy().load().key(secret.getLatestRevision()).now();
secretRevision =
tm().loadByKey(VKey.createOfy(KmsSecretRevision.class, secret.getLatestRevision()));
} else {
secretRevision =
tm().transact(() -> KmsSecretRevisionSqlDao.getLatestRevision(secretName).get());

View file

@ -15,7 +15,7 @@
package google.registry.model.server;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm;
import static google.registry.testing.DatabaseHelper.persistResource;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -63,6 +63,6 @@ public class KmsSecretRevisionTest {
@Test
void testPersistence() {
assertThat(ofy().load().entity(secretRevision).now()).isEqualTo(secretRevision);
assertThat(ofyTm().loadByEntity(secretRevision)).isEqualTo(secretRevision);
}
}

View file

@ -15,7 +15,7 @@
package google.registry.model.server;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm;
import static google.registry.testing.DatabaseHelper.persistResource;
import google.registry.testing.AppEngineExtension;
@ -47,6 +47,6 @@ public class KmsSecretTest {
@Test
void testPersistence() {
assertThat(ofy().load().entity(secret).now()).isEqualTo(secret);
assertThat(ofyTm().loadByEntity(secret)).isEqualTo(secret);
}
}

View file

@ -15,9 +15,9 @@
package google.registry.ui.server.registrar;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatabaseHelper.createTlds;
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
import static google.registry.testing.DatabaseHelper.loadByEntity;
import static google.registry.testing.DatabaseHelper.newDomainBase;
import static google.registry.testing.DatabaseHelper.persistActiveHost;
import static google.registry.testing.DatabaseHelper.persistResource;
@ -301,7 +301,7 @@ final class RegistryLockVerifyActionTest {
}
private DomainBase reloadDomain() {
return ofy().load().entity(domain).now();
return loadByEntity(domain);
}
private void assertNoDomainChanges() {

View file

@ -261,7 +261,7 @@ td.section {
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2021-04-19 23:14:22.344615</td>
<td class="property_value">2021-04-21 21:56:39.575987</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
@ -284,7 +284,7 @@ td.section {
generated on
</text>
<text text-anchor="start" x="4027.94" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
2021-04-19 23:14:22.344615
2021-04-21 21:56:39.575987
</text>
<polygon fill="none" stroke="#888888" points="3940.44,-4 3940.44,-44 4205.44,-44 4205.44,-4 3940.44,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">

View file

@ -261,7 +261,7 @@ td.section {
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2021-04-19 23:14:20.274596</td>
<td class="property_value">2021-04-21 21:56:37.513728</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
@ -284,7 +284,7 @@ td.section {
generated on
</text>
<text text-anchor="start" x="4656.52" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
2021-04-19 23:14:20.274596
2021-04-21 21:56:37.513728
</text>
<polygon fill="none" stroke="#888888" points="4569.02,-4 4569.02,-44 4834.02,-44 4834.02,-4 4569.02,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">