mv com/google/domain/registry google/registry

This change renames directories in preparation for the great package
rename. The repository is now in a broken state because the code
itself hasn't been updated. However this should ensure that git
correctly preserves history for each file.
This commit is contained in:
Justine Tunney 2016-05-13 18:55:08 -04:00
parent a41677aea1
commit 5012893c1d
2396 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,262 @@
// 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 com.google.domain.registry.whois;
import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.util.DateTimeUtils.END_OF_TIME;
import static com.google.domain.registry.whois.WhoisHelper.loadWhoisTestFile;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.domain.registry.model.contact.ContactAddress;
import com.google.domain.registry.model.contact.ContactPhoneNumber;
import com.google.domain.registry.model.contact.ContactResource;
import com.google.domain.registry.model.contact.PostalInfo;
import com.google.domain.registry.model.domain.DesignatedContact;
import com.google.domain.registry.model.domain.DomainResource;
import com.google.domain.registry.model.domain.GracePeriod;
import com.google.domain.registry.model.domain.ReferenceUnion;
import com.google.domain.registry.model.domain.rgp.GracePeriodStatus;
import com.google.domain.registry.model.domain.secdns.DelegationSignerData;
import com.google.domain.registry.model.eppcommon.StatusValue;
import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.googlecode.objectify.Ref;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link DomainWhoisResponse}. */
@RunWith(JUnit4.class)
public class DomainWhoisResponseTest {
@Rule
public final AppEngineRule gae = AppEngineRule.builder()
.withDatastore()
.build();
HostResource hostResource1;
HostResource hostResource2;
ContactResource registrant;
ContactResource adminContact;
ContactResource techContact;
DomainResource domainResource;
private final FakeClock clock = new FakeClock(DateTime.parse("2009-05-29T20:15:00Z"));
@Before
public void setUp() {
// Update the registrar to have an IANA ID.
persistResource(
Registrar.loadByClientId("NewRegistrar").asBuilder().setIanaIdentifier(5555555L).build());
createTld("tld");
hostResource1 = persistResource(new HostResource.Builder()
.setFullyQualifiedHostName("NS01.EXAMPLEREGISTRAR.tld")
.setRepoId("1-TLD")
.build());
hostResource2 = persistResource(new HostResource.Builder()
.setFullyQualifiedHostName("NS02.EXAMPLEREGISTRAR.tld")
.setRepoId("2-TLD")
.build());
registrant = persistResource(new ContactResource.Builder()
.setContactId("5372808-ERL")
.setRepoId("4-TLD")
.setLocalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.LOCALIZED)
.setName("SHOULD NOT BE USED")
.setOrg("SHOULD NOT BE USED")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setInternationalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.INTERNATIONALIZED)
.setName("EXAMPLE REGISTRANT")
.setOrg("EXAMPLE ORGANIZATION")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setVoiceNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.5555551212")
.setExtension("1234")
.build())
.setFaxNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.5555551213")
.setExtension("4321")
.build())
.setEmailAddress("EMAIL@EXAMPLE.tld")
.build());
adminContact = persistResource(new ContactResource.Builder()
.setContactId("5372809-ERL")
.setRepoId("5-TLD")
.setLocalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.LOCALIZED)
.setName("SHOULD NOT BE USED")
.setOrg("SHOULD NOT BE USED")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setInternationalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.INTERNATIONALIZED)
.setName("EXAMPLE REGISTRANT ADMINISTRATIVE")
.setOrg("EXAMPLE REGISTRANT ORGANIZATION")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setVoiceNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.5555551212")
.setExtension("1234")
.build())
.setFaxNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.5555551213")
.build())
.setEmailAddress("EMAIL@EXAMPLE.tld")
.build());
techContact = persistResource(new ContactResource.Builder()
.setContactId("5372811-ERL")
.setRepoId("6-TLD")
.setLocalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.LOCALIZED)
.setName("SHOULD NOT BE USED")
.setOrg("SHOULD NOT BE USED")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setInternationalizedPostalInfo(
new PostalInfo.Builder()
.setType(PostalInfo.Type.INTERNATIONALIZED)
.setName("EXAMPLE REGISTRAR TECHNICAL")
.setOrg("EXAMPLE REGISTRAR LLC")
.setAddress(new ContactAddress.Builder()
.setStreet(ImmutableList.of("123 EXAMPLE STREET"))
.setCity("ANYTOWN")
.setState("AP")
.setZip("A1A1A1")
.setCountryCode("EX")
.build())
.build())
.setVoiceNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.1235551234")
.setExtension("1234")
.build())
.setFaxNumber(
new ContactPhoneNumber.Builder()
.setPhoneNumber("+1.5555551213")
.setExtension("93")
.build())
.setEmailAddress("EMAIL@EXAMPLE.tld")
.build());
Ref<HostResource> hostResource1Ref = Ref.create(hostResource1);
Ref<HostResource> hostResource2Ref = Ref.create(hostResource2);
Ref<ContactResource> registrantResourceRef = Ref.create(registrant);
Ref<ContactResource> adminResourceRef = Ref.create(adminContact);
Ref<ContactResource> techResourceRef = Ref.create(techContact);
domainResource = persistResource(new DomainResource.Builder()
.setFullyQualifiedDomainName("EXAMPLE.tld")
.setRepoId("3-TLD")
.setLastEppUpdateTime(DateTime.parse("2009-05-29T20:13:00Z"))
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"))
.setRegistrationExpirationTime(DateTime.parse("2010-10-08T00:44:59Z"))
.setCurrentSponsorClientId("NewRegistrar")
.setStatusValues(ImmutableSet.of(
StatusValue.CLIENT_DELETE_PROHIBITED,
StatusValue.CLIENT_RENEW_PROHIBITED,
StatusValue.CLIENT_TRANSFER_PROHIBITED,
StatusValue.SERVER_UPDATE_PROHIBITED))
.setRegistrant(ReferenceUnion.create(registrantResourceRef))
.setContacts(ImmutableSet.of(
DesignatedContact.create(
DesignatedContact.Type.ADMIN,
ReferenceUnion.create(adminResourceRef)),
DesignatedContact.create(
DesignatedContact.Type.TECH,
ReferenceUnion.create(techResourceRef))))
.setNameservers(ImmutableSet.of(
ReferenceUnion.create(hostResource1Ref),
ReferenceUnion.create(hostResource2Ref)))
.setDsData(ImmutableSet.of(new DelegationSignerData()))
.setGracePeriods(ImmutableSet.of(
GracePeriod.create(GracePeriodStatus.ADD, END_OF_TIME, "", null),
GracePeriod.create(GracePeriodStatus.TRANSFER, END_OF_TIME, "", null)))
.build());
}
@Test
public void getPlainTextOutputTest() {
DomainWhoisResponse domainWhoisResponse =
new DomainWhoisResponse(domainResource, clock.nowUtc());
assertThat(domainWhoisResponse.getPlainTextOutput(false))
.isEqualTo(loadWhoisTestFile("whois_domain.txt"));
}
@Test
public void addImplicitOkStatusTest() {
DomainWhoisResponse domainWhoisResponse = new DomainWhoisResponse(
domainResource.asBuilder().setStatusValues(null).build(),
clock.nowUtc());
assertThat(domainWhoisResponse.getPlainTextOutput(false)).contains("Domain Status: ok");
}
}