mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
mv com/google/domain/registry google/registry
This change renames directories in preparation for the great package rename. The repository is now in a broken state because the code itself hasn't been updated. However this should ensure that git correctly preserves history for each file.
This commit is contained in:
parent
a41677aea1
commit
5012893c1d
2396 changed files with 0 additions and 0 deletions
172
javatests/google/registry/server/RegistryTestServerMain.java
Normal file
172
javatests/google/registry/server/RegistryTestServerMain.java
Normal file
|
@ -0,0 +1,172 @@
|
|||
// 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.
|
||||
|
||||
package com.google.domain.registry.server;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.domain.registry.testing.AppEngineRule;
|
||||
import com.google.domain.registry.testing.UserInfo;
|
||||
import com.google.domain.registry.tools.params.HostAndPortParameter;
|
||||
import com.google.domain.registry.ui.ConsoleDebug;
|
||||
|
||||
import com.beust.jcommander.JCommander;
|
||||
import com.beust.jcommander.Parameter;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** Command-line interface for {@link RegistryTestServer}. */
|
||||
public final class RegistryTestServerMain {
|
||||
|
||||
private static final String RESET = "\u001b[0m";
|
||||
private static final String BLUE = "\u001b[1;34m";
|
||||
private static final String PURPLE = "\u001b[1;35m";
|
||||
private static final String PINK = "\u001b[1;38;5;205m";
|
||||
private static final String LIGHT_PURPLE = "\u001b[38;5;139m";
|
||||
private static final String ORANGE = "\u001b[1;38;5;172m";
|
||||
|
||||
@Parameter(
|
||||
names = "--mode",
|
||||
description = "UI console debug mode. RAW allows live editing; DEBUG allows rename testing.")
|
||||
private ConsoleDebug mode = ConsoleDebug.RAW;
|
||||
|
||||
@Parameter(
|
||||
names = "--address",
|
||||
description = "Listening address.",
|
||||
validateWith = HostAndPortParameter.class)
|
||||
private HostAndPort address = HostAndPort.fromString("[::]:8080");
|
||||
|
||||
@Parameter(
|
||||
names = "--fixtures",
|
||||
description = "Fixtures to load into the datastore.")
|
||||
private List<Fixture> fixtures = ImmutableList.of(Fixture.BASIC);
|
||||
|
||||
@Parameter(
|
||||
names = "--login_email",
|
||||
description = "Login email address for App Engine Local User Service.")
|
||||
private String loginEmail = "Marla.Singer@crr.com";
|
||||
|
||||
@Parameter(
|
||||
names = "--login_user_id",
|
||||
description = "GAE User ID for App Engine Local User Service.")
|
||||
private String loginUserId = AppEngineRule.THE_REGISTRAR_GAE_USER_ID;
|
||||
|
||||
@Parameter(
|
||||
names = "--login_is_admin",
|
||||
description = "Should logged in user be an admin for App Engine Local User Service.",
|
||||
arity = 1)
|
||||
private boolean loginIsAdmin = true;
|
||||
|
||||
@Parameter(
|
||||
names = "--jetty_debug",
|
||||
description = "Enables Jetty debug logging.")
|
||||
private boolean jettyDebug;
|
||||
|
||||
@Parameter(
|
||||
names = "--jetty_verbose",
|
||||
description = "Enables Jetty verbose logging.")
|
||||
private boolean jettyVerbose;
|
||||
|
||||
@Parameter(
|
||||
names = {"-h", "--help"},
|
||||
description = "Display help and list flags for this command.",
|
||||
help = true)
|
||||
private boolean help;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
RegistryTestServerMain serverMain = new RegistryTestServerMain();
|
||||
JCommander jCommander = new JCommander(serverMain);
|
||||
jCommander.setProgramName("dr-run server");
|
||||
jCommander.parse(args);
|
||||
if (serverMain.help) {
|
||||
jCommander.usage();
|
||||
return;
|
||||
}
|
||||
serverMain.run();
|
||||
}
|
||||
|
||||
private void run() throws Throwable {
|
||||
ConsoleDebug.set(mode);
|
||||
if (jettyDebug) {
|
||||
System.setProperty("DEBUG", "true");
|
||||
}
|
||||
if (jettyVerbose) {
|
||||
System.setProperty("VERBOSE", "true");
|
||||
}
|
||||
|
||||
System.out.printf("\n"
|
||||
+ " CHARLESTON ROAD REGISTRY SHARED REGISTRATION SYSTEM\n"
|
||||
+ " ICANN-GTLD-AGB-20120604\n\n%s"
|
||||
+ " ▓█████▄ ▒█████ ███▄ ▄███▓ ▄▄▄ ██▓ ███▄ █\n"
|
||||
+ " ▒██▀ ██▌▒██▒ ██▒▓██▒▀█▀ ██▒▒████▄ ▓██▒ ██ ▀█ █\n"
|
||||
+ " ░██ █▌▒██░ ██▒▓██ ▓██░▒██ ▀█▄ ▒██▒▓██ ▀█ ██▒\n"
|
||||
+ " ░▓█▄ ▌▒██ ██░▒██ ▒██ ░██▄▄▄▄██ ░██░▓██▒ ▐▌██▒\n"
|
||||
+ " ░▒████▓ ░ ████▓▒░▒██▒ ░██▒ ▓█ ▓██▒░██░▒██░ ▓██░\n"
|
||||
+ " ▒▒▓ ▒ ░ ▒░▒░▒░ ░ ▒░ ░ ░ ▒▒ ▓▒█░░▓ ░ ▒░ ▒ ▒\n"
|
||||
+ " ░ ▒ ▒ ░ ▒ ▒░ ░ ░ ░ ▒ ▒▒ ░ ▒ ░░ ░░ ░ ▒░\n"
|
||||
+ " ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ▒ ░ ░ ░ ░\n"
|
||||
+ " ░ ░ ░ ░ ░ ░ ░ ░\n"
|
||||
+ " ░\n%s"
|
||||
+ " ██▀███ ▓█████ ▄████ ██▓ ██████ ▄▄▄█████▓ ██▀███ ▓██ ██▓\n"
|
||||
+ " ▓██ ▒ ██▒▓█ ▀ ██▒ ▀█▒▓██▒▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▒██ ██▒\n"
|
||||
+ " ▓██ ░▄█ ▒▒███ ▒██░▄▄▄░▒██▒░ ▓██▄ ▒ ▓██░ ▒░▓██ ░▄█ ▒ ▒██ ██░\n"
|
||||
+ " ▒██▀▀█▄ ▒▓█ ▄ ░▓█ ██▓░██░ ▒ ██▒░ ▓██▓ ░ ▒██▀▀█▄ ░ ▐██▓░\n"
|
||||
+ " ░██▓ ▒██▒░▒████▒░▒▓███▀▒░██░▒██████▒▒ ▒██▒ ░ ░██▓ ▒██▒ ░ ██▒▓░\n"
|
||||
+ " ░ ▒▓ ░▒▓░░░ ▒░ ░ ░▒ ▒ ░▓ ▒ ▒▓▒ ▒ ░ ▒ ░░ ░ ▒▓ ░▒▓░ ██▒▒▒\n"
|
||||
+ " ░▒ ░ ▒░ ░ ░ ░ ░ ░ ▒ ░░ ░▒ ░ ░ ░ ░▒ ░ ▒░▓██ ░▒░\n"
|
||||
+ " ░░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░░ ░ ▒ ▒ ░░\n"
|
||||
+ " ░ ░ ░ ░ ░ ░ ░ ░ ░\n"
|
||||
+ " ░ ░\n%s"
|
||||
+ "(✿◕ ‿◕ )ノ%s\n",
|
||||
LIGHT_PURPLE, ORANGE, PINK, RESET);
|
||||
|
||||
final RegistryTestServer server = new RegistryTestServer(address);
|
||||
Statement runner = new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws InterruptedException {
|
||||
System.out.printf("%sLoading datastore fixtures...%s\n", BLUE, RESET);
|
||||
for (Fixture fixture : fixtures) {
|
||||
fixture.load();
|
||||
}
|
||||
System.out.printf("%sStarting Jetty6 HTTP Server...%s\n", BLUE, RESET);
|
||||
server.start();
|
||||
System.out.printf("%sListening on: %s%s\n", PURPLE, server.getUrl("/"), RESET);
|
||||
try {
|
||||
while (true) {
|
||||
server.process();
|
||||
}
|
||||
} finally {
|
||||
server.stop();
|
||||
}
|
||||
}};
|
||||
|
||||
System.out.printf("%sLoading AppEngineRule...%s\n", BLUE, RESET);
|
||||
AppEngineRule.builder()
|
||||
.withDatastore()
|
||||
.withUrlFetch()
|
||||
.withTaskQueue()
|
||||
.withLocalModules()
|
||||
.withUserService(loginIsAdmin
|
||||
? UserInfo.createAdmin(loginEmail, loginUserId)
|
||||
: UserInfo.create(loginEmail, loginUserId))
|
||||
.build()
|
||||
.apply(runner, Description.EMPTY)
|
||||
.evaluate();
|
||||
}
|
||||
|
||||
private RegistryTestServerMain() {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue