diff --git a/core/src/main/java/google/registry/model/EntityYamlUtils.java b/core/src/main/java/google/registry/model/EntityYamlUtils.java index a08455ebf..cc2c360d4 100644 --- a/core/src/main/java/google/registry/model/EntityYamlUtils.java +++ b/core/src/main/java/google/registry/model/EntityYamlUtils.java @@ -19,10 +19,12 @@ import static com.google.common.collect.Ordering.natural; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; @@ -54,8 +56,10 @@ public class EntityYamlUtils { module.addSerializer(Money.class, new MoneySerializer()); module.addDeserializer(Money.class, new MoneyDeserializer()); ObjectMapper mapper = - new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER)) + JsonMapper.builder(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER)) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY) + .build() .registerModule(module); mapper.findAndRegisterModules(); return mapper; diff --git a/core/src/test/resources/google/registry/model/tld/tld.yaml b/core/src/test/resources/google/registry/model/tld/tld.yaml index 23419904d..f0e19104d 100644 --- a/core/src/test/resources/google/registry/model/tld/tld.yaml +++ b/core/src/test/resources/google/registry/model/tld/tld.yaml @@ -1,59 +1,26 @@ -tldStr: "tld" -roidSuffix: "TLD" -pricingEngineClassName: "google.registry.model.pricing.StaticPremiumListPricingEngine" -dnsWriters: -- "baz" -- "bang" -numDnsPublishLocks: 1 -dnsAPlusAaaaTtl: 3600000 -dnsNsTtl: null -dnsDsTtl: null -tldUnicode: "tld" -driveFolderId: null -tldType: "REAL" -invoicingEnabled: false -tldStateTransitions: - "1970-01-01T00:00:00.000Z": "GENERAL_AVAILABILITY" -creationTime: "1970-01-01T00:00:00.000Z" -reservedListNames: [] -premiumListName: "tld" -escrowEnabled: false -dnsPaused: false addGracePeriodLength: 432000000 +allowedFullyQualifiedHostNames: +- "foo" +allowedRegistrantContactIds: [] anchorTenantAddGracePeriodLength: 2592000000 autoRenewGracePeriodLength: 3888000000 -redemptionGracePeriodLength: 2592000000 -renewGracePeriodLength: 432000000 -transferGracePeriodLength: 432000000 automaticTransferLength: 432000000 -pendingDeleteLength: 432000000 -currency: "USD" +claimsPeriodEnd: "294247-01-10T04:00:54.775Z" createBillingCost: currency: "USD" amount: 13.00 -restoreBillingCost: - currency: "USD" - amount: 17.00 -serverStatusChangeBillingCost: - currency: "USD" - amount: 19.00 -registryLockOrUnlockBillingCost: - currency: "USD" - amount: 0.00 -renewBillingCostTransitions: - "1970-01-01T00:00:00.000Z": - currency: "USD" - amount: 11.00 -lordnUsername: null -claimsPeriodEnd: "294247-01-10T04:00:54.775Z" -allowedRegistrantContactIds: [] -allowedFullyQualifiedHostNames: -- "foo" +creationTime: "1970-01-01T00:00:00.000Z" +currency: "USD" defaultPromoTokens: - "bbbbb" -idnTables: -- "JA" -- "EXTENDED_LATIN" +dnsAPlusAaaaTtl: 3600000 +dnsDsTtl: null +dnsNsTtl: null +dnsPaused: false +dnsWriters: +- "baz" +- "bang" +driveFolderId: null eapFeeSchedule: "1970-01-01T00:00:00.000Z": currency: "USD" @@ -64,3 +31,36 @@ eapFeeSchedule: "2000-06-02T00:00:00.000Z": currency: "USD" amount: 0.00 +escrowEnabled: false +idnTables: +- "JA" +- "EXTENDED_LATIN" +invoicingEnabled: false +lordnUsername: null +numDnsPublishLocks: 1 +pendingDeleteLength: 432000000 +premiumListName: "tld" +pricingEngineClassName: "google.registry.model.pricing.StaticPremiumListPricingEngine" +redemptionGracePeriodLength: 2592000000 +registryLockOrUnlockBillingCost: + currency: "USD" + amount: 0.00 +renewBillingCostTransitions: + "1970-01-01T00:00:00.000Z": + currency: "USD" + amount: 11.00 +renewGracePeriodLength: 432000000 +reservedListNames: [] +restoreBillingCost: + currency: "USD" + amount: 17.00 +roidSuffix: "TLD" +serverStatusChangeBillingCost: + currency: "USD" + amount: 19.00 +tldStateTransitions: + "1970-01-01T00:00:00.000Z": "GENERAL_AVAILABILITY" +tldStr: "tld" +tldType: "REAL" +tldUnicode: "tld" +transferGracePeriodLength: 432000000 diff --git a/core/src/test/resources/google/registry/tools/tld.yaml b/core/src/test/resources/google/registry/tools/tld.yaml index a585e13f4..1dd5a2ad5 100644 --- a/core/src/test/resources/google/registry/tools/tld.yaml +++ b/core/src/test/resources/google/registry/tools/tld.yaml @@ -1,41 +1,36 @@ -tldStr: "xn--q9jyb4c" -roidSuffix: "Q9JYB4C" -pricingEngineClassName: "google.registry.model.pricing.StaticPremiumListPricingEngine" -dnsWriters: -- "VoidDnsWriter" -numDnsPublishLocks: 1 -dnsAPlusAaaaTtl: null -dnsNsTtl: null -dnsDsTtl: null -tldUnicode: "みんな" -driveFolderId: null -tldType: "REAL" -invoicingEnabled: false -tldStateTransitions: - "1970-01-01T00:00:00.000Z": "GENERAL_AVAILABILITY" -creationTime: "2022-09-01T00:00:00.000Z" -reservedListNames: [] -premiumListName: "xn--q9jyb4c" -escrowEnabled: false -dnsPaused: false addGracePeriodLength: 432000000 +allowedFullyQualifiedHostNames: [] +allowedRegistrantContactIds: [] anchorTenantAddGracePeriodLength: 2592000000 autoRenewGracePeriodLength: 3888000000 -redemptionGracePeriodLength: 2592000000 -renewGracePeriodLength: 432000000 -transferGracePeriodLength: 432000000 automaticTransferLength: 432000000 -pendingDeleteLength: 432000000 -currency: "USD" +claimsPeriodEnd: "294247-01-10T04:00:54.775Z" createBillingCost: currency: "USD" amount: 13.00 -restoreBillingCost: - currency: "USD" - amount: 17.00 -serverStatusChangeBillingCost: - currency: "USD" - amount: 19.00 +creationTime: "2022-09-01T00:00:00.000Z" +currency: "USD" +defaultPromoTokens: [] +dnsAPlusAaaaTtl: null +dnsDsTtl: null +dnsNsTtl: null +dnsPaused: false +dnsWriters: +- "VoidDnsWriter" +driveFolderId: null +eapFeeSchedule: + "1970-01-01T00:00:00.000Z": + currency: "USD" + amount: 0.00 +escrowEnabled: false +idnTables: [] +invoicingEnabled: false +lordnUsername: null +numDnsPublishLocks: 1 +pendingDeleteLength: 432000000 +premiumListName: "xn--q9jyb4c" +pricingEngineClassName: "google.registry.model.pricing.StaticPremiumListPricingEngine" +redemptionGracePeriodLength: 2592000000 registryLockOrUnlockBillingCost: currency: "USD" amount: 0.00 @@ -43,13 +38,18 @@ renewBillingCostTransitions: "1970-01-01T00:00:00.000Z": currency: "USD" amount: 11.00 -lordnUsername: null -claimsPeriodEnd: "294247-01-10T04:00:54.775Z" -allowedRegistrantContactIds: [] -allowedFullyQualifiedHostNames: [] -defaultPromoTokens: [] -idnTables: [] -eapFeeSchedule: - "1970-01-01T00:00:00.000Z": - currency: "USD" - amount: 0.00 \ No newline at end of file +renewGracePeriodLength: 432000000 +reservedListNames: [] +restoreBillingCost: + currency: "USD" + amount: 17.00 +roidSuffix: "Q9JYB4C" +serverStatusChangeBillingCost: + currency: "USD" + amount: 19.00 +tldStateTransitions: + "1970-01-01T00:00:00.000Z": "GENERAL_AVAILABILITY" +tldStr: "xn--q9jyb4c" +tldType: "REAL" +tldUnicode: "みんな" +transferGracePeriodLength: 432000000 \ No newline at end of file