diff --git a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java index f9d068f90..4415ffaaa 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java @@ -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()) diff --git a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java index 809b5e83c..e5d8f0b35 100644 --- a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java @@ -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)); diff --git a/core/src/test/java/google/registry/flows/EppLifecycleContactTest.java b/core/src/test/java/google/registry/flows/EppLifecycleContactTest.java index 1a8172e7f..c825f90b0 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleContactTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleContactTest.java @@ -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") diff --git a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java index e6f92819e..c8318166e 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java @@ -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 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 diff --git a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java index 6898577d7..c82cd38fe 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java @@ -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"); diff --git a/core/src/test/java/google/registry/flows/EppTestCase.java b/core/src/test/java/google/registry/flows/EppTestCase.java index 38cad6d36..2964fdb46 100644 --- a/core/src/test/java/google/registry/flows/EppTestCase.java +++ b/core/src/test/java/google/registry/flows/EppTestCase.java @@ -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 findKeyToActualOneTimeBillingEvent(OneTime expectedBillingEvent) { Optional 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()); } } diff --git a/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java index 6cadf91cd..ae47ddd44 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java @@ -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 { @Order(value = Order.DEFAULT - 2) @@ -286,7 +290,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase KmsSecretRevisionSqlDao.getLatestRevision(secretName).get()); diff --git a/core/src/test/java/google/registry/model/server/KmsSecretRevisionTest.java b/core/src/test/java/google/registry/model/server/KmsSecretRevisionTest.java index 76f841463..da46fadf6 100644 --- a/core/src/test/java/google/registry/model/server/KmsSecretRevisionTest.java +++ b/core/src/test/java/google/registry/model/server/KmsSecretRevisionTest.java @@ -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); } } diff --git a/core/src/test/java/google/registry/model/server/KmsSecretTest.java b/core/src/test/java/google/registry/model/server/KmsSecretTest.java index c658fca76..49c2e1052 100644 --- a/core/src/test/java/google/registry/model/server/KmsSecretTest.java +++ b/core/src/test/java/google/registry/model/server/KmsSecretTest.java @@ -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); } } diff --git a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java index 6de3ee300..d6140c408 100644 --- a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java +++ b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java @@ -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() { diff --git a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html index b2c9ed0ec..dd81c2737 100644 --- a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html @@ -261,7 +261,7 @@ td.section { generated on - 2021-04-19 23:14:22.344615 + 2021-04-21 21:56:39.575987 last flyway file @@ -284,7 +284,7 @@ td.section { generated on - 2021-04-19 23:14:22.344615 + 2021-04-21 21:56:39.575987 diff --git a/db/src/main/resources/sql/er_diagram/full_er_diagram.html b/db/src/main/resources/sql/er_diagram/full_er_diagram.html index 76c590ac4..7c0f0fb83 100644 --- a/db/src/main/resources/sql/er_diagram/full_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/full_er_diagram.html @@ -261,7 +261,7 @@ td.section { generated on - 2021-04-19 23:14:20.274596 + 2021-04-21 21:56:37.513728 last flyway file @@ -284,7 +284,7 @@ td.section { generated on - 2021-04-19 23:14:20.274596 + 2021-04-21 21:56:37.513728