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:
mountford 2016-08-12 09:41:48 -07:00 committed by Ben McIlwain
parent e55ed209c5
commit 0066a03709
18 changed files with 397 additions and 16 deletions

View file

@ -27,8 +27,8 @@ import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAll
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException;
import google.registry.flows.EppException.ParameterValuePolicyErrorException;
import google.registry.flows.EppException.RequiredParameterMissingException;
@ -41,7 +41,6 @@ import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.domain.secdns.SecDnsUpdateExtension;
import google.registry.model.domain.secdns.SecDnsUpdateExtension.Add;
import google.registry.model.domain.secdns.SecDnsUpdateExtension.Remove;
import java.util.Set;
/**
@ -53,10 +52,18 @@ import java.util.Set;
public abstract class BaseDomainUpdateFlow<R extends DomainBase, B extends Builder<R, B>>
extends ResourceUpdateFlow<R, B, Update> {
protected Optional<RegistryExtraFlowLogic> extraFlowLogic;
@Override
public final void initResourceCreateOrMutateFlow() throws EppException {
command = cloneAndLinkReferences(command, now);
initDomainUpdateFlow();
// In certain conditions (for instance, errors), there is no existing resource.
if (existingResource == null) {
extraFlowLogic = Optional.absent();
} else {
extraFlowLogic = RegistryExtraFlowLogicProxy.newInstanceForTld(existingResource.getTld());
}
}
@SuppressWarnings("unused")
@ -98,8 +105,13 @@ public abstract class BaseDomainUpdateFlow<R extends DomainBase, B extends Build
return setDomainUpdateProperties(builder);
}
/** Subclasses can override this to do set more specific properties. */
protected B setDomainUpdateProperties(B builder) {
/**
* Subclasses can override this to do set more specific properties.
*
* @throws EppException if the overriding method encounters an error that should be returned to
* the user as an EPP response
*/
protected B setDomainUpdateProperties(B builder) throws EppException {
return builder;
}

View file

@ -324,7 +324,7 @@ public class DomainFlowUtils {
throws RegistrantNotAllowedException {
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedRegistrantContactIds();
// Empty whitelist or null registrantContactId are ignored.
if (registrantContactId != null && !whitelist.isEmpty()
if (registrantContactId != null && !whitelist.isEmpty()
&& !whitelist.contains(registrantContactId)) {
throw new RegistrantNotAllowedException(registrantContactId);
}
@ -576,7 +576,7 @@ public class DomainFlowUtils {
if (feeRequest.getPhase() != null || feeRequest.getSubphase() != null) {
throw new FeeChecksDontSupportPhasesException();
}
CurrencyUnit currency =
feeRequest.isCurrencySupported() ? feeRequest.getCurrency() : topLevelCurrency;
if ((currency != null) && !currency.equals(registry.getCurrency())) {
@ -620,7 +620,7 @@ public class DomainFlowUtils {
}
}
static void validateFeeChallenge(
public static void validateFeeChallenge(
String domainName,
String tld,
DateTime priceTime,
@ -664,7 +664,7 @@ public class DomainFlowUtils {
throw new CurrencyUnitMismatchException();
}
if (!feeTotal.equals(costTotal)) {
throw new FeesMismatchException();
throw new FeesMismatchException(costTotal);
}
}
@ -988,10 +988,16 @@ public class DomainFlowUtils {
}
/** The fees passed in the transform command do not match the fees that will be charged. */
static class FeesMismatchException extends ParameterValueRangeErrorException {
public static class FeesMismatchException extends ParameterValueRangeErrorException {
public FeesMismatchException() {
super("The fees passed in the transform command do not match the fees that will be charged");
}
public FeesMismatchException(Money correctFee) {
super(String.format(
"The fees passed in the transform command do not match the expected total of %s",
correctFee));
}
}
/** Registrar is not authorized to access this TLD. */

View file

@ -16,6 +16,7 @@ package google.registry.flows.domain;
import static google.registry.flows.domain.DomainFlowUtils.handleFeeRequest;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException;
@ -23,9 +24,11 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.DomainResource.Builder;
import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06;
import google.registry.model.domain.fee06.FeeInfoResponseExtensionV06;
import google.registry.model.domain.flags.FlagsInfoResponseExtension;
import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.rgp.RgpInfoExtension;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import java.util.List;
import javax.inject.Inject;
/**
@ -100,6 +103,17 @@ public class DomainInfoFlow extends BaseDomainInfoFlow<DomainResource, Builder>
now);
extensions.add(builder.build());
}
// If the TLD uses the flags extension, add it to the info response.
Optional<RegistryExtraFlowLogic> extraLogicManager =
RegistryExtraFlowLogicProxy.newInstanceForTld(existingResource.getTld());
if (extraLogicManager.isPresent()) {
List<String> flags = extraLogicManager.get().getFlags(
existingResource, this.getClientId(), now); // As-of date is always now for info commands.
if (!flags.isEmpty()) {
extensions.add(FlagsInfoResponseExtension.create(flags));
}
}
return extensions.build();
}
}

View file

@ -22,11 +22,13 @@ import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import google.registry.dns.DnsQueue;
import google.registry.flows.EppException;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.DomainResource.Builder;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.flags.FlagsUpdateCommandExtension;
import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.secdns.SecDnsUpdateExtension;
import google.registry.model.eppcommon.StatusValue;
@ -70,11 +72,11 @@ public class DomainUpdateFlow extends BaseDomainUpdateFlow<DomainResource, Build
@Override
protected void initDomainUpdateFlow() {
registerExtensions(SecDnsUpdateExtension.class);
registerExtensions(SecDnsUpdateExtension.class, FlagsUpdateCommandExtension.class);
}
@Override
protected Builder setDomainUpdateProperties(Builder builder) {
protected Builder setDomainUpdateProperties(Builder builder) throws EppException {
// Check if the domain is currently in the sunrush add grace period.
Optional<GracePeriod> sunrushAddGracePeriod = Iterables.tryFind(
existingResource.getGracePeriods(),
@ -127,6 +129,11 @@ public class DomainUpdateFlow extends BaseDomainUpdateFlow<DomainResource, Build
ofy().save().entities(billingEvent, billingEventCancellation);
}
// Handle extra flow logic, if any.
if (extraFlowLogic.isPresent()) {
extraFlowLogic.get().performAdditionalDomainUpdateLogic(
existingResource, getClientId(), now, eppInput);
}
return builder;
}
@ -154,6 +161,10 @@ public class DomainUpdateFlow extends BaseDomainUpdateFlow<DomainResource, Build
ofy().save().entity(billingEvent);
}
}
if (extraFlowLogic.isPresent()) {
extraFlowLogic.get().commitAdditionalDomainUpdates();
}
}
@Override

View file

@ -0,0 +1,45 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.flows.domain;
import google.registry.flows.EppException;
import google.registry.model.domain.DomainResource;
import google.registry.model.eppinput.EppInput;
import java.util.List;
import org.joda.time.DateTime;
/**
* Interface for classes which provide extra registry logic for things like TLD-specific rules and
* discounts.
*/
public interface RegistryExtraFlowLogic {
/** Get the flags to be passed to the client in the EPP flags extension. */
public List<String> getFlags(
DomainResource domainResource, String clientIdentifier, DateTime asOfDate);
/**
* Add and remove flags passed via the EPP flags extension. Any changes should not be persisted to
* Datastore until commitAdditionalDomainUpdates is called. Name suggested by Benjamin McIlwain.
*/
public void performAdditionalDomainUpdateLogic(
DomainResource domainResource,
String clientIdentifier,
DateTime asOfDate,
EppInput eppInput) throws EppException;
/** Commit any changes made as a result of a call to performAdditionalDomainUpdateLogic(). */
public void commitAdditionalDomainUpdates();
}

View file

@ -0,0 +1,49 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.flows.domain;
import com.google.common.base.Optional;
import google.registry.model.registry.Registry;
import java.util.HashMap;
/**
* Static class to return the correct {@link RegistryExtraFlowLogic} for a particular TLD.
* Eventually, this will probably be replaced with dependency injection, barring unforeseen
* complications.
*/
public class RegistryExtraFlowLogicProxy {
private static final HashMap<String, Class<? extends RegistryExtraFlowLogic>>
extraLogicOverrideMap = new HashMap<>();
public static void setOverride(
String tld, Class<? extends RegistryExtraFlowLogic> extraLogicClass) {
if (Registry.get(tld) == null) {
throw new IllegalArgumentException(tld + " does not exist");
}
extraLogicOverrideMap.put(tld, extraLogicClass);
}
public static Optional<RegistryExtraFlowLogic> newInstanceForTld(String tld) {
if (extraLogicOverrideMap.containsKey(tld)) {
try {
return Optional.<RegistryExtraFlowLogic>of(extraLogicOverrideMap.get(tld).newInstance());
} catch (InstantiationException | IllegalAccessException e) {
return Optional.absent();
}
}
return Optional.absent();
}
}

View file

@ -30,4 +30,10 @@ import javax.xml.bind.annotation.XmlRootElement;
public class FlagsInfoResponseExtension implements ResponseExtension {
@XmlElement(name = "flag")
List<String> flags;
public static FlagsInfoResponseExtension create(List<String> flags) {
FlagsInfoResponseExtension extension = new FlagsInfoResponseExtension();
extension.flags = flags;
return extension;
}
}

View file

@ -24,4 +24,8 @@ import javax.xml.bind.annotation.XmlElement;
public class FlagsList {
@XmlElement(name = "flag")
List<String> flags;
public List<String> getFlags() {
return flags;
}
}

View file

@ -30,4 +30,12 @@ import javax.xml.bind.annotation.XmlType;
public class FlagsUpdateCommandExtension implements CommandExtension {
FlagsList add; // list of flags to be added (turned on)
FlagsList rem; // list of flags to be removed (turned off)
public FlagsList getAddFlags() {
return add;
}
public FlagsList getRemoveFlags() {
return rem;
}
}

View file

@ -39,6 +39,7 @@ import google.registry.model.billing.BillingEvent;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.eppcommon.ProtocolDefinition;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppOutput;
import google.registry.model.ofy.Ofy;
import google.registry.model.poll.PollMessage;
@ -112,6 +113,11 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
eppLoader = new EppLoader(this, inputFilename, substitutions);
}
/** Returns the EPP data loaded by a previous call to setEppInput. */
protected EppInput getEppInput() throws Exception {
return eppLoader.getEpp();
}
protected String readFile(String filename) {
return readResourceUtf8(getClass(), "testdata/" + filename);
}

View file

@ -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);
}
}

View file

@ -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();
}
}

View 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>

View 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>

View 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>

View 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>

View 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>

View file

@ -0,0 +1,63 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import google.registry.flows.EppException;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.domain.RegistryExtraFlowLogic;
import google.registry.model.domain.flags.FlagsUpdateCommandExtension;
import google.registry.model.eppinput.EppInput;
import java.util.List;
import org.joda.time.DateTime;
/**
* Fake extra logic manager which synthesizes information from the domain name for testing purposes.
*/
public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override
public List<String> getFlags(
DomainResource domainResource, String clientIdentifier, DateTime asOfDate) {
// Take the part before the period, split by dashes, and treat each part after the first as
// a flag.
List<String> components =
Splitter.on('-').splitToList(
Iterables.getFirst(
Splitter.on('.').split(domainResource.getFullyQualifiedDomainName()), ""));
return components.subList(1, components.size());
}
@Override
public void performAdditionalDomainUpdateLogic(
DomainResource domainResource,
String clientIdentifier,
DateTime asOfDate,
EppInput eppInput) throws EppException {
FlagsUpdateCommandExtension updateFlags =
eppInput.getSingleExtension(FlagsUpdateCommandExtension.class);
if (updateFlags == null) {
return;
}
// Throw this exception as a signal to the test that we got this far.
throw new UnimplementedExtensionException();
}
@Override
public void commitAdditionalDomainUpdates() {
return;
}
}