Make name and address fields required on Registrar

The absence of these fields causes RDE failures, so they are in effect
required on any functioning registry system. We are currently
experiencing problems in sandbox caused by null values on these fields.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155474895
This commit is contained in:
mcilwain 2017-05-09 00:27:41 -07:00 committed by Ben McIlwain
parent 5313ca58d6
commit ef1487cb57
18 changed files with 460 additions and 272 deletions

View file

@ -16,6 +16,7 @@ package google.registry.model.ofy;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.initOfy;
import static google.registry.testing.DatastoreHelper.newContactResource;
import static org.junit.Assert.fail;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
@ -26,8 +27,7 @@ import com.googlecode.objectify.ObjectifyFilter;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import google.registry.model.registrar.Registrar;
import google.registry.model.registrar.Registrar.Type;
import google.registry.model.contact.ContactResource;
import google.registry.testing.ExceptionRule;
import org.junit.After;
import org.junit.Before;
@ -93,9 +93,8 @@ public class OfyFilterTest {
@Test
public void testKeyCreateAfterFilter() throws Exception {
new OfyFilter().init(null);
Registrar registrar =
new Registrar.Builder().setType(Type.TEST).setClientId("clientId").build();
Key.create(registrar);
ContactResource contact = newContactResource("contact1234");
Key.create(contact);
}
@Entity

View file

@ -314,8 +314,26 @@ public class RegistrarTest extends EntityTestCase {
@Test
public void testFailure_missingRegistrarType() throws Exception {
thrown.expect(NullPointerException.class);
new Registrar.Builder().build();
thrown.expect(IllegalArgumentException.class, "Registrar type cannot be null");
new Registrar.Builder().setRegistrarName("blah").build();
}
@Test
public void testFailure_missingRegistrarName() throws Exception {
thrown.expect(IllegalArgumentException.class, "Registrar name cannot be null");
new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build();
}
@Test
public void testFailure_missingAddress() throws Exception {
thrown.expect(
IllegalArgumentException.class,
"Must specify at least one of localized or internationalized address");
new Registrar.Builder()
.setClientId("blahid")
.setType(Registrar.Type.TEST)
.setRegistrarName("Blah Co")
.build();
}
@Test