mirror of
https://github.com/google/nomulus.git
synced 2025-08-03 08:22:13 +02:00
Add a test for Registrar.loadByClientId not being enrolled in a transaction
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154470388
This commit is contained in:
parent
8025c7547b
commit
d4d02f8977
1 changed files with 19 additions and 0 deletions
|
@ -30,6 +30,8 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.common.EntityGroupRoot;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
|
@ -375,4 +377,21 @@ public class RegistrarTest extends EntityTestCase {
|
|||
thrown.expect(IllegalArgumentException.class);
|
||||
new Registrar.Builder().setPhonePasscode("code1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadByClientId_isTransactionless() {
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
assertThat(Registrar.loadByClientId("registrar")).isNotNull();
|
||||
// Load something as a control to make sure we are seeing loaded keys in the session cache.
|
||||
ofy().load().entity(abuseAdminContact).now();
|
||||
assertThat(ofy().getSessionKeys()).contains(Key.create(abuseAdminContact));
|
||||
assertThat(ofy().getSessionKeys()).doesNotContain(Key.create(registrar));
|
||||
}});
|
||||
ofy().clearSessionCache();
|
||||
// Conversely, loads outside of a transaction should end up in the session cache.
|
||||
assertThat(Registrar.loadByClientId("registrar")).isNotNull();
|
||||
assertThat(ofy().getSessionKeys()).contains(Key.create(registrar));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue