Skip to content

Commit a138806

Browse files
authored
Re-enable old fee extensions in sandbox (#2939)
Now that we've passed the RST testing (or at least the EPP portion of it) we are no longer bound by the restriction to only use the fee extension version 1.0 on sandbox. For now, in order to avoid changing prod behavior, this does not enable advertisement of the fee extension version 1.0 in production. We can change this at any point in the future.
1 parent a5c1412 commit a138806

24 files changed

+3649
-5631
lines changed

core/src/main/java/google/registry/model/eppcommon/EppXmlTransformer.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import google.registry.model.ImmutableObject;
2424
import google.registry.model.eppinput.EppInput;
2525
import google.registry.model.eppoutput.EppOutput;
26-
import google.registry.util.NonFinalForTesting;
2726
import google.registry.util.RegistryEnvironment;
2827
import google.registry.xml.ValidationMode;
2928
import google.registry.xml.XmlException;
@@ -61,35 +60,20 @@ public class EppXmlTransformer {
6160
// XML schemas that should not be used in production (yet)
6261
private static final ImmutableSet<String> NON_PROD_SCHEMAS = ImmutableSet.of("fee-std-v1.xsd");
6362

64-
// XML schemas that should only be used in production (for backcompat)
65-
private static final ImmutableSet<String> ONLY_PROD_SCHEMAS =
66-
ImmutableSet.of("fee06.xsd", "fee11.xsd", "fee12.xsd");
67-
68-
// TODO(gbrodman): make this final when we can actually remove the old fee extensions and aren't
69-
// relying on switching by environment
70-
@NonFinalForTesting
71-
private static XmlTransformer INPUT_TRANSFORMER =
63+
private static final XmlTransformer INPUT_TRANSFORMER =
7264
new XmlTransformer(getSchemas(), EppInput.class);
7365

74-
// TODO(gbrodman): make this final when we can actually remove the old fee extensions and aren't
75-
// relying on switching by environment
76-
@NonFinalForTesting
77-
private static XmlTransformer OUTPUT_TRANSFORMER =
66+
private static final XmlTransformer OUTPUT_TRANSFORMER =
7867
new XmlTransformer(getSchemas(), EppOutput.class);
7968

8069
@VisibleForTesting
8170
public static ImmutableList<String> getSchemas() {
82-
ImmutableSet<String> schemasToSkip =
83-
RegistryEnvironment.get().equals(RegistryEnvironment.PRODUCTION)
84-
? NON_PROD_SCHEMAS
85-
: ONLY_PROD_SCHEMAS;
86-
return ALL_SCHEMAS.stream().filter(s -> !schemasToSkip.contains(s)).collect(toImmutableList());
87-
}
88-
89-
@VisibleForTesting
90-
public static void reloadTransformers() {
91-
INPUT_TRANSFORMER = new XmlTransformer(getSchemas(), EppInput.class);
92-
OUTPUT_TRANSFORMER = new XmlTransformer(getSchemas(), EppOutput.class);
71+
if (RegistryEnvironment.get().equals(RegistryEnvironment.PRODUCTION)) {
72+
return ALL_SCHEMAS.stream()
73+
.filter(s -> !NON_PROD_SCHEMAS.contains(s))
74+
.collect(toImmutableList());
75+
}
76+
return ALL_SCHEMAS;
9377
}
9478

9579
public static void validateOutput(String xml) throws XmlException {

core/src/main/java/google/registry/model/eppcommon/ProtocolDefinition.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public class ProtocolDefinition {
5454
/** Enum representing which environments should have which service extensions enabled. */
5555
private enum ServiceExtensionVisibility {
5656
ALL,
57-
ONLY_IN_PRODUCTION,
5857
ONLY_IN_NON_PRODUCTION,
5958
NONE
6059
}
@@ -67,15 +66,15 @@ public enum ServiceExtension {
6766
FEE_0_6(
6867
FeeCheckCommandExtensionV06.class,
6968
FeeCheckResponseExtensionV06.class,
70-
ServiceExtensionVisibility.ONLY_IN_PRODUCTION),
69+
ServiceExtensionVisibility.ALL),
7170
FEE_0_11(
7271
FeeCheckCommandExtensionV11.class,
7372
FeeCheckResponseExtensionV11.class,
74-
ServiceExtensionVisibility.ONLY_IN_PRODUCTION),
73+
ServiceExtensionVisibility.ALL),
7574
FEE_0_12(
7675
FeeCheckCommandExtensionV12.class,
7776
FeeCheckResponseExtensionV12.class,
78-
ServiceExtensionVisibility.ONLY_IN_PRODUCTION),
77+
ServiceExtensionVisibility.ALL),
7978
FEE_1_00(
8079
FeeCheckCommandExtensionStdV1.class,
8180
FeeCheckResponseExtensionStdV1.class,
@@ -117,7 +116,6 @@ public static String getCommandExtensionUri(Class<? extends CommandExtension> cl
117116
public boolean isVisible() {
118117
return switch (visibility) {
119118
case ALL -> true;
120-
case ONLY_IN_PRODUCTION -> RegistryEnvironment.get().equals(RegistryEnvironment.PRODUCTION);
121119
case ONLY_IN_NON_PRODUCTION ->
122120
!RegistryEnvironment.get().equals(RegistryEnvironment.PRODUCTION);
123121
case NONE -> false;

0 commit comments

Comments
 (0)