mirror of
https://github.com/google/nomulus
synced 2026-07-07 16:46:56 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad2cf933c2 | |||
| 3a9e5d398e | |||
| 2009540f8b | |||
| ca0d95b066 | |||
| 851465a89d | |||
| 6aa7c19344 | |||
| cf0e8e1b26 | |||
| c90d5ed43b | |||
| e106e25800 | |||
| 54471e2714 | |||
| bd5299b2f2 | |||
| 4eae10800d | |||
| 533515817f | |||
| d4b1048363 | |||
| 2ffcfc4c5e | |||
| b47e152ca5 | |||
| b523b3835f | |||
| eb7d779bc8 | |||
| 8fb12d21a2 | |||
| 5d9bf64b96 | |||
| 76603812e3 | |||
| a28754dc5d | |||
| d6bf6f375e | |||
| 8f67c4b9cf | |||
| c17a5c489c |
@@ -179,6 +179,16 @@ allprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
if (rootProject.enableCrossReferencing.toBoolean()) {
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
options.fork = true
|
||||
options.forkOptions.executable =
|
||||
"${project.rootDir}/kythe/extractors/javac-wrapper.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task runPresubmits(type: Exec) {
|
||||
|
||||
@@ -49,7 +49,7 @@ javax.annotation:jsr250-api:1.0
|
||||
javax.inject:javax.inject:1
|
||||
javax.validation:validation-api:1.0.0.GA
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.7
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
|
||||
@@ -49,7 +49,7 @@ javax.annotation:jsr250-api:1.0
|
||||
javax.inject:javax.inject:1
|
||||
javax.validation:validation-api:1.0.0.GA
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.7
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
|
||||
@@ -49,7 +49,7 @@ javax.annotation:jsr250-api:1.0
|
||||
javax.inject:javax.inject:1
|
||||
javax.validation:validation-api:1.0.0.GA
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.7
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
|
||||
@@ -49,7 +49,7 @@ javax.annotation:jsr250-api:1.0
|
||||
javax.inject:javax.inject:1
|
||||
javax.validation:validation-api:1.0.0.GA
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.7
|
||||
org.apache.commons:commons-lang3:3.8.1
|
||||
|
||||
@@ -62,5 +62,4 @@ dependencies {
|
||||
testingCompile deps['io.github.java-diff-utils:java-diff-utils']
|
||||
|
||||
testCompile deps['junit:junit']
|
||||
testCompile project(':third_party')
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ com.googlecode.java-diff-utils:diffutils:1.3.0
|
||||
io.github.java-diff-utils:java-diff-utils:4.0
|
||||
javax.inject:javax.inject:1
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
org.checkerframework:checker-compat-qual:2.5.5
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.18
|
||||
|
||||
@@ -14,7 +14,7 @@ com.googlecode.java-diff-utils:diffutils:1.3.0
|
||||
io.github.java-diff-utils:java-diff-utils:4.0
|
||||
javax.inject:javax.inject:1
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
org.checkerframework:checker-compat-qual:2.5.5
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.18
|
||||
|
||||
@@ -15,7 +15,7 @@ com.googlecode.java-diff-utils:diffutils:1.3.0
|
||||
io.github.java-diff-utils:java-diff-utils:4.0
|
||||
javax.inject:javax.inject:1
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
org.checkerframework:checker-compat-qual:2.5.5
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.18
|
||||
|
||||
@@ -15,7 +15,7 @@ com.googlecode.java-diff-utils:diffutils:1.3.0
|
||||
io.github.java-diff-utils:java-diff-utils:4.0
|
||||
javax.inject:javax.inject:1
|
||||
joda-time:joda-time:2.9.2
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
org.checkerframework:checker-compat-qual:2.5.5
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.18
|
||||
|
||||
@@ -16,8 +16,8 @@ package google.registry.testing.truth;
|
||||
|
||||
import static com.google.common.io.Resources.getResource;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.truth.TextDiffSubject.assertThat;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -55,12 +55,6 @@ by Joshua Bloch in his book Effective Java -->
|
||||
<property name="message" value="Use java.util.Optional instead of Guava's Optional."/>
|
||||
</module>
|
||||
|
||||
<!-- Checks that our backport JUnit exception assertion methods are used instead of the ones slated for release in JUnit 4.13. -->
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="org\.junit\.Assert\.(assert|expect)Throws"/>
|
||||
<property name="message" value="Use the exception assertion methods in google.registry.testing.JUnitBackports instead of those in JUnit."/>
|
||||
</module>
|
||||
|
||||
<!-- Checks that the deprecated ExpectedException is not used. -->
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="org\.junit\.rules\.ExpectedException"/>
|
||||
|
||||
@@ -166,7 +166,6 @@ dependencies {
|
||||
// release.
|
||||
compile files(
|
||||
"${rootDir}/third_party/objectify/v4_1/objectify-4.1.3.jar")
|
||||
testRuntime project(':third_party')
|
||||
|
||||
testRuntime files(sourceSets.test.resources.srcDirs)
|
||||
|
||||
@@ -270,7 +269,6 @@ dependencies {
|
||||
// Known issue: nebula-lint misses inherited dependency.
|
||||
compile project(':common')
|
||||
testCompile project(path: ':common', configuration: 'testing')
|
||||
compile project(':third_party')
|
||||
compile project(':util')
|
||||
// Import NomulusPostreSql from ':db' for compile but exclude dependencies.
|
||||
compile project(path: ':db', configuration: 'compileApi')
|
||||
|
||||
@@ -93,8 +93,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -92,8 +92,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -104,8 +104,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -104,8 +104,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -10,11 +10,11 @@ com.fasterxml.jackson.core:jackson-annotations:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-core:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-databind:2.9.10
|
||||
com.fasterxml:classmate:1.3.4
|
||||
com.google.api-client:google-api-client-appengine:1.30.6
|
||||
com.google.api-client:google-api-client-appengine:1.29.0
|
||||
com.google.api-client:google-api-client-jackson2:1.27.0
|
||||
com.google.api-client:google-api-client-java6:1.27.0
|
||||
com.google.api-client:google-api-client-servlet:1.30.6
|
||||
com.google.api-client:google-api-client:1.30.6
|
||||
com.google.api-client:google-api-client-servlet:1.29.0
|
||||
com.google.api-client:google-api-client:1.29.2
|
||||
com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:0.44.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-admin-v2:0.38.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-v2:0.38.0
|
||||
@@ -84,22 +84,22 @@ com.google.guava:failureaccess:1.0.1
|
||||
com.google.guava:guava:28.1-jre
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|
||||
com.google.gwt:gwt-user:2.8.2
|
||||
com.google.http-client:google-http-client-appengine:1.32.1
|
||||
com.google.http-client:google-http-client-jackson2:1.32.1
|
||||
com.google.http-client:google-http-client-appengine:1.29.2
|
||||
com.google.http-client:google-http-client-jackson2:1.30.1
|
||||
com.google.http-client:google-http-client-jackson:1.20.0
|
||||
com.google.http-client:google-http-client-protobuf:1.20.0
|
||||
com.google.http-client:google-http-client:1.32.1
|
||||
com.google.http-client:google-http-client:1.30.1
|
||||
com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.30.4
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.30.4
|
||||
com.google.oauth-client:google-oauth-client:1.30.4
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.29.0
|
||||
com.google.oauth-client:google-oauth-client:1.29.2
|
||||
com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5
|
||||
com.google.protobuf:protobuf-java-util:3.6.1
|
||||
com.google.protobuf:protobuf-java:3.6.1
|
||||
@@ -124,7 +124,7 @@ io.dropwizard.metrics:metrics-core:3.1.2
|
||||
io.grpc:grpc-all:1.17.1
|
||||
io.grpc:grpc-alts:1.17.1
|
||||
io.grpc:grpc-auth:1.17.1
|
||||
io.grpc:grpc-context:1.22.1
|
||||
io.grpc:grpc-context:1.19.0
|
||||
io.grpc:grpc-core:1.17.1
|
||||
io.grpc:grpc-grpclb:1.17.1
|
||||
io.grpc:grpc-netty-shaded:1.17.1
|
||||
@@ -146,10 +146,10 @@ io.netty:netty-handler:4.1.30.Final
|
||||
io.netty:netty-resolver:4.1.30.Final
|
||||
io.netty:netty-tcnative-boringssl-static:2.0.17.Final
|
||||
io.netty:netty-transport:4.1.30.Final
|
||||
io.opencensus:opencensus-api:0.24.0
|
||||
io.opencensus:opencensus-api:0.21.0
|
||||
io.opencensus:opencensus-contrib-grpc-metrics:0.17.0
|
||||
io.opencensus:opencensus-contrib-grpc-util:0.17.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.24.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.21.0
|
||||
it.unimi.dsi:fastutil:6.5.16
|
||||
javax.activation:activation:1.1
|
||||
javax.activation:javax.activation-api:1.2.0
|
||||
@@ -183,8 +183,8 @@ org.apache.beam:beam-vendor-grpc-1_21_0:0.1
|
||||
org.apache.beam:beam-vendor-guava-26_0-jre:0.1
|
||||
org.apache.commons:commons-compress:1.19
|
||||
org.apache.commons:commons-lang3:3.5
|
||||
org.apache.httpcomponents:httpclient:4.5.10
|
||||
org.apache.httpcomponents:httpcore:4.4.12
|
||||
org.apache.httpcomponents:httpclient:4.5.8
|
||||
org.apache.httpcomponents:httpcore:4.4.11
|
||||
org.bouncycastle:bcpg-jdk15on:1.61
|
||||
org.bouncycastle:bcprov-jdk15on:1.61
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
|
||||
@@ -10,11 +10,11 @@ com.fasterxml.jackson.core:jackson-annotations:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-core:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-databind:2.9.10
|
||||
com.fasterxml:classmate:1.3.4
|
||||
com.google.api-client:google-api-client-appengine:1.30.6
|
||||
com.google.api-client:google-api-client-appengine:1.29.0
|
||||
com.google.api-client:google-api-client-jackson2:1.27.0
|
||||
com.google.api-client:google-api-client-java6:1.27.0
|
||||
com.google.api-client:google-api-client-servlet:1.30.6
|
||||
com.google.api-client:google-api-client:1.30.6
|
||||
com.google.api-client:google-api-client-servlet:1.29.0
|
||||
com.google.api-client:google-api-client:1.29.2
|
||||
com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:0.44.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-admin-v2:0.38.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-v2:0.38.0
|
||||
@@ -83,22 +83,22 @@ com.google.guava:failureaccess:1.0.1
|
||||
com.google.guava:guava:28.1-jre
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|
||||
com.google.gwt:gwt-user:2.8.2
|
||||
com.google.http-client:google-http-client-appengine:1.32.1
|
||||
com.google.http-client:google-http-client-jackson2:1.32.1
|
||||
com.google.http-client:google-http-client-appengine:1.29.2
|
||||
com.google.http-client:google-http-client-jackson2:1.30.1
|
||||
com.google.http-client:google-http-client-jackson:1.20.0
|
||||
com.google.http-client:google-http-client-protobuf:1.20.0
|
||||
com.google.http-client:google-http-client:1.32.1
|
||||
com.google.http-client:google-http-client:1.30.1
|
||||
com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.30.4
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.30.4
|
||||
com.google.oauth-client:google-oauth-client:1.30.4
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.29.0
|
||||
com.google.oauth-client:google-oauth-client:1.29.2
|
||||
com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5
|
||||
com.google.protobuf:protobuf-java-util:3.6.1
|
||||
com.google.protobuf:protobuf-java:3.6.1
|
||||
@@ -123,7 +123,7 @@ io.dropwizard.metrics:metrics-core:3.1.2
|
||||
io.grpc:grpc-all:1.17.1
|
||||
io.grpc:grpc-alts:1.17.1
|
||||
io.grpc:grpc-auth:1.17.1
|
||||
io.grpc:grpc-context:1.22.1
|
||||
io.grpc:grpc-context:1.19.0
|
||||
io.grpc:grpc-core:1.17.1
|
||||
io.grpc:grpc-netty-shaded:1.17.1
|
||||
io.grpc:grpc-netty:1.17.1
|
||||
@@ -144,10 +144,10 @@ io.netty:netty-handler:4.1.30.Final
|
||||
io.netty:netty-resolver:4.1.30.Final
|
||||
io.netty:netty-tcnative-boringssl-static:2.0.17.Final
|
||||
io.netty:netty-transport:4.1.30.Final
|
||||
io.opencensus:opencensus-api:0.24.0
|
||||
io.opencensus:opencensus-api:0.21.0
|
||||
io.opencensus:opencensus-contrib-grpc-metrics:0.17.0
|
||||
io.opencensus:opencensus-contrib-grpc-util:0.17.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.24.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.21.0
|
||||
it.unimi.dsi:fastutil:6.5.16
|
||||
javax.activation:activation:1.1
|
||||
javax.activation:javax.activation-api:1.2.0
|
||||
@@ -181,8 +181,8 @@ org.apache.beam:beam-vendor-grpc-1_21_0:0.1
|
||||
org.apache.beam:beam-vendor-guava-26_0-jre:0.1
|
||||
org.apache.commons:commons-compress:1.19
|
||||
org.apache.commons:commons-lang3:3.5
|
||||
org.apache.httpcomponents:httpclient:4.5.10
|
||||
org.apache.httpcomponents:httpcore:4.4.12
|
||||
org.apache.httpcomponents:httpclient:4.5.8
|
||||
org.apache.httpcomponents:httpcore:4.4.11
|
||||
org.bouncycastle:bcpg-jdk15on:1.61
|
||||
org.bouncycastle:bcprov-jdk15on:1.61
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
|
||||
@@ -10,11 +10,11 @@ com.fasterxml.jackson.core:jackson-annotations:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-core:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-databind:2.9.10
|
||||
com.fasterxml:classmate:1.3.4
|
||||
com.google.api-client:google-api-client-appengine:1.30.6
|
||||
com.google.api-client:google-api-client-appengine:1.29.0
|
||||
com.google.api-client:google-api-client-jackson2:1.27.0
|
||||
com.google.api-client:google-api-client-java6:1.27.0
|
||||
com.google.api-client:google-api-client-servlet:1.30.6
|
||||
com.google.api-client:google-api-client:1.30.6
|
||||
com.google.api-client:google-api-client-servlet:1.29.0
|
||||
com.google.api-client:google-api-client:1.29.2
|
||||
com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:0.44.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-admin-v2:0.38.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-v2:0.38.0
|
||||
@@ -84,22 +84,22 @@ com.google.guava:failureaccess:1.0.1
|
||||
com.google.guava:guava:28.1-jre
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|
||||
com.google.gwt:gwt-user:2.8.2
|
||||
com.google.http-client:google-http-client-appengine:1.32.1
|
||||
com.google.http-client:google-http-client-jackson2:1.32.1
|
||||
com.google.http-client:google-http-client-appengine:1.29.2
|
||||
com.google.http-client:google-http-client-jackson2:1.30.1
|
||||
com.google.http-client:google-http-client-jackson:1.20.0
|
||||
com.google.http-client:google-http-client-protobuf:1.20.0
|
||||
com.google.http-client:google-http-client:1.32.1
|
||||
com.google.http-client:google-http-client:1.30.1
|
||||
com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.30.4
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.30.4
|
||||
com.google.oauth-client:google-oauth-client:1.30.4
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.29.0
|
||||
com.google.oauth-client:google-oauth-client:1.29.2
|
||||
com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5
|
||||
com.google.protobuf:protobuf-java-util:3.6.1
|
||||
com.google.protobuf:protobuf-java:3.6.1
|
||||
@@ -124,7 +124,7 @@ io.dropwizard.metrics:metrics-core:3.1.2
|
||||
io.grpc:grpc-all:1.17.1
|
||||
io.grpc:grpc-alts:1.17.1
|
||||
io.grpc:grpc-auth:1.17.1
|
||||
io.grpc:grpc-context:1.22.1
|
||||
io.grpc:grpc-context:1.19.0
|
||||
io.grpc:grpc-core:1.17.1
|
||||
io.grpc:grpc-grpclb:1.17.1
|
||||
io.grpc:grpc-netty-shaded:1.17.1
|
||||
@@ -146,10 +146,10 @@ io.netty:netty-handler:4.1.30.Final
|
||||
io.netty:netty-resolver:4.1.30.Final
|
||||
io.netty:netty-tcnative-boringssl-static:2.0.17.Final
|
||||
io.netty:netty-transport:4.1.30.Final
|
||||
io.opencensus:opencensus-api:0.24.0
|
||||
io.opencensus:opencensus-api:0.21.0
|
||||
io.opencensus:opencensus-contrib-grpc-metrics:0.17.0
|
||||
io.opencensus:opencensus-contrib-grpc-util:0.17.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.24.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.21.0
|
||||
it.unimi.dsi:fastutil:6.5.16
|
||||
javax.activation:activation:1.1
|
||||
javax.activation:javax.activation-api:1.2.0
|
||||
@@ -183,8 +183,8 @@ org.apache.beam:beam-vendor-grpc-1_21_0:0.1
|
||||
org.apache.beam:beam-vendor-guava-26_0-jre:0.1
|
||||
org.apache.commons:commons-compress:1.19
|
||||
org.apache.commons:commons-lang3:3.5
|
||||
org.apache.httpcomponents:httpclient:4.5.10
|
||||
org.apache.httpcomponents:httpcore:4.4.12
|
||||
org.apache.httpcomponents:httpclient:4.5.8
|
||||
org.apache.httpcomponents:httpcore:4.4.11
|
||||
org.bouncycastle:bcpg-jdk15on:1.61
|
||||
org.bouncycastle:bcprov-jdk15on:1.61
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
|
||||
@@ -10,11 +10,11 @@ com.fasterxml.jackson.core:jackson-annotations:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-core:2.9.10
|
||||
com.fasterxml.jackson.core:jackson-databind:2.9.10
|
||||
com.fasterxml:classmate:1.3.4
|
||||
com.google.api-client:google-api-client-appengine:1.30.6
|
||||
com.google.api-client:google-api-client-appengine:1.29.0
|
||||
com.google.api-client:google-api-client-jackson2:1.27.0
|
||||
com.google.api-client:google-api-client-java6:1.27.0
|
||||
com.google.api-client:google-api-client-servlet:1.30.6
|
||||
com.google.api-client:google-api-client:1.30.6
|
||||
com.google.api-client:google-api-client-servlet:1.29.0
|
||||
com.google.api-client:google-api-client:1.29.2
|
||||
com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:0.44.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-admin-v2:0.38.0
|
||||
com.google.api.grpc:grpc-google-cloud-bigtable-v2:0.38.0
|
||||
@@ -84,22 +84,22 @@ com.google.guava:failureaccess:1.0.1
|
||||
com.google.guava:guava:28.1-jre
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|
||||
com.google.gwt:gwt-user:2.8.2
|
||||
com.google.http-client:google-http-client-appengine:1.32.1
|
||||
com.google.http-client:google-http-client-jackson2:1.32.1
|
||||
com.google.http-client:google-http-client-appengine:1.29.2
|
||||
com.google.http-client:google-http-client-jackson2:1.30.1
|
||||
com.google.http-client:google-http-client-jackson:1.20.0
|
||||
com.google.http-client:google-http-client-protobuf:1.20.0
|
||||
com.google.http-client:google-http-client:1.32.1
|
||||
com.google.http-client:google-http-client:1.30.1
|
||||
com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.30.4
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.30.4
|
||||
com.google.oauth-client:google-oauth-client:1.30.4
|
||||
com.google.oauth-client:google-oauth-client-servlet:1.29.0
|
||||
com.google.oauth-client:google-oauth-client:1.29.2
|
||||
com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5
|
||||
com.google.protobuf:protobuf-java-util:3.6.1
|
||||
com.google.protobuf:protobuf-java:3.6.1
|
||||
@@ -124,7 +124,7 @@ io.dropwizard.metrics:metrics-core:3.1.2
|
||||
io.grpc:grpc-all:1.17.1
|
||||
io.grpc:grpc-alts:1.17.1
|
||||
io.grpc:grpc-auth:1.17.1
|
||||
io.grpc:grpc-context:1.22.1
|
||||
io.grpc:grpc-context:1.19.0
|
||||
io.grpc:grpc-core:1.17.1
|
||||
io.grpc:grpc-grpclb:1.17.1
|
||||
io.grpc:grpc-netty-shaded:1.17.1
|
||||
@@ -146,10 +146,10 @@ io.netty:netty-handler:4.1.30.Final
|
||||
io.netty:netty-resolver:4.1.30.Final
|
||||
io.netty:netty-tcnative-boringssl-static:2.0.17.Final
|
||||
io.netty:netty-transport:4.1.30.Final
|
||||
io.opencensus:opencensus-api:0.24.0
|
||||
io.opencensus:opencensus-api:0.21.0
|
||||
io.opencensus:opencensus-contrib-grpc-metrics:0.17.0
|
||||
io.opencensus:opencensus-contrib-grpc-util:0.17.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.24.0
|
||||
io.opencensus:opencensus-contrib-http-util:0.21.0
|
||||
it.unimi.dsi:fastutil:6.5.16
|
||||
javax.activation:activation:1.1
|
||||
javax.activation:javax.activation-api:1.2.0
|
||||
@@ -183,8 +183,8 @@ org.apache.beam:beam-vendor-grpc-1_21_0:0.1
|
||||
org.apache.beam:beam-vendor-guava-26_0-jre:0.1
|
||||
org.apache.commons:commons-compress:1.19
|
||||
org.apache.commons:commons-lang3:3.5
|
||||
org.apache.httpcomponents:httpclient:4.5.10
|
||||
org.apache.httpcomponents:httpcore:4.4.12
|
||||
org.apache.httpcomponents:httpclient:4.5.8
|
||||
org.apache.httpcomponents:httpcore:4.4.11
|
||||
org.bouncycastle:bcpg-jdk15on:1.61
|
||||
org.bouncycastle:bcprov-jdk15on:1.61
|
||||
org.checkerframework:checker-qual:2.8.1
|
||||
|
||||
@@ -93,8 +93,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -104,8 +104,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
|
||||
@@ -95,9 +95,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:contrib:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:contrib:1.0.7
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
@@ -174,7 +174,7 @@ javax.validation:validation-api:1.0.0.GA
|
||||
javax.xml.bind:jaxb-api:2.3.1
|
||||
jline:jline:1.0
|
||||
joda-time:joda-time:2.10.3
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.11
|
||||
net.java.dev.jna:jna-platform:5.3.1
|
||||
|
||||
@@ -94,9 +94,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:contrib:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:contrib:1.0.7
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
@@ -172,7 +172,7 @@ javax.validation:validation-api:1.0.0.GA
|
||||
javax.xml.bind:jaxb-api:2.3.1
|
||||
jline:jline:1.0
|
||||
joda-time:joda-time:2.10.3
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.11
|
||||
net.java.dev.jna:jna-platform:5.3.1
|
||||
|
||||
@@ -106,9 +106,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:contrib:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:contrib:1.0.7
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
@@ -186,7 +186,7 @@ javax.validation:validation-api:1.0.0.GA
|
||||
javax.xml.bind:jaxb-api:2.3.1
|
||||
jline:jline:1.0
|
||||
joda-time:joda-time:2.10.3
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.11
|
||||
net.java.dev.jna:jna-platform:5.3.1
|
||||
|
||||
@@ -106,9 +106,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
|
||||
com.google.inject:guice:4.1.0
|
||||
com.google.j2objc:j2objc-annotations:1.3
|
||||
com.google.jsinterop:jsinterop-annotations:1.0.2
|
||||
com.google.monitoring-client:contrib:1.0.6
|
||||
com.google.monitoring-client:metrics:1.0.6
|
||||
com.google.monitoring-client:stackdriver:1.0.6
|
||||
com.google.monitoring-client:contrib:1.0.7
|
||||
com.google.monitoring-client:metrics:1.0.7
|
||||
com.google.monitoring-client:stackdriver:1.0.7
|
||||
com.google.oauth-client:google-oauth-client-appengine:1.29.0
|
||||
com.google.oauth-client:google-oauth-client-java6:1.28.0
|
||||
com.google.oauth-client:google-oauth-client-jetty:1.28.0
|
||||
@@ -186,7 +186,7 @@ javax.validation:validation-api:1.0.0.GA
|
||||
javax.xml.bind:jaxb-api:2.3.1
|
||||
jline:jline:1.0
|
||||
joda-time:joda-time:2.10.3
|
||||
junit:junit:4.12
|
||||
junit:junit:4.13
|
||||
net.bytebuddy:byte-buddy-agent:1.9.7
|
||||
net.bytebuddy:byte-buddy:1.9.11
|
||||
net.java.dev.jna:jna-platform:5.3.1
|
||||
|
||||
@@ -42,6 +42,8 @@ import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.index.ForeignKeyIndex;
|
||||
@@ -247,6 +249,30 @@ public final class ResourceFlowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the exDate for the domain at the given transfer approval time with an adjusted amount
|
||||
* of transfer period years if the domain is in the auto renew grace period at the time of
|
||||
* approval.
|
||||
*
|
||||
* @param domain is the domain already projected at approvalTime
|
||||
*/
|
||||
public static DateTime computeExDateForApprovalTime(
|
||||
DomainBase domain, DateTime approvalTime, Period period) {
|
||||
boolean inAutoRenew = domain.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW);
|
||||
// inAutoRenew is set to false if the period is zero because a zero-period transfer should not
|
||||
// subsume an autorenew.
|
||||
// https://www.icann.org/resources/unthemed-pages/appendix-07-2010-01-06-en section 3.1.2
|
||||
// specifies that when a transfer occurs without a change to the expiration date, the losing
|
||||
// registrar's account should still be charged for the autorenew.
|
||||
if (period.getValue() == 0) {
|
||||
inAutoRenew = false;
|
||||
}
|
||||
return DomainBase.extendRegistrationWithCap(
|
||||
approvalTime,
|
||||
domain.getRegistrationExpirationTime(),
|
||||
period.getValue() - (inAutoRenew ? 1 : 0));
|
||||
}
|
||||
|
||||
/** Resource with this id does not exist. */
|
||||
public static class ResourceDoesNotExistException extends ObjectDoesNotExistException {
|
||||
public ResourceDoesNotExistException(Class<?> type, String targetId) {
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.flows.domain;
|
||||
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
@@ -26,7 +27,6 @@ import static google.registry.flows.domain.DomainFlowUtils.updateAutorenewRecurr
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createGainingTransferPollMessage;
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
|
||||
import static google.registry.model.ResourceTransferUtils.approvePendingTransfer;
|
||||
import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
|
||||
import static google.registry.model.transaction.TransactionManagerFactory.tm;
|
||||
@@ -136,9 +136,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||
// increase the registration time, since the transfer subsumes the autorenew's extra year.
|
||||
GracePeriod autorenewGrace =
|
||||
getOnlyElement(existingDomain.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW), null);
|
||||
int extraYears = transferData.getTransferPeriod().getValue();
|
||||
if (autorenewGrace != null) {
|
||||
extraYears = 0;
|
||||
// During a normal transfer, if the domain is in the auto-renew grace period, the auto-renew
|
||||
// billing event is cancelled and the gaining registrar is charged for the one year renewal.
|
||||
// But, if the superuser extension is used to request a transfer without an additional year
|
||||
@@ -152,8 +150,8 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||
// Close the old autorenew event and poll message at the transfer time (aka now). This may end
|
||||
// up deleting the poll message.
|
||||
updateAutorenewRecurrenceEndTime(existingDomain, now);
|
||||
DateTime newExpirationTime = extendRegistrationWithCap(
|
||||
now, existingDomain.getRegistrationExpirationTime(), extraYears);
|
||||
DateTime newExpirationTime =
|
||||
computeExDateForApprovalTime(existingDomain, now, transferData.getTransferPeriod());
|
||||
// Create a new autorenew event starting at the expiration time.
|
||||
BillingEvent.Recurring autorenewEvent = new BillingEvent.Recurring.Builder()
|
||||
.setReason(Reason.RENEW)
|
||||
|
||||
@@ -18,13 +18,13 @@ import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
|
||||
import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.ResourceFlowUtils;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
||||
import google.registry.flows.exceptions.NotAuthorizedToViewTransferException;
|
||||
@@ -86,10 +86,12 @@ public final class DomainTransferQueryFlow implements Flow {
|
||||
throw new NotAuthorizedToViewTransferException();
|
||||
}
|
||||
DateTime newExpirationTime = null;
|
||||
if (transferData.getTransferStatus().isApproved()
|
||||
|| transferData.getTransferStatus().equals(TransferStatus.PENDING)) {
|
||||
// TODO(b/25084229): fix exDate computation logic.
|
||||
newExpirationTime = extendRegistrationWithCap(now, domain.getRegistrationExpirationTime(), 1);
|
||||
if (transferData.getTransferStatus().isApproved()) {
|
||||
newExpirationTime = transferData.getTransferredRegistrationExpirationTime();
|
||||
} else if (transferData.getTransferStatus().equals(TransferStatus.PENDING)) {
|
||||
newExpirationTime =
|
||||
ResourceFlowUtils.computeExDateForApprovalTime(
|
||||
domain, now, domain.getTransferData().getTransferPeriod());
|
||||
}
|
||||
return responseBuilder
|
||||
.setResData(createTransferResponse(targetId, transferData, newExpirationTime))
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoPresentForResourceTransfer;
|
||||
@@ -29,7 +30,6 @@ import static google.registry.flows.domain.DomainTransferUtils.createLosingTrans
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createPendingTransferData;
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createTransferServerApproveEntities;
|
||||
import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.transaction.TransactionManagerFactory.tm;
|
||||
@@ -56,7 +56,6 @@ import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.FeeTransferCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import google.registry.model.domain.metadata.MetadataExtension;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.superuser.DomainTransferRequestSuperuserExtension;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
@@ -183,18 +182,10 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||
//
|
||||
// See b/19430703#comment17 and https://www.icann.org/news/advisory-2002-06-06-en for the
|
||||
// policy documentation for transfers subsuming autorenews within the autorenew grace period.
|
||||
int extraYears = period.getValue();
|
||||
DomainBase domainAtTransferTime =
|
||||
existingDomain.cloneProjectedAtTime(automaticTransferTime);
|
||||
if (!domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW).isEmpty()) {
|
||||
extraYears = 0;
|
||||
}
|
||||
DomainBase domainAtTransferTime = existingDomain.cloneProjectedAtTime(automaticTransferTime);
|
||||
// The new expiration time if there is a server approval.
|
||||
DateTime serverApproveNewExpirationTime =
|
||||
extendRegistrationWithCap(
|
||||
automaticTransferTime,
|
||||
domainAtTransferTime.getRegistrationExpirationTime(),
|
||||
extraYears);
|
||||
computeExDateForApprovalTime(domainAtTransferTime, automaticTransferTime, period);
|
||||
// Create speculative entities in anticipation of an automatic server approval.
|
||||
ImmutableSet<TransferServerApproveEntity> serverApproveEntities =
|
||||
createTransferServerApproveEntities(
|
||||
@@ -337,10 +328,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||
// If the registration were approved this instant, this is what the new expiration would be,
|
||||
// because we cap at 10 years from the moment of approval. This is different than the server
|
||||
// approval new expiration time, which is capped at 10 years from the server approve time.
|
||||
DateTime approveNowExtendedRegistrationTime = extendRegistrationWithCap(
|
||||
now,
|
||||
existingDomain.getRegistrationExpirationTime(),
|
||||
period.getValue());
|
||||
DateTime approveNowExtendedRegistrationTime =
|
||||
computeExDateForApprovalTime(existingDomain, now, period);
|
||||
return createTransferResponse(
|
||||
targetId, newDomain.getTransferData(), approveNowExtendedRegistrationTime);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,15 @@ public class CacheUtils {
|
||||
* lists downloaded from the TMCH get updated in Datastore and the caches need to be refreshed.)
|
||||
*/
|
||||
public static <T> Supplier<T> memoizeWithShortExpiration(Supplier<T> original) {
|
||||
Duration expiration = getSingletonCacheRefreshDuration();
|
||||
return tryMemoizeWithExpiration(getSingletonCacheRefreshDuration(), original);
|
||||
}
|
||||
|
||||
/**
|
||||
* Memoize a supplier with the given expiration. If the expiration is zero(likely happens in a
|
||||
* unit test), it returns the original supplier.
|
||||
*/
|
||||
public static <T> Supplier<T> tryMemoizeWithExpiration(
|
||||
Duration expiration, Supplier<T> original) {
|
||||
return expiration.isEqual(ZERO)
|
||||
? original
|
||||
: memoizeWithExpiration(original, expiration.getMillis(), MILLISECONDS);
|
||||
|
||||
@@ -17,7 +17,6 @@ package google.registry.model;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -53,24 +52,22 @@ public final class ResourceTransferUtils {
|
||||
TransferStatus.PENDING, TransferStatus.CLIENT_APPROVED, TransferStatus.SERVER_APPROVED);
|
||||
|
||||
/**
|
||||
* Create a transfer response using the id and type of this resource and the specified
|
||||
* {@link TransferData}.
|
||||
* Create a transfer response using the id and type of this resource and the specified {@link
|
||||
* TransferData}.
|
||||
*/
|
||||
public static TransferResponse createTransferResponse(
|
||||
EppResource eppResource, TransferData transferData, DateTime now) {
|
||||
EppResource eppResource, TransferData transferData) {
|
||||
assertIsContactOrDomain(eppResource);
|
||||
TransferResponse.Builder<? extends TransferResponse, ?> builder;
|
||||
if (eppResource instanceof ContactResource) {
|
||||
builder = new ContactTransferResponse.Builder().setContactId(eppResource.getForeignKey());
|
||||
} else {
|
||||
DomainBase domain = (DomainBase) eppResource;
|
||||
builder =
|
||||
new DomainTransferResponse.Builder()
|
||||
.setFullyQualifiedDomainName(eppResource.getForeignKey())
|
||||
// TODO(b/25084229): fix exDate computation logic.
|
||||
.setExtendedRegistrationExpirationTime(
|
||||
ADD_EXDATE_STATUSES.contains(transferData.getTransferStatus())
|
||||
? extendRegistrationWithCap(now, domain.getRegistrationExpirationTime(), 1)
|
||||
? transferData.getTransferredRegistrationExpirationTime()
|
||||
: null);
|
||||
}
|
||||
builder.setGainingClientId(transferData.getGainingClientId())
|
||||
@@ -118,16 +115,20 @@ public final class ResourceTransferUtils {
|
||||
if (resource.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
|
||||
TransferData oldTransferData = resource.getTransferData();
|
||||
ofy().delete().keys(oldTransferData.getServerApproveEntities());
|
||||
ofy().save().entity(new PollMessage.OneTime.Builder()
|
||||
.setClientId(oldTransferData.getGainingClientId())
|
||||
.setEventTime(now)
|
||||
.setMsg(TransferStatus.SERVER_CANCELLED.getMessage())
|
||||
.setResponseData(ImmutableList.of(
|
||||
createTransferResponse(newResource, newResource.getTransferData(), now),
|
||||
createPendingTransferNotificationResponse(
|
||||
resource, oldTransferData.getTransferRequestTrid(), false, now)))
|
||||
.setParent(historyEntry)
|
||||
.build());
|
||||
ofy()
|
||||
.save()
|
||||
.entity(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setClientId(oldTransferData.getGainingClientId())
|
||||
.setEventTime(now)
|
||||
.setMsg(TransferStatus.SERVER_CANCELLED.getMessage())
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
createTransferResponse(newResource, newResource.getTransferData()),
|
||||
createPendingTransferNotificationResponse(
|
||||
resource, oldTransferData.getTransferRequestTrid(), false, now)))
|
||||
.setParent(historyEntry)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ public class Cursor extends ImmutableObject {
|
||||
/** Cursor for tracking monthly uploads of ICANN activity reports. */
|
||||
ICANN_UPLOAD_ACTIVITY(Registry.class),
|
||||
|
||||
/** Cursor for tracking monthly upload of MANIFEST.txt to ICANN. */
|
||||
// TODO(sarahbot) Delete this cursor once all data in the database that refers to it is removed.
|
||||
/** Cursor for tracking monthly uploads of MANIFEST.txt to ICANN. No longer used. */
|
||||
@Deprecated
|
||||
ICANN_UPLOAD_MANIFEST(EntityGroupRoot.class);
|
||||
|
||||
/** See the definition of scope on {@link #getScopeClass}. */
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.IgnoreSave;
|
||||
import com.googlecode.objectify.annotation.Index;
|
||||
import com.googlecode.objectify.condition.IfNull;
|
||||
import google.registry.flows.ResourceFlowUtils;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||
@@ -377,28 +378,31 @@ public class DomainBase extends EppResource
|
||||
// exclusive of their ending), and we can just proceed with the transfer.
|
||||
DomainBase domainAtTransferTime =
|
||||
cloneProjectedAtTime(transferExpirationTime.minusMillis(1));
|
||||
|
||||
DateTime expirationDate = transferData.getTransferredRegistrationExpirationTime();
|
||||
if (expirationDate == null) {
|
||||
// Extend the registration by the correct number of years from the expiration time
|
||||
// that was current on the domain right before the transfer, capped at 10 years from
|
||||
// the moment of the transfer.
|
||||
expirationDate =
|
||||
ResourceFlowUtils.computeExDateForApprovalTime(
|
||||
domainAtTransferTime, transferExpirationTime, transferData.getTransferPeriod());
|
||||
}
|
||||
// If we are within an autorenew grace period, the transfer will subsume the autorenew. There
|
||||
// will already be a cancellation written in advance by the transfer request flow, so we don't
|
||||
// need to worry about billing, but we do need to cancel out the expiration time increase.
|
||||
// The transfer period saved in the transfer data will be one year, unless the superuser
|
||||
// extension set the transfer period to zero.
|
||||
int extraYears = transferData.getTransferPeriod().getValue();
|
||||
if (domainAtTransferTime.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW)) {
|
||||
extraYears = 0;
|
||||
}
|
||||
// Set the expiration, autorenew events, and grace period for the transfer. (Transfer ends
|
||||
// all other graces).
|
||||
Builder builder = domainAtTransferTime.asBuilder()
|
||||
// Extend the registration by the correct number of years from the expiration time that
|
||||
// was current on the domain right before the transfer, capped at 10 years from the
|
||||
// moment of the transfer.
|
||||
.setRegistrationExpirationTime(extendRegistrationWithCap(
|
||||
transferExpirationTime,
|
||||
domainAtTransferTime.getRegistrationExpirationTime(),
|
||||
extraYears))
|
||||
// Set the speculatively-written new autorenew events as the domain's autorenew events.
|
||||
.setAutorenewBillingEvent(transferData.getServerApproveAutorenewEvent())
|
||||
.setAutorenewPollMessage(transferData.getServerApproveAutorenewPollMessage());
|
||||
Builder builder =
|
||||
domainAtTransferTime
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(expirationDate)
|
||||
// Set the speculatively-written new autorenew events as the domain's autorenew
|
||||
// events.
|
||||
.setAutorenewBillingEvent(transferData.getServerApproveAutorenewEvent())
|
||||
.setAutorenewPollMessage(transferData.getServerApproveAutorenewPollMessage());
|
||||
if (transferData.getTransferPeriod().getValue() == 1) {
|
||||
// Set the grace period using a key to the prescheduled transfer billing event. Not using
|
||||
// GracePeriod.forBillingEvent() here in order to avoid the actual Datastore fetch.
|
||||
|
||||
@@ -49,7 +49,7 @@ public final class RegistryLockDao {
|
||||
}
|
||||
|
||||
/** Returns all lock objects that this registrar has created. */
|
||||
public static ImmutableList<RegistryLock> getByRegistrarId(String registrarId) {
|
||||
public static ImmutableList<RegistryLock> getLockedDomainsByRegistrarId(String registrarId) {
|
||||
return jpaTm()
|
||||
.transact(
|
||||
() ->
|
||||
@@ -58,7 +58,9 @@ public final class RegistryLockDao {
|
||||
.getEntityManager()
|
||||
.createQuery(
|
||||
"SELECT lock FROM RegistryLock lock WHERE"
|
||||
+ " lock.registrarId = :registrarId",
|
||||
+ " lock.registrarId = :registrarId "
|
||||
+ "AND lock.lockCompletionTimestamp IS NOT NULL "
|
||||
+ "AND lock.unlockCompletionTimestamp IS NULL",
|
||||
RegistryLock.class)
|
||||
.setParameter("registrarId", registrarId)
|
||||
.getResultList()));
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.model.registry.label;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.ImmutableMap.toImmutableMap;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
|
||||
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
|
||||
@@ -31,6 +32,10 @@ import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Embed;
|
||||
@@ -40,6 +45,8 @@ import com.googlecode.objectify.mapper.Mapper;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.label.DomainLabelMetrics.MetricsReservedListMatch;
|
||||
import google.registry.schema.tld.ReservedList.ReservedEntry;
|
||||
import google.registry.schema.tld.ReservedListDao;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -54,6 +61,8 @@ import org.joda.time.DateTime;
|
||||
public final class ReservedList
|
||||
extends BaseDomainLabelList<ReservationType, ReservedList.ReservedListEntry> {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Mapify(ReservedListEntry.LabelMapper.class)
|
||||
Map<String, ReservedListEntry> reservedListMap;
|
||||
|
||||
@@ -222,13 +231,67 @@ public final class ReservedList
|
||||
new CacheLoader<String, ReservedList>() {
|
||||
@Override
|
||||
public ReservedList load(String listName) {
|
||||
return ofy()
|
||||
.load()
|
||||
.type(ReservedList.class)
|
||||
.parent(getCrossTldKey())
|
||||
.id(listName)
|
||||
.now();
|
||||
}});
|
||||
ReservedList datastoreList =
|
||||
ofy()
|
||||
.load()
|
||||
.type(ReservedList.class)
|
||||
.parent(getCrossTldKey())
|
||||
.id(listName)
|
||||
.now();
|
||||
// Also load the list from Cloud SQL, compare the two lists, and log if different.
|
||||
try {
|
||||
loadAndCompareCloudSqlList(datastoreList);
|
||||
} catch (Throwable t) {
|
||||
logger.atSevere().withCause(t).log("Error comparing reserved lists.");
|
||||
}
|
||||
return datastoreList;
|
||||
}
|
||||
});
|
||||
|
||||
private static final void loadAndCompareCloudSqlList(ReservedList datastoreList) {
|
||||
Optional<google.registry.schema.tld.ReservedList> maybeCloudSqlList =
|
||||
ReservedListDao.getLatestRevision(datastoreList.getName());
|
||||
if (maybeCloudSqlList.isPresent()) {
|
||||
Map<String, ReservedEntry> datastoreLabelsToReservations =
|
||||
datastoreList.reservedListMap.entrySet().parallelStream()
|
||||
.collect(
|
||||
toImmutableMap(
|
||||
entry -> entry.getKey(),
|
||||
entry ->
|
||||
ReservedEntry.create(
|
||||
entry.getValue().reservationType, entry.getValue().comment)));
|
||||
|
||||
google.registry.schema.tld.ReservedList cloudSqlList = maybeCloudSqlList.get();
|
||||
MapDifference<String, ReservedEntry> diff =
|
||||
Maps.difference(datastoreLabelsToReservations, cloudSqlList.getLabelsToReservations());
|
||||
if (!diff.areEqual()) {
|
||||
if (diff.entriesDiffering().size() > 10) {
|
||||
logger.atWarning().log(
|
||||
String.format(
|
||||
"Unequal reserved lists detected, Cloud SQL list with revision"
|
||||
+ " id %d has %d different records than the current"
|
||||
+ " Datastore list.",
|
||||
cloudSqlList.getRevisionId(), diff.entriesDiffering().size()));
|
||||
} else {
|
||||
StringBuilder diffMessage = new StringBuilder("Unequal reserved lists detected:\n");
|
||||
diff.entriesDiffering().entrySet().stream()
|
||||
.forEach(
|
||||
entry -> {
|
||||
String label = entry.getKey();
|
||||
ValueDifference<ReservedEntry> valueDiff = entry.getValue();
|
||||
diffMessage.append(
|
||||
String.format(
|
||||
"Domain label %s has entry %s in Datastore and entry"
|
||||
+ " %s in Cloud SQL.\n",
|
||||
label, valueDiff.leftValue(), valueDiff.rightValue()));
|
||||
});
|
||||
logger.atWarning().log(diffMessage.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.atWarning().log("Reserved list in Cloud SQL is empty.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link ReservationType} of a label in a single ReservedList, or returns an absent
|
||||
|
||||
@@ -27,6 +27,10 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.EmbedMap;
|
||||
@@ -40,6 +44,8 @@ import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.annotations.VirtualEntity;
|
||||
import google.registry.model.common.CrossTldSingleton;
|
||||
import google.registry.schema.tmch.ClaimsList;
|
||||
import google.registry.schema.tmch.ClaimsListDao;
|
||||
import google.registry.util.CollectionUtils;
|
||||
import google.registry.util.Concurrent;
|
||||
import google.registry.util.Retrier;
|
||||
@@ -71,6 +77,8 @@ import org.joda.time.DateTime;
|
||||
@NotBackedUp(reason = Reason.EXTERNALLY_SOURCED)
|
||||
public class ClaimsListShard extends ImmutableObject {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
/** The number of claims list entries to store per shard. */
|
||||
private static final int SHARD_SIZE = 10000;
|
||||
|
||||
@@ -112,8 +120,7 @@ public class ClaimsListShard extends ImmutableObject {
|
||||
Concurrent.transform(
|
||||
shardKeys,
|
||||
key ->
|
||||
tm()
|
||||
.transactNewReadOnly(
|
||||
tm().transactNewReadOnly(
|
||||
() -> {
|
||||
ClaimsListShard claimsListShard = ofy().load().key(key).now();
|
||||
checkState(
|
||||
@@ -142,9 +149,52 @@ public class ClaimsListShard extends ImmutableObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
return create(creationTime, ImmutableMap.copyOf(combinedLabelsToKeys));
|
||||
|
||||
ClaimsListShard datastoreList =
|
||||
create(creationTime, ImmutableMap.copyOf(combinedLabelsToKeys));
|
||||
// Also load the list from Cloud SQL, compare the two lists, and log if different.
|
||||
try {
|
||||
loadAndCompareCloudSqlList(datastoreList);
|
||||
} catch (Throwable t) {
|
||||
logger.atSevere().withCause(t).log("Error comparing reserved lists.");
|
||||
}
|
||||
return datastoreList;
|
||||
};
|
||||
|
||||
private static final void loadAndCompareCloudSqlList(ClaimsListShard datastoreList) {
|
||||
Optional<ClaimsList> maybeCloudSqlList = ClaimsListDao.getLatestRevision();
|
||||
if (maybeCloudSqlList.isPresent()) {
|
||||
ClaimsList cloudSqlList = maybeCloudSqlList.get();
|
||||
MapDifference<String, String> diff =
|
||||
Maps.difference(datastoreList.labelsToKeys, cloudSqlList.getLabelsToKeys());
|
||||
if (!diff.areEqual()) {
|
||||
if (diff.entriesDiffering().size() > 10) {
|
||||
logger.atWarning().log(
|
||||
String.format(
|
||||
"Unequal claims lists detected, Cloud SQL list with revision id %d has %d"
|
||||
+ " different records than the current Datastore list.",
|
||||
cloudSqlList.getRevisionId(), diff.entriesDiffering().size()));
|
||||
} else {
|
||||
StringBuilder diffMessage = new StringBuilder("Unequal claims lists detected:\n");
|
||||
diff.entriesDiffering().entrySet().stream()
|
||||
.forEach(
|
||||
entry -> {
|
||||
String label = entry.getKey();
|
||||
ValueDifference<String> valueDiff = entry.getValue();
|
||||
diffMessage.append(
|
||||
String.format(
|
||||
"Domain label %s has key %s in Datastore and key %s in Cloud"
|
||||
+ " SQL.\n",
|
||||
label, valueDiff.leftValue(), valueDiff.rightValue()));
|
||||
});
|
||||
logger.atWarning().log(diffMessage.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.atWarning().log("Claims list in Cloud SQL is empty.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A cached supplier that fetches the claims list shards from Datastore and recombines them into a
|
||||
* single {@link ClaimsListShard} object.
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/** Abstract Hibernate user type for storing/retrieving {@link Set<Enum<E>>}. */
|
||||
public class EnumSetUserType<E extends Enum<E>> extends GenericCollectionUserType<Set<Enum<E>>> {
|
||||
|
||||
@Override
|
||||
Set<Enum<E>> getNewCollection() {
|
||||
return new HashSet<Enum<E>>();
|
||||
}
|
||||
|
||||
@Override
|
||||
ArrayColumnType getColumnType() {
|
||||
return ArrayColumnType.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Set.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence;
|
||||
|
||||
import java.sql.Array;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Collection;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
||||
/** Generic Hibernate user type to store/retrieve Java collection as an array in Cloud SQL. */
|
||||
public abstract class GenericCollectionUserType<T extends Collection> extends MutableUserType {
|
||||
|
||||
abstract T getNewCollection();
|
||||
|
||||
abstract ArrayColumnType getColumnType();
|
||||
|
||||
enum ArrayColumnType {
|
||||
STRING(Types.ARRAY, "text");
|
||||
|
||||
final int typeCode;
|
||||
final String typeName;
|
||||
|
||||
ArrayColumnType(int typeCode, String typeName) {
|
||||
this.typeCode = typeCode;
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
int getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
String getTypeDdlName() {
|
||||
return typeName + "[]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {getColumnType().getTypeCode()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nullSafeGet(
|
||||
ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
if (rs.getArray(names[0]) != null) {
|
||||
T result = getNewCollection();
|
||||
for (Object element : (Object[]) rs.getArray(names[0]).getArray()) {
|
||||
result.add(convertToElem(element));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nullSafeSet(
|
||||
PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
if (value == null) {
|
||||
st.setArray(index, null);
|
||||
return;
|
||||
}
|
||||
T list = (T) value;
|
||||
Array arr = st.getConnection().createArrayOf(getColumnType().getTypeName(), list.toArray());
|
||||
st.setArray(index, arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this to convert an element value retrieved from the database to a different type.
|
||||
*
|
||||
* <p>This method is useful when encoding a java type to one of the types that can be used as an
|
||||
* array element.
|
||||
*/
|
||||
protected Object convertToElem(Object columnValue) {
|
||||
return columnValue;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ import org.hibernate.tool.schema.TargetType;
|
||||
|
||||
/** Utility class to export DDL script for given {@link javax.persistence.Entity} classes. */
|
||||
public class HibernateSchemaExporter {
|
||||
// Hibernate proprietary mappings.
|
||||
private static final String HIBERNATE_MAPPING_RESOURCES = "META-INF/orm.xml";
|
||||
|
||||
private final String jdbcUrl;
|
||||
private final String username;
|
||||
private final String password;
|
||||
@@ -63,6 +66,7 @@ public class HibernateSchemaExporter {
|
||||
try (StandardServiceRegistry registry =
|
||||
new StandardServiceRegistryBuilder().applySettings(settings).build()) {
|
||||
MetadataSources metadata = new MetadataSources(registry);
|
||||
metadata.addResource(HIBERNATE_MAPPING_RESOURCES);
|
||||
|
||||
// Note that we need to also add all converters to the Hibernate context because
|
||||
// the entity class may use the customized type.
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
/**
|
||||
* A custom {@link UserType} used to convert a Java {@link Map<String, String>} to/from PostgreSQL
|
||||
* hstore type. Per this <a href="https://www.postgresql.org/docs/current/hstore.html">doc</a>, as
|
||||
* hstore keys and values are simply text strings, the type of key and value in the Java map has to
|
||||
* be {@link String} as well.
|
||||
*/
|
||||
public class MapUserType extends MutableUserType {
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {Types.OTHER};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nullSafeGet(
|
||||
ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
return rs.getObject(names[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nullSafeSet(
|
||||
PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
st.setObject(index, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
/**
|
||||
* An abstract class represents a mutable Hibernate user type which implements related methods
|
||||
* defined in {@link UserType}.
|
||||
*/
|
||||
public abstract class MutableUserType implements UserType {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
return Objects.equals(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x == null ? 0 : x.hashCode();
|
||||
}
|
||||
|
||||
// TODO(b/147489651): Investigate how to properly implement the below methods.
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable disassemble(Object value) throws HibernateException {
|
||||
return (Serializable) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return cached;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
package google.registry.persistence;
|
||||
|
||||
import google.registry.persistence.GenericCollectionUserType.ArrayColumnType;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.dialect.PostgreSQL95Dialect;
|
||||
|
||||
@@ -23,5 +24,9 @@ public class NomulusPostgreSQLDialect extends PostgreSQL95Dialect {
|
||||
registerColumnType(Types.VARCHAR, "text");
|
||||
registerColumnType(Types.TIMESTAMP_WITH_TIMEZONE, "timestamptz");
|
||||
registerColumnType(Types.TIMESTAMP, "timestamptz");
|
||||
registerColumnType(Types.OTHER, "hstore");
|
||||
for (ArrayColumnType arrayType : ArrayColumnType.values()) {
|
||||
registerColumnType(arrayType.getTypeCode(), arrayType.getTypeDdlName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
|
||||
/** Abstract Hibernate user type for storing/retrieving {@link List<String>}. */
|
||||
public class StringListUserType extends GenericCollectionUserType<List<String>> {
|
||||
|
||||
@Override
|
||||
List<String> getNewCollection() {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
ArrayColumnType getColumnType() {
|
||||
return ArrayColumnType.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return List.class;
|
||||
}
|
||||
}
|
||||
+21
-12
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
||||
// Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -12,17 +12,26 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
package google.registry.persistence;
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = [
|
||||
"${rootDir}/third_party/junit/"
|
||||
]
|
||||
include '**/*.java'
|
||||
}
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Set;
|
||||
|
||||
/** Abstract Hibernate user type for storing/retrieving {@link Set<String>}. */
|
||||
public class StringSetUserType extends GenericCollectionUserType<Set<String>> {
|
||||
|
||||
@Override
|
||||
Set<String> getNewCollection() {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
ArrayColumnType getColumnType() {
|
||||
return ArrayColumnType.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Set.class;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.rde.RdeMode;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.util.Idn;
|
||||
import google.registry.xjc.domain.XjcDomainContactAttrType;
|
||||
import google.registry.xjc.domain.XjcDomainContactType;
|
||||
@@ -45,7 +44,6 @@ import google.registry.xjc.rgp.XjcRgpStatusType;
|
||||
import google.registry.xjc.rgp.XjcRgpStatusValueType;
|
||||
import google.registry.xjc.secdns.XjcSecdnsDsDataType;
|
||||
import google.registry.xjc.secdns.XjcSecdnsDsOrKeyType;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Utility class that turns {@link DomainBase} as {@link XjcRdeDomainElement}. */
|
||||
final class DomainBaseToXjcConverter {
|
||||
@@ -241,8 +239,7 @@ final class DomainBaseToXjcConverter {
|
||||
// empty transfer records to get generated for deleted domains.
|
||||
// TODO(b/33289763): remove the hasGainingAndLosingRegistrars check in February 2017
|
||||
if (hasGainingAndLosingRegistrars(model)) {
|
||||
bean.setTrnData(convertTransferData(model.getTransferData(),
|
||||
model.getRegistrationExpirationTime()));
|
||||
bean.setTrnData(convertTransferData(model.getTransferData()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +258,7 @@ final class DomainBaseToXjcConverter {
|
||||
}
|
||||
|
||||
/** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */
|
||||
private static XjcRdeDomainTransferDataType convertTransferData(
|
||||
TransferData model, DateTime domainExpires) {
|
||||
private static XjcRdeDomainTransferDataType convertTransferData(TransferData model) {
|
||||
XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType();
|
||||
bean.setTrStatus(
|
||||
XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
|
||||
@@ -270,12 +266,7 @@ final class DomainBaseToXjcConverter {
|
||||
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId()));
|
||||
bean.setReDate(model.getTransferRequestTime());
|
||||
bean.setAcDate(model.getPendingTransferExpirationTime());
|
||||
// TODO(b/25084229): fix exDate computation logic.
|
||||
if (model.getTransferStatus() == TransferStatus.PENDING) {
|
||||
bean.setExDate(domainExpires.plusYears(1));
|
||||
} else {
|
||||
bean.setExDate(domainExpires);
|
||||
}
|
||||
bean.setExDate(model.getTransferredRegistrationExpirationTime());
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
+17
-26
@@ -20,7 +20,6 @@ import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
|
||||
import static google.registry.model.common.Cursor.getCursorTimeOrStartOfTime;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.reporting.icann.IcannReportingModule.MANIFEST_FILE_NAME;
|
||||
import static google.registry.reporting.icann.IcannReportingModule.PARAM_SUBDIR;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
@@ -65,8 +64,9 @@ import org.joda.time.Duration;
|
||||
* Action that uploads the monthly activity/transactions reports from GCS to ICANN via an HTTP PUT.
|
||||
*
|
||||
* <p>This should be run after {@link IcannReportingStagingAction}, which writes out the month's
|
||||
* reports and a MANIFEST.txt file. This action reads the filenames from the MANIFEST.txt, and
|
||||
* attempts to upload every file in the manifest to ICANN's endpoint.
|
||||
* reports and a MANIFEST.txt file. This action checks each ICANN_UPLOAD_TX and
|
||||
* ICANN_UPLOAD_ACTIVITY cursor and uploads the corresponding report if the cursor time is before
|
||||
* now.
|
||||
*
|
||||
* <p>Parameters:
|
||||
*
|
||||
@@ -181,32 +181,22 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||
|
||||
// Set cursor to first day of next month if the upload succeeded
|
||||
if (success) {
|
||||
Cursor newCursor;
|
||||
if (cursorType.equals(CursorType.ICANN_UPLOAD_MANIFEST)) {
|
||||
newCursor =
|
||||
Cursor.createGlobal(
|
||||
cursorType, cursorTime.withTimeAtStartOfDay().withDayOfMonth(1).plusMonths(1));
|
||||
} else {
|
||||
newCursor =
|
||||
Cursor.create(
|
||||
cursorType,
|
||||
cursorTime.withTimeAtStartOfDay().withDayOfMonth(1).plusMonths(1),
|
||||
Registry.get(tldStr));
|
||||
}
|
||||
Cursor newCursor =
|
||||
Cursor.create(
|
||||
cursorType,
|
||||
cursorTime.withTimeAtStartOfDay().withDayOfMonth(1).plusMonths(1),
|
||||
Registry.get(tldStr));
|
||||
tm().transact(() -> ofy().save().entity(newCursor));
|
||||
}
|
||||
}
|
||||
|
||||
private String getFileName(CursorType cursorType, DateTime cursorTime, String tld) {
|
||||
if (cursorType.equals(CursorType.ICANN_UPLOAD_MANIFEST)) {
|
||||
return MANIFEST_FILE_NAME;
|
||||
}
|
||||
return String.format(
|
||||
"%s%s%d%02d.csv",
|
||||
tld,
|
||||
(cursorType.equals(CursorType.ICANN_UPLOAD_ACTIVITY) ? "-activity-" : "-transactions-"),
|
||||
cursorTime.year().get(),
|
||||
cursorTime.monthOfYear().get());
|
||||
cursorTime.withDayOfMonth(1).minusMonths(1).monthOfYear().get());
|
||||
}
|
||||
|
||||
/** Returns a map of each cursor to the CursorType and tld. */
|
||||
@@ -222,7 +212,6 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||
ImmutableSet.Builder<Key<Cursor>> keys = new ImmutableSet.Builder<>();
|
||||
keys.addAll(activityKeyMap.keySet());
|
||||
keys.addAll(transactionKeyMap.keySet());
|
||||
keys.add(Cursor.createGlobalKey(CursorType.ICANN_UPLOAD_MANIFEST));
|
||||
|
||||
Map<Key<Cursor>, Cursor> cursorMap = ofy().load().keys(keys.build());
|
||||
ImmutableMap.Builder<Cursor, CursorInfo> cursors = new ImmutableMap.Builder<>();
|
||||
@@ -230,11 +219,6 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||
activityKeyMap, CursorType.ICANN_UPLOAD_ACTIVITY, cursorMap, cursors);
|
||||
defaultNullCursorsToNextMonthAndAddToMap(
|
||||
transactionKeyMap, CursorType.ICANN_UPLOAD_TX, cursorMap, cursors);
|
||||
Cursor manifestCursor =
|
||||
cursorMap.getOrDefault(
|
||||
Cursor.createGlobalKey(CursorType.ICANN_UPLOAD_MANIFEST),
|
||||
Cursor.createGlobal(CursorType.ICANN_UPLOAD_MANIFEST, clock.nowUtc().minusDays(1)));
|
||||
cursors.put(manifestCursor, CursorInfo.create(CursorType.ICANN_UPLOAD_MANIFEST, null));
|
||||
return cursors.build();
|
||||
}
|
||||
|
||||
@@ -259,7 +243,14 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||
// report staged for upload.
|
||||
Cursor cursor =
|
||||
cursorMap.getOrDefault(
|
||||
key, Cursor.create(type, clock.nowUtc().minusDays(1), registry));
|
||||
key,
|
||||
Cursor.create(
|
||||
type,
|
||||
clock.nowUtc().withDayOfMonth(1).withTimeAtStartOfDay().plusMonths(1),
|
||||
registry));
|
||||
if (!cursorMap.containsValue(cursor)) {
|
||||
tm().transact(() -> ofy().save().entity(cursor));
|
||||
}
|
||||
cursors.put(cursor, CursorInfo.create(type, registry.getTldStr()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,13 +21,12 @@ import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.CreateAutoTimestamp;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.UpdateAutoTimestamp;
|
||||
import google.registry.util.DateTimeUtils;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Optional;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
@@ -70,12 +69,6 @@ import org.joda.time.DateTime;
|
||||
})
|
||||
public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
|
||||
/** Describes the action taken by the user. */
|
||||
public enum Action {
|
||||
LOCK,
|
||||
UNLOCK
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(nullable = false)
|
||||
@@ -99,28 +92,26 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
/** The POC that performed the action, or null if it was a superuser. */
|
||||
private String registrarPocId;
|
||||
|
||||
/**
|
||||
* Lock action is immutable and describes whether the action performed was a lock or an unlock.
|
||||
*/
|
||||
@Enumerated(EnumType.STRING)
|
||||
/** When the lock is first requested. */
|
||||
@Column(nullable = false)
|
||||
private Action action;
|
||||
private CreateAutoTimestamp lockRequestTimestamp = CreateAutoTimestamp.create(null);
|
||||
|
||||
/** Creation timestamp is when the lock/unlock is first requested. */
|
||||
@Column(nullable = false)
|
||||
private CreateAutoTimestamp creationTimestamp = CreateAutoTimestamp.create(null);
|
||||
/** When the unlock is first requested. */
|
||||
private ZonedDateTime unlockRequestTimestamp;
|
||||
|
||||
/**
|
||||
* Completion timestamp is when the user has verified the lock/unlock, when this object de facto
|
||||
* becomes immutable. If this field is null, it means that the lock has not been verified yet (and
|
||||
* thus not been put into effect).
|
||||
* When the user has verified the lock. If this field is null, it means the lock has not been
|
||||
* verified yet (and thus not been put into effect).
|
||||
*/
|
||||
private ZonedDateTime completionTimestamp;
|
||||
private ZonedDateTime lockCompletionTimestamp;
|
||||
|
||||
/**
|
||||
* The user must provide the random verification code in order to complete the lock and move the
|
||||
* status from PENDING to COMPLETED.
|
||||
* When the user has verified the unlock of this lock. If this field is null, it means the unlock
|
||||
* action has not been verified yet (and has not been put into effect).
|
||||
*/
|
||||
private ZonedDateTime unlockCompletionTimestamp;
|
||||
|
||||
/** The user must provide the random verification code in order to complete the action. */
|
||||
@Column(nullable = false)
|
||||
private String verificationCode;
|
||||
|
||||
@@ -131,6 +122,9 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
@Column(nullable = false)
|
||||
private boolean isSuperuser;
|
||||
|
||||
/** Time that this entity was last updated. */
|
||||
private UpdateAutoTimestamp lastUpdateTimestamp;
|
||||
|
||||
public String getRepoId() {
|
||||
return repoId;
|
||||
}
|
||||
@@ -147,17 +141,25 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
return registrarPocId;
|
||||
}
|
||||
|
||||
public Action getAction() {
|
||||
return action;
|
||||
public DateTime getLockRequestTimestamp() {
|
||||
return lockRequestTimestamp.getTimestamp();
|
||||
}
|
||||
|
||||
public DateTime getCreationTimestamp() {
|
||||
return creationTimestamp.getTimestamp();
|
||||
/** Returns the unlock request timestamp or null if an unlock has not been requested yet. */
|
||||
public Optional<DateTime> getUnlockRequestTimestamp() {
|
||||
return Optional.ofNullable(unlockRequestTimestamp).map(DateTimeUtils::toJodaDateTime);
|
||||
}
|
||||
|
||||
/** Returns the completion timestamp, or empty if this lock has not been completed yet. */
|
||||
public Optional<DateTime> getCompletionTimestamp() {
|
||||
return Optional.ofNullable(completionTimestamp).map(DateTimeUtils::toJodaDateTime);
|
||||
public Optional<DateTime> getLockCompletionTimestamp() {
|
||||
return Optional.ofNullable(lockCompletionTimestamp).map(DateTimeUtils::toJodaDateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock completion timestamp, or empty if this unlock has not been completed yet.
|
||||
*/
|
||||
public Optional<DateTime> getUnlockCompletionTimestamp() {
|
||||
return Optional.ofNullable(unlockCompletionTimestamp).map(DateTimeUtils::toJodaDateTime);
|
||||
}
|
||||
|
||||
public String getVerificationCode() {
|
||||
@@ -168,16 +170,16 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
return isSuperuser;
|
||||
}
|
||||
|
||||
public DateTime getLastUpdateTimestamp() {
|
||||
return lastUpdateTimestamp.getTimestamp();
|
||||
}
|
||||
|
||||
public Long getRevisionId() {
|
||||
return revisionId;
|
||||
}
|
||||
|
||||
public void setCompletionTimestamp(DateTime dateTime) {
|
||||
this.completionTimestamp = toZonedDateTime(dateTime);
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return completionTimestamp != null;
|
||||
public boolean isLocked() {
|
||||
return lockCompletionTimestamp != null && unlockCompletionTimestamp == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,8 +200,7 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
checkArgumentNotNull(getInstance().repoId, "Repo ID cannot be null");
|
||||
checkArgumentNotNull(getInstance().domainName, "Domain name cannot be null");
|
||||
checkArgumentNotNull(getInstance().registrarId, "Registrar ID cannot be null");
|
||||
checkArgumentNotNull(getInstance().action, "Action cannot be null");
|
||||
checkArgumentNotNull(getInstance().verificationCode, "Verification codecannot be null");
|
||||
checkArgumentNotNull(getInstance().verificationCode, "Verification code cannot be null");
|
||||
checkArgument(
|
||||
getInstance().registrarPocId != null || getInstance().isSuperuser,
|
||||
"Registrar POC ID must be provided if superuser is false");
|
||||
@@ -226,18 +227,18 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAction(Action action) {
|
||||
getInstance().action = action;
|
||||
public Builder setUnlockRequestTimestamp(DateTime unlockRequestTimestamp) {
|
||||
getInstance().unlockRequestTimestamp = toZonedDateTime(unlockRequestTimestamp);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCreationTimestamp(CreateAutoTimestamp creationTimestamp) {
|
||||
getInstance().creationTimestamp = creationTimestamp;
|
||||
public Builder setLockCompletionTimestamp(DateTime lockCompletionTimestamp) {
|
||||
getInstance().lockCompletionTimestamp = toZonedDateTime(lockCompletionTimestamp);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCompletionTimestamp(DateTime lockTimestamp) {
|
||||
getInstance().completionTimestamp = toZonedDateTime(lockTimestamp);
|
||||
public Builder setUnlockCompletionTimestamp(DateTime unlockCompletionTimestamp) {
|
||||
getInstance().unlockCompletionTimestamp = toZonedDateTime(unlockCompletionTimestamp);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +66,15 @@ public class PremiumListDao {
|
||||
jpaTm()
|
||||
.transact(
|
||||
() -> {
|
||||
checkArgument(
|
||||
checkExists(premiumList.getName()),
|
||||
"Can't update non-existent premium list '%s'",
|
||||
premiumList.getName());
|
||||
// This check is currently disabled because, during the Cloud SQL migration, we need
|
||||
// to be able to update premium lists in Datastore while simultaneously creating their
|
||||
// first revision in Cloud SQL (i.e. if they haven't been migrated over yet).
|
||||
// TODO(b/147246613): Reinstate this once all premium lists are migrated to Cloud SQL,
|
||||
// and re-enable the test update_throwsWhenListDoesntExist().
|
||||
// checkArgument(
|
||||
// checkExists(premiumList.getName()),
|
||||
// "Can't update non-existent premium list '%s'",
|
||||
// premiumList.getName());
|
||||
jpaTm().getEntityManager().persist(premiumList);
|
||||
});
|
||||
}
|
||||
@@ -80,7 +85,7 @@ public class PremiumListDao {
|
||||
* <p>Note that this does not load <code>PremiumList.labelsToPrices</code>! If you need to check
|
||||
* prices, use {@link #getPremiumPrice}.
|
||||
*/
|
||||
static Optional<PremiumList> getLatestRevision(String premiumListName) {
|
||||
public static Optional<PremiumList> getLatestRevision(String premiumListName) {
|
||||
return jpaTm()
|
||||
.transact(
|
||||
() ->
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.schema.tld;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import google.registry.model.registry.label.PremiumList.PremiumListEntry;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Static utility methods for {@link PremiumList}. */
|
||||
public class PremiumListUtils {
|
||||
|
||||
public static PremiumList parseToPremiumList(String name, String inputData) {
|
||||
List<String> inputDataPreProcessed =
|
||||
Splitter.on('\n').omitEmptyStrings().splitToList(inputData);
|
||||
|
||||
ImmutableMap<String, PremiumListEntry> prices =
|
||||
new google.registry.model.registry.label.PremiumList.Builder()
|
||||
.setName(name)
|
||||
.build()
|
||||
.parse(inputDataPreProcessed);
|
||||
ImmutableSet<CurrencyUnit> currencies =
|
||||
prices.values().stream()
|
||||
.map(e -> e.getValue().getCurrencyUnit())
|
||||
.distinct()
|
||||
.collect(toImmutableSet());
|
||||
checkArgument(
|
||||
currencies.size() == 1,
|
||||
"The Cloud SQL schema requires exactly one currency, but got: %s",
|
||||
ImmutableSortedSet.copyOf(currencies));
|
||||
CurrencyUnit currency = Iterables.getOnlyElement(currencies);
|
||||
|
||||
Map<String, BigDecimal> priceAmounts =
|
||||
Maps.transformValues(prices, ple -> ple.getValue().getAmount());
|
||||
return google.registry.schema.tld.PremiumList.create(name, currency, priceAmounts);
|
||||
}
|
||||
|
||||
private PremiumListUtils() {}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.schema.tld;
|
||||
|
||||
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
/** Caching utils for {@link ReservedList} */
|
||||
public class ReservedListCache {
|
||||
|
||||
/**
|
||||
* In-memory cache for reserved lists.
|
||||
*
|
||||
* <p>This is cached for a shorter duration because we need to periodically reload from the DB to
|
||||
* check if a new revision has been published, and if so, then use that.
|
||||
*/
|
||||
@NonFinalForTesting
|
||||
static LoadingCache<String, Optional<ReservedList>> cacheReservedLists =
|
||||
createCacheReservedLists(getDomainLabelListCacheDuration());
|
||||
|
||||
@VisibleForTesting
|
||||
static LoadingCache<String, Optional<ReservedList>> createCacheReservedLists(
|
||||
Duration cachePersistDuration) {
|
||||
return CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(cachePersistDuration.getMillis(), MILLISECONDS)
|
||||
.build(
|
||||
new CacheLoader<String, Optional<ReservedList>>() {
|
||||
@Override
|
||||
public Optional<ReservedList> load(String reservedListName) {
|
||||
return ReservedListDao.getLatestRevision(reservedListName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,10 @@ package google.registry.schema.tld;
|
||||
|
||||
import static google.registry.model.transaction.TransactionManagerFactory.jpaTm;
|
||||
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/** Data access object class for {@link ReservedList} */
|
||||
public class ReservedListDao {
|
||||
|
||||
@@ -43,5 +47,38 @@ public class ReservedListDao {
|
||||
> 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most recent revision of the {@link ReservedList} with the specified name, if it
|
||||
* exists. TODO(shicong): Change this method to package level access after dual-read phase.
|
||||
*/
|
||||
public static Optional<ReservedList> getLatestRevision(String reservedListName) {
|
||||
return jpaTm()
|
||||
.transact(
|
||||
() ->
|
||||
jpaTm()
|
||||
.getEntityManager()
|
||||
.createQuery(
|
||||
"FROM ReservedList rl LEFT JOIN FETCH rl.labelsToReservations WHERE"
|
||||
+ " rl.revisionId IN (SELECT MAX(revisionId) FROM ReservedList subrl"
|
||||
+ " WHERE subrl.name = :name)",
|
||||
ReservedList.class)
|
||||
.setParameter("name", reservedListName)
|
||||
.getResultStream()
|
||||
.findFirst());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most recent revision of the {@link ReservedList} with the specified name, from
|
||||
* cache.
|
||||
*/
|
||||
public static Optional<ReservedList> getLatestRevisionCached(String reservedListName) {
|
||||
try {
|
||||
return ReservedListCache.cacheReservedLists.get(reservedListName);
|
||||
} catch (ExecutionException e) {
|
||||
throw new UncheckedExecutionException(
|
||||
"Could not retrieve reserved list named " + reservedListName, e);
|
||||
}
|
||||
}
|
||||
|
||||
private ReservedListDao() {}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
|
||||
package google.registry.schema.tmch;
|
||||
|
||||
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
|
||||
import static google.registry.model.CacheUtils.tryMemoizeWithExpiration;
|
||||
import static google.registry.model.transaction.TransactionManagerFactory.jpaTm;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
import java.util.Optional;
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
/** Data access object for {@link ClaimsList}. */
|
||||
@@ -24,6 +29,11 @@ public class ClaimsListDao {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
/** In-memory cache for claims list. */
|
||||
@NonFinalForTesting
|
||||
private static Supplier<Optional<ClaimsList>> cacheClaimsList =
|
||||
tryMemoizeWithExpiration(getDomainLabelListCacheDuration(), ClaimsListDao::getLatestRevision);
|
||||
|
||||
private static void save(ClaimsList claimsList) {
|
||||
jpaTm().transact(() -> jpaTm().getEntityManager().persist(claimsList));
|
||||
}
|
||||
@@ -47,10 +57,12 @@ public class ClaimsListDao {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current revision of the {@link ClaimsList} in Cloud SQL. Throws exception if there
|
||||
* is no claims in the table.
|
||||
* Returns the most recent revision of the {@link ClaimsList} in Cloud SQL, if it exists.
|
||||
* TODO(shicong): Change this method to package level access after dual-read phase.
|
||||
* ClaimsListShard uses this method to retrieve claims list in Cloud SQL for the comparison, and
|
||||
* ClaimsListShard is not in this package.
|
||||
*/
|
||||
public static ClaimsList getCurrent() {
|
||||
public static Optional<ClaimsList> getLatestRevision() {
|
||||
return jpaTm()
|
||||
.transact(
|
||||
() -> {
|
||||
@@ -63,9 +75,15 @@ public class ClaimsListDao {
|
||||
+ " :revisionId",
|
||||
ClaimsList.class)
|
||||
.setParameter("revisionId", revisionId)
|
||||
.getSingleResult();
|
||||
.getResultStream()
|
||||
.findFirst();
|
||||
});
|
||||
}
|
||||
|
||||
/** Returns the most recent revision of the {@link ClaimsList}, from cache. */
|
||||
public static Optional<ClaimsList> getLatestRevisionCached() {
|
||||
return cacheClaimsList.get();
|
||||
}
|
||||
|
||||
private ClaimsListDao() {}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package google.registry.tools;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static google.registry.security.JsonHttp.JSON_SAFETY_PREFIX;
|
||||
import static google.registry.tools.server.CreateOrUpdatePremiumListAction.ALSO_CLOUD_SQL_PARAM;
|
||||
import static google.registry.tools.server.CreateOrUpdatePremiumListAction.INPUT_PARAM;
|
||||
import static google.registry.tools.server.CreateOrUpdatePremiumListAction.NAME_PARAM;
|
||||
import static google.registry.util.ListNamingUtils.convertFilePathToName;
|
||||
@@ -58,12 +57,6 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
|
||||
required = true)
|
||||
Path inputFile;
|
||||
|
||||
@Parameter(
|
||||
names = {"--also_cloud_sql"},
|
||||
description =
|
||||
"Persist premium list to Cloud SQL in addition to Datastore; defaults to false.")
|
||||
boolean alsoCloudSql;
|
||||
|
||||
protected AppEngineConnection connection;
|
||||
protected int inputLineCount;
|
||||
|
||||
@@ -97,7 +90,6 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
|
||||
public String execute() throws Exception {
|
||||
ImmutableMap.Builder<String, String> params = new ImmutableMap.Builder<>();
|
||||
params.put(NAME_PARAM, name);
|
||||
params.put(ALSO_CLOUD_SQL_PARAM, Boolean.toString(alsoCloudSql));
|
||||
String inputFileContents = new String(Files.readAllBytes(inputFile), UTF_8);
|
||||
String requestBody =
|
||||
Joiner.on('&').withKeyValueSeparator("=").join(
|
||||
|
||||
@@ -62,10 +62,16 @@ final class UpdateReservedListCommand extends CreateOrUpdateReservedListCommand
|
||||
jpaTm()
|
||||
.transact(
|
||||
() -> {
|
||||
checkArgument(
|
||||
ReservedListDao.checkExists(cloudSqlReservedList.getName()),
|
||||
"A reserved list of this name doesn't exist: %s.",
|
||||
cloudSqlReservedList.getName());
|
||||
// This check is currently disabled because, during the Cloud SQL migration, we need
|
||||
// to be able to update reserved lists in Datastore while simultaneously creating
|
||||
// their first revision in Cloud SQL (i.e. if they haven't been migrated over yet).
|
||||
// TODO(shicong): Re-instate this once all reserved lists are migrated to Cloud SQL,
|
||||
// and add a unit test to verity that an exception will be thrown if
|
||||
// the reserved list doesn't exist.
|
||||
// checkArgument(
|
||||
// ReservedListDao.checkExists(cloudSqlReservedList.getName()),
|
||||
// "A reserved list of this name doesn't exist: %s.",
|
||||
// cloudSqlReservedList.getName());
|
||||
ReservedListDao.save(cloudSqlReservedList);
|
||||
});
|
||||
}
|
||||
|
||||
+6
-49
@@ -14,26 +14,13 @@
|
||||
|
||||
package google.registry.tools.server;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.flogger.LazyArgs.lazy;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.model.registry.label.PremiumList;
|
||||
import google.registry.model.registry.label.PremiumList.PremiumListEntry;
|
||||
import google.registry.request.JsonResponse;
|
||||
import google.registry.request.Parameter;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
|
||||
/** Abstract base class for actions that update premium lists. */
|
||||
public abstract class CreateOrUpdatePremiumListAction implements Runnable {
|
||||
@@ -44,7 +31,6 @@ public abstract class CreateOrUpdatePremiumListAction implements Runnable {
|
||||
|
||||
public static final String NAME_PARAM = "name";
|
||||
public static final String INPUT_PARAM = "inputData";
|
||||
public static final String ALSO_CLOUD_SQL_PARAM = "alsoCloudSql";
|
||||
|
||||
@Inject JsonResponse response;
|
||||
|
||||
@@ -56,10 +42,6 @@ public abstract class CreateOrUpdatePremiumListAction implements Runnable {
|
||||
@Parameter(INPUT_PARAM)
|
||||
String inputData;
|
||||
|
||||
@Inject
|
||||
@Parameter(ALSO_CLOUD_SQL_PARAM)
|
||||
boolean alsoCloudSql;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -76,40 +58,15 @@ public abstract class CreateOrUpdatePremiumListAction implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (alsoCloudSql) {
|
||||
try {
|
||||
saveToCloudSql();
|
||||
} catch (Throwable e) {
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Unexpected error saving premium list to Cloud SQL from nomulus tool command");
|
||||
response.setPayload(ImmutableMap.of("error", e.toString(), "status", "error"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
saveToCloudSql();
|
||||
} catch (Throwable e) {
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Unexpected error saving premium list to Cloud SQL from nomulus tool command");
|
||||
response.setPayload(ImmutableMap.of("error", e.toString(), "status", "error"));
|
||||
}
|
||||
}
|
||||
|
||||
google.registry.schema.tld.PremiumList parseInputToPremiumList() {
|
||||
List<String> inputDataPreProcessed =
|
||||
Splitter.on('\n').omitEmptyStrings().splitToList(inputData);
|
||||
|
||||
ImmutableMap<String, PremiumListEntry> prices =
|
||||
new PremiumList.Builder().setName(name).build().parse(inputDataPreProcessed);
|
||||
ImmutableSet<CurrencyUnit> currencies =
|
||||
prices.values().stream()
|
||||
.map(e -> e.getValue().getCurrencyUnit())
|
||||
.distinct()
|
||||
.collect(toImmutableSet());
|
||||
checkArgument(
|
||||
currencies.size() == 1,
|
||||
"The Cloud SQL schema requires exactly one currency, but got: %s",
|
||||
ImmutableSortedSet.copyOf(currencies));
|
||||
CurrencyUnit currency = Iterables.getOnlyElement(currencies);
|
||||
|
||||
Map<String, BigDecimal> priceAmounts =
|
||||
Maps.transformValues(prices, ple -> ple.getValue().getAmount());
|
||||
return google.registry.schema.tld.PremiumList.create(name, currency, priceAmounts);
|
||||
}
|
||||
|
||||
/** Logs the premium list data at INFO, truncated if too long. */
|
||||
void logInputData() {
|
||||
logger.atInfo().log(
|
||||
|
||||
@@ -19,6 +19,7 @@ import static google.registry.model.registry.Registries.assertTldExists;
|
||||
import static google.registry.model.registry.label.PremiumListUtils.doesPremiumListExist;
|
||||
import static google.registry.model.registry.label.PremiumListUtils.savePremiumListAndEntries;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.schema.tld.PremiumListUtils.parseToPremiumList;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -81,7 +82,7 @@ public class CreatePremiumListAction extends CreateOrUpdatePremiumListAction {
|
||||
logger.atInfo().log("Saving premium list to Cloud SQL for TLD %s", name);
|
||||
// TODO(mcilwain): Call logInputData() here once Datastore persistence is removed.
|
||||
|
||||
google.registry.schema.tld.PremiumList premiumList = parseInputToPremiumList();
|
||||
google.registry.schema.tld.PremiumList premiumList = parseToPremiumList(name, inputData);
|
||||
PremiumListDao.saveNew(premiumList);
|
||||
|
||||
String message =
|
||||
|
||||
@@ -60,12 +60,6 @@ public class ToolsServerModule {
|
||||
return extractRequiredParameter(req, CreatePremiumListAction.INPUT_PARAM);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Parameter("alsoCloudSql")
|
||||
static boolean provideAlsoCloudSql(HttpServletRequest req) {
|
||||
return extractBooleanParameter(req, CreatePremiumListAction.ALSO_CLOUD_SQL_PARAM);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Parameter("premiumListName")
|
||||
static String provideName(HttpServletRequest req) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package google.registry.tools.server;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static google.registry.model.registry.label.PremiumListUtils.savePremiumListAndEntries;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.schema.tld.PremiumListUtils.parseToPremiumList;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -24,6 +25,7 @@ import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.model.registry.label.PremiumList;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.schema.tld.PremiumListDao;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
@@ -68,10 +70,17 @@ public class UpdatePremiumListAction extends CreateOrUpdatePremiumListAction {
|
||||
response.setPayload(ImmutableMap.of("status", "success", "message", message));
|
||||
}
|
||||
|
||||
// TODO(mcilwain): Implement this in a subsequent PR.
|
||||
@Override
|
||||
protected void saveToCloudSql() {
|
||||
throw new UnsupportedOperationException(
|
||||
"Updating of premium lists in Cloud SQL is not supported yet");
|
||||
logger.atInfo().log("Updating premium list '%s' in Cloud SQL.", name);
|
||||
// TODO(mcilwain): Add logInputData() call here once DB migration is complete.
|
||||
google.registry.schema.tld.PremiumList premiumList = parseToPremiumList(name, inputData);
|
||||
PremiumListDao.update(premiumList);
|
||||
String message =
|
||||
String.format(
|
||||
"Updated premium list '%s' with %d entries.",
|
||||
premiumList.getName(), premiumList.getLabelsToPrices().size());
|
||||
logger.atInfo().log(message);
|
||||
// TODO(mcilwain): Call response.setPayload() here once DB migration is complete.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,11 +149,9 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
||||
}
|
||||
|
||||
private ImmutableList<ImmutableMap<String, ?>> getLockedDomains(String clientId) {
|
||||
ImmutableList<RegistryLock> locks =
|
||||
RegistryLockDao.getByRegistrarId(clientId).stream()
|
||||
.filter(RegistryLock::isVerified)
|
||||
.collect(toImmutableList());
|
||||
return locks.stream().map(this::lockToMap).collect(toImmutableList());
|
||||
return RegistryLockDao.getLockedDomainsByRegistrarId(clientId).stream()
|
||||
.map(this::lockToMap)
|
||||
.collect(toImmutableList());
|
||||
}
|
||||
|
||||
private ImmutableMap<String, ?> lockToMap(RegistryLock lock) {
|
||||
@@ -161,7 +159,7 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
||||
FULLY_QUALIFIED_DOMAIN_NAME_PARAM,
|
||||
lock.getDomainName(),
|
||||
LOCKED_TIME_PARAM,
|
||||
lock.getCompletionTimestamp().map(DateTime::toString).orElse(""),
|
||||
lock.getLockCompletionTimestamp().map(DateTime::toString).orElse(""),
|
||||
LOCKED_BY_PARAM,
|
||||
lock.isSuperuser() ? "admin" : lock.getRegistrarPocId());
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
|
||||
import static google.registry.backup.BackupUtils.GcsMetadataKeys.LOWER_BOUND_CHECKPOINT;
|
||||
import static google.registry.backup.ExportCommitLogDiffAction.DIFF_FILE_PREFIX;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.lang.reflect.Proxy.newProxyInstance;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import com.google.appengine.tools.cloudstorage.GcsFileMetadata;
|
||||
|
||||
@@ -26,11 +26,11 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistDomainAsDeleted;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
|
||||
+1
-1
@@ -29,10 +29,10 @@ import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
|
||||
@@ -118,8 +118,7 @@ public class ResaveEntityActionTest extends ShardableTestCase {
|
||||
DateTime.parse("2017-01-02T10:11:00Z")),
|
||||
DateTime.parse("2016-02-06T10:00:00Z"),
|
||||
DateTime.parse("2016-02-11T10:00:00Z"),
|
||||
DateTime.parse("2017-01-02T10:11:00Z"),
|
||||
DateTime.parse("2016-02-06T10:00:00Z"));
|
||||
DateTime.parse("2017-01-02T10:11:00Z"));
|
||||
clock.advanceOneMilli();
|
||||
assertThat(domain.getCurrentSponsorClientId()).isEqualTo("TheRegistrar");
|
||||
runAction(Key.create(domain), DateTime.parse("2016-02-06T10:00:01Z"), ImmutableSortedSet.of());
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package google.registry.beam;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.avro.Schema;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package google.registry.beam.invoicing;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey;
|
||||
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey.InvoiceGroupingKeyCoder;
|
||||
|
||||
@@ -19,9 +19,9 @@ import static google.registry.bigquery.BigqueryUtils.fromBigqueryTimestampString
|
||||
import static google.registry.bigquery.BigqueryUtils.toBigqueryTimestamp;
|
||||
import static google.registry.bigquery.BigqueryUtils.toBigqueryTimestampString;
|
||||
import static google.registry.bigquery.BigqueryUtils.toJobReferenceString;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.api.services.bigquery.model.JobReference;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -19,9 +19,9 @@ import static com.google.common.collect.Iterables.getLast;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.appengine.api.taskqueue.dev.QueueStateInfo.TaskStateInfo;
|
||||
import com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig;
|
||||
|
||||
@@ -18,9 +18,9 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ package google.registry.dns;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
|
||||
@@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package google.registry.dns.writer;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ package google.registry.dns.writer.dnsupdate;
|
||||
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHo
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
@@ -378,6 +378,7 @@ public class DnsUpdateWriterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("AssertThrowsMultipleStatements")
|
||||
public void testPublishDomainFails_whenDnsUpdateReturnsError() throws Exception {
|
||||
DomainBase domain =
|
||||
persistActiveDomain("example.tld")
|
||||
@@ -397,6 +398,7 @@ public class DnsUpdateWriterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("AssertThrowsMultipleStatements")
|
||||
public void testPublishHostFails_whenDnsUpdateReturnsError() throws Exception {
|
||||
HostResource host =
|
||||
persistActiveSubordinateHost("ns1.example.tld", persistActiveDomain("example.tld"))
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
package google.registry.documentation;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -17,12 +17,12 @@ package google.registry.export;
|
||||
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static google.registry.testing.TestLogHandlerUtils.assertLogMessage;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ package google.registry.export;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.export.CheckBackupAction.CHECK_BACKUP_KINDS_TO_LOAD_PARAM;
|
||||
import static google.registry.export.CheckBackupAction.CHECK_BACKUP_NAME_PARAM;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.GcsTestingUtils.readGcsFile;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@@ -22,10 +22,10 @@ import static google.registry.model.registry.label.PremiumListUtils.savePremiumL
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.deleteTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
|
||||
@@ -20,10 +20,10 @@ import static google.registry.export.ExportReservedTermsAction.RESERVED_TERMS_FI
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -22,8 +22,8 @@ import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_KI
|
||||
import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_TABLE_ID_PARAM;
|
||||
import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_VIEWNAME_PARAM;
|
||||
import static google.registry.export.UpdateSnapshotViewAction.createViewUpdateTask;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
|
||||
@@ -25,8 +25,8 @@ import static google.registry.export.UploadDatastoreBackupAction.UPLOAD_BACKUP_I
|
||||
import static google.registry.export.UploadDatastoreBackupAction.UPLOAD_BACKUP_KINDS_PARAM;
|
||||
import static google.registry.export.UploadDatastoreBackupAction.enqueueUploadBackupTask;
|
||||
import static google.registry.export.UploadDatastoreBackupAction.getBackupInfoFileForKind;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package google.registry.export.datastore;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.api.client.json.JsonFactory;
|
||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||
|
||||
@@ -56,6 +56,12 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public class EppLifecycleDomainTest extends EppTestCase {
|
||||
|
||||
private static final ImmutableMap<String, String> DEFAULT_TRANSFER_RESPONSE_PARMS =
|
||||
ImmutableMap.of(
|
||||
"REDATE", "2002-05-30T00:00:00Z",
|
||||
"ACDATE", "2002-06-04T00:00:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z");
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine =
|
||||
AppEngineRule.builder().withDatastore().withTaskQueue().build();
|
||||
@@ -552,7 +558,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
assertThatCommand("domain_transfer_request.xml")
|
||||
.atTime("2002-05-30T00:00:00Z")
|
||||
.hasResponse("domain_transfer_response.xml");
|
||||
.hasResponse("domain_transfer_response.xml", DEFAULT_TRANSFER_RESPONSE_PARMS);
|
||||
assertThatLogoutSucceeds();
|
||||
|
||||
// Log back in as the first registrar and verify things.
|
||||
@@ -590,7 +596,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
assertThatCommand("domain_transfer_request.xml")
|
||||
.atTime("2002-05-30T00:00:00Z")
|
||||
.hasResponse("domain_transfer_response.xml");
|
||||
.hasResponse("domain_transfer_response.xml", DEFAULT_TRANSFER_RESPONSE_PARMS);
|
||||
assertThatLogoutSucceeds();
|
||||
|
||||
// Log back in as the first registrar and verify domain is pending transfer.
|
||||
@@ -640,7 +646,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
assertThatCommand("domain_transfer_request.xml")
|
||||
.atTime("2002-05-30T00:00:00Z")
|
||||
.hasResponse("domain_transfer_response.xml");
|
||||
.hasResponse("domain_transfer_response.xml", DEFAULT_TRANSFER_RESPONSE_PARMS);
|
||||
assertThatLogoutSucceeds();
|
||||
|
||||
// Log back in as the first registrar and delete then restore the domain while the transfer
|
||||
@@ -1027,4 +1033,120 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
||||
|
||||
assertThatLogoutSucceeds();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomainTransfer_duringAutorenewGrace() throws Exception {
|
||||
// Creation date of fakesite: 2000-06-01T00:04:00.0Z
|
||||
// Expiration date: 2002-06-01T00:04:00.0Z
|
||||
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
|
||||
createFakesite();
|
||||
|
||||
// Domain info before transfer is requested and before autorenew grace period begins
|
||||
assertThatCommand("domain_info.xml", ImmutableMap.of("DOMAIN", "fakesite.example"))
|
||||
.atTime("2001-06-01T00:00:00Z")
|
||||
.hasResponse("domain_info_response_before_transfer_and_argp.xml");
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2001-06-01T00:00:00Z")
|
||||
.hasResponse("domain_transfer_query_response_wildcard_not_requested.xml");
|
||||
|
||||
// Domain info before transfer is requested, but after autorenew grace period begins
|
||||
assertThatCommand("domain_info.xml", ImmutableMap.of("DOMAIN", "fakesite.example"))
|
||||
.atTime("2002-06-02T00:00:00Z")
|
||||
.hasResponse("domain_info_response_before_transfer_during_argp.xml");
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2002-06-02T00:00:00Z")
|
||||
.hasResponse("domain_transfer_query_response_wildcard_not_requested.xml");
|
||||
|
||||
assertThatLogoutSucceeds();
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
|
||||
// Request the transfer
|
||||
assertThatCommand("domain_transfer_request.xml")
|
||||
.atTime("2002-06-05T00:02:00.0Z")
|
||||
.hasResponse(
|
||||
"domain_transfer_response.xml",
|
||||
ImmutableMap.of(
|
||||
"REDATE", "2002-06-05T00:02:00Z",
|
||||
"ACDATE", "2002-06-10T00:02:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z"));
|
||||
|
||||
assertThatLogoutSucceeds();
|
||||
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
|
||||
|
||||
// Domain info right after the transfer is requested
|
||||
assertThatCommand("domain_info.xml", ImmutableMap.of("DOMAIN", "fakesite.example"))
|
||||
.atTime("2002-06-07T00:00:00Z")
|
||||
.hasResponse("domain_info_response_during_transfer_during_argp.xml");
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2002-06-07T00:00:00Z")
|
||||
.hasResponse(
|
||||
"domain_transfer_query_response_wildcard.xml",
|
||||
ImmutableMap.of(
|
||||
"STATUS", "pending",
|
||||
"REDATE", "2002-06-05T00:02:00Z",
|
||||
"ACDATE", "2002-06-10T00:02:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z"));
|
||||
|
||||
assertThatLogoutSucceeds();
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
|
||||
// Domain info after transfer is implicitly approved, but autorenew grace period is still
|
||||
// pending
|
||||
assertThatCommand("domain_info.xml", ImmutableMap.of("DOMAIN", "fakesite.example"))
|
||||
.atTime("2002-06-11T00:00:00Z")
|
||||
.hasResponse("domain_info_response_after_transfer_during_argp.xml");
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2002-06-11T00:00:00Z")
|
||||
.hasResponse(
|
||||
"domain_transfer_query_response_wildcard.xml",
|
||||
ImmutableMap.of(
|
||||
"STATUS", "serverApproved",
|
||||
"REDATE", "2002-06-05T00:02:00Z",
|
||||
"ACDATE", "2002-06-10T00:02:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z"));
|
||||
|
||||
// Domain info after the end of autorenew grace period
|
||||
assertThatCommand("domain_info.xml", ImmutableMap.of("DOMAIN", "fakesite.example"))
|
||||
.atTime("2002-09-11T00:00:00Z")
|
||||
.hasResponse("domain_info_response_after_transfer_after_argp.xml");
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2002-09-11T00:00:00Z")
|
||||
.hasResponse(
|
||||
"domain_transfer_query_response_wildcard.xml",
|
||||
ImmutableMap.of(
|
||||
"STATUS", "serverApproved",
|
||||
"REDATE", "2002-06-05T00:02:00Z",
|
||||
"ACDATE", "2002-06-10T00:02:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomainTransfer_queryForServerApproved() throws Exception {
|
||||
// Creation date of fakesite: 2000-06-01T00:04:00.0Z
|
||||
// Expiration date: 2002-06-01T00:04:00.0Z
|
||||
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
|
||||
createFakesite();
|
||||
assertThatLogoutSucceeds();
|
||||
|
||||
assertThatLoginSucceeds("TheRegistrar", "password2");
|
||||
assertThatCommand("domain_transfer_request.xml")
|
||||
.atTime("2001-01-01T00:00:00.0Z")
|
||||
.hasResponse(
|
||||
"domain_transfer_response.xml",
|
||||
ImmutableMap.of(
|
||||
"REDATE", "2001-01-01T00:00:00Z",
|
||||
"ACDATE", "2001-01-06T00:00:00Z",
|
||||
"EXDATE", "2003-06-01T00:04:00Z"));
|
||||
assertThatLogoutSucceeds();
|
||||
|
||||
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
|
||||
// Verify that reID is set correctly.
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2001-01-03T00:00:00Z")
|
||||
.hasResponse("domain_transfer_query_response_fakesite.xml");
|
||||
|
||||
assertThatCommand("domain_transfer_query_fakesite.xml")
|
||||
.atTime("2001-01-08T00:00:00Z")
|
||||
.hasResponse("domain_transfer_query_response_completed_fakesite.xml");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ package google.registry.flows;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
@@ -20,9 +20,9 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.LogsSubject.assertAboutLogs;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@@ -17,8 +17,8 @@ package google.registry.flows;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.ContactCheck.create;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceCheckFlowTestCase;
|
||||
|
||||
@@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
|
||||
@@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
|
||||
@@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
|
||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
|
||||
@@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
|
||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
|
||||
@@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
|
||||
@@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
|
||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
@@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
@@ -28,9 +28,9 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user