Relax uniqueness constraint on ROID suffixes

The command still enforces uniqueness (which is fine), but by changing the cache
from a BiMap to a Map, we can support non-unique suffixes if they happen to be
configured as data. The only reason the cache was ever a BiMap in the first
place was to support the Registry 2.0 migration, which was finished a year and a
half ago. It's only being read one way now, so a Map is fine.

See https://github.com/google/nomulus/pull/53 for context.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144381946
This commit is contained in:
mcilwain 2017-01-12 15:51:02 -08:00 committed by Ben McIlwain
parent 66a02856c4
commit f7e84b56a0
2 changed files with 22 additions and 16 deletions

View file

@ -39,4 +39,12 @@ public class RoidSuffixesTest {
persistResource(newRegistry("tld", "MEOW"));
assertThat(getRoidSuffixForTld("tld")).isEqualTo("MEOW");
}
@Test
public void test_allowDupeRoidSuffixes() {
persistResource(newRegistry("tld", "MEOW"));
persistResource(newRegistry("example", "MEOW"));
assertThat(getRoidSuffixForTld("tld")).isEqualTo("MEOW");
assertThat(getRoidSuffixForTld("example")).isEqualTo("MEOW");
}
}