mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 10:46:10 +02:00
Add filter support to the test server
The lack of ObjectifyFilter means that in any tests using RegistryTestServer the Objectify session cache persists between "requests" in the same test method. This is wrong but had not caused any failures because we didn't assert anything that mattered. However, a CL I'm working on asserts that there is a creationTime on a created resource, which is set automatically on Datastore save, and therefore is still null in the session cache's version of the resource if you don't clear it before the next command. Fixing it here separately from that CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141939330
This commit is contained in:
parent
c281f54def
commit
5b9219fbdd
4 changed files with 29 additions and 9 deletions
|
@ -19,9 +19,12 @@ import static google.registry.server.Route.route;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.googlecode.objectify.ObjectifyFilter;
|
||||
import google.registry.model.ofy.OfyFilter;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import javax.servlet.Filter;
|
||||
|
||||
/** Lightweight HTTP server for testing the Nomulus Admin and Registrar consoles. */
|
||||
public final class RegistryTestServer {
|
||||
|
@ -90,11 +93,15 @@ public final class RegistryTestServer {
|
|||
route("/registrar-payment-setup",
|
||||
google.registry.module.frontend.FrontendServlet.class));
|
||||
|
||||
private static final ImmutableList<Class<? extends Filter>> FILTERS = ImmutableList.of(
|
||||
ObjectifyFilter.class,
|
||||
OfyFilter.class);
|
||||
|
||||
private final TestServer server;
|
||||
|
||||
/** @see TestServer#TestServer(HostAndPort, java.util.Map, Iterable) */
|
||||
/** @see TestServer#TestServer(HostAndPort, java.util.Map, Iterable, Iterable) */
|
||||
public RegistryTestServer(HostAndPort address) {
|
||||
server = new TestServer(address, RUNFILES, ROUTES);
|
||||
server = new TestServer(address, RUNFILES, ROUTES, FILTERS);
|
||||
}
|
||||
|
||||
/** @see TestServer#start() */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue