Change @DoNotHydrate to work on fields, not types.

There was a circular reference when hydrating a domain with a
subordinate host, since the host references the domain. To fix
this, I redid @DoNotHydrate to be the way it should have been,
rather than the hack I had originally submitted. I also beefed
up the unit tests of the epp resource types to check for cycles.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135792416
This commit is contained in:
cgoldfeder 2016-10-11 07:05:26 -07:00 committed by Ben McIlwain
parent 27ec47051e
commit cb8320ff40
12 changed files with 151 additions and 118 deletions

View file

@ -110,17 +110,21 @@ public class ModelUtilsTest {
testInstance.id = "foo";
testInstance.a = "a";
testInstance.b = "b";
// More complicated version of isEqualTo() so that we check for ordering.
assertThat(ModelUtils.getFieldValues(testInstance).entrySet())
.containsExactlyElementsIn(ImmutableMap.of("id", "foo", "a", "a", "b", "b").entrySet())
assertThat(ModelUtils.getFieldValues(testInstance))
.containsExactly(
TestClass.class.getDeclaredField("id"), "foo",
TestClass.class.getDeclaredField("a"), "a",
TestClass.class.getDeclaredField("b"), "b")
.inOrder();
// Test again, to make sure we aren't caching values.
testInstance.id = "bar";
testInstance.a = "1";
testInstance.b = "2";
// More complicated version of isEqualTo() so that we check for ordering.
assertThat(ModelUtils.getFieldValues(testInstance).entrySet())
.containsExactlyElementsIn(ImmutableMap.of("id", "bar", "a", "1", "b", "2").entrySet())
assertThat(ModelUtils.getFieldValues(testInstance))
.containsExactly(
TestClass.class.getDeclaredField("id"), "bar",
TestClass.class.getDeclaredField("a"), "1",
TestClass.class.getDeclaredField("b"), "2")
.inOrder();
}