mirror of
https://github.com/google/nomulus.git
synced 2025-08-05 01:11:50 +02:00
Add extra flow logic hooks for info and update
This CL adds the hooks necessary to implement TLD-specific flow info and update flow logic. Usage of the hooks follows in a separate CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130108832
This commit is contained in:
parent
e55ed209c5
commit
0066a03709
18 changed files with 397 additions and 16 deletions
|
@ -17,6 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
|
@ -42,6 +43,7 @@ import google.registry.model.domain.DesignatedContact.Type;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
|
@ -67,9 +69,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
setEppInput("domain_info.xml");
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
|
||||
createTld("tld");
|
||||
createTlds("tld", "flags");
|
||||
persistResource(
|
||||
AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build());
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void persistTestEntities(String domainName, boolean inactive) {
|
||||
|
@ -613,4 +617,20 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
persistTestEntities(false);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
/** Test registry extra logic manager with no flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_noFlags() throws Exception {
|
||||
setEppInput("domain_info_flags_none.xml");
|
||||
persistTestEntities("domain.flags", false);
|
||||
doSuccessfulTest("domain_info_response_flags_none.xml", false);
|
||||
}
|
||||
|
||||
/** Test registry extra logic manager with two flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_twoFlags() throws Exception {
|
||||
setEppInput("domain_info_flags_two.xml");
|
||||
persistTestEntities("domain-flag1-flag2.flags", false);
|
||||
doSuccessfulTest("domain_info_response_flags_two.xml", false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
|||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
|
@ -37,10 +38,8 @@ import static org.joda.money.CurrencyUnit.USD;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.EppRequestSource;
|
||||
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
|
||||
|
@ -74,6 +73,7 @@ import google.registry.model.domain.DesignatedContact;
|
|||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -81,7 +81,6 @@ import google.registry.model.host.HostResource;
|
|||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Before;
|
||||
|
@ -105,7 +104,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
|
||||
@Before
|
||||
public void initDomainTest() {
|
||||
createTld("tld");
|
||||
createTlds("tld", "flags");
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void persistReferencedEntities() {
|
||||
|
@ -1176,4 +1177,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
thrown.expect(NameserversNotSpecifiedException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags() throws Exception {
|
||||
setEppInput("domain_update_addremove_flags.xml");
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(UnimplementedExtensionException.class);
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
11
javatests/google/registry/flows/domain/testdata/domain_info_flags_none.xml
vendored
Normal file
11
javatests/google/registry/flows/domain/testdata/domain_info_flags_none.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<info>
|
||||
<domain:info
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name hosts="all">domain.flags</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
11
javatests/google/registry/flows/domain/testdata/domain_info_flags_two.xml
vendored
Normal file
11
javatests/google/registry/flows/domain/testdata/domain_info_flags_two.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<info>
|
||||
<domain:info
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name hosts="all">domain-flag1-flag2.flags</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
38
javatests/google/registry/flows/domain/testdata/domain_info_response_flags_none.xml
vendored
Normal file
38
javatests/google/registry/flows/domain/testdata/domain_info_response_flags_none.xml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1000">
|
||||
<msg>Command completed successfully</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:infData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>domain.flags</domain:name>
|
||||
<domain:roid>%ROID%</domain:roid>
|
||||
<domain:status s="ok"/>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.tld</domain:hostObj>
|
||||
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:host>ns1.example.tld</domain:host>
|
||||
<domain:host>ns2.example.tld</domain:host>
|
||||
<domain:clID>NewRegistrar</domain:clID>
|
||||
<domain:crID>TheRegistrar</domain:crID>
|
||||
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
|
||||
<domain:upID>NewRegistrar</domain:upID>
|
||||
<domain:upDate>1999-12-03T09:00:00.0Z</domain:upDate>
|
||||
<domain:exDate>2005-04-03T22:00:00.0Z</domain:exDate>
|
||||
<domain:trDate>2000-04-08T09:00:00.0Z</domain:trDate>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:infData>
|
||||
</resData>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
44
javatests/google/registry/flows/domain/testdata/domain_info_response_flags_two.xml
vendored
Normal file
44
javatests/google/registry/flows/domain/testdata/domain_info_response_flags_two.xml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1000">
|
||||
<msg>Command completed successfully</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:infData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>domain-flag1-flag2.flags</domain:name>
|
||||
<domain:roid>%ROID%</domain:roid>
|
||||
<domain:status s="ok"/>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.tld</domain:hostObj>
|
||||
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:host>ns1.example.tld</domain:host>
|
||||
<domain:host>ns2.example.tld</domain:host>
|
||||
<domain:clID>NewRegistrar</domain:clID>
|
||||
<domain:crID>TheRegistrar</domain:crID>
|
||||
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
|
||||
<domain:upID>NewRegistrar</domain:upID>
|
||||
<domain:upDate>1999-12-03T09:00:00.0Z</domain:upDate>
|
||||
<domain:exDate>2005-04-03T22:00:00.0Z</domain:exDate>
|
||||
<domain:trDate>2000-04-08T09:00:00.0Z</domain:trDate>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:infData>
|
||||
</resData>
|
||||
<extension>
|
||||
<flags:infData xmlns:flags="urn:google:params:xml:ns:flags-0.1">
|
||||
<flags:flag>flag1</flags:flag>
|
||||
<flags:flag>flag2</flags:flag>
|
||||
</flags:infData>
|
||||
</extension>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
23
javatests/google/registry/flows/domain/testdata/domain_update_addremove_flags.xml
vendored
Normal file
23
javatests/google/registry/flows/domain/testdata/domain_update_addremove_flags.xml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.flags</domain:name>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<flags:update xmlns:flags="urn:google:params:xml:ns:flags-0.1">
|
||||
<flags:add>
|
||||
<flags:flag>flag1</flags:flag>
|
||||
<flags:flag>flag2</flags:flag>
|
||||
</flags:add>
|
||||
<flags:rem>
|
||||
<flags:flag>flag3</flags:flag>
|
||||
<flags:flag>flag4</flags:flag>
|
||||
</flags:rem>
|
||||
</flags:update>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue