mirror of
https://github.com/google/nomulus
synced 2026-09-02 14:17:12 +00:00
Convert DomainCreateFlow to use generic tm() methods (#1026)
Various necessary changes included as part of this: - Make ForeignKeyIndex completely generic. Previously, only the load() method that took a DateTime as input could use SQL, and the cached flow was particular to Objectify Keys. Now, the cached flow and the non-cached flow can use the same (ish) piece of code to load / create the relevant index objects before filtering or modifying them as necessary. - EntityChanges should use VKeys - FlowUtils should persist entity changes using tm(), however not all object types are storable in SQL. - Filling out PollMessage fields with the proper object type when loading from SQL - Changing a few tm() calls to ofyTm() calls when using objectify. This is because creating a read-only transaction in SQL is quite a footgun at the moment, because it makes the entire transaction you're in (if you were already in one) a read-only transaction.
This commit is contained in:
@@ -121,6 +121,10 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
||||
* Confirms that an EppResourceIndex entity exists in Datastore for a given resource.
|
||||
*/
|
||||
protected static <T extends EppResource> void assertEppResourceIndexEntityFor(final T resource) {
|
||||
if (!tm().isOfy()) {
|
||||
// Indices aren't explicitly stored as objects in SQL
|
||||
return;
|
||||
}
|
||||
ImmutableList<EppResourceIndex> indices =
|
||||
Streams.stream(
|
||||
ofy()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -137,7 +137,7 @@ public class TransactionManagerTest {
|
||||
assertThat(persisted).isEqualTo(theEntity);
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
@TestOfyOnly // read-only not implemented in SQL yet
|
||||
void transactNewReadOnly_throwsWhenWritingEntity() {
|
||||
assertEntityNotExist(theEntity);
|
||||
assertThrows(
|
||||
|
||||
Reference in New Issue
Block a user