mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Turn CheckApiAction into a standard-ish epp endpoint
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125335634
This commit is contained in:
parent
bb82f5bc05
commit
2b2fb958f6
15 changed files with 76 additions and 182 deletions
|
@ -4,6 +4,8 @@ package(
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
licenses(["notice"]) # Apache 2.0
|
||||||
|
|
||||||
|
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_template_java_library")
|
||||||
|
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "flows_files",
|
name = "flows_files",
|
||||||
|
@ -21,6 +23,7 @@ java_library(
|
||||||
]),
|
]),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
":soy_java_wrappers",
|
||||||
"//java/com/google/common/annotations",
|
"//java/com/google/common/annotations",
|
||||||
"//java/com/google/common/base",
|
"//java/com/google/common/base",
|
||||||
"//java/com/google/common/collect",
|
"//java/com/google/common/collect",
|
||||||
|
@ -31,6 +34,7 @@ java_library(
|
||||||
"//third_party/java/dagger",
|
"//third_party/java/dagger",
|
||||||
"//third_party/java/joda_money",
|
"//third_party/java/joda_money",
|
||||||
"//third_party/java/joda_time",
|
"//third_party/java/joda_time",
|
||||||
|
"//third_party/java/json_simple",
|
||||||
"//third_party/java/jsr305_annotations",
|
"//third_party/java/jsr305_annotations",
|
||||||
"//third_party/java/jsr330_inject",
|
"//third_party/java/jsr330_inject",
|
||||||
"//third_party/java/objectify:objectify-v4_1",
|
"//third_party/java/objectify:objectify-v4_1",
|
||||||
|
@ -47,5 +51,14 @@ java_library(
|
||||||
"//java/google/registry/tmch",
|
"//java/google/registry/tmch",
|
||||||
"//java/google/registry/util",
|
"//java/google/registry/util",
|
||||||
"//java/google/registry/xml",
|
"//java/google/registry/xml",
|
||||||
|
"//third_party/java_src/soy/java/com/google/template/soy",
|
||||||
|
|
||||||
|
"@io_bazel_rules_closure//closure/templates",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
closure_template_java_library(
|
||||||
|
name = "soy_java_wrappers",
|
||||||
|
srcs = glob(["soy/*.soy"]),
|
||||||
|
java_package = "google.registry.flows.soy",
|
||||||
|
)
|
||||||
|
|
|
@ -12,40 +12,32 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package google.registry.ui.server.api;
|
package google.registry.flows;
|
||||||
|
|
||||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||||
import static com.google.common.base.Strings.nullToEmpty;
|
import static com.google.common.base.Strings.nullToEmpty;
|
||||||
|
import static com.google.common.io.Resources.getResource;
|
||||||
import static com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN;
|
import static com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN;
|
||||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
|
||||||
import static google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension.FEE_0_6;
|
import static google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension.FEE_0_6;
|
||||||
import static google.registry.model.registry.Registries.findTldForNameOrThrow;
|
import static google.registry.model.registry.Registries.findTldForNameOrThrow;
|
||||||
import static google.registry.ui.server.SoyTemplateUtils.createTofuSupplier;
|
|
||||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import static org.json.simple.JSONValue.toJSONString;
|
import static org.json.simple.JSONValue.toJSONString;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
|
import com.google.template.soy.SoyFileSet;
|
||||||
import com.google.template.soy.tofu.SoyTofu;
|
import com.google.template.soy.tofu.SoyTofu;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
|
||||||
import google.registry.config.RegistryEnvironment;
|
import google.registry.config.RegistryConfig;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.soy.DomainCheckFeeEppSoyInfo;
|
||||||
import google.registry.flows.EppRequestSource;
|
|
||||||
import google.registry.flows.FlowRunner;
|
|
||||||
import google.registry.flows.PasswordOnlyTransportCredentials;
|
|
||||||
import google.registry.flows.StatelessRequestSessionMetadata;
|
|
||||||
import google.registry.flows.domain.DomainCheckFlow;
|
|
||||||
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
||||||
import google.registry.model.domain.fee.FeeCheckResponseExtension.FeeCheck;
|
import google.registry.model.domain.fee.FeeCheckResponseExtension.FeeCheck;
|
||||||
import google.registry.model.eppcommon.Trid;
|
|
||||||
import google.registry.model.eppinput.EppInput;
|
|
||||||
import google.registry.model.eppoutput.CheckData.DomainCheck;
|
import google.registry.model.eppoutput.CheckData.DomainCheck;
|
||||||
import google.registry.model.eppoutput.CheckData.DomainCheckData;
|
import google.registry.model.eppoutput.CheckData.DomainCheckData;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
@ -53,8 +45,6 @@ import google.registry.request.Action;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
import google.registry.request.RequestParameters;
|
import google.registry.request.RequestParameters;
|
||||||
import google.registry.request.Response;
|
import google.registry.request.Response;
|
||||||
import google.registry.ui.soy.api.DomainCheckFeeEppSoyInfo;
|
|
||||||
import google.registry.util.Clock;
|
|
||||||
import google.registry.util.FormattingLogger;
|
import google.registry.util.FormattingLogger;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -63,7 +53,7 @@ import javax.inject.Inject;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A servlet that returns availability and premium checks as json.
|
* A servlet that returns availability and premium checks as JSON.
|
||||||
*
|
*
|
||||||
* <p>This action returns plain JSON without a safety prefix, so it's vital that the output not be
|
* <p>This action returns plain JSON without a safety prefix, so it's vital that the output not be
|
||||||
* user controlled, lest it open an XSS vector. Do not modify this to return the domain name in the
|
* user controlled, lest it open an XSS vector. Do not modify this to return the domain name in the
|
||||||
|
@ -74,62 +64,60 @@ public class CheckApiAction implements Runnable {
|
||||||
|
|
||||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||||
|
|
||||||
private static final Supplier<SoyTofu> TOFU_SUPPLIER =
|
private static final SoyTofu TOFU =
|
||||||
createTofuSupplier(DomainCheckFeeEppSoyInfo.getInstance());
|
SoyFileSet.builder().add(getResource(DomainCheckFeeEppSoyInfo.class,
|
||||||
|
DomainCheckFeeEppSoyInfo.getInstance().getFileName())).build().compileToTofu();
|
||||||
private final StatelessRequestSessionMetadata sessionMetadata =
|
|
||||||
new StatelessRequestSessionMetadata(
|
|
||||||
RegistryEnvironment.get().config().getCheckApiServletRegistrarClientId(),
|
|
||||||
ImmutableSet.of(FEE_0_6.getUri()));
|
|
||||||
|
|
||||||
@Inject @Parameter("domain") String domain;
|
@Inject @Parameter("domain") String domain;
|
||||||
@Inject Response response;
|
@Inject Response response;
|
||||||
@Inject Clock clock;
|
@Inject EppController eppController;
|
||||||
|
@Inject RegistryConfig config;
|
||||||
@Inject CheckApiAction() {}
|
@Inject CheckApiAction() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Map<String, ?> checkResponse = doCheck(domain);
|
|
||||||
response.setHeader("Content-Disposition", "attachment");
|
response.setHeader("Content-Disposition", "attachment");
|
||||||
response.setHeader("X-Content-Type-Options", "nosniff");
|
response.setHeader("X-Content-Type-Options", "nosniff");
|
||||||
response.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
|
response.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
|
||||||
response.setContentType(MediaType.JSON_UTF_8);
|
response.setContentType(MediaType.JSON_UTF_8);
|
||||||
response.setPayload(toJSONString(checkResponse));
|
response.setPayload(toJSONString(doCheck()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rgr): add whitebox instrumentation for this?
|
private Map<String, Object> doCheck() {
|
||||||
private Map<String, ?> doCheck(String domainString) {
|
String domainString;
|
||||||
try {
|
try {
|
||||||
domainString = canonicalizeDomainName(nullToEmpty(domainString));
|
domainString = canonicalizeDomainName(nullToEmpty(domain));
|
||||||
// Validate the TLD.
|
// Validate the TLD.
|
||||||
findTldForNameOrThrow(InternetDomainName.from(domainString));
|
findTldForNameOrThrow(InternetDomainName.from(domainString));
|
||||||
} catch (IllegalStateException | IllegalArgumentException e) {
|
} catch (IllegalStateException | IllegalArgumentException e) {
|
||||||
return fail("Must supply a valid domain name on an authoritative TLD");
|
return fail("Must supply a valid domain name on an authoritative TLD");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
byte[] inputXmlBytes = TOFU_SUPPLIER.get()
|
byte[] inputXml = TOFU
|
||||||
.newRenderer(DomainCheckFeeEppSoyInfo.DOMAINCHECKFEE)
|
.newRenderer(DomainCheckFeeEppSoyInfo.DOMAINCHECKFEE)
|
||||||
.setData(ImmutableMap.of("domainName", domainString))
|
.setData(ImmutableMap.of("domainName", domainString))
|
||||||
.render()
|
.render()
|
||||||
.getBytes(UTF_8);
|
.getBytes(UTF_8);
|
||||||
EppResponse response = new FlowRunner(
|
SessionMetadata sessionMetadata = new StatelessRequestSessionMetadata(
|
||||||
DomainCheckFlow.class,
|
config.getCheckApiServletRegistrarClientId(),
|
||||||
unmarshal(EppInput.class, inputXmlBytes),
|
ImmutableSet.of(FEE_0_6.getUri()));
|
||||||
Trid.create(getClass().getSimpleName()),
|
EppResponse response = eppController
|
||||||
|
.handleEppCommand(
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
new PasswordOnlyTransportCredentials(),
|
new PasswordOnlyTransportCredentials(),
|
||||||
EppRequestSource.CHECK_API,
|
EppRequestSource.CHECK_API,
|
||||||
false,
|
false, // This endpoint is never a dry run.
|
||||||
false,
|
false, // This endpoint is never a superuser.
|
||||||
inputXmlBytes,
|
inputXml)
|
||||||
null,
|
|
||||||
clock)
|
|
||||||
.run()
|
|
||||||
.getResponse();
|
.getResponse();
|
||||||
|
if (!response.getResult().getCode().isSuccess()) {
|
||||||
|
return fail(response.getResult().getMsg());
|
||||||
|
}
|
||||||
DomainCheckData checkData = (DomainCheckData) response.getResponseData().get(0);
|
DomainCheckData checkData = (DomainCheckData) response.getResponseData().get(0);
|
||||||
DomainCheck check = (DomainCheck) checkData.getChecks().get(0);
|
DomainCheck check = (DomainCheck) checkData.getChecks().get(0);
|
||||||
boolean available = check.getName().getAvail();
|
boolean available = check.getName().getAvail();
|
||||||
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<String, Object>()
|
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
|
||||||
|
builder
|
||||||
.put("status", "success")
|
.put("status", "success")
|
||||||
.put("available", available);
|
.put("available", available);
|
||||||
if (available) {
|
if (available) {
|
||||||
|
@ -141,16 +129,14 @@ public class CheckApiAction implements Runnable {
|
||||||
builder.put("reason", check.getReason());
|
builder.put("reason", check.getReason());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
} catch (EppException e) {
|
|
||||||
return fail(e.getMessage());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warning(e, "Unknown error");
|
logger.warning(e, "Unknown error");
|
||||||
return fail("Invalid request");
|
return fail("Invalid request");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> fail(String reason) {
|
private Map<String, Object> fail(String reason) {
|
||||||
return ImmutableMap.of(
|
return ImmutableMap.<String, Object>of(
|
||||||
"status", "error",
|
"status", "error",
|
||||||
"reason", reason);
|
"reason", reason);
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
package google.registry.flows;
|
package google.registry.flows;
|
||||||
|
|
||||||
import static google.registry.flows.EppXmlTransformer.marshalWithLenientRetry;
|
|
||||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||||
import static google.registry.flows.picker.FlowPicker.getFlowClass;
|
import static google.registry.flows.picker.FlowPicker.getFlowClass;
|
||||||
|
|
||||||
|
@ -47,11 +46,8 @@ public final class EppController {
|
||||||
@Inject EppMetrics metrics;
|
@Inject EppMetrics metrics;
|
||||||
@Inject EppController() {}
|
@Inject EppController() {}
|
||||||
|
|
||||||
/**
|
/** Read EPP XML, execute the matching flow, and return an {@link EppOutput}. */
|
||||||
* Read an EPP envelope from the client, find the matching flow, execute it, and return
|
public EppOutput handleEppCommand(
|
||||||
* the response marshalled to a byte array.
|
|
||||||
*/
|
|
||||||
public byte[] handleEppCommand(
|
|
||||||
SessionMetadata sessionMetadata,
|
SessionMetadata sessionMetadata,
|
||||||
TransportCredentials credentials,
|
TransportCredentials credentials,
|
||||||
EppRequestSource eppRequestSource,
|
EppRequestSource eppRequestSource,
|
||||||
|
@ -85,17 +81,16 @@ public final class EppController {
|
||||||
if (eppOutput.isResponse()) {
|
if (eppOutput.isResponse()) {
|
||||||
metrics.setEppStatus(eppOutput.getResponse().getResult().getCode());
|
metrics.setEppStatus(eppOutput.getResponse().getResult().getCode());
|
||||||
}
|
}
|
||||||
return marshalWithLenientRetry(eppOutput);
|
return eppOutput;
|
||||||
} catch (EppException e) {
|
} catch (EppException e) {
|
||||||
// The command failed. Send the client an error message.
|
// The command failed. Send the client an error message.
|
||||||
metrics.setEppStatus(e.getResult().getCode());
|
metrics.setEppStatus(e.getResult().getCode());
|
||||||
return marshalWithLenientRetry(getErrorResponse(clock, e.getResult(), trid));
|
return getErrorResponse(clock, e.getResult(), trid);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Something bad and unexpected happened. Send the client a generic error, and log it.
|
// Something bad and unexpected happened. Send the client a generic error, and log it.
|
||||||
logger.severe(e, "Unexpected failure");
|
logger.severe(e, "Unexpected failure");
|
||||||
metrics.setEppStatus(Code.CommandFailed);
|
metrics.setEppStatus(Code.CommandFailed);
|
||||||
return marshalWithLenientRetry(
|
return getErrorResponse(clock, Result.create(Code.CommandFailed), trid);
|
||||||
getErrorResponse(clock, Result.create(Code.CommandFailed), trid));
|
|
||||||
} finally {
|
} finally {
|
||||||
metrics.export();
|
metrics.export();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
package google.registry.flows;
|
package google.registry.flows;
|
||||||
|
|
||||||
|
import static google.registry.flows.EppXmlTransformer.marshalWithLenientRetry;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
||||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||||
|
@ -48,13 +49,15 @@ public class EppRequestHandler {
|
||||||
byte[] inputXmlBytes) {
|
byte[] inputXmlBytes) {
|
||||||
try {
|
try {
|
||||||
response.setPayload(new String(
|
response.setPayload(new String(
|
||||||
|
marshalWithLenientRetry(
|
||||||
eppController.handleEppCommand(
|
eppController.handleEppCommand(
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
credentials,
|
credentials,
|
||||||
eppRequestSource,
|
eppRequestSource,
|
||||||
isDryRun,
|
isDryRun,
|
||||||
isSuperuser,
|
isSuperuser,
|
||||||
inputXmlBytes), UTF_8));
|
inputXmlBytes)),
|
||||||
|
UTF_8));
|
||||||
response.setContentType(APPLICATION_EPP_XML);
|
response.setContentType(APPLICATION_EPP_XML);
|
||||||
// Note that we always return 200 (OK) even if the EppController returns an error response.
|
// Note that we always return 200 (OK) even if the EppController returns an error response.
|
||||||
// This is because returning an non-OK HTTP status code will cause the proxy server to
|
// This is because returning an non-OK HTTP status code will cause the proxy server to
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{namespace registry.soy.api autoescape="strict"}
|
{namespace registry.soy.api autoescape="strict"}
|
||||||
|
|
||||||
/**
|
/** Domain check fee request for one domain. */
|
||||||
* Domain check fee request for one domain
|
|
||||||
* @param domainName
|
|
||||||
*/
|
|
||||||
{template .domaincheckfee}
|
{template .domaincheckfee}
|
||||||
|
{@param domainName: string}
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
<command>
|
<command>
|
|
@ -24,7 +24,6 @@ java_library(
|
||||||
"//java/google/registry/request",
|
"//java/google/registry/request",
|
||||||
"//java/google/registry/request:modules",
|
"//java/google/registry/request:modules",
|
||||||
"//java/google/registry/ui",
|
"//java/google/registry/ui",
|
||||||
"//java/google/registry/ui/server/api",
|
|
||||||
"//java/google/registry/ui/server/registrar",
|
"//java/google/registry/ui/server/registrar",
|
||||||
"//java/google/registry/util",
|
"//java/google/registry/util",
|
||||||
"//java/google/registry/whois",
|
"//java/google/registry/whois",
|
||||||
|
@ -40,7 +39,6 @@ java_binary(
|
||||||
create_executable = 0,
|
create_executable = 0,
|
||||||
runtime_deps = [
|
runtime_deps = [
|
||||||
":frontend",
|
":frontend",
|
||||||
"//java/google/registry/ui/server/api", # CheckApiServlet
|
|
||||||
"//java/google/registry/ui/server/registrar", # ResourceServlet
|
"//java/google/registry/ui/server/registrar", # ResourceServlet
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,6 +16,8 @@ package google.registry.module.frontend;
|
||||||
|
|
||||||
import dagger.Subcomponent;
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
import google.registry.flows.CheckApiAction;
|
||||||
|
import google.registry.flows.CheckApiAction.CheckApiModule;
|
||||||
import google.registry.flows.EppConsoleAction;
|
import google.registry.flows.EppConsoleAction;
|
||||||
import google.registry.flows.EppTlsAction;
|
import google.registry.flows.EppTlsAction;
|
||||||
import google.registry.flows.TlsCredentials.EppTlsModule;
|
import google.registry.flows.TlsCredentials.EppTlsModule;
|
||||||
|
@ -31,8 +33,6 @@ import google.registry.rdap.RdapNameserverAction;
|
||||||
import google.registry.rdap.RdapNameserverSearchAction;
|
import google.registry.rdap.RdapNameserverSearchAction;
|
||||||
import google.registry.request.RequestModule;
|
import google.registry.request.RequestModule;
|
||||||
import google.registry.request.RequestScope;
|
import google.registry.request.RequestScope;
|
||||||
import google.registry.ui.server.api.CheckApiAction;
|
|
||||||
import google.registry.ui.server.api.CheckApiAction.CheckApiModule;
|
|
||||||
import google.registry.ui.server.registrar.ConsoleUiAction;
|
import google.registry.ui.server.registrar.ConsoleUiAction;
|
||||||
import google.registry.ui.server.registrar.RegistrarPaymentAction;
|
import google.registry.ui.server.registrar.RegistrarPaymentAction;
|
||||||
import google.registry.ui.server.registrar.RegistrarPaymentSetupAction;
|
import google.registry.ui.server.registrar.RegistrarPaymentSetupAction;
|
||||||
|
|
|
@ -18,7 +18,6 @@ filegroup(
|
||||||
"//java/google/registry/ui/js:js_files",
|
"//java/google/registry/ui/js:js_files",
|
||||||
"//java/google/registry/ui/js/registrar:js_files",
|
"//java/google/registry/ui/js/registrar:js_files",
|
||||||
"//java/google/registry/ui/soy:js_files",
|
"//java/google/registry/ui/soy:js_files",
|
||||||
"//java/google/registry/ui/soy/api:js_files",
|
|
||||||
"//java/google/registry/ui/soy/registrar:js_files",
|
"//java/google/registry/ui/soy/registrar:js_files",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package(default_visibility = ["//java/google/registry:registry_project"])
|
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
|
||||||
|
|
||||||
|
|
||||||
java_library(
|
|
||||||
name = "api",
|
|
||||||
srcs = glob(["*.java"]),
|
|
||||||
deps = [
|
|
||||||
"//java/com/google/common/annotations",
|
|
||||||
"//java/com/google/common/base",
|
|
||||||
"//java/com/google/common/collect",
|
|
||||||
"//java/com/google/common/net",
|
|
||||||
"//third_party/java/dagger",
|
|
||||||
"//third_party/java/jsr330_inject",
|
|
||||||
"//java/google/registry/config",
|
|
||||||
"//java/google/registry/flows",
|
|
||||||
"//java/google/registry/model",
|
|
||||||
"//java/google/registry/request",
|
|
||||||
"//java/google/registry/ui/server",
|
|
||||||
"//java/google/registry/ui/soy/api:soy_java_wrappers",
|
|
||||||
"//java/google/registry/util",
|
|
||||||
"//third_party/java/json_simple",
|
|
||||||
"//third_party/java/jsr305_annotations",
|
|
||||||
"//third_party/java/servlet/servlet_api",
|
|
||||||
|
|
||||||
"@io_bazel_rules_closure//closure/templates",
|
|
||||||
],
|
|
||||||
)
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2016 The Domain Registry 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.
|
|
||||||
|
|
||||||
@javax.annotation.ParametersAreNonnullByDefault
|
|
||||||
package google.registry.ui.server.api;
|
|
|
@ -1,23 +0,0 @@
|
||||||
package(default_visibility = ["//java/google/registry:registry_project"])
|
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
|
||||||
|
|
||||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_template_java_library", "closure_template_js_library")
|
|
||||||
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "js_files",
|
|
||||||
srcs = ["DomainCheckFeeEpp.soy.js"],
|
|
||||||
)
|
|
||||||
|
|
||||||
closure_template_java_library(
|
|
||||||
name = "soy_java_wrappers",
|
|
||||||
srcs = glob(["*.soy"]),
|
|
||||||
java_package = "google.registry.ui.soy.api",
|
|
||||||
)
|
|
||||||
|
|
||||||
closure_template_js_library(
|
|
||||||
name = "DomainCheckFeeEpp",
|
|
||||||
srcs = ["DomainCheckFeeEpp.soy"],
|
|
||||||
globals = "//java/google/registry/ui:globals.txt",
|
|
||||||
)
|
|
|
@ -33,6 +33,7 @@ java_library(
|
||||||
"//third_party/java/appengine:appengine-testing",
|
"//third_party/java/appengine:appengine-testing",
|
||||||
"//third_party/java/joda_money",
|
"//third_party/java/joda_money",
|
||||||
"//third_party/java/joda_time",
|
"//third_party/java/joda_time",
|
||||||
|
"//third_party/java/json_simple",
|
||||||
"//third_party/java/jsr305_annotations",
|
"//third_party/java/jsr305_annotations",
|
||||||
"//third_party/java/junit",
|
"//third_party/java/junit",
|
||||||
"//third_party/java/mockito",
|
"//third_party/java/mockito",
|
||||||
|
@ -48,8 +49,6 @@ java_library(
|
||||||
"//java/google/registry/monitoring/whitebox",
|
"//java/google/registry/monitoring/whitebox",
|
||||||
"//java/google/registry/pricing",
|
"//java/google/registry/pricing",
|
||||||
"//java/google/registry/request",
|
"//java/google/registry/request",
|
||||||
"//java/google/registry/security",
|
|
||||||
"//java/google/registry/security:servlets",
|
|
||||||
"//java/google/registry/tmch",
|
"//java/google/registry/tmch",
|
||||||
"//java/google/registry/util",
|
"//java/google/registry/util",
|
||||||
"//java/google/registry/xml",
|
"//java/google/registry/xml",
|
||||||
|
|
|
@ -12,18 +12,21 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package google.registry.ui.server.api;
|
package google.registry.flows;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
|
import google.registry.monitoring.whitebox.EppMetrics;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.FakeResponse;
|
import google.registry.testing.FakeResponse;
|
||||||
import google.registry.util.SystemClock;
|
import google.registry.util.SystemClock;
|
||||||
|
@ -62,7 +65,10 @@ public class CheckApiActionTest {
|
||||||
private Map<String, Object> getCheckResponse(String domain) {
|
private Map<String, Object> getCheckResponse(String domain) {
|
||||||
action.domain = domain;
|
action.domain = domain;
|
||||||
action.response = new FakeResponse();
|
action.response = new FakeResponse();
|
||||||
action.clock = new SystemClock();
|
action.config = RegistryEnvironment.UNITTEST.config();
|
||||||
|
action.eppController = new EppController();
|
||||||
|
action.eppController.clock = new SystemClock();
|
||||||
|
action.eppController.metrics = mock(EppMetrics.class);
|
||||||
action.run();
|
action.run();
|
||||||
return (Map<String, Object>) JSONValue.parse(((FakeResponse) action.response).getPayload());
|
return (Map<String, Object>) JSONValue.parse(((FakeResponse) action.response).getPayload());
|
||||||
}
|
}
|
|
@ -54,10 +54,8 @@ java_library(
|
||||||
"//java/com/google/common/net",
|
"//java/com/google/common/net",
|
||||||
"//third_party/java/jsr305_annotations",
|
"//third_party/java/jsr305_annotations",
|
||||||
"//third_party/java/servlet/servlet_api",
|
"//third_party/java/servlet/servlet_api",
|
||||||
"//java/google/registry/flows",
|
|
||||||
"//java/google/registry/module/backend",
|
"//java/google/registry/module/backend",
|
||||||
"//java/google/registry/module/frontend",
|
"//java/google/registry/module/frontend",
|
||||||
"//java/google/registry/ui/server/api",
|
|
||||||
"//java/google/registry/ui/server/registrar",
|
"//java/google/registry/ui/server/registrar",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package(
|
|
||||||
default_testonly = 1,
|
|
||||||
default_visibility = ["//java/google/registry:registry_project"],
|
|
||||||
)
|
|
||||||
|
|
||||||
licenses(["notice"]) # Apache 2.0
|
|
||||||
|
|
||||||
load("//java/com/google/testing/builddefs:GenTestRules.bzl", "GenTestRules")
|
|
||||||
|
|
||||||
|
|
||||||
java_library(
|
|
||||||
name = "api",
|
|
||||||
srcs = glob(["*.java"]),
|
|
||||||
deps = [
|
|
||||||
"//java/com/google/common/collect",
|
|
||||||
"//third_party/java/appengine:appengine-api-testonly",
|
|
||||||
"//third_party/java/json_simple",
|
|
||||||
"//third_party/java/junit",
|
|
||||||
"//third_party/java/mockito",
|
|
||||||
"//third_party/java/servlet/servlet_api",
|
|
||||||
"//third_party/java/truth",
|
|
||||||
"//java/google/registry/model",
|
|
||||||
"//java/google/registry/ui/server/api",
|
|
||||||
"//java/google/registry/util",
|
|
||||||
"//javatests/google/registry/testing",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
GenTestRules(
|
|
||||||
name = "GeneratedTestRules",
|
|
||||||
test_files = glob(["*Test.java"]),
|
|
||||||
deps = [":api"],
|
|
||||||
)
|
|
Loading…
Add table
Add a link
Reference in a new issue