mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 18:26:12 +02:00
This also deletes the associated commands and domain application specific entities. We haven't used any of these TLD phases since early 2015 and have no intent to do so in the future, so it makes sense to delete them now so we don't have to carry them through the Registry 3.0 migration. Note that, while there are data model changes, there should be no required data migrations. The fields and entities being removed will simply remain as orphans. I confirmed that the removed types (such as the SUNRUSH_ADD GracePeriodType) are no longer used in production data, and left types that are still used, e.g. BillingEvent.Flag.LANDRUSH or HistoryEntry.Type.ALLOCATE. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228752843
227 lines
7 KiB
Java
227 lines
7 KiB
Java
// Copyright 2017 The Nomulus 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 static google.registry.testing.DatastoreHelper.persistActiveContact;
|
|
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
|
|
|
import google.registry.model.ResourceCommandTestCase;
|
|
import google.registry.model.eppinput.EppInput;
|
|
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
|
|
import google.registry.model.eppinput.ResourceCommand;
|
|
import google.registry.testing.EppLoader;
|
|
import org.junit.Test;
|
|
|
|
/** Tests for DomainCommand. */
|
|
public class DomainCommandTest extends ResourceCommandTestCase {
|
|
|
|
@Test
|
|
public void testCreate() throws Exception {
|
|
doXmlRoundtripTest("domain_create.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_sunriseSignedMark() throws Exception {
|
|
doXmlRoundtripTest("domain_create_sunrise_signed_mark.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_sunriseCode() throws Exception {
|
|
doXmlRoundtripTest("domain_create_sunrise_code.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_sunriseMark() throws Exception {
|
|
doXmlRoundtripTest("domain_create_sunrise_mark.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_sunriseCodeWithMark() throws Exception {
|
|
doXmlRoundtripTest("domain_create_sunrise_code_with_mark.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_sunriseEncodedSignedMark() throws Exception {
|
|
doXmlRoundtripTest("domain_create_sunrise_encoded_signed_mark.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_fee() throws Exception {
|
|
doXmlRoundtripTest("domain_create_fee.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_emptyCommand() throws Exception {
|
|
// This EPP command wouldn't be allowed for policy reasons, but should marshal/unmarshal fine.
|
|
doXmlRoundtripTest("domain_create_empty.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_missingNonRegistrantContacts() throws Exception {
|
|
// This EPP command wouldn't be allowed for policy reasons, but should marshal/unmarshal fine.
|
|
doXmlRoundtripTest("domain_create_missing_non_registrant_contacts.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_cloneAndLinkReferences() throws Exception {
|
|
persistActiveHost("ns1.example.net");
|
|
persistActiveHost("ns2.example.net");
|
|
persistActiveContact("sh8013");
|
|
persistActiveContact("jd1234");
|
|
DomainCommand.Create create =
|
|
(DomainCommand.Create) loadEppResourceCommand("domain_create.xml");
|
|
create.cloneAndLinkReferences(clock.nowUtc());
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_emptyCommand_cloneAndLinkReferences() throws Exception {
|
|
// This EPP command wouldn't be allowed for policy reasons, but should clone-and-link fine.
|
|
DomainCommand.Create create =
|
|
(DomainCommand.Create) loadEppResourceCommand("domain_create_empty.xml");
|
|
create.cloneAndLinkReferences(clock.nowUtc());
|
|
}
|
|
|
|
@Test
|
|
public void testCreate_missingNonRegistrantContacts_cloneAndLinkReferences() throws Exception {
|
|
persistActiveContact("jd1234");
|
|
// This EPP command wouldn't be allowed for policy reasons, but should clone-and-link fine.
|
|
DomainCommand.Create create =
|
|
(DomainCommand.Create)
|
|
loadEppResourceCommand("domain_create_missing_non_registrant_contacts.xml");
|
|
create.cloneAndLinkReferences(clock.nowUtc());
|
|
}
|
|
|
|
@Test
|
|
public void testDelete() throws Exception {
|
|
doXmlRoundtripTest("domain_delete.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate() throws Exception {
|
|
doXmlRoundtripTest("domain_update.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate_fee() throws Exception {
|
|
doXmlRoundtripTest("domain_update_fee.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate_emptyCommand() throws Exception {
|
|
// This EPP command wouldn't be allowed for policy reasons, but should marshal/unmarshal fine.
|
|
doXmlRoundtripTest("domain_update_empty.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate_cloneAndLinkReferences() throws Exception {
|
|
persistActiveHost("ns1.example.com");
|
|
persistActiveHost("ns2.example.com");
|
|
persistActiveContact("mak21");
|
|
persistActiveContact("sh8013");
|
|
DomainCommand.Update update =
|
|
(DomainCommand.Update) loadEppResourceCommand("domain_update.xml");
|
|
update.cloneAndLinkReferences(clock.nowUtc());
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate_emptyCommand_cloneAndLinkReferences() throws Exception {
|
|
// This EPP command wouldn't be allowed for policy reasons, but should clone-and-link fine.
|
|
DomainCommand.Update update =
|
|
(DomainCommand.Update) loadEppResourceCommand("domain_update_empty.xml");
|
|
update.cloneAndLinkReferences(clock.nowUtc());
|
|
}
|
|
|
|
@Test
|
|
public void testInfo() throws Exception {
|
|
doXmlRoundtripTest("domain_info.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testInfo_sunrise() throws Exception {
|
|
doXmlRoundtripTest("domain_info_sunrise.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testInfo_feeExtension() throws Exception {
|
|
doXmlRoundtripTest("domain_info_fee.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCheck() throws Exception {
|
|
doXmlRoundtripTest("domain_check.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCheck_avail() throws Exception {
|
|
doXmlRoundtripTest("domain_check_avail.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCheck_claims() throws Exception {
|
|
doXmlRoundtripTest("domain_check_claims.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testCheck_fee() throws Exception {
|
|
doXmlRoundtripTest("domain_check_fee.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferApprove() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_approve.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferReject() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_reject.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferCancel() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_cancel.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferQuery() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_query.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferRequest() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_request.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testTransferRequest_fee() throws Exception {
|
|
doXmlRoundtripTest("domain_transfer_request_fee.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testRenew() throws Exception {
|
|
doXmlRoundtripTest("domain_renew.xml");
|
|
}
|
|
|
|
@Test
|
|
public void testRenew_fee() throws Exception {
|
|
doXmlRoundtripTest("domain_renew_fee.xml");
|
|
}
|
|
|
|
/** Loads the EppInput from the given filename and returns its ResourceCommand element. */
|
|
private ResourceCommand loadEppResourceCommand(String filename) throws Exception {
|
|
EppInput eppInput = new EppLoader(this, filename).getEpp();
|
|
return ((ResourceCommandWrapper) eppInput.getCommandWrapper().getCommand())
|
|
.getResourceCommand();
|
|
}
|
|
}
|