diff --git a/.github/git-hook-pre-commit.sh b/.github/git-hook-pre-commit.sh new file mode 100644 index 00000000..4cbc3c78 --- /dev/null +++ b/.github/git-hook-pre-commit.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +## +# This Git pre-commit hook script verifies that the Java source code is formatted consistently, and errors +# (preventing commit) if it is not. +# +# Git will call this script from the repository root. A non-zero exit code will halt the commit, unless +# `--no-verify` is specified. +## + + +# Stop script on errors. +set -o pipefail # Non-zero returns from piped commands throw ERR. +set -o errtrace # Non-zero returns in functions throw ERR. +set -o nounset # Attempts to use an uninitialized variable throw ERR. +set -o errexit # Non-zero returns from the main script throw ERR. + +# This function can be called to handle errors. +function error_handler() { + local CALLER_LINENO="$1" + local MESSAGE="$2" + local CODE="${3:-1}" + + local FULL_MESSAGE="Error on or near line ${CALLER_LINENO}: \"${MESSAGE}\". Exiting with status: ${CODE}." + echo -e "${FULL_MESSAGE}" + exit "${CODE}" +} + +# Trap any errors, calling error() when they're caught. +trap 'error_handler ${LINENO}' ERR + +echo 'Running fmt plugin check.' +# TODO switch plugin group after we're past Java 8 +if mvn -f apps/ spotless:check >/dev/null 2>&1; then + echo 'Verified Java source code format: a-okay.' +else + echo -e "Inconsistencies discovered in Java formatting check. Run 'mvn spotless:check' for details or 'mvn spotless:apply' to automatically apply the required formatting." + exit 1 +fi diff --git a/.gitignore b/.gitignore index c09e2130..83145153 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Ignore Eclipse metadata files, but include .gitignore itself /.* !/.gitignore +!/.github/ # Ignore vim metadata files. *.swp diff --git a/dev/eclipse-formatter-java.xml b/dev/eclipse-formatter-java.xml new file mode 100644 index 00000000..a31dd26d --- /dev/null +++ b/dev/eclipse-formatter-java.xml @@ -0,0 +1,401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/eclipse-formatter-xml.prefs b/dev/eclipse-formatter-xml.prefs new file mode 100644 index 00000000..83c42b05 --- /dev/null +++ b/dev/eclipse-formatter-xml.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +lineWidth=120 diff --git a/pom.xml b/pom.xml index 79521eda..63669607 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,7 @@ - + 4.0.0 - - 3.0 - - com.justdavis.karl.jessentials jessentials-parent @@ -19,9 +14,7 @@ pom rps-tourney-parent - - The parent POM for the "Rock-Paper-Scissors Tourney" games. - + The parent POM for the "Rock-Paper-Scissors Tourney" games. https://github.com/karlmdavis/rps-tourney Karl M. Davis @@ -33,8 +26,30 @@ + + 3.0 + + + + rps-tourney-service-api + rps-tourney-service-client + rps-tourney-service-app + rps-tourney-console + rps-tourney-webapp + rps-tourney-benchmarks + rps-tourney-deployment + + + + + scm:git:git@github.com:karlmdavis/rps-tourney.git + scm:git:git@github.com:karlmdavis/rps-tourney.git + HEAD + https://github.com/karlmdavis/rps-tourney + + - GitHub Issues https://github.com/karlmdavis/rps-tourney/issues @@ -45,14 +60,6 @@ https://justdavis.com/jenkins/job/rps-tourney/ - - - scm:git:git@github.com:karlmdavis/rps-tourney.git - scm:git:git@github.com:karlmdavis/rps-tourney.git - https://github.com/karlmdavis/rps-tourney - HEAD - - justdavis.com-nexus @@ -64,22 +71,16 @@ - - rps-tourney-service-api - rps-tourney-service-client - rps-tourney-service-app - rps-tourney-console - rps-tourney-webapp - rps-tourney-benchmarks - rps-tourney-deployment - - - + ${project.basedir}/dev + + ${dependency.springframework.version} - 5.2.12.Final @@ -88,11 +89,11 @@ 2.9.0 - + 9.2.24.v20180105 - 0.25C @@ -127,7 +128,7 @@ [4.0.1-SNAPSHOT,] - com.justdavis.karl.jessentials jessentials-tomcat @@ -135,7 +136,7 @@ - ch.qos.logback logback-classic @@ -143,7 +144,7 @@ - org.springframework spring-framework-bom @@ -151,16 +152,16 @@ pom import - + - org.postgresql postgresql 42.6.0 - org.hsqldb hsqldb @@ -172,11 +173,72 @@ + + + com.rudikershaw.gitbuildhook + git-build-hook-maven-plugin + 3.4.1 + + + + com.diffplug.spotless + spotless-maven-plugin + 2.30.0 + + + + + -1 + + + + + + + + rps-tourney-*/**/*.java + + + + ${rps.dev.path}/eclipse-formatter-java.xml + + + + + + + + + src/main/webapp/resources/js/*.js + + + JS + + + + + + + + src/**/*.xml + + + XML + + ${rps.dev.path}/eclipse-formatter-xml.prefs + + + + + + + + org.apache.maven.plugins maven-install-plugin - true @@ -185,7 +247,7 @@ org.apache.maven.plugins maven-deploy-plugin - true @@ -198,7 +260,7 @@ tests (both unit and integration). --> ${sonar.jacoco.reportPath} true - + ${sonar.jacoco.reportPath} @@ -207,8 +269,8 @@ org.apache.maven.plugins maven-failsafe-plugin - ${forkCount.its} true @@ -242,6 +304,42 @@ + + + + com.rudikershaw.gitbuildhook + git-build-hook-maven-plugin + + + + install + + + + + ../.github/git-hook-pre-commit.sh + + + + + + + + com.diffplug.spotless + spotless-maven-plugin + + + + + apply + + + + + diff --git a/rps-tourney-benchmarks/pom.xml b/rps-tourney-benchmarks/pom.xml index 9f56864d..4451fce1 100644 --- a/rps-tourney-benchmarks/pom.xml +++ b/rps-tourney-benchmarks/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 @@ -13,11 +12,13 @@ jar rps-tourney-benchmarks - - A set of benchmarks for the "RPS Tourney" web applications. - + A set of benchmarks for the "RPS Tourney" web applications. + + ${project.basedir}/../dev + 1.20 @@ -55,7 +56,7 @@ - ch.qos.logback logback-classic @@ -78,22 +79,20 @@ maven-shade-plugin - - package shade + + package ${uberjar.name} - + org.openjdk.jmh.Main - + META-INF/cxf/bus-extensions.txt diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BaselineBenchmarks.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BaselineBenchmarks.java index 94db6ba5..4b2643cb 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BaselineBenchmarks.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BaselineBenchmarks.java @@ -17,21 +17,18 @@ public class BaselineBenchmarks { @Benchmark public void emptyMethod() { /* - * This method is intentionally left empty. It can be used to assess the - * benchmarks' overhead. + * This method is intentionally left empty. It can be used to assess the benchmarks' overhead. */ } /** - * This method is only here to allow this {@link Benchmark} class to be run - * inside Eclipse. These configuration settings specified in here are only - * applied within Eclipse. - * + * This method is only here to allow this {@link Benchmark} class to be run inside Eclipse. These configuration + * settings specified in here are only applied within Eclipse. + * * @param args * (not used) * @throws RunnerException - * Any failures in the benchmarks will be wrapped and rethrown - * as {@link RunnerException}s. + * Any failures in the benchmarks will be wrapped and rethrown as {@link RunnerException}s. */ public static void main(String[] args) throws RunnerException { ChainedOptionsBuilder benchmarkOptions = new OptionsBuilder().include(BaselineBenchmarks.class.getSimpleName()) diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BenchmarkUser.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BenchmarkUser.java index ac852a49..7b12c6b1 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BenchmarkUser.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/BenchmarkUser.java @@ -7,9 +7,8 @@ import com.justdavis.karl.rpstourney.service.api.auth.game.GameLoginIdentity; /** - * Enumerates the standard {@link GameLoginIdentity}s that the benchmarks should - * use. Using these identities makes it easier to go clean up any mistakes if - * the benchmarks fail to clean up after themselves for some reason. + * Enumerates the standard {@link GameLoginIdentity}s that the benchmarks should use. Using these identities makes it + * easier to go clean up any mistakes if the benchmarks fail to clean up after themselves for some reason. */ public enum BenchmarkUser { USER_A("benchmarker.a@example.com", "player.a.pw1"), USER_B("benchmarker.b@example.com", "player.b.pw1"); @@ -19,7 +18,7 @@ public enum BenchmarkUser { /** * Enum constant constructor. - * + * * @param address * the value to use for {@link #getAddress()} * @param password @@ -35,16 +34,14 @@ private BenchmarkUser(String address, String password) { } /** - * @return the {@link GameLoginIdentity#getEmailAddress()} value for this - * {@link BenchmarkUser} + * @return the {@link GameLoginIdentity#getEmailAddress()} value for this {@link BenchmarkUser} */ public InternetAddress getAddress() { return address; } /** - * @return the (unhashed) {@link GameLoginIdentity#getPasswordHash()} value - * for this {@link BenchmarkUser} + * @return the (unhashed) {@link GameLoginIdentity#getPasswordHash()} value for this {@link BenchmarkUser} */ public String getPassword() { return password; diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/package-info.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/package-info.java index 6073a307..43e3a067 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/package-info.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/package-info.java @@ -1,4 +1,4 @@ /** * Base package for the benchmarks project. */ -package org.rps.tourney.benchmarks; \ No newline at end of file +package org.rps.tourney.benchmarks; diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ExistingServerManager.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ExistingServerManager.java index c149bfdd..c3b18ee7 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ExistingServerManager.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ExistingServerManager.java @@ -14,32 +14,30 @@ import org.slf4j.LoggerFactory; /** - * This {@link IServerManager} implementation is used when the benchmarks should - * run against an already-running server, such as production. + * This {@link IServerManager} implementation is used when the benchmarks should run against an already-running server, + * such as production. */ public final class ExistingServerManager implements IServerManager { /** - * The {@link System#getProperties()} key that specifies the {@link URL} of - * the already-running web service to use. + * The {@link System#getProperties()} key that specifies the {@link URL} of the already-running web service to use. */ public static final String PROP_SERVICE_URL = "rps.service.url"; /** - * The {@link System#getProperties()} key that specifies the {@link URL} of - * the already-running web application to use. + * The {@link System#getProperties()} key that specifies the {@link URL} of the already-running web application to + * use. */ public static final String PROP_WEBAPP_URL = "rps.webapp.url"; /** - * The {@link System#getProperties()} key that specifies the email - * address/login of the admin account for the already-running web service to - * use. + * The {@link System#getProperties()} key that specifies the email address/login of the admin account for the + * already-running web service to use. */ public static final String PROP_SERVICE_ADMIN_ADDRESS = "rps.service.admin.address"; /** - * The {@link System#getProperties()} key that specifies the password of the - * admin account for the already-running web service to use. + * The {@link System#getProperties()} key that specifies the password of the admin account for the already-running + * web service to use. */ public static final String PROP_SERVICE_ADMIN_PASSWORD = "rps.service.admin.password"; @@ -51,9 +49,8 @@ public final class ExistingServerManager implements IServerManager { private final String adminPassword; /** - * Constructs a new {@link ExistingServerManager} instance. Will attempt to - * configure itself based on the current Java system properties. If it - * fails, it will throw an {@link IllegalArgumentException}. + * Constructs a new {@link ExistingServerManager} instance. Will attempt to configure itself based on the current + * Java system properties. If it fails, it will throw an {@link IllegalArgumentException}. */ public ExistingServerManager() { String serviceUrlText = System.getProperty(PROP_SERVICE_URL); @@ -95,7 +92,7 @@ public ExistingServerManager() { public URL getServiceUrl() { return serviceUrl; } - + /** * @see org.rps.tourney.benchmarks.serverutils.IServerManager#getWebAppUrl() */ @@ -145,10 +142,8 @@ public String toString() { } /** - * @return true if the necessary {@link System#getProperties()} - * entries have been provided to properly configure an - * {@link ExistingServerManager}, false if they have - * not + * @return true if the necessary {@link System#getProperties()} entries have been provided to properly + * configure an {@link ExistingServerManager}, false if they have not */ public static boolean isConfigured() { try { @@ -162,14 +157,12 @@ public static boolean isConfigured() { /** *

- * Generates the Java System properties that would configure the benchmarks - * to run against a local Tomcat instance running out of Eclipse on port - * 9093. + * Generates the Java System properties that would configure the benchmarks to run against a local Tomcat instance + * running out of Eclipse on port 9093. *

*

- * Just a convenience method for use in {@link Benchmark} classes' - * main(...) methods. Should be used with - * {@link ChainedOptionsBuilder#jvmArgsAppend(String...)}. + * Just a convenience method for use in {@link Benchmark} classes' main(...) methods. Should be used + * with {@link ChainedOptionsBuilder#jvmArgsAppend(String...)}. *

*/ public static String[] jvmArgsForTomcatWtp() { @@ -179,8 +172,7 @@ public static String[] jvmArgsForTomcatWtp() { jvmArgs.add(String.format("-D%s=%s", PROP_WEBAPP_URL, "http://localhost:9093/rps-tourney-webapp")); /* - * The admin login details are specified in - * /rps-tourney-webapp/src/test/resources/rps-service-config-dev.xml. + * The admin login details are specified in /rps-tourney-webapp/src/test/resources/rps-service-config-dev.xml. */ jvmArgs.add(String.format("-D%s=%s", PROP_SERVICE_ADMIN_ADDRESS, "admin@example.com")); jvmArgs.add(String.format("-D%s=%s", PROP_SERVICE_ADMIN_PASSWORD, "password")); diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/IServerManager.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/IServerManager.java index c4703faa..c37b7b76 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/IServerManager.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/IServerManager.java @@ -7,8 +7,8 @@ import org.openjdk.jmh.annotations.TearDown; /** - * Encapsulates the information that the application's benchmarks need from - * {@link ServerState}: where the applications are, logins to use for them, etc. + * Encapsulates the information that the application's benchmarks need from {@link ServerState}: where the applications + * are, logins to use for them, etc. */ public interface IServerManager { /** @@ -32,9 +32,8 @@ public interface IServerManager { String getAdminPassword(); /** - * Call this method as part of the benchmarks' {@link TearDown} to release - * any resources that were acquired to start or interact with this - * {@link IServerManager}. + * Call this method as part of the benchmarks' {@link TearDown} to release any resources that were acquired to start + * or interact with this {@link IServerManager}. */ void tearDown(); } diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/LocalServerManager.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/LocalServerManager.java index 7806039c..3f6ee77b 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/LocalServerManager.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/LocalServerManager.java @@ -36,8 +36,7 @@ import com.justdavis.karl.tomcat.TomcatServerHelper; /** - * This {@link IServerManager} implementation stands up a local - * {@link ITomcatServer} for the benchmarks to run against. + * This {@link IServerManager} implementation stands up a local {@link ITomcatServer} for the benchmarks to run against. */ final class LocalServerManager implements IServerManager { public static final String CONTEXT_ROOT_SERVICE = "rps-tourney-service-app"; @@ -51,8 +50,8 @@ final class LocalServerManager implements IServerManager { private final ITomcatServer server; /** - * Constructs a new {@link LocalServerManager}, reading the configuration - * from src/main/resources/rps-service-config-benchmarks.xml. + * Constructs a new {@link LocalServerManager}, reading the configuration from + * src/main/resources/rps-service-config-benchmarks.xml. */ public LocalServerManager() { Path tomcatDir = Paths.get(".", "target", "tomcat").toAbsolutePath(); diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ServerState.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ServerState.java index 617a8242..3b7f1fae 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ServerState.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/ServerState.java @@ -10,9 +10,8 @@ import com.justdavis.karl.tomcat.ITomcatServer; /** - * Stores the {@link ITomcatServer} instance representing the application - * server/container that is running the web applications, along with related - * objects. + * Stores the {@link ITomcatServer} instance representing the application server/container that is running the web + * applications, along with related objects. */ @State(Scope.Benchmark) public class ServerState { @@ -21,17 +20,15 @@ public class ServerState { private IServerManager serverManager; /** - * @return the {@link IServerManager} for the application server being - * benchmarked + * @return the {@link IServerManager} for the application server being benchmarked */ public IServerManager getServerManager() { return serverManager; } /** - * Initializes this {@link ServerState} instance. Will be called by the - * benchmark framework after the instance has been constructed, but before - * it is used. + * Initializes this {@link ServerState} instance. Will be called by the benchmark framework after the instance has + * been constructed, but before it is used. */ @Setup public void setup() { diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/package-info.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/package-info.java index d969006a..5f1b247d 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/package-info.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/serverutils/package-info.java @@ -1,5 +1,4 @@ /** - * Contains all of the Benchmark {@link org.openjdk.jmh.annotations.State} - * utilities. + * Contains all of the Benchmark {@link org.openjdk.jmh.annotations.State} utilities. */ -package org.rps.tourney.benchmarks.serverutils; \ No newline at end of file +package org.rps.tourney.benchmarks.serverutils; diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameDisplayBenchmarks.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameDisplayBenchmarks.java index f0238d3a..aae5a92b 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameDisplayBenchmarks.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameDisplayBenchmarks.java @@ -21,17 +21,14 @@ import com.justdavis.karl.rpstourney.service.client.game.GameClient; /** - * Contains {@link Benchmark}s for those web service methods related to display - * of existing game instances. + * Contains {@link Benchmark}s for those web service methods related to display of existing game instances. */ public class ServiceGameDisplayBenchmarks { /** - * A {@link Benchmark} for {@link GameClient#getGame(String)}, when the - * requesting user is unauthenticated. - * + * A {@link Benchmark} for {@link GameClient#getGame(String)}, when the requesting user is unauthenticated. + * * @param gameInProgressState - * a {@link GameInProgressState} instance that provides the game - * to be requested from the web service + * a {@link GameInProgressState} instance that provides the game to be requested from the web service */ @Benchmark public void retrieveGameAsUnauthenticatedUser(GameInProgressState gameInProgressState) { @@ -43,15 +40,13 @@ public void retrieveGameAsUnauthenticatedUser(GameInProgressState gameInProgress } /** - * This method is only here to allow this {@link Benchmark} class to be run - * inside Eclipse. These configuration settings specified in here are only - * applied within Eclipse. - * + * This method is only here to allow this {@link Benchmark} class to be run inside Eclipse. These configuration + * settings specified in here are only applied within Eclipse. + * * @param args * (not used) * @throws RunnerException - * Any failures in the benchmarks will be wrapped and rethrown - * as {@link RunnerException}s. + * Any failures in the benchmarks will be wrapped and rethrown as {@link RunnerException}s. */ public static void main(String[] args) throws RunnerException { ChainedOptionsBuilder benchmarkOptions = new OptionsBuilder() @@ -64,8 +59,7 @@ public static void main(String[] args) throws RunnerException { } /** - * Represents a {@link Game} that is already in-progress and can be - * retrieved from the web service. + * Represents a {@link Game} that is already in-progress and can be retrieved from the web service. */ @State(Scope.Benchmark) public static class GameInProgressState { @@ -80,8 +74,7 @@ public ServerState getServerState() { } /** - * @return the {@link Game#getId()} for the {@link Game} represented by - * this instance + * @return the {@link Game#getId()} for the {@link Game} represented by this instance */ public String getGameId() { return gameId; @@ -89,7 +82,7 @@ public String getGameId() { /** * Initializes {@link GameInProgressState} instances. - * + * * @param serverState * the {@link ServerState} that the web service is running in */ diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameplayBenchmarks.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameplayBenchmarks.java index c707d7ba..6f3b5481 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameplayBenchmarks.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/ServiceGameplayBenchmarks.java @@ -30,17 +30,14 @@ import com.justdavis.karl.rpstourney.service.client.game.PlayersClient; /** - * Contains {@link Benchmark}s for those web service methods related to playing - * games. + * Contains {@link Benchmark}s for those web service methods related to playing games. */ public class ServiceGameplayBenchmarks { /** - * A {@link Benchmark} for {@link GameClient#getGame(String)}, when the - * requesting user is unauthenticated. - * + * A {@link Benchmark} for {@link GameClient#getGame(String)}, when the requesting user is unauthenticated. + * * @param gameInProgressState - * a {@link GameInProgressState} instance that provides the game - * to be requested from the web service + * a {@link GameInProgressState} instance that provides the game to be requested from the web service */ @Benchmark public void playScriptedFiveRoundGame(GameplayState gameplayState) { @@ -101,19 +98,18 @@ public void playScriptedFiveRoundGame(GameplayState gameplayState) { } /** - * This method is only here to allow this {@link Benchmark} class to be run - * inside Eclipse. These configuration settings specified in here are only - * applied within Eclipse. - * + * This method is only here to allow this {@link Benchmark} class to be run inside Eclipse. These configuration + * settings specified in here are only applied within Eclipse. + * * @param args * (not used) * @throws RunnerException - * Any failures in the benchmarks will be wrapped and rethrown - * as {@link RunnerException}s. + * Any failures in the benchmarks will be wrapped and rethrown as {@link RunnerException}s. */ public static void main(String[] args) throws RunnerException { - ChainedOptionsBuilder benchmarkOptions = new OptionsBuilder().include(ServiceGameplayBenchmarks.class.getSimpleName()) - .warmupIterations(20).measurementIterations(10).forks(1).threads(10 ^ 2).verbosity(VerboseMode.EXTRA); + ChainedOptionsBuilder benchmarkOptions = new OptionsBuilder() + .include(ServiceGameplayBenchmarks.class.getSimpleName()).warmupIterations(20).measurementIterations(10) + .forks(1).threads(10 ^ 2).verbosity(VerboseMode.EXTRA); // benchmarkOptions.addProfiler(StackProfiler.class); // benchmarkOptions.jvmArgsAppend(ExistingServerManager.jvmArgsForTomcatWtp()); @@ -125,8 +121,8 @@ public static void main(String[] args) throws RunnerException { * Manages the state required for {@link ServiceGameplayBenchmarks}. *

*

- * Also tracks the {@link Game}s that were created during the benchmark and - * cleans them up afterwards in a {@link TearDown}. + * Also tracks the {@link Game}s that were created during the benchmark and cleans them up afterwards in a + * {@link TearDown}. *

*/ @State(Scope.Benchmark) @@ -143,8 +139,7 @@ public ServerState getServerState() { /** * @param gameToCleanup - * the {@link GameView} for the game to be cleaned up at the - * end of the benchmarks + * the {@link GameView} for the game to be cleaned up at the end of the benchmarks */ public void addGameForCleanup(GameView gameToCleanup) { gameIds.add(gameToCleanup.getId()); @@ -152,7 +147,7 @@ public void addGameForCleanup(GameView gameToCleanup) { /** * Initializes {@link GameplayState} instances. - * + * * @param serverState * the {@link ServerState} that the web service is running in */ @@ -195,9 +190,7 @@ public void setup(ServerState serverState) { } /** - * Cleans up all of the games passed to - * {@link #addGameForCleanup(GameView)} over the course of the - * benchmarks. + * Cleans up all of the games passed to {@link #addGameForCleanup(GameView)} over the course of the benchmarks. */ @TearDown public void tearDown() { diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/package-info.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/package-info.java index 0616c3b4..a571b296 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/package-info.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/service/package-info.java @@ -1,5 +1,4 @@ /** - * Base package for the project, which also contains all of the actual - * benchmarks. + * Base package for the project, which also contains all of the actual benchmarks. */ -package org.rps.tourney.benchmarks.service; \ No newline at end of file +package org.rps.tourney.benchmarks.service; diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/WebAppGameDisplayBenchmarks.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/WebAppGameDisplayBenchmarks.java index f4161c6c..81111efd 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/WebAppGameDisplayBenchmarks.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/WebAppGameDisplayBenchmarks.java @@ -37,17 +37,15 @@ import com.justdavis.karl.rpstourney.service.client.game.GameClient; /** - * Contains {@link Benchmark}s for those web app resources related to display of - * existing game instances. + * Contains {@link Benchmark}s for those web app resources related to display of existing game instances. */ public class WebAppGameDisplayBenchmarks { /** - * A {@link Benchmark} for server side rendering of the game page and its - * associated resources, with an unauthenticated user. - * + * A {@link Benchmark} for server side rendering of the game page and its associated resources, with an + * unauthenticated user. + * * @param gameInProgressState - * a {@link GameInProgressState} instance that provides the game - * to be requested from the web service + * a {@link GameInProgressState} instance that provides the game to be requested from the web service */ @Benchmark public void viewGameAsUnauthenticatedUser(GameInProgressState gameInProgressState) { @@ -56,8 +54,8 @@ public void viewGameAsUnauthenticatedUser(GameInProgressState gameInProgressStat URL gameUrl = resolve(webAppUrl, "/game/" + gameInProgressState.getGameId()); /* - * Specify the resources to be loaded, in groups. Each top-level element - * here is a group of resources that will be loaded concurrently. + * Specify the resources to be loaded, in groups. Each top-level element here is a group of resources that will + * be loaded concurrently. */ URL[] resources1 = new URL[] { gameUrl }; URL[] resources2 = new URL[] { resolve(webAppUrl, "/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"), @@ -99,12 +97,10 @@ public void viewGameAsUnauthenticatedUser(GameInProgressState gameInProgressStat } /** - * A {@link Benchmark} for server side rendering of the game - * update/refresh/status JSON, as an unauthenticated user. - * + * A {@link Benchmark} for server side rendering of the game update/refresh/status JSON, as an unauthenticated user. + * * @param gameInProgressState - * a {@link GameInProgressState} instance that provides the game - * to be requested from the web service + * a {@link GameInProgressState} instance that provides the game to be requested from the web service */ @Benchmark public void refreshGameAsUnauthenticatedUser(GameInProgressState gameInProgressState) { @@ -141,15 +137,13 @@ private static final URL resolve(URL baseUrl, String additionalUrl) { } /** - * This method is only here to allow this {@link Benchmark} class to be run - * inside Eclipse. These configuration settings specified in here are only - * applied within Eclipse. - * + * This method is only here to allow this {@link Benchmark} class to be run inside Eclipse. These configuration + * settings specified in here are only applied within Eclipse. + * * @param args * (not used) * @throws RunnerException - * Any failures in the benchmarks will be wrapped and rethrown - * as {@link RunnerException}s. + * Any failures in the benchmarks will be wrapped and rethrown as {@link RunnerException}s. */ public static void main(String[] args) throws RunnerException { ChainedOptionsBuilder benchmarkOptions = new OptionsBuilder() @@ -163,15 +157,14 @@ public static void main(String[] args) throws RunnerException { /** * A {@link Callable} that can be used in - * {@link WebAppGameDisplayBenchmarks#retrieveGameHtmlOnlyAsUnauthenticatedUser(GameInProgressState)} - * . + * {@link WebAppGameDisplayBenchmarks#retrieveGameHtmlOnlyAsUnauthenticatedUser(GameInProgressState)} . */ private static final class ResourceLoader implements Callable { private final URL resource; /** * Constructs a new {@link ResourceLoader}. - * + * * @param resource * the {@link URL} of the resource to be loaded */ @@ -199,7 +192,7 @@ private static final class ResourceResult { /** * Constructs a new {@link ResourceResult}. - * + * * @param resource * the value to use for {@link #getResource()} * @param responseCode @@ -218,8 +211,7 @@ public URL getResource() { } /** - * @return the HTTP response/status code that was encountered while - * loading the resource + * @return the HTTP response/status code that was encountered while loading the resource */ public int getResponseCode() { return responseCode; @@ -241,8 +233,7 @@ public String toString() { } /** - * Represents a {@link Game} that is already in-progress and can be - * retrieved from the web service. + * Represents a {@link Game} that is already in-progress and can be retrieved from the web service. */ @State(Scope.Benchmark) public static class GameInProgressState { @@ -257,8 +248,7 @@ public ServerState getServerState() { } /** - * @return the {@link Game#getId()} for the {@link Game} represented by - * this instance + * @return the {@link Game#getId()} for the {@link Game} represented by this instance */ public String getGameId() { return gameId; @@ -266,7 +256,7 @@ public String getGameId() { /** * Initializes {@link GameInProgressState} instances. - * + * * @param serverState * the {@link ServerState} that the web service is running in */ diff --git a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/package-info.java b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/package-info.java index 9b9bd866..83644d20 100644 --- a/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/package-info.java +++ b/rps-tourney-benchmarks/src/main/java/org/rps/tourney/benchmarks/webapp/package-info.java @@ -1,4 +1,4 @@ /** * Contains benchmarks for the rps-tourney-webapp WAR. */ -package org.rps.tourney.benchmarks.webapp; \ No newline at end of file +package org.rps.tourney.benchmarks.webapp; diff --git a/rps-tourney-benchmarks/src/main/resources/logback.xml b/rps-tourney-benchmarks/src/main/resources/logback.xml index ba3eb9c1..fe7c7dbc 100644 --- a/rps-tourney-benchmarks/src/main/resources/logback.xml +++ b/rps-tourney-benchmarks/src/main/resources/logback.xml @@ -2,16 +2,12 @@ - + - - + + target/logs/${project.artifactId}.log @@ -29,4 +25,4 @@ -
\ No newline at end of file + diff --git a/rps-tourney-benchmarks/src/main/resources/rps-service-config-benchmarks.xml b/rps-tourney-benchmarks/src/main/resources/rps-service-config-benchmarks.xml index 6b57a077..ea36299d 100644 --- a/rps-tourney-benchmarks/src/main/resources/rps-service-config-benchmarks.xml +++ b/rps-tourney-benchmarks/src/main/resources/rps-service-config-benchmarks.xml @@ -2,9 +2,8 @@ - + jdbc:hsqldb:mem:serviceapp;hsqldb.tx=mvcc diff --git a/rps-tourney-console/pom.xml b/rps-tourney-console/pom.xml index 68bd4f97..5384e162 100644 --- a/rps-tourney-console/pom.xml +++ b/rps-tourney-console/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 @@ -12,11 +12,12 @@ jar rps-tourney-console - - A text console version of the "Rock-Paper-Scissors Tourney" game. - + A text console version of the "Rock-Paper-Scissors Tourney" game. + + ${project.basedir}/../dev @@ -37,14 +38,14 @@
- org.slf4j slf4j-api - ch.qos.logback logback-classic @@ -62,7 +63,7 @@ test - com.justdavis.karl.rpstourney rps-tourney-service-app @@ -71,7 +72,7 @@ test - org.hsqldb hsqldb @@ -82,10 +83,10 @@ - src/main/java true + src/main/java - ** @@ -94,8 +95,8 @@ - src/main/resources true + src/main/resources @@ -124,7 +125,7 @@ - org.codehaus.cargo cargo-maven2-plugin @@ -132,9 +133,9 @@ jetty9x - org.eclipse.jetty jetty-distribution @@ -148,7 +149,7 @@ - org.hsqldb hsqldb @@ -184,10 +185,10 @@ jacoco-maven-plugin - default-prepare-agent @@ -195,10 +196,10 @@ - default-prepare-agent-integration @@ -213,40 +214,40 @@ make-assembly - package single + package - org.codehaus.cargo cargo-maven2-plugin start-container - pre-integration-test start + pre-integration-test stop-container - post-integration-test stop + post-integration-test - org.apache.maven.plugins maven-failsafe-plugin diff --git a/rps-tourney-console/src/main/assembly/dist.xml b/rps-tourney-console/src/main/assembly/dist.xml index 3df0f24b..eb7373fc 100644 --- a/rps-tourney-console/src/main/assembly/dist.xml +++ b/rps-tourney-console/src/main/assembly/dist.xml @@ -1,5 +1,4 @@ - dist @@ -19,7 +18,7 @@ - + src/main/assembly/rpstourney.sh / 775 @@ -34,4 +33,4 @@ runtime - \ No newline at end of file + diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/BuiltInAiOptionHandler.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/BuiltInAiOptionHandler.java index c59b3847..ae21698a 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/BuiltInAiOptionHandler.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/BuiltInAiOptionHandler.java @@ -11,17 +11,15 @@ import com.justdavis.karl.rpstourney.service.api.game.ai.BuiltInAi; /** - * This Args4J {@link OptionHandler} handles parsing of {@link BuiltInAi} - * instances from {@link String}s. This will map "Easy", "Medium", or "Hard" - * {@link String}s to hardcoded {@link BuiltInAi} constants. + * This Args4J {@link OptionHandler} handles parsing of {@link BuiltInAi} instances from {@link String}s. This will map + * "Easy", "Medium", or "Hard" {@link String}s to hardcoded {@link BuiltInAi} constants. */ public final class BuiltInAiOptionHandler extends OptionHandler { /** * Constructs a new {@link BuiltInAiOptionHandler} instance. - * + * * @param parser - * the {@link CmdLineParser} that this {@link OptionHandler} will - * be used with + * the {@link CmdLineParser} that this {@link OptionHandler} will be used with * @param option * the {@link OptionDef} being handled * @param setter @@ -59,4 +57,4 @@ public int parseArguments(Parameters params) throws CmdLineException { public String getDefaultMetaVariable() { return "AI"; } -} \ No newline at end of file +} diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleApp.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleApp.java index 3139b37f..f208aba6 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleApp.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleApp.java @@ -34,34 +34,30 @@ /** *

- * The main entry point/driver for the text console version of the - * "Rock-Paper-Scissors Tourney" game. When run, it will allow a human to play - * the game using the text console (or whatever is connected to - * {@link System#out} and {@link System#in}). The player's opponent will be a - * computer/AI player. + * The main entry point/driver for the text console version of the "Rock-Paper-Scissors Tourney" game. When run, it will + * allow a human to play the game using the text console (or whatever is connected to {@link System#out} and + * {@link System#in}). The player's opponent will be a computer/AI player. *

*

- * This class is pretty much only responsible for application initialization. It - * delegates the user interface and gameplay to {@link ConsoleGameDriver}. + * This class is pretty much only responsible for application initialization. It delegates the user interface and + * gameplay to {@link ConsoleGameDriver}. *

*/ public final class ConsoleApp { /** - * By convention, applications return this value as an exit code to indicate - * that they ran successfully and are exiting normally. + * By convention, applications return this value as an exit code to indicate that they ran successfully and are + * exiting normally. */ private static final int EXIT_CODE_OK = 0; /** - * This is the exit code that the application will return if the command - * line options cannot be parsed correctly. + * This is the exit code that the application will return if the command line options cannot be parsed correctly. */ private static final int EXIT_CODE_BAD_ARGS = 1; /** - * The {@link Pattern} that will be used to extract {@link Game#getId()} - * values from {@link Options#getGameUri()}. The group at index - * 1 will contain the game ID. + * The {@link Pattern} that will be used to extract {@link Game#getId()} values from {@link Options#getGameUri()}. + * The group at index 1 will contain the game ID. */ private static final Pattern GAME_URI_PATTERN = Pattern .compile("^https?://.+/(" + Game.ID_PATTERN.pattern() + ")$"); @@ -79,12 +75,10 @@ public ConsoleApp() { /** * The application entry point for {@link ConsoleApp}. - * + * * @param args - * the command line arguments passed to the application when it - * was launched. See - * {@link OptionsParser#parseCommandLineOptions(String[])} for - * details on how these are parsed. + * the command line arguments passed to the application when it was launched. See + * {@link OptionsParser#parseCommandLineOptions(String[])} for details on how these are parsed. */ public static void main(String[] args) { // Create and run the app. @@ -92,11 +86,9 @@ public static void main(String[] args) { int exitCode = app.runApp(args, System.out, System.in); /* - * This application doesn't have any expected error conditions, aside - * from unanticipated (and unhandled) runtime exceptions. Accordingly, - * we'll always return an "all clear" exit code if we make it this far. - * We'll let the JVM deal with any unhandled exceptions, presumably by - * dumping a stack trace and returning an error code. + * This application doesn't have any expected error conditions, aside from unanticipated (and unhandled) runtime + * exceptions. Accordingly, we'll always return an "all clear" exit code if we make it this far. We'll let the + * JVM deal with any unhandled exceptions, presumably by dumping a stack trace and returning an error code. */ System.exit(exitCode); } @@ -108,18 +100,15 @@ public static void main(String[] args) { *

* The method is only in the default/package scope to enable unit testing. *

- * + * * @param args - * the command line arguments passed to the application when it - * was launched. See - * {@link OptionsParser#parseCommandLineOptions(String[])} for - * details on how these are parsed. + * the command line arguments passed to the application when it was launched. See + * {@link OptionsParser#parseCommandLineOptions(String[])} for details on how these are parsed. * @param out * the {@link PrintStream} to display the game on * @param in * the {@link InputStream} to read the player's input from - * @return the exit code that the application should return, e.g. - * {@link #EXIT_CODE_OK} + * @return the exit code that the application should return, e.g. {@link #EXIT_CODE_OK} */ int runApp(String[] args, PrintStream out, InputStream in) { // Parse the command line options. @@ -129,17 +118,15 @@ int runApp(String[] args, PrintStream out, InputStream in) { } /* - * Enable debug logging, if requested. We must be careful not to - * accidentally log anything before now, as any such log events will - * never be written out. + * Enable debug logging, if requested. We must be careful not to accidentally log anything before now, as any + * such log events will never be written out. */ if (options.isDebugEnabled()) enableDebugLogging(); LOGGER.debug("Command line arguments: {}", Arrays.toString(args)); /* - * Did the user request the command line help? If so, display it and - * exit early. + * Did the user request the command line help? If so, display it and exit early. */ if (options.isHelpRequested()) { optionsParser.printUsage(out); @@ -174,8 +161,7 @@ private static void enableDebugLogging() { ch.qos.logback.classic.Logger rootLogbackLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); /* - * Enable all logging levels at the root logger, which will in turn - * enable them for all child loggers. + * Enable all logging levels at the root logger, which will in turn enable them for all child loggers. */ rootLogbackLogger.setLevel(Level.ALL); } @@ -197,11 +183,10 @@ private static GameBundle createLocalGame(Options options) { /** * @param options * the {@link Options} specified for the game - * @return a {@link GameBundle} for playing an online game using the web - * service + * @return a {@link GameBundle} for playing an online game using the web service * @throws ConsoleGameExitException - * A {@link GameConflictException} may be thrown if a problem is - * found with the provided {@link Options}. + * A {@link GameConflictException} may be thrown if a problem is found with the provided + * {@link Options}. */ private static GameBundle createOnlineGame(Options options) throws ConsoleGameExitException { ClientConfig config = new ClientConfig(options.getServerUri()); @@ -250,4 +235,4 @@ private static void authenticateToWebService(Options options, ClientConfig confi guestAuthClient.loginAsGuest(); } } -} \ No newline at end of file +} diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriver.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriver.java index d6e613d0..4a4bb989 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriver.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriver.java @@ -22,8 +22,8 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * Allows a "Rock-Paper-Scissors Tourney" game to be played via a text console - * (or something else connected to an input & output stream). + * Allows a "Rock-Paper-Scissors Tourney" game to be played via a text console (or something else connected to an input + * & output stream). */ final class ConsoleGameDriver { private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleGameDriver.class); @@ -32,7 +32,7 @@ final class ConsoleGameDriver { /** * Constructs a new {@link ConsoleGameDriver} instance. - * + * * @param resourceBundleLoader * the {@link IResourceBundleLoader} to use */ @@ -41,12 +41,10 @@ public ConsoleGameDriver(IResourceBundleLoader resourceBundleLoader) { } /** - * Allows the user at the specified input/output streams to play the - * specified game. - * + * Allows the user at the specified input/output streams to play the specified game. + * * @param gameBundle - * the {@link GameBundle} containing the game and the services - * needed to play through it + * the {@link GameBundle} containing the game and the services needed to play through it * @param out * the {@link PrintStream} to display the game on * @param in @@ -86,10 +84,9 @@ void playGame(GameBundle gameBundle, PrintStream out, InputStream in) { /** * Plays a full, single round in the specified game. - * + * * @param gameBundle - * the {@link GameBundle} containing the game and the services - * needed to play through it + * the {@link GameBundle} containing the game and the services needed to play through it * @param out * the {@link PrintStream} to display the game on * @param scanner @@ -140,8 +137,7 @@ private static void playGameRound(GameBundle gameBundle, PrintStream out, Scanne * the {@link PrintStream} to display the game on * @param scanner * the {@link Scanner} to read the player's input from - * @return the {@link Throw} selected by the human player, that they would - * like to next make + * @return the {@link Throw} selected by the human player, that they would like to next make */ private static Throw requestHumanMove(PrintStream out, Scanner scanner) { Throw humanMove = null; @@ -167,13 +163,11 @@ private static Throw requestHumanMove(PrintStream out, Scanner scanner) { /** * @param gameBundle - * the {@link GameBundle} containing the game and the services - * needed to play through it + * the {@link GameBundle} containing the game and the services needed to play through it * @param roundIndex - * the {@link GameRound#getRoundIndex()} of the game round to - * wait for the opponent to make a move in - * @return an updated {@link GameView} instance, wherein the opponent has - * now made their move for the specified round + * the {@link GameRound#getRoundIndex()} of the game round to wait for the opponent to make a move in + * @return an updated {@link GameView} instance, wherein the opponent has now made their move for the specified + * round */ private static void waitForOpponentThrow(GameBundle gameBundle, int roundIndex) { GameView game = getGame(gameBundle); @@ -206,8 +200,7 @@ private static GameView getGame(GameBundle gameBundle) { * the {@link IResourceBundleLoader} to use * @param gameBundle * the {@link GameBundle} for the active game - * @return the display name to use for the user's opponent in the active - * game + * @return the display name to use for the user's opponent in the active game */ private static String computeOpponentName(IResourceBundleLoader resourceBundleLoader, GameBundle gameBundle) { GameView game = getGame(gameBundle); @@ -231,11 +224,10 @@ private static String computeOpponentName(IResourceBundleLoader resourceBundleLo /** * Determines the "won/lost" text to display for a completed game. - * + * * @param game * the {@link GameView} to calculate the result for - * @return the text "You won!" or "You lost.", as - * appropriate + * @return the text "You won!" or "You lost.", as appropriate */ private static String determineWonOrLostText(GameView game) { if (game == null) @@ -263,13 +255,12 @@ else if (scoreForUser < scoreForOpponent) /** * Determines the "won/lost" text to display for a completed game round. - * + * * @param game * the {@link GameView} to calculate the result for * @param round * the {@link GameRound} to calculate the result for - * @return the text "You won!", or "You lost. - * ", or "Tied.", as appropriate + * @return the text "You won!", or "You lost. ", or "Tied.", as appropriate */ private static String determineWonOrLostText(GameView game, GameRound round) { if (game == null) @@ -291,11 +282,10 @@ else if (userRoles.contains(roundResult.getWinningPlayerRole())) /** * Determines the score text to display. - * + * * @param game * the {@link GameView} to calculate the score from - * @return the score so far in the form of "You: X, Opponent: Y - * " + * @return the score so far in the form of "You: X, Opponent: Y " */ private static String determineScoreText(GameView game) { if (game == null) @@ -315,8 +305,7 @@ private static String determineScoreText(GameView game) { } /** - * Associates each {@link Throw} with a token that can be used to represent - * it. + * Associates each {@link Throw} with a token that can be used to represent it. */ private enum ThrowToken { ROCK("R", "Rock", Throw.ROCK), @@ -331,7 +320,7 @@ private enum ThrowToken { /** * Enum constant constructor. - * + * * @param token * the value to use for {@link #getToken()} * @param fullDisplayText @@ -346,16 +335,14 @@ private ThrowToken(String token, String fullDisplayText, Throw move) { } /** - * @return the short {@link String} to use to represent the - * {@link #getMove()} {@link Throw} + * @return the short {@link String} to use to represent the {@link #getMove()} {@link Throw} */ public String getToken() { return token; } /** - * @return the full display {@link String} to use to represent the - * {@link #getMove()} {@link Throw} + * @return the full display {@link String} to use to represent the {@link #getMove()} {@link Throw} */ public String getFullDisplayText() { return fullDisplayText; @@ -369,13 +356,11 @@ public Throw getMove() { } /** - * Checks all of the {@link ThrowToken}s to find the one that matches - * the specified token, if any. - * + * Checks all of the {@link ThrowToken}s to find the one that matches the specified token, if any. + * * @param token * the possible {@link #getToken()} value to match - * @return the matching {@link ThrowToken}, or null if no - * match is found + * @return the matching {@link ThrowToken}, or null if no match is found */ public static ThrowToken match(String token) { for (ThrowToken throwToken : ThrowToken.values()) @@ -386,9 +371,8 @@ public static ThrowToken match(String token) { } /** - * Checks all of the {@link ThrowToken}s to find the one that matches - * the specified {@link Throw}. - * + * Checks all of the {@link ThrowToken}s to find the one that matches the specified {@link Throw}. + * * @param move * the {@link Throw} value to match * @return the matching {@link ThrowToken} diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameExitException.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameExitException.java index 7e66e96d..5bba2ef9 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameExitException.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameExitException.java @@ -1,9 +1,8 @@ package com.justdavis.karl.rpstourney.app.console; /** - * This checked exception is used to signal that an error condition has occurred - * that should cause the game application to exit with the code specified in - * {@link #getExitCode()}. + * This checked exception is used to signal that an error condition has occurred that should cause the game application + * to exit with the code specified in {@link #getExitCode()}. */ public final class ConsoleGameExitException extends Exception { private static final long serialVersionUID = 7946240691200608017L; @@ -12,7 +11,7 @@ public final class ConsoleGameExitException extends Exception { /** * Constructs a new {@link ConsoleGameExitException} instance. - * + * * @param exitCode */ public ConsoleGameExitException(int exitCode) { @@ -20,8 +19,7 @@ public ConsoleGameExitException(int exitCode) { } /** - * @return the {@link System#exit(int)} code that the game application - * should exit with + * @return the {@link System#exit(int)} code that the game application should exit with */ public int getExitCode() { return exitCode; diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/InternetAddressOptionHandler.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/InternetAddressOptionHandler.java index dc4ed4e2..c3e9f9fb 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/InternetAddressOptionHandler.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/InternetAddressOptionHandler.java @@ -12,16 +12,14 @@ import org.kohsuke.args4j.spi.Setter; /** - * This Args4J {@link OptionHandler} handles parsing of {@link InternetAddress} - * instances from {@link String}s. + * This Args4J {@link OptionHandler} handles parsing of {@link InternetAddress} instances from {@link String}s. */ public final class InternetAddressOptionHandler extends OptionHandler { /** * Constructs a new {@link InternetAddressOptionHandler} instance. - * + * * @param parser - * the {@link CmdLineParser} that this {@link OptionHandler} will - * be used with + * the {@link CmdLineParser} that this {@link OptionHandler} will be used with * @param option * the {@link OptionDef} being handled * @param setter @@ -53,4 +51,4 @@ public int parseArguments(Parameters params) throws CmdLineException { public String getDefaultMetaVariable() { return "EMAIL"; } -} \ No newline at end of file +} diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/Options.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/Options.java index e3984a95..21b1546d 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/Options.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/Options.java @@ -21,9 +21,8 @@ */ final class Options { /* - * In order to support parsing via CmdLineParser, the following is required: - * 1) a non-private default constructor must be present, and 2) none of the - * fields here may be final. + * In order to support parsing via CmdLineParser, the following is required: 1) a non-private default constructor + * must be present, and 2) none of the fields here may be final. */ static final String DEFAULT_SERVER = "https://rpstourney.com/api"; @@ -86,8 +85,7 @@ final class Options { } /** - * @return true if network play (and saving history) are - * disabled, false if they are not + * @return true if network play (and saving history) are disabled, false if they are not */ public boolean isOnline() { return online; @@ -117,9 +115,8 @@ void setServerUri(URI serverUri) { } /** - * @return the email address of the user to login as (if {@link #isOnline()} - * is false), if not set, an anonymous account will be - * created and used + * @return the email address of the user to login as (if {@link #isOnline()} is false), if not set, an + * anonymous account will be created and used */ public InternetAddress getEmailAddress() { return emailAddress; @@ -149,8 +146,7 @@ void setPassword(String password) { } /** - * @return the URL of the RPS Tourney game to join (instead of starting a - * new game) + * @return the URL of the RPS Tourney game to join (instead of starting a new game) */ public URI getGameUri() { return gameUri; @@ -198,9 +194,8 @@ void setNumRounds(int numRounds) { } /** - * @return true if the application should write debug/logging - * output to STDERR, false if all such - * output should be suppressed + * @return true if the application should write debug/logging output to STDERR, + * false if all such output should be suppressed */ public boolean isDebugEnabled() { return debugEnabled; @@ -215,10 +210,8 @@ void setDebugEnabled(boolean debugEnabled) { } /** - * @return true if the application should write the command - * line help text to STDOUT and then exit, - * false if the application should attempt to just run - * normally + * @return true if the application should write the command line help text to STDOUT and + * then exit, false if the application should attempt to just run normally */ public boolean isHelpRequested() { return helpRequested; diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/OptionsParser.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/OptionsParser.java index 6db10d13..eb9c7730 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/OptionsParser.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/OptionsParser.java @@ -19,23 +19,18 @@ final class OptionsParser { /** *

- * Parses the specified {@link String} array of command line options and - * returns an {@link Options} instance representing them, or - * null if they could not be parsed. + * Parses the specified {@link String} array of command line options and returns an {@link Options} instance + * representing them, or null if they could not be parsed. *

*

- * Side Effects: If the command line arguments could not be - * parsed successfully, this method will also print out a (hopefully) - * helpful error message and the application usage text, all to - * {@link System#err}. + * Side Effects: If the command line arguments could not be parsed successfully, this method will + * also print out a (hopefully) helpful error message and the application usage text, all to {@link System#err}. *

- * + * * @param args - * the command line arguments passed to the application when it - * was launched - * @return an {@link Options} instance representing the command line - * arguments passed to the application when it was launched, or - * null if they could not be parsed + * the command line arguments passed to the application when it was launched + * @return an {@link Options} instance representing the command line arguments passed to the application when it was + * launched, or null if they could not be parsed */ Options parseCommandLineOptions(String[] args) { Options options = new Options(); @@ -45,8 +40,7 @@ Options parseCommandLineOptions(String[] args) { optionsParser.parseArgument(args); } catch (CmdLineException e) { /* - * This exception will be thrown if the command line options cannot - * be parsed correctly. + * This exception will be thrown if the command line options cannot be parsed correctly. */ // Print the error and usage. @@ -59,10 +53,9 @@ Options parseCommandLineOptions(String[] args) { /** * Prints out help text regarding the application's command line options. - * + * * @param outputStream - * the {@link PrintStream} to write to, typically - * {@link System#out} or {@link System#err} + * the {@link PrintStream} to write to, typically {@link System#out} or {@link System#err} */ void printUsage(PrintStream outputStream) { // Create a throw-away parser to use here. @@ -82,10 +75,8 @@ void printUsage(PrintStream outputStream) { */ private static String getExpectedOutputJarName() { /* - * To pull this off, I've created a .properties resource file that Maven - * should filter, dropping the output JAR's name into it. This method - * just loads that properties file and pulls the filtered value out from - * it. + * To pull this off, I've created a .properties resource file that Maven should filter, dropping the output + * JAR's name into it. This method just loads that properties file and pulls the filtered value out from it. */ // Get the path to the resource. diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/DefaultResourceBundleLoader.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/DefaultResourceBundleLoader.java index e6ffd429..36a5e8df 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/DefaultResourceBundleLoader.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/DefaultResourceBundleLoader.java @@ -5,15 +5,14 @@ /** * This {@link IResourceBundleLoader} implementation just loads from the - * rps-tourney-console/src/main/resources/i18n/messages.properties - * file, for the current system {@link Locale}. + * rps-tourney-console/src/main/resources/i18n/messages.properties file, for the current system + * {@link Locale}. */ public final class DefaultResourceBundleLoader implements IResourceBundleLoader { private final Locale locale; /** - * Constructs a new {@link DefaultResourceBundleLoader}, which will use - * {@link Locale#getDefault()}. + * Constructs a new {@link DefaultResourceBundleLoader}, which will use {@link Locale#getDefault()}. */ public DefaultResourceBundleLoader() { this(Locale.getDefault()); @@ -26,7 +25,7 @@ public DefaultResourceBundleLoader() { *

* Warning: Only intended for external use by tests. *

- * + * * @param locale * the {@link Locale} to use */ diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/IResourceBundleLoader.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/IResourceBundleLoader.java index 02e5b4a5..7a4431fe 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/IResourceBundleLoader.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/IResourceBundleLoader.java @@ -4,14 +4,12 @@ import java.util.ResourceBundle; /** - * Implementations of this interface are responsible for retrieving the - * application's {@link ResourceBundle}s. (This application uses a single, - * combined bundle.) + * Implementations of this interface are responsible for retrieving the application's {@link ResourceBundle}s. (This + * application uses a single, combined bundle.) */ public interface IResourceBundleLoader { /** - * @return the application's {@link ResourceBundle} for the current - * {@link Locale} + * @return the application's {@link ResourceBundle} for the current {@link Locale} */ ResourceBundle getBundle(); } diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/package-info.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/package-info.java index 353dbbb8..4c4da391 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/package-info.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/i18n/package-info.java @@ -1,4 +1,4 @@ /** * Contains utility code related to internationalization/localization. */ -package com.justdavis.karl.rpstourney.app.console.i18n; \ No newline at end of file +package com.justdavis.karl.rpstourney.app.console.i18n; diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/GameBundle.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/GameBundle.java index 0420f93a..245d31ee 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/GameBundle.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/GameBundle.java @@ -12,7 +12,7 @@ public final class GameBundle { /** * Constructs a new {@link GameBundle} instance. - * + * * @param gameClient * the value to use for {@link #getGameClient()} * @param gameId @@ -24,8 +24,7 @@ public GameBundle(IGameResource gameClient, String gameId) { } /** - * @return the {@link IGameResource} that will be used to interact with the - * game being played + * @return the {@link IGameResource} that will be used to interact with the game being played */ public IGameResource getGameClient() { return gameClient; diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/LocalGameClient.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/LocalGameClient.java index 068a0ef4..68a01fc8 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/LocalGameClient.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/LocalGameClient.java @@ -13,14 +13,12 @@ /** *

- * This {@link IGameResource} implementation only supports local games. It's - * really just used to enable this application to play local games using the - * same interface as remote games must be played with. + * This {@link IGameResource} implementation only supports local games. It's really just used to enable this application + * to play local games using the same interface as remote games must be played with. *

*

- * Each {@link LocalGameClient} instance is associated with a single new - * {@link Game} instance; a new {@link LocalGameClient} is needed for each game - * to be played. + * Each {@link LocalGameClient} instance is associated with a single new {@link Game} instance; a new + * {@link LocalGameClient} is needed for each game to be played. *

*/ public final class LocalGameClient implements IGameResource { @@ -29,7 +27,7 @@ public final class LocalGameClient implements IGameResource { /** * Constructs a new {@link LocalGameClient} instance. - * + * * @param game * the {@link Game} to be played/manipulated * @param localPlayer @@ -69,8 +67,7 @@ public GameView getGame(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, - * int, int) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, int, int) */ @Override public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsValue) { @@ -79,8 +76,7 @@ public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRou } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, - * long) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, long) */ @Override public void inviteOpponent(String gameId, long playerId) { @@ -105,8 +101,8 @@ public GameView prepareRound(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, - * int, com.justdavis.karl.rpstourney.service.api.game.Throw) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, int, + * com.justdavis.karl.rpstourney.service.api.game.Throw) */ @Override public GameView submitThrow(String gameId, int roundIndex, Throw throwToPlay) { diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/package-info.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/package-info.java index 63bc2242..2d968b11 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/package-info.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/localservice/package-info.java @@ -1,6 +1,5 @@ /** - * Contains local-only implementations of some of the web service APIs, which - * are used to keep the console application's local and network play code - * consistent. + * Contains local-only implementations of some of the web service APIs, which are used to keep the console application's + * local and network play code consistent. */ -package com.justdavis.karl.rpstourney.app.console.localservice; \ No newline at end of file +package com.justdavis.karl.rpstourney.app.console.localservice; diff --git a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/package-info.java b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/package-info.java index a1f98e06..113fb0f4 100644 --- a/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/package-info.java +++ b/rps-tourney-console/src/main/java/com/justdavis/karl/rpstourney/app/console/package-info.java @@ -1,7 +1,6 @@ /** *

- * Contains the classes used to run the console/command line version of the - * game. + * Contains the classes used to run the console/command line version of the game. *

*/ -package com.justdavis.karl.rpstourney.app.console; \ No newline at end of file +package com.justdavis.karl.rpstourney.app.console; diff --git a/rps-tourney-console/src/main/resources/logback.xml b/rps-tourney-console/src/main/resources/logback.xml index b3833a3f..546bdfe1 100644 --- a/rps-tourney-console/src/main/resources/logback.xml +++ b/rps-tourney-console/src/main/resources/logback.xml @@ -11,9 +11,8 @@ - + - \ No newline at end of file + diff --git a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppIT.java b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppIT.java index 02aed2ad..5a7b8d93 100644 --- a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppIT.java +++ b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppIT.java @@ -34,12 +34,10 @@ public final class ConsoleAppIT { private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleAppIT.class); /** - * Runs the app, creating a new local game against an AI opponent. The - * "human" player in the test will make the same throw over and over until - * the game ends. It's a bit nondeterministic, but the best we can do - * without allowing users to specify one of the deterministic AIs (which - * would be a bad idea). - * + * Runs the app, creating a new local game against an AI opponent. The "human" player in the test will make the same + * throw over and over until the game ends. It's a bit nondeterministic, but the best we can do without allowing + * users to specify one of the deterministic AIs (which would be a bad idea). + * * @throws AddressException * (won't happen; addresses are hardcoded) * @throws IOException @@ -51,11 +49,9 @@ public void playOneRoundGameAgainstLocalAi() throws AddressException, IOExceptio final MockInputStream gameInputStream = new MockInputStream(); /* - * Because we need to review the output and then respond to it (via the - * input), the game must be run on a separate thread. This thread will - * block whenever it's waiting for new input. When the - * MockInputStream.exit() method is called, it will stop blocking and - * just return -1 after exhausting all existing input. + * Because we need to review the output and then respond to it (via the input), the game must be run on a + * separate thread. This thread will block whenever it's waiting for new input. When the MockInputStream.exit() + * method is called, it will stop blocking and just return -1 after exhausting all existing input. */ ExecutorService gameExecutor = Executors.newSingleThreadExecutor(); Runnable gameRunnable = new GameRunnable(gameInputStream, gameOutputStream, "--ai", "Hard", "-r", "1"); @@ -84,12 +80,10 @@ public void playOneRoundGameAgainstLocalAi() throws AddressException, IOExceptio } /** - * Runs the app, creating a new online game against an AI opponent. The - * "human" player in the test will make the same throw over and over until - * the game ends. It's a bit nondeterministic, but the best we can do - * without allowing users to specify one of the deterministic AIs (which - * would be a bad idea). - * + * Runs the app, creating a new online game against an AI opponent. The "human" player in the test will make the + * same throw over and over until the game ends. It's a bit nondeterministic, but the best we can do without + * allowing users to specify one of the deterministic AIs (which would be a bad idea). + * * @throws AddressException * (won't happen; addresses are hardcoded) * @throws IOException @@ -107,11 +101,9 @@ public void playOneRoundGameAgainstNetworkAi() throws AddressException, IOExcept final MockInputStream gameInputStream = new MockInputStream(); /* - * Because we need to review the output and then respond to it (via the - * input), the game must be run on a separate thread. This thread will - * block whenever it's waiting for new input. When the - * MockInputStream.exit() method is called, it will stop blocking and - * just return -1 after exhausting all existing input. + * Because we need to review the output and then respond to it (via the input), the game must be run on a + * separate thread. This thread will block whenever it's waiting for new input. When the MockInputStream.exit() + * method is called, it will stop blocking and just return -1 after exhausting all existing input. */ ExecutorService gameExecutor = Executors.newSingleThreadExecutor(); Runnable gameRunnable = new GameRunnable(gameInputStream, gameOutputStream, "--online", "--server", @@ -151,16 +143,13 @@ private final class GameRunnable implements Runnable { /** * Constructs a new {@link GameRunnable} instance. - * + * * @param gameInputStream - * the {@link InputStream} that will be used to interact with - * the game + * the {@link InputStream} that will be used to interact with the game * @param gameOutputStream - * the {@link ByteArrayOutputStream} that the game will - * display to + * the {@link ByteArrayOutputStream} that the game will display to * @param gameArgs - * the list of arguments to pass to - * {@link ConsoleApp#runApp(String[], PrintStream, InputStream)} + * the list of arguments to pass to {@link ConsoleApp#runApp(String[], PrintStream, InputStream)} */ private GameRunnable(InputStream gameInputStream, ByteArrayOutputStream gameOutputStream, String... gameArgs) { this.gameInputStream = gameInputStream; @@ -178,8 +167,8 @@ public void run() { app.runApp(gameArgs, new PrintStream(gameOutputStream), gameInputStream); } catch (Exception e) { /* - * Catch and rethrow errors, also logging the console output to - * that point. Otherwise, things are impossible to debug. + * Catch and rethrow errors, also logging the console output to that point. Otherwise, things are + * impossible to debug. */ try { LOGGER.error("Test failed. Game output:\n" @@ -213,7 +202,7 @@ public MockInputStream() { /** * Adds a new message to the queue of those to be read through. - * + * * @param message * the new message to read (messages are read in FIFO order) */ @@ -222,14 +211,13 @@ public void addMessage(String message) { } /** - * After calling this method, {@link #read()} will no longer block if no - * further messages are (yet) available to be read. + * After calling this method, {@link #read()} will no longer block if no further messages are (yet) available to + * be read. */ public void exit() { /* - * Per the suggestion in BlockingQueue's javadoc, we use a - * "magic object" message to signal that we should stop waiting for - * new content. + * Per the suggestion in BlockingQueue's javadoc, we use a "magic object" message to signal that we should + * stop waiting for new content. */ this.messages.offer(MAGIC_OBJECT_EXIT); } @@ -245,10 +233,9 @@ public int read() throws IOException { // If there was no result, grab the next message. if (nextResult == -1) { /* - * This stream is read on a different thread than the one used - * to construct and add content to it. The moveToNextMessage() - * call will block the read() thread until a message is - * available, or until exit() has been called. + * This stream is read on a different thread than the one used to construct and add content to it. The + * moveToNextMessage() call will block the read() thread until a message is available, or until exit() + * has been called. */ moveToNextMessage(); nextResult = currentMessage.read(); @@ -258,8 +245,7 @@ public int read() throws IOException { } /** - * Waits for and/or moves to the next message. Adjusts {@link #messages} - * and {@link #currentMessage}. + * Waits for and/or moves to the next message. Adjusts {@link #messages} and {@link #currentMessage}. */ private void moveToNextMessage() { if (this.currentMessage == MAGIC_OBJECT_EXIT) @@ -269,9 +255,8 @@ private void moveToNextMessage() { this.currentMessage = this.messages.take(); } catch (InterruptedException e) { /* - * If this thread is interrupted (whether or not it's currently - * waiting), that likely means someone is asking us to shut - * down. + * If this thread is interrupted (whether or not it's currently waiting), that likely means someone is + * asking us to shut down. */ LOGGER.warn("Interrupted, so closing down this stream.", e); this.exit(); diff --git a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppTest.java b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppTest.java index 27b2459e..8606ee4c 100644 --- a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppTest.java +++ b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleAppTest.java @@ -13,17 +13,15 @@ * Unit tests for {@link ConsoleApp}. *

*

- * These tests should probably include a simulated game. However, that's tough - * to do as the app's API doesn't (and probably shouldn't) allow for the AI - * opponent to be specified. Without that, there's no way to ensure that the - * game will end in the expected number of rounds (hypothetically, it could keep - * tieing forever). + * These tests should probably include a simulated game. However, that's tough to do as the app's API doesn't (and + * probably shouldn't) allow for the AI opponent to be specified. Without that, there's no way to ensure that the game + * will end in the expected number of rounds (hypothetically, it could keep tieing forever). *

*/ public final class ConsoleAppTest { /** * Runs the app with the "--help" flag. - * + * * @throws UnsupportedEncodingException * (should not occur) */ diff --git a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriverTest.java b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriverTest.java index 0128177c..d8ec8abb 100644 --- a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriverTest.java +++ b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ConsoleGameDriverTest.java @@ -22,9 +22,8 @@ */ public final class ConsoleGameDriverTest { /** - * Plays a short game via {@link ConsoleGameDriver}, to ensure that - * everything works as expected. - * + * Plays a short game via {@link ConsoleGameDriver}, to ensure that everything works as expected. + * * @throws UnsupportedEncodingException * (should not occur) */ @@ -50,9 +49,8 @@ public void playOneRoundGame() throws UnsupportedEncodingException { } /** - * Plays a short game via {@link ConsoleGameDriver}, to ensure that - * everything works as expected. - * + * Plays a short game via {@link ConsoleGameDriver}, to ensure that everything works as expected. + * * @throws UnsupportedEncodingException * (should not occur) */ diff --git a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ITUtils.java b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ITUtils.java index 63a18559..77ce2604 100644 --- a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ITUtils.java +++ b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/ITUtils.java @@ -9,30 +9,25 @@ * Contains constants and methods for use by the project's integration tests. *

*

- * The code here relies on and interacts with the embedded Jetty instance that - * is used for this project's integration tests. See - * cargo-maven2-plugin in the project's pom.xml for - * details. + * The code here relies on and interacts with the embedded Jetty instance that is used for this project's integration + * tests. See cargo-maven2-plugin in the project's pom.xml for details. *

*/ public final class ITUtils { /** - * The port that Jetty will run on, for the embedded Jetty instance used in - * the project's integration tests. + * The port that Jetty will run on, for the embedded Jetty instance used in the project's integration tests. */ private static final int JETTY_PORT = 9093; /** - * The context path that the rps-tourney-service-app project's - * WAR will be hosted at, for the embedded Jetty instance used in this - * project's integration tests. + * The context path that the rps-tourney-service-app project's WAR will be hosted at, for the embedded + * Jetty instance used in this project's integration tests. */ private static final String CONTEXT_WEB_SERVICE = "/rps-tourney-service-app"; /** - * @return a {@link ClientConfig} instance that can be used to access the - * rps-tourney-service-app WAR's web services, for the - * embedded Jetty instance used in this project's integration tests + * @return a {@link ClientConfig} instance that can be used to access the rps-tourney-service-app WAR's + * web services, for the embedded Jetty instance used in this project's integration tests */ public static ClientConfig createClientConfig() { UriBuilder serviceRootUri = UriBuilder diff --git a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/OptionsParserTest.java b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/OptionsParserTest.java index f8f40287..43d94743 100644 --- a/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/OptionsParserTest.java +++ b/rps-tourney-console/src/test/java/com/justdavis/karl/rpstourney/app/console/OptionsParserTest.java @@ -20,7 +20,7 @@ public final class OptionsParserTest { /** * Parses an empty set of arguments. - * + * * @throws URISyntaxException * (won't happen; address is hardcoded) */ @@ -43,7 +43,7 @@ public void noOptions() throws URISyntaxException { /** * Parses a set of arguments containing all network play options. - * + * * @throws URISyntaxException * (won't happen; addresses are hardcoded) * @throws AddressException @@ -84,9 +84,8 @@ public void allOptions() { } /** - * Makes sure that {@link OptionsParser#printUsage(java.io.PrintStream)} - * works as expected. - * + * Makes sure that {@link OptionsParser#printUsage(java.io.PrintStream)} works as expected. + * * @throws UnsupportedEncodingException * (should not occur) */ diff --git a/rps-tourney-deployment/pom.xml b/rps-tourney-deployment/pom.xml index 5c0bc2c9..6b3937f7 100644 --- a/rps-tourney-deployment/pom.xml +++ b/rps-tourney-deployment/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 @@ -11,18 +12,20 @@ pom rps-tourney-deployment - - A stub project used to provide the configuration needed - for the Maven Cargo plugin to deploy things. Note that - nothing will be deployed automatically as part of a normal - build; deployments must be run manually. See the - deploy-to-justdavis.sh script. - + A stub project used to provide the configuration needed + for the Maven Cargo plugin to deploy things. Note that + nothing will be deployed automatically as part of a normal + build; deployments must be run manually. See the + deploy-to-justdavis.sh script. - + ${project.basedir}/../dev + + - 2.0.0-SNAPSHOT @@ -62,9 +65,9 @@
- org.codehaus.cargo cargo-maven2-plugin @@ -77,7 +80,7 @@ runtime https://justdavis.com/manager/text - justdavis.com-jetty @@ -115,10 +118,10 @@ process-config-resources - process-resources copy-resources + process-resources diff --git a/rps-tourney-service-api/pom.xml b/rps-tourney-service-api/pom.xml index 34a71e63..82e3c11f 100644 --- a/rps-tourney-service-api/pom.xml +++ b/rps-tourney-service-api/pom.xml @@ -12,12 +12,13 @@ jar rps-tourney-service-api - - The API definitions for the web service layer of the "Rock-Paper-Scissors Tourney" - game, which allow for play over the Internet. - + The API definitions for the web service layer of the "Rock-Paper-Scissors Tourney" + game, which allow for play over the Internet. + + ${project.basedir}/../dev @@ -28,8 +29,8 @@
- org.slf4j slf4j-api @@ -43,7 +44,7 @@ 2.1 - javax.annotation jsr250-api @@ -51,8 +52,8 @@ - com.fasterxml.jackson.core jackson-annotations @@ -60,9 +61,9 @@ - - org.eclipse.jetty.orbit javax.mail.glassfish @@ -70,13 +71,13 @@ - org.hibernate hibernate-core ${hibernate.version} - org.hibernate.common @@ -113,8 +114,8 @@ - org.hibernate hibernate-jpamodelgen @@ -122,8 +123,8 @@ - org.hibernate.validator hibernate-validator @@ -147,8 +148,8 @@ test - com.fasterxml.jackson.core jackson-databind @@ -159,8 +160,7 @@ - - + @@ -168,10 +168,10 @@ jacoco-maven-plugin - default-prepare-agent @@ -179,10 +179,10 @@ - default-prepare-agent-integration @@ -196,7 +196,7 @@ - org.apache.maven.plugins maven-failsafe-plugin diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/IServiceStatusResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/IServiceStatusResource.java index a1700960..543c5495 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/IServiceStatusResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/IServiceStatusResource.java @@ -10,14 +10,12 @@ import com.justdavis.karl.rpstourney.service.api.auth.Account; /** - * Implementations of this service allow clients to check the web service's - * status. + * Implementations of this service allow clients to check the web service's status. */ @Path(IServiceStatusResource.SERVICE_PATH) public interface IServiceStatusResource { /** - * The {@link Path} that this this resource class' methods will be hosted - * at. + * The {@link Path} that this this resource class' methods will be hosted at. */ public static final String SERVICE_PATH = "/status/"; @@ -42,9 +40,8 @@ public interface IServiceStatusResource { public static final String PONG = "pong"; /** - * Returns a simple response ({@link #PONG}) to indicate that the service is - * up and running. - * + * Returns a simple response ({@link #PONG}) to indicate that the service is up and running. + * * @return the user's/client's {@link Account} */ @GET @@ -53,9 +50,8 @@ public interface IServiceStatusResource { String ping(); /** - * Returns the specified text back to verify that form submission is - * working. - * + * Returns the specified text back to verify that form submission is working. + * * @param text * the value to echo back * @return the value that was passed in via the text parameter @@ -67,11 +63,11 @@ public interface IServiceStatusResource { /** * Returns the version number of the web service. - * + * * @return the version number of the web service */ @GET @Path(SERVICE_PATH_VERSION) @Produces(MediaType.TEXT_PLAIN) String getVersion(); -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/XmlNamespace.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/XmlNamespace.java index e72d38f5..eed47745 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/XmlNamespace.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/XmlNamespace.java @@ -5,14 +5,12 @@ */ public final class XmlNamespace { /** - * The default XML namespace that should be used by this project's web - * services. + * The default XML namespace that should be used by this project's web services. */ public static final String RPSTOURNEY_API = "http://justdavis.com/karl/rpstourney/api/schema/v1"; /** - * A convenience-only alias for - * {@link com.justdavis.karl.misc.datasources.XmlNamespace#JE_DATASOURCES}. + * A convenience-only alias for {@link com.justdavis.karl.misc.datasources.XmlNamespace#JE_DATASOURCES}. */ public static final String JE_DATASOURCES = com.justdavis.karl.misc.datasources.XmlNamespace.JE_DATASOURCES; } diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AbstractLoginIdentity.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AbstractLoginIdentity.java index 36b3c560..99bb3897 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AbstractLoginIdentity.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AbstractLoginIdentity.java @@ -35,15 +35,12 @@ * A common base class for all {@link ILoginIdentity} implementations. *

*

- * This is required by JPA, to enable queries of the - * "select all logins for user 'foo'" variety. Specifically, JPA only supports - * those queries for for supertypes if the types all share a common base - * class/table. + * This is required by JPA, to enable queries of the "select all logins for user 'foo'" variety. Specifically, JPA only + * supports those queries for for supertypes if the types all share a common base class/table. *

*

- * This class is marked as {@link Serializable}, as Spring Security will store - * instances of it as part of the authenticated {@link Principal}s in user - * sessions (via {@link Account#getLogins()}). + * This class is marked as {@link Serializable}, as Spring Security will store instances of it as part of the + * authenticated {@link Principal}s in user sessions (via {@link Account#getLogins()}). *

*/ @Entity @@ -80,7 +77,7 @@ public abstract class AbstractLoginIdentity implements ILoginIdentity, Serializa /** * Constructs a new {@link AbstractLoginIdentity} instance. - * + * * @param account * the value to use for {@link #getAccount()} * @param createdTimestamp @@ -99,7 +96,7 @@ protected AbstractLoginIdentity(Account account, Instant createdTimestamp) { /** * Constructs a new {@link AbstractLoginIdentity} instance. - * + * * @param account * the value to use for {@link #getAccount()} */ @@ -108,8 +105,7 @@ protected AbstractLoginIdentity(Account account) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated protected AbstractLoginIdentity() { @@ -117,9 +113,8 @@ protected AbstractLoginIdentity() { } /** - * @return true if this {@link AbstractLoginIdentity} has been - * assigned an ID (which it should if it's been persisted), - * false if it has not + * @return true if this {@link AbstractLoginIdentity} has been assigned an ID (which it should if it's + * been persisted), false if it has not */ public boolean hasId() { return id > -1; @@ -127,16 +122,14 @@ public boolean hasId() { /** *

- * Returns the unique integer that identifies and represents this - * {@link AbstractLoginIdentity} instance. + * Returns the unique integer that identifies and represents this {@link AbstractLoginIdentity} instance. *

*

- * This value will be assigned by JPA when the {@link Entity} is persisted. - * Until then, this value should not be accessed. + * This value will be assigned by JPA when the {@link Entity} is persisted. Until then, this value should not be + * accessed. *

- * - * @return the unique integer that identifies and represents this - * {@link AbstractLoginIdentity} instance + * + * @return the unique integer that identifies and represents this {@link AbstractLoginIdentity} instance */ public long getId() { return id; @@ -167,19 +160,16 @@ public Instant getCreatedTimestamp() { } /** - * This method will be called by JAXB during unmarshalling, and allows - * instances of this class to rebuild their {@link #getAccount()} references - * (which would otherwise be lost due to the {@link XmlTransient} annotation - * on the field). This setup is necessary to avoid cycle problems, per - * - * Mapping cyclic references to XML. - * + * This method will be called by JAXB during unmarshalling, and allows instances of this class to rebuild their + * {@link #getAccount()} references (which would otherwise be lost due to the {@link XmlTransient} annotation on the + * field). This setup is necessary to avoid cycle problems, per + * Mapping cyclic references to + * XML. + * * @param u * the JAXB {@link Unmarshaller} being used * @param parent - * the child element/object's containing/parent object (always an - * Account, in this case) + * the child element/object's containing/parent object (always an Account, in this case) */ public void afterUnmarshal(Unmarshaller u, Object parent) { this.account = (Account) parent; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/Account.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/Account.java index 4a672c1f..db870d20 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/Account.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/Account.java @@ -47,19 +47,19 @@ /** *

- * Each {@link Account} instance represents a given user. It is what a user's - * details, preferences, and history are associated with. + * Each {@link Account} instance represents a given user. It is what a user's details, preferences, and history are + * associated with. *

*

- * This class supports JPA. The JPA SQL-specific data (e.g. column names) is - * specified in the META-INF/orm.xml file. + * This class supports JPA. The JPA SQL-specific data (e.g. column names) is specified in the + * META-INF/orm.xml file. *

*

* This class supports JAX-B. *

*

- * This class is marked as {@link Serializable}, as Spring Security will store - * instances of it as the authenticated {@link Principal}s in user sessions. + * This class is marked as {@link Serializable}, as Spring Security will store instances of it as the authenticated + * {@link Principal}s in user sessions. *

*/ @XmlRootElement @@ -95,15 +95,14 @@ public class Account implements Principal, Serializable { @XmlElementWrapper(name = "roles", required = true) @XmlElement(name = "role") @ElementCollection(fetch = FetchType.EAGER) - @CollectionTable(name = "`AccountRoles`", joinColumns = @JoinColumn(name = "`accountId`") ) + @CollectionTable(name = "`AccountRoles`", joinColumns = @JoinColumn(name = "`accountId`")) @Column(name = "`role`") @Enumerated(EnumType.STRING) private Set roles; /** - * This field is marked {@link XmlTransient} to help ensure it's never sent - * off of the server by mistake. Any web services wishing to use it in a - * response will have to do so explicitly. + * This field is marked {@link XmlTransient} to help ensure it's never sent off of the server by mistake. Any web + * services wishing to use it in a response will have to do so explicitly. */ @XmlTransient @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE, @@ -120,10 +119,9 @@ public class Account implements Principal, Serializable { /** * Constructs a new {@link Account} instance. - * + * * @param roles - * the value to use for {@link #getRoles()} ( - * {@link SecurityRole#USERS} will always be added to this) + * the value to use for {@link #getRoles()} ( {@link SecurityRole#USERS} will always be added to this) */ public Account(SecurityRole... roles) { this.id = -1; @@ -145,9 +143,8 @@ public Account() { } /** - * @return true if this {@link Account} has been assigned an ID - * (which it should if it's been persisted), false if - * it has not + * @return true if this {@link Account} has been assigned an ID (which it should if it's been + * persisted), false if it has not */ public boolean hasId() { return id > -1; @@ -155,16 +152,14 @@ public boolean hasId() { /** *

- * Returns the unique integer that identifies and represents this - * {@link Account} instance. + * Returns the unique integer that identifies and represents this {@link Account} instance. *

*

- * This value will be assigned by JPA when the {@link Entity} is persisted. - * Until then, this value should not be accessed. + * This value will be assigned by JPA when the {@link Entity} is persisted. Until then, this value should not be + * accessed. *

- * - * @return the unique integer that identifies and represents this - * {@link Account} instance + * + * @return the unique integer that identifies and represents this {@link Account} instance */ public long getId() { if (!hasId()) @@ -181,23 +176,20 @@ public Instant getCreatedTimestamp() { } /** - * Returns the modifiable {@link Set} of {@link SecurityRole}s that this - * user {@link Account} is a member of. This {@link Set} should never be - * modified to remove {@link SecurityRole#USERS}; all {@link Account}s - * should be a member of that {@link SecurityRole}. - * - * @return the modifiable {@link Set} of {@link SecurityRole}s that this - * user {@link Account} is a member of + * Returns the modifiable {@link Set} of {@link SecurityRole}s that this user {@link Account} is a member of. This + * {@link Set} should never be modified to remove {@link SecurityRole#USERS}; all {@link Account}s should be a + * member of that {@link SecurityRole}. + * + * @return the modifiable {@link Set} of {@link SecurityRole}s that this user {@link Account} is a member of */ public Set getRoles() { return roles; } /** - * @return the user-defined name for this {@link Account}, or - * null if the user has not (yet) specified a name for - * themselves - * + * @return the user-defined name for this {@link Account}, or null if the user has not (yet) specified + * a name for themselves + * * @see java.security.Principal#getName() */ @XmlTransient @@ -217,8 +209,8 @@ public void setName(String name) { /** * @param role * the {@link SecurityRole} to check for - * @return true if {@link Account#getRoles()} contains the - * specified {@link SecurityRole}, false if it does not + * @return true if {@link Account#getRoles()} contains the specified {@link SecurityRole}, + * false if it does not */ public boolean hasRole(SecurityRole role) { if (role == null) @@ -228,8 +220,7 @@ public boolean hasRole(SecurityRole role) { } /** - * @return the modifiable {@link Set} of {@link AuthToken}s for this - * {@link Account} + * @return the modifiable {@link Set} of {@link AuthToken}s for this {@link Account} */ public Set getAuthTokens() { return authTokens; @@ -238,8 +229,8 @@ public Set getAuthTokens() { /** * @param authTokenValue * the {@link AuthToken#getToken()} value to match against - * @return the {@link #getAuthTokens()} entry that matches the specified - * value, or null if no match is found + * @return the {@link #getAuthTokens()} entry that matches the specified value, or null if no match is + * found */ public AuthToken getAuthToken(UUID authTokenValue) { for (AuthToken authToken : authTokens) @@ -250,8 +241,7 @@ public AuthToken getAuthToken(UUID authTokenValue) { } /** - * @return the first valid {@link #getAuthTokens()} entry found, or - * null if no such entry is found + * @return the first valid {@link #getAuthTokens()} entry found, or null if no such entry is found */ public AuthToken getAuthToken() { for (AuthToken authToken : authTokens) @@ -263,16 +253,14 @@ public AuthToken getAuthToken() { /** * @param authTokenValue * the {@link AuthToken#getToken()} value to match against - * @return true if a matching {@link #getAuthTokens()} entry - * could be found, false if not + * @return true if a matching {@link #getAuthTokens()} entry could be found, false if not */ public boolean isValidAuthToken(UUID authTokenValue) { return getAuthToken(authTokenValue) != null; } /** - * @return the {@link List} of {@link AbstractLoginIdentity}s associated - * with this {@link Account}, ordered by + * @return the {@link List} of {@link AbstractLoginIdentity}s associated with this {@link Account}, ordered by * {@link AbstractLoginIdentity#getCreatedTimestamp()} */ public List getLogins() { @@ -280,9 +268,8 @@ public List getLogins() { } /** - * @return false if {@link #getLogins()} contains anything - * other than {@link GuestLoginIdentity}s, true - * otherwise + * @return false if {@link #getLogins()} contains anything other than {@link GuestLoginIdentity}s, + * true otherwise */ @JsonProperty public boolean isAnonymous() { @@ -298,15 +285,13 @@ public boolean isAnonymous() { @Override public int hashCode() { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to the superclass' implementation - * (mostly for the benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to the + * superclass' implementation (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ final int prime = 31; int result = 1; @@ -323,15 +308,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to instance equality (mostly for the - * benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to instance + * equality (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ if (this == obj) return true; @@ -363,9 +346,8 @@ public String toString() { builder.append(", roles="); builder.append(roles); /* - * Warning: printing out the actual authTokens here would be a very bad - * idea, as it might enable security leaks in logs, error messages, and - * such. + * Warning: printing out the actual authTokens here would be a very bad idea, as it might enable security leaks + * in logs, error messages, and such. */ builder.append(", authTokens.size()="); builder.append(authTokens.size()); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountGameMerge.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountGameMerge.java index 828ff364..038226f2 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountGameMerge.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountGameMerge.java @@ -18,9 +18,8 @@ /** *

- * Each {@link AuditAccountGameMerge} instance records a {@link Game} that was - * modified as part of an XXX operation. Every {@link AuditAccountGameMerge} - * instance is a child of its parent {@link AuditAccountMerge} instance. + * Each {@link AuditAccountGameMerge} instance records a {@link Game} that was modified as part of an XXX operation. + * Every {@link AuditAccountGameMerge} instance is a child of its parent {@link AuditAccountMerge} instance. *

*

* This class supports JPA. This class supports JAX-B. @@ -51,8 +50,7 @@ public class AuditAccountGameMerge { @ManyToOne(optional = false, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH }) /* - * FIXME This column can't be quoted unless/until - * https://hibernate.atlassian.net/browse/HHH-9427 is resolved. + * FIXME This column can't be quoted unless/until https://hibernate.atlassian.net/browse/HHH-9427 is resolved. */ @JoinColumn(name = "gameId", nullable = false, updatable = false) private Game game; @@ -63,7 +61,7 @@ public class AuditAccountGameMerge { /** * Constructs a new {@link AuditAccountGameMerge} instance. - * + * * @param parentAuditAccountMerge * the value to use for {@link #getParentAuditAccountMerge()} * @param game @@ -79,8 +77,7 @@ public AuditAccountGameMerge(AuditAccountMerge parentAuditAccountMerge, Game gam } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated AuditAccountGameMerge() { @@ -88,9 +85,8 @@ public AuditAccountGameMerge(AuditAccountMerge parentAuditAccountMerge, Game gam } /** - * @return true if this {@link AuditAccountGameMerge} has been - * assigned an ID (which it should if it's been persisted), - * false if it has not + * @return true if this {@link AuditAccountGameMerge} has been assigned an ID (which it should if it's + * been persisted), false if it has not */ public boolean hasId() { return id > -1; @@ -98,16 +94,14 @@ public boolean hasId() { /** *

- * Returns the unique integer that identifies and represents this - * {@link AuditAccountGameMerge} instance. + * Returns the unique integer that identifies and represents this {@link AuditAccountGameMerge} instance. *

*

- * This value will be assigned by JPA when the {@link Entity} is persisted. - * Until then, this value should not be accessed. + * This value will be assigned by JPA when the {@link Entity} is persisted. Until then, this value should not be + * accessed. *

- * - * @return the unique integer that identifies and represents this - * {@link AuditAccountGameMerge} instance + * + * @return the unique integer that identifies and represents this {@link AuditAccountGameMerge} instance */ public long getId() { if (!hasId()) @@ -117,8 +111,7 @@ public long getId() { } /** - * @return the parent {@link AuditAccountMerge} instance that this - * {@link AuditAccountGameMerge} is a part of + * @return the parent {@link AuditAccountMerge} instance that this {@link AuditAccountGameMerge} is a part of */ public AuditAccountMerge getParentAuditAccountMerge() { return parentAuditAccountMerge; @@ -132,8 +125,7 @@ public Game getGame() { } /** - * @return the {@link PlayerRole} indicating whether - * {@link Game#getPlayer1()} or {@link Game#getPlayer2()} is + * @return the {@link PlayerRole} indicating whether {@link Game#getPlayer1()} or {@link Game#getPlayer2()} is * represented by this {@link AuditAccountGameMerge} instance */ public PlayerRole getPlayerRole() { @@ -146,15 +138,13 @@ public PlayerRole getPlayerRole() { @Override public int hashCode() { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to the superclass' implementation - * (mostly for the benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to the + * superclass' implementation (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ final int prime = 31; int result = 1; @@ -171,15 +161,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to instance equality (mostly for the - * benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to instance + * equality (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ if (this == obj) return true; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMerge.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMerge.java index 4439abd5..bdd9ac6e 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMerge.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMerge.java @@ -17,15 +17,12 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; - import com.justdavis.karl.rpstourney.service.api.game.Game; /** *

- * Each {@link AuditAccountMerge} instance records an - * {@link IAccountsResource#mergeAccount(long, java.util.UUID)} operation that - * has been performed, and provides the information that would (theoretically) - * be needed to undo it. + * Each {@link AuditAccountMerge} instance records an {@link IAccountsResource#mergeAccount(long, java.util.UUID)} + * operation that has been performed, and provides the information that would (theoretically) be needed to undo it. *

*

* This class supports JPA. This class supports JAX-B. @@ -72,7 +69,7 @@ public class AuditAccountMerge { /** * Constructs a new {@link AuditAccountMerge} instance. - * + * * @param targetAccount * the value to use for {@link #getTargetAccount()} * @param mergedLogins @@ -87,8 +84,7 @@ public AuditAccountMerge(Account targetAccount, Set merge } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated AuditAccountMerge() { @@ -96,9 +92,8 @@ public AuditAccountMerge(Account targetAccount, Set merge } /** - * @return true if this {@link AuditAccountMerge} has been - * assigned an ID (which it should if it's been persisted), - * false if it has not + * @return true if this {@link AuditAccountMerge} has been assigned an ID (which it should if it's been + * persisted), false if it has not */ public boolean hasId() { return id > -1; @@ -106,16 +101,14 @@ public boolean hasId() { /** *

- * Returns the unique integer that identifies and represents this - * {@link AuditAccountMerge} instance. + * Returns the unique integer that identifies and represents this {@link AuditAccountMerge} instance. *

*

- * This value will be assigned by JPA when the {@link Entity} is persisted. - * Until then, this value should not be accessed. + * This value will be assigned by JPA when the {@link Entity} is persisted. Until then, this value should not be + * accessed. *

- * - * @return the unique integer that identifies and represents this - * {@link AuditAccountMerge} instance + * + * @return the unique integer that identifies and represents this {@link AuditAccountMerge} instance */ public long getId() { if (!hasId()) @@ -133,8 +126,7 @@ public Instant getMergeTimestamp() { /** * @return the {@link Account} that was merged into as part of the - * {@link IAccountsResource#mergeAccount(long, java.util.UUID)} - * operation + * {@link IAccountsResource#mergeAccount(long, java.util.UUID)} operation */ public Account getTargetAccount() { return targetAccount; @@ -149,18 +141,15 @@ public void setTargetAccount(Account targetAccount) { } /** - * @return the {@link AbstractLoginIdentity} instances that were associated - * with the old/merged {@link Account} + * @return the {@link AbstractLoginIdentity} instances that were associated with the old/merged {@link Account} */ public Set getMergedLogins() { return mergedLogins; } /** - * @return the {@link AuditAccountGameMerge} instances that represent the - * {@link Game}s that were altered as part of the - * {@link IAccountsResource#mergeAccount(long, java.util.UUID)} - * operation + * @return the {@link AuditAccountGameMerge} instances that represent the {@link Game}s that were altered as part of + * the {@link IAccountsResource#mergeAccount(long, java.util.UUID)} operation */ public Set getMergedGames() { return mergedGames; @@ -172,15 +161,13 @@ public Set getMergedGames() { @Override public int hashCode() { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to the superclass' implementation - * (mostly for the benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to the + * superclass' implementation (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ final int prime = 31; int result = 1; @@ -197,15 +184,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to instance equality (mostly for the - * benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to instance + * equality (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ if (this == obj) return true; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthToken.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthToken.java index 12866733..fa075fca 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthToken.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthToken.java @@ -21,21 +21,20 @@ /** *

- * Each {@link AuthToken} instance represents an authentication token that has - * been issued for a specific {@link Account}. + * Each {@link AuthToken} instance represents an authentication token that has been issued for a specific + * {@link Account}. *

*

- * For all intents and purposes, these values are a "free pass" to a user's - * account. Any time they're sent over the network, care must be taken to ensure - * they are transmitted and managed securely. + * For all intents and purposes, these values are a "free pass" to a user's account. Any time they're sent over the + * network, care must be taken to ensure they are transmitted and managed securely. *

*

- * This class supports JPA. The JPA SQL-specific data (e.g. column names) is - * specified in the META-INF/orm.xml file. + * This class supports JPA. The JPA SQL-specific data (e.g. column names) is specified in the + * META-INF/orm.xml file. *

*

- * This class is marked as {@link Serializable}, as it is contained in - * {@link Account} instances, which are also {@link Serializable}. + * This class is marked as {@link Serializable}, as it is contained in {@link Account} instances, which are also + * {@link Serializable}. *

*/ @XmlRootElement @@ -62,7 +61,7 @@ public class AuthToken implements Serializable { /** * Constructs a new {@link AuthToken} instance. - * + * * @param account * the value to use for {@link #getAccount()} * @param token @@ -82,8 +81,7 @@ public AuthToken(Account account, UUID token) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated AuthToken() { @@ -97,20 +95,17 @@ public Account getAccount() { } /** - * @return the unique, random token that represents and identifies this - * {@link AuthToken} + * @return the unique, random token that represents and identifies this {@link AuthToken} */ public UUID getToken() { return token; } /** - * Note: Because this will be persisted as a SQL TIMESTAMP - * column, sub-second values will likely be discarded when it's persisted to - * a database via JPA. - * - * @return the timestamp for (approximately) when this {@link AuthToken} was - * created + * Note: Because this will be persisted as a SQL TIMESTAMP column, sub-second values will likely be + * discarded when it's persisted to a database via JPA. + * + * @return the timestamp for (approximately) when this {@link AuthToken} was created */ public Instant getCreatedTimestamp() { return createdTimestamp; @@ -122,8 +117,7 @@ public Instant getCreatedTimestamp() { @Override public int hashCode() { /* - * Created by Eclipse's "Source > Generate hashCode() and equals()..." - * function. + * Created by Eclipse's "Source > Generate hashCode() and equals()..." function. */ final int prime = 31; @@ -138,8 +132,7 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * Created by Eclipse's "Source > Generate hashCode() and equals()..." - * function. + * Created by Eclipse's "Source > Generate hashCode() and equals()..." function. */ if (this == obj) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenCookieHelper.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenCookieHelper.java index 38bfbe01..969ee93f 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenCookieHelper.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenCookieHelper.java @@ -7,19 +7,16 @@ /** *

- * Contains utility methods for working with this application's authentication - * token cookies. + * Contains utility methods for working with this application's authentication token cookies. *

*

- * These cookies store the {@link Account#getAuthToken()} for the current user - * and represent an active login. Users wishing to logout just need to - * delete/drop the cookie from their requests. + * These cookies store the {@link Account#getAuthToken()} for the current user and represent an active login. Users + * wishing to logout just need to delete/drop the cookie from their requests. *

*/ public final class AuthTokenCookieHelper { /** - * The name of the {@link Cookie} used to track the - * {@link Account#getAuthToken()} value. + * The name of the {@link Cookie} used to track the {@link Account#getAuthToken()} value. */ public static final String COOKIE_NAME_AUTH_TOKEN = "authToken"; @@ -27,11 +24,10 @@ public final class AuthTokenCookieHelper { * @param authToken * the {@link AuthToken} to create the {@link NewCookie} for * @param requestUri - * a {@link URI} representing the webservice request, which will - * be used to set the {@link NewCookie}'s domain - * @return a {@link NewCookie} that contains the specified {@link AuthToken} - * 's {@link AuthToken#getToken()} value, and which, when passed - * back in requests, will represent a login + * a {@link URI} representing the webservice request, which will be used to set the {@link NewCookie}'s + * domain + * @return a {@link NewCookie} that contains the specified {@link AuthToken} 's {@link AuthToken#getToken()} value, + * and which, when passed back in requests, will represent a login */ public static NewCookie createAuthTokenCookie(AuthToken authToken, URI requestUri) { String authTokenString = authToken.getToken().toString(); @@ -40,14 +36,12 @@ public static NewCookie createAuthTokenCookie(AuthToken authToken, URI requestUr /** * @param authTokenValue - * the {@link AuthToken#getToken()} value to create the - * {@link NewCookie} for + * the {@link AuthToken#getToken()} value to create the {@link NewCookie} for * @param requestUri - * a {@link URI} representing the webservice request, which will - * be used to set the {@link NewCookie}'s domain - * @return a {@link NewCookie} that contains the specified - * {@link AuthToken#getToken()} value, and which, when passed back - * in requests, will represent a login + * a {@link URI} representing the webservice request, which will be used to set the {@link NewCookie}'s + * domain + * @return a {@link NewCookie} that contains the specified {@link AuthToken#getToken()} value, and which, when + * passed back in requests, will represent a login */ public static NewCookie createAuthTokenCookie(String authTokenValue, URI requestUri) { String path = "/"; @@ -55,15 +49,15 @@ public static NewCookie createAuthTokenCookie(String authTokenValue, URI request int maxAge = 60 * 60 * 24 * 365 * 1; /* - * Workaround: the request host is often prefixed with a '.' but recent - * versions of Tomcat DO NOT like that and will throw errors. + * Workaround: the request host is often prefixed with a '.' but recent versions of Tomcat DO NOT like that and + * will throw errors. */ String domain = requestUri.getHost(); if (domain.startsWith(".")) domain = domain.substring(1); - NewCookie authCookie = new NewCookie(AuthTokenCookieHelper.COOKIE_NAME_AUTH_TOKEN, authTokenValue, path, - domain, comment, maxAge, true, true); + NewCookie authCookie = new NewCookie(AuthTokenCookieHelper.COOKIE_NAME_AUTH_TOKEN, authTokenValue, path, domain, + comment, maxAge, true, true); return authCookie; } diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/IAccountsResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/IAccountsResource.java index 499cd791..daff8dd2 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/IAccountsResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/IAccountsResource.java @@ -21,8 +21,7 @@ @Path(IAccountsResource.SERVICE_PATH) public interface IAccountsResource { /** - * The {@link Path} that this this resource class' methods will be hosted - * at. + * The {@link Path} that this this resource class' methods will be hosted at. */ public static final String SERVICE_PATH = "/account/"; @@ -52,22 +51,19 @@ public interface IAccountsResource { public static final String SERVICE_PATH_MERGE = "merge"; /** - * The {@link FormParam#value()} / name of the first - * {@link #mergeFromDifferentAccount(Account)} param. + * The {@link FormParam#value()} / name of the first {@link #mergeFromDifferentAccount(Account)} param. */ public static final String SERVICE_PARAM_MERGE_TARGET = "targetAccountId"; /** - * The {@link FormParam#value()} / name of the second - * {@link #mergeFromDifferentAccount(Account)} param. + * The {@link FormParam#value()} / name of the second {@link #mergeFromDifferentAccount(Account)} param. */ public static final String SERVICE_PARAM_MERGE_SOURCE = "sourceAccountAuthTokenValue"; /** - * Allows users to validate that their existing logins (as represented by - * the {@value AuthTokenCookieHelper#COOKIE_NAME_AUTH_TOKEN} - * cookie) are valid. - * + * Allows users to validate that their existing logins (as represented by the + * {@value AuthTokenCookieHelper#COOKIE_NAME_AUTH_TOKEN} cookie) are valid. + * * @return the user's/client's {@link Account} */ @GET @@ -77,7 +73,7 @@ public interface IAccountsResource { /** * Returns the {@link Account} for the requesting user/client. - * + * * @return the user's/client's {@link Account} */ @GET @@ -86,24 +82,19 @@ public interface IAccountsResource { Account getAccount(); /** - * Updates the specified {@link Account}. Users/clients may only update the - * {@link Account} that they are authenticated as, unless they have the - * {@link SecurityRole#ADMINS} privilege. - * + * Updates the specified {@link Account}. Users/clients may only update the {@link Account} that they are + * authenticated as, unless they have the {@link SecurityRole#ADMINS} privilege. + * * @param accountToUpdate - * the {@link Account} to be updated, with the updated state - * modified in it (e.g. if you want to change - * {@link Account#getName()}, get the {@link Account}, call - * {@link Account#setName(String)}, and then pass that modified - * instance to this method) + * the {@link Account} to be updated, with the updated state modified in it (e.g. if you want to change + * {@link Account#getName()}, get the {@link Account}, call {@link Account#setName(String)}, and then + * pass that modified instance to this method) * @return the updated user's/client's {@link Account} * @throws BadRequestException - * A {@link BadRequestException} will be thrown if the specified - * {@link Account} is invalid. + * A {@link BadRequestException} will be thrown if the specified {@link Account} is invalid. * @throws ForbiddenException - * A {@link ForbiddenException} will be thrown if a non-admin - * attempts to modify another user's account or attempts to - * adjust their permissions. + * A {@link ForbiddenException} will be thrown if a non-admin attempts to modify another user's account + * or attempts to adjust their permissions. */ @POST @Path(SERVICE_PATH_GET_ACCOUNT) @@ -111,12 +102,10 @@ public interface IAccountsResource { Account updateAccount(@Valid Account accountToUpdate); /** - * Selects the most recent active {@link AuthToken} from the requesting - * user/client's {@link Account} or, if no such {@link AuthToken} exists, - * creates a new one, persists it, and returns that. - * - * @return the most recent active {@link AuthToken} from the requesting - * user/client's {@link Account} (or a new one) + * Selects the most recent active {@link AuthToken} from the requesting user/client's {@link Account} or, if no such + * {@link AuthToken} exists, creates a new one, persists it, and returns that. + * + * @return the most recent active {@link AuthToken} from the requesting user/client's {@link Account} (or a new one) */ @GET @Path(SERVICE_PATH_AUTH_TOKEN) @@ -125,39 +114,34 @@ public interface IAccountsResource { /** *

- * Merges all of the {@link Game}s and {@link ILoginIdentity}s associated - * with the specified "source" {@link Account} into the specified "target" - * {@link Account}, and then deletes the now-empty "source" {@link Account}. - * In addition, an {@link AuditAccountMerge} record will be saved to the - * database recording the operation. + * Merges all of the {@link Game}s and {@link ILoginIdentity}s associated with the specified "source" + * {@link Account} into the specified "target" {@link Account}, and then deletes the now-empty "source" + * {@link Account}. In addition, an {@link AuditAccountMerge} record will be saved to the database recording the + * operation. *

*

- * Security Considerations: Unless this method is being called by an admin, - * the following restrictions will be enforced for this method: + * Security Considerations: Unless this method is being called by an admin, the following restrictions will be + * enforced for this method: *

*
    - *
  • The current user, as returned by {@link #getAccount()}, must be the - * "target" {@link Account}.
  • - *
  • The "source" {@link Account} must be anonymous; it must only have - * {@link GuestLoginIdentity}s associated with it.
  • + *
  • The current user, as returned by {@link #getAccount()}, must be the "target" {@link Account}.
  • + *
  • The "source" {@link Account} must be anonymous; it must only have {@link GuestLoginIdentity}s associated with + * it.
  • *
*

- * These restrictions are intended to allow non-admins to merge anonymous - * {@link Account}s that they have access to, while preventing users from - * "poisoning" the history of {@link Account}s they don't control. + * These restrictions are intended to allow non-admins to merge anonymous {@link Account}s that they have access to, + * while preventing users from "poisoning" the history of {@link Account}s they don't control. *

- * + * * @param targetAccountId - * the {@link Account#getId()} of the {@link Account} to merge - * to, which will end up acquiring all of the game history, etc. - * from the other {@link Account} + * the {@link Account#getId()} of the {@link Account} to merge to, which will end up acquiring all of the + * game history, etc. from the other {@link Account} * @param sourceAccountId - * a valid {@link AuthToken#getToken()} associated with the - * {@link Account} to merge from, which will be deleted from the - * database as part of this operation + * a valid {@link AuthToken#getToken()} associated with the {@link Account} to merge from, which will be + * deleted from the database as part of this operation */ @POST @Path(SERVICE_PATH_MERGE) void mergeAccount(@FormParam(SERVICE_PARAM_MERGE_TARGET) long targetAccountId, @FormParam(SERVICE_PARAM_MERGE_SOURCE) UUID sourceAccountAuthTokenValue); -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/ILoginIdentity.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/ILoginIdentity.java index bc86321b..44974803 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/ILoginIdentity.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/ILoginIdentity.java @@ -4,31 +4,26 @@ /** *

- * Each {@link ILoginIdentity} implementation encapsulates the information - * related to one of a user's various logins to the system, for a given - * {@link LoginProvider}. There should be a 1:1 relationship between - * {@link ILoginIdentity} implementations and {@link LoginProvider}s. + * Each {@link ILoginIdentity} implementation encapsulates the information related to one of a user's various logins to + * the system, for a given {@link LoginProvider}. There should be a 1:1 relationship between {@link ILoginIdentity} + * implementations and {@link LoginProvider}s. *

*

* Each implementation must also comply with the following requirements: *

*
    *
  • It must provide support for marshalling and unmarshalling via JAX-B.
  • - *
  • It must provide a DAO that uses JPA to retrieve instances from and - * persist instances to a database.
  • + *
  • It must provide a DAO that uses JPA to retrieve instances from and persist instances to a database.
  • *
*/ public interface ILoginIdentity { /** - * Returns the {@link Account} instance associated with this - * {@link ILoginIdentity} instance. There is an N:1 relationship between - * {@link ILoginIdentity} instances and {@link Account} instances: every - * {@link ILoginIdentity} must have exactly one associated {@link Account} - * instance, while any given {@link Account} must have one or more + * Returns the {@link Account} instance associated with this {@link ILoginIdentity} instance. There is an N:1 + * relationship between {@link ILoginIdentity} instances and {@link Account} instances: every {@link ILoginIdentity} + * must have exactly one associated {@link Account} instance, while any given {@link Account} must have one or more * associated {@link ILoginIdentity} instances. - * - * @return the {@link Account} instance associated with this - * {@link ILoginIdentity} instance + * + * @return the {@link Account} instance associated with this {@link ILoginIdentity} instance */ Account getAccount(); @@ -38,8 +33,7 @@ public interface ILoginIdentity { Instant getCreatedTimestamp(); /** - * @return the {@link LoginProvider} associated with this - * {@link ILoginIdentity} implementation + * @return the {@link LoginProvider} associated with this {@link ILoginIdentity} implementation */ LoginProvider getLoginProvider(); } diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/LoginProvider.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/LoginProvider.java index 0335b87b..b7e6d743 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/LoginProvider.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/LoginProvider.java @@ -8,23 +8,20 @@ * Enumerates the various login providers/mechanisms that are available. *

*

- * Design note: This is an enum, as it really isn't possible to abstract out the - * functionality required to support the different options available here. For - * instance, you can't abstract away the fact that guests don't have to login at - * all, "simple" accounts can be created on the site, or that OAuth logins are - * an option. It just kind of has to be hard-coded. (Though the various OAuth - * providers can be abstracted out.) + * Design note: This is an enum, as it really isn't possible to abstract out the functionality required to support the + * different options available here. For instance, you can't abstract away the fact that guests don't have to login at + * all, "simple" accounts can be created on the site, or that OAuth logins are an option. It just kind of has to be + * hard-coded. (Though the various OAuth providers can be abstracted out.) *

*/ public enum LoginProvider { /** *

- * Using this {@link LoginProvider}, client browsers receive an - * automatically created "guest" account. These accounts are persistent, but - * can't easily be used in more than one client browser (at least not - * without the user manually copy-pasting the cookie to the other browser). + * Using this {@link LoginProvider}, client browsers receive an automatically created "guest" account. These + * accounts are persistent, but can't easily be used in more than one client browser (at least not without the user + * manually copy-pasting the cookie to the other browser). *

- * + * * @see GuestAuthService * @see GuestLoginIdentity */ @@ -32,10 +29,10 @@ public enum LoginProvider { /** *

- * Using this {@link LoginProvider}, clients must specify a username and - * password. It also allows for login sessions to be cached via a cookie. + * Using this {@link LoginProvider}, clients must specify a username and password. It also allows for login sessions + * to be cached via a cookie. *

- * + * * @see GameAuthService * @see GameLoginIdentity */ diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/MockAccountsClient.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/MockAccountsClient.java index 6673edef..99183452 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/MockAccountsClient.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/MockAccountsClient.java @@ -39,8 +39,7 @@ public AuthToken selectOrCreateAuthToken() { } /** - * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, - * java.util.UUID) + * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, java.util.UUID) */ @Override public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) { diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/SecurityRole.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/SecurityRole.java index 83bff990..0f2cdfe2 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/SecurityRole.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/SecurityRole.java @@ -4,7 +4,7 @@ /** * Enumerates the security roles used by the application. - * + * * @see RolesAllowed */ public enum SecurityRole { @@ -32,7 +32,7 @@ public enum SecurityRole { /** * Enum constant constructor. - * + * * @param id * the value to use for {@link #getId()} */ @@ -41,9 +41,8 @@ private SecurityRole(String id) { } /** - * @return the unique identifier for this {@link SecurityRole}, which for - * use with the {@link RolesAllowed} annotation, will also be - * available as a SecurityRole.ID_NNN constant + * @return the unique identifier for this {@link SecurityRole}, which for use with the {@link RolesAllowed} + * annotation, will also be available as a SecurityRole.ID_NNN constant */ public String getId() { return id; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentity.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentity.java index 22ab9ae0..5f9661c1 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentity.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentity.java @@ -17,15 +17,12 @@ /** *

- * The {@link ILoginIdentity} implementation for {@link LoginProvider#GAME} - * logins. + * The {@link ILoginIdentity} implementation for {@link LoginProvider#GAME} logins. *

*

- * Each {@link GameLoginIdentity} instance is basically just a username (always - * an email address) and password hash, with an associated {@link Account}. When - * creating one of these accounts, the game UI should also prompt users to flesh - * out some of the {@link Account} details, e.g. their name, though that's not - * required. + * Each {@link GameLoginIdentity} instance is basically just a username (always an email address) and password hash, + * with an associated {@link Account}. When creating one of these accounts, the game UI should also prompt users to + * flesh out some of the {@link Account} details, e.g. their name, though that's not required. *

*

* This class supports JPA. @@ -44,9 +41,8 @@ public class GameLoginIdentity extends AbstractLoginIdentity implements ILoginId private InternetAddress emailAddress; /* - * This field is marked {@link XmlTransient} to help ensure it's never sent - * off of the server by mistake. Any web services wishing to use it in a - * response will have to do so explicitly. + * This field is marked {@link XmlTransient} to help ensure it's never sent off of the server by mistake. Any web + * services wishing to use it in a response will have to do so explicitly. */ @Column(name = "`passwordHash`", nullable = false) @XmlTransient @@ -54,7 +50,7 @@ public class GameLoginIdentity extends AbstractLoginIdentity implements ILoginId /** * Constructs a new {@link GameLoginIdentity} instance. - * + * * @param account * the value to use for {@link #getAccount()} * @param emailAddress @@ -70,8 +66,7 @@ public GameLoginIdentity(Account account, InternetAddress emailAddress, String p } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated GameLoginIdentity() { @@ -94,13 +89,12 @@ public InternetAddress getEmailAddress() { /** *

- * Returns the scrypt hash of the user's password that is stored for - * authentication purposes. + * Returns the scrypt hash of the user's password that is stored for authentication purposes. *

*

* In general, this should never be sent off of the server. *

- * + * * @return the scrypt hash of the user's password */ public String getPasswordHash() { @@ -124,8 +118,7 @@ public String toString() { builder.append("GameLoginIdentity [id="); builder.append(id); /* - * Can't just include account.toString(), as that would create a - * recursive never-ending loop. + * Can't just include account.toString(), as that would create a recursive never-ending loop. */ builder.append(", account.getId()="); builder.append(account.hasId() ? account.getId() : "N/A"); @@ -134,8 +127,7 @@ public String toString() { builder.append(", emailAddress="); builder.append(emailAddress); /* - * Can't print out the passwordHash itself, as that value needs to be - * very carefully protected. + * Can't print out the passwordHash itself, as that value needs to be very carefully protected. */ builder.append(", passwordHash="); builder.append(passwordHash != null ? "(not null)" : "(null)"); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/IGameAuthResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/IGameAuthResource.java index 70c2b1ac..c4e7ed60 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/IGameAuthResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/IGameAuthResource.java @@ -13,8 +13,8 @@ import com.justdavis.karl.rpstourney.service.api.auth.Account; /** - * Implementations of this service allows users to login as a guest. See - * {@link #loginAsGuest(UriInfo, UUID)} for details. + * Implementations of this service allows users to login as a guest. See {@link #loginAsGuest(UriInfo, UUID)} for + * details. */ @Path(IGameAuthResource.SERVICE_PATH) public interface IGameAuthResource { @@ -23,35 +23,29 @@ public interface IGameAuthResource { */ public static final String SERVICE_PATH = "/auth/game/"; /** - * The {@link Path} for - * {@link #loginWithGameAccount(UriInfo, UUID, InternetAddress, String)}. + * The {@link Path} for {@link #loginWithGameAccount(UriInfo, UUID, InternetAddress, String)}. */ public static final String SERVICE_PATH_LOGIN = "/login/"; /** - * The {@link Path} for - * {@link #createGameLogin(UriInfo, UUID, InternetAddress, String)}. + * The {@link Path} for {@link #createGameLogin(UriInfo, UUID, InternetAddress, String)}. */ public static final String SERVICE_PATH_CREATE_LOGIN = "/create/"; /** *

- * Allows clients to login with a {@link GameLoginIdentity}. This login will - * be persistent. + * Allows clients to login with a {@link GameLoginIdentity}. This login will be persistent. *

*

- * The account being logged in must already exist. If the user/client - * calling this method is already logged in, this method will return an - * error, rather than overwriting the existing login (users must manually - * log out, first). + * The account being logged in must already exist. If the user/client calling this method is already logged in, this + * method will return an error, rather than overwriting the existing login (users must manually log out, first). *

- * + * * @param emailAddress * the email address to log in as, which must match an existing * {@link GameLoginIdentity#getEmailAddress()} * @param password - * the password to authenticate with, which must match the - * password hash in {@link GameLoginIdentity#getPasswordHash()} - * for the specified login + * the password to authenticate with, which must match the password hash in + * {@link GameLoginIdentity#getPasswordHash()} for the specified login * @return the logged-in {@link Account} instance */ @POST @@ -62,24 +56,20 @@ Account loginWithGameAccount(@FormParam("emailAddress") InternetAddress emailAdd /** *

- * Allows clients to create a new {@link GameLoginIdentity}. This login will - * be persistent. + * Allows clients to create a new {@link GameLoginIdentity}. This login will be persistent. *

*

- * If the user/client calling this method is already logged in, this method - * will not also create a new {@link Account}, but will instead associate - * the new {@link GameLoginIdentity} with the existing {@link Account}. This - * can be used to "upgrade" guest accounts to accounts that can be used from - * multiple clients/browsers. + * If the user/client calling this method is already logged in, this method will not also create a new + * {@link Account}, but will instead associate the new {@link GameLoginIdentity} with the existing {@link Account}. + * This can be used to "upgrade" guest accounts to accounts that can be used from multiple clients/browsers. *

- * + * * @param emailAddress * the email address to log in as, which must match an existing * {@link GameLoginIdentity#getEmailAddress()} * @param password - * the password to authenticate with, which must match the - * password hash in {@link GameLoginIdentity#getPasswordHash()} - * for the specified login + * the password to authenticate with, which must match the password hash in + * {@link GameLoginIdentity#getPasswordHash()} for the specified login * @return the new/linked {@link Account} instance */ @POST @@ -87,4 +77,4 @@ Account loginWithGameAccount(@FormParam("emailAddress") InternetAddress emailAdd @Produces(MediaType.TEXT_XML) Account createGameLogin(@FormParam("emailAddress") InternetAddress emailAddress, @FormParam("password") String password); -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/package-info.java index 8023e0b9..f30eb8a7 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/game/package-info.java @@ -1,6 +1,5 @@ /** - * Contains the types related to the "accounts-are-specific-to-this-app" - * authentication mechanism. + * Contains the types related to the "accounts-are-specific-to-this-app" authentication mechanism. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentity.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentity.java index f3ed151c..11d13464 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentity.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentity.java @@ -7,7 +7,6 @@ import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; - import com.justdavis.karl.rpstourney.service.api.auth.AbstractLoginIdentity; import com.justdavis.karl.rpstourney.service.api.auth.Account; import com.justdavis.karl.rpstourney.service.api.auth.ILoginIdentity; @@ -15,15 +14,12 @@ /** *

- * The {@link ILoginIdentity} implementation for {@link LoginProvider#GUEST} - * logins. + * The {@link ILoginIdentity} implementation for {@link LoginProvider#GUEST} logins. *

*

- * Each {@link GuestLoginIdentity} instance is basically just a reference to its - * associated {@link Account}. The {@link Account}s for - * {@link GuestLoginIdentity}s are often created automatically and are thus - * pretty much blank, unless/until the user fleshes them out, e.g. by providing - * their name. + * Each {@link GuestLoginIdentity} instance is basically just a reference to its associated {@link Account}. The + * {@link Account}s for {@link GuestLoginIdentity}s are often created automatically and are thus pretty much blank, + * unless/until the user fleshes them out, e.g. by providing their name. *

*

* This class supports JPA. @@ -38,7 +34,7 @@ public class GuestLoginIdentity extends AbstractLoginIdentity implements ILoginI /** * Constructs a new {@link GuestLoginIdentity} instance. - * + * * @param account * the value to use for {@link #getAccount()} * @param createdTimestamp @@ -50,7 +46,7 @@ public GuestLoginIdentity(Account account, Instant createdTimestamp) { /** * Constructs a new {@link GuestLoginIdentity} instance. - * + * * @param account * the value to use for {@link #getAccount()} */ @@ -59,8 +55,7 @@ public GuestLoginIdentity(Account account) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated GuestLoginIdentity() { @@ -83,8 +78,7 @@ public String toString() { builder.append("GuestLoginIdentity [id="); builder.append(id); /* - * Can't just include account.toString(), as that would create a - * recursive never-ending loop. + * Can't just include account.toString(), as that would create a recursive never-ending loop. */ builder.append(", account.getId()="); builder.append(account.hasId() ? account.getId() : "N/A"); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/IGuestAuthResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/IGuestAuthResource.java index 94d973aa..f9d4bef2 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/IGuestAuthResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/IGuestAuthResource.java @@ -11,8 +11,7 @@ import com.justdavis.karl.rpstourney.service.api.auth.Account; /** - * This service allows users to login as a guest. See - * {@link #loginAsGuest(UriInfo, UUID)} for details. + * This service allows users to login as a guest. See {@link #loginAsGuest(UriInfo, UUID)} for details. */ @Path(IGuestAuthResource.SERVICE_PATH) public interface IGuestAuthResource { @@ -24,18 +23,17 @@ public interface IGuestAuthResource { /** *

- * Allows clients to login as a guest. This guest login will be persistent - * and will have a "blank" {@link Account} created for it. + * Allows clients to login as a guest. This guest login will be persistent and will have a "blank" {@link Account} + * created for it. *

*

- * If the user/client calling this method is already logged in, this method - * will return an error, rather than overwriting the existing login (users - * must manually log out, first). + * If the user/client calling this method is already logged in, this method will return an error, rather than + * overwriting the existing login (users must manually log out, first). *

- * + * * @return the new {@link Account} instance */ @POST @Produces(MediaType.TEXT_XML) Account loginAsGuest(); -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/package-info.java index bacbbe19..77d6edbc 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/guest/package-info.java @@ -1,7 +1,6 @@ /** - * Contains the types related to the guest authentication code, which persists - * user data across requests and sessions, but doesn't require an explicit - * login. + * Contains the types related to the guest authentication code, which persists user data across requests and sessions, + * but doesn't require an explicit login. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/package-info.java index fcf1e2ed..c90c9eb0 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/auth/package-info.java @@ -1,8 +1,7 @@ /** - * The base package for the web service's authentication API. This API has - * several implementations, but is not pluggable. See - * {@link com.justdavis.karl.rpstourney.service.api.auth.LoginProvider} for a - * listing of the implementations. + * The base package for the web service's authentication API. This API has several implementations, but is not + * pluggable. See {@link com.justdavis.karl.rpstourney.service.api.auth.LoginProvider} for a listing of the + * implementations. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/UncheckedAddressException.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/UncheckedAddressException.java index e0df8150..fbe46842 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/UncheckedAddressException.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/UncheckedAddressException.java @@ -10,7 +10,7 @@ public final class UncheckedAddressException extends RuntimeException { /** * Constructor. - * + * * @param e * the checked exception to wrap */ diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/package-info.java index 858489a0..ebb612e3 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/exceptions/package-info.java @@ -1,4 +1,4 @@ /** * Contains exceptions specific to the web service API. */ -package com.justdavis.karl.rpstourney.service.api.exceptions; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.api.exceptions; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/AbstractGame.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/AbstractGame.java index f172be3c..aee77191 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/AbstractGame.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/AbstractGame.java @@ -23,7 +23,6 @@ import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - import com.fasterxml.jackson.annotation.JsonProperty; import com.justdavis.karl.misc.exceptions.BadCodeMonkeyException; import com.justdavis.karl.rpstourney.service.api.auth.Account; @@ -75,7 +74,7 @@ class AbstractGame { /** * Constructs a new {@link AbstractGame} instance. - * + * * @param id * the value to use for {@link #getId()}t * @param createdTimestamp @@ -115,16 +114,15 @@ protected AbstractGame(String id, Instant createdTimestamp, State state, int max } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated protected AbstractGame() { } /** - * @return the unique ID for this {@link Game}, which will match the - * following regular expression: [a-zA-Z]{1,10} + * @return the unique ID for this {@link Game}, which will match the following regular expression: + * [a-zA-Z]{1,10} */ public String getId() { return id; @@ -145,36 +143,30 @@ public State getState() { } /** - * @return the maximum number of non-tied rounds that play will continue for - * (though play will end early if a player takes a non-loseable - * lead), which will be at least 1, an odd number, and less than or - * equal to {@link #MAX_MAX_ROUNDS} + * @return the maximum number of non-tied rounds that play will continue for (though play will end early if a player + * takes a non-loseable lead), which will be at least 1, an odd number, and less than or equal to + * {@link #MAX_MAX_ROUNDS} */ public int getMaxRounds() { return maxRounds; } /** - * Returns an immutable copy of the {@link List} of {@link GameRound}s that - * are part of this {@link Game}, where the last {@link GameRound} in the - * {@link List} will be the current or final round of play. Will return an - * empty {@link List} if {@link #getState()} is - * {@value State#WAITING_FOR_PLAYER}. - * - * @return an immutable copy of the {@link List} of {@link GameRound}s that - * are part of this {@link Game}, or an empty {@link List} if - * {@link #getState()} is {@value State#WAITING_FOR_PLAYER} + * Returns an immutable copy of the {@link List} of {@link GameRound}s that are part of this {@link Game}, where the + * last {@link GameRound} in the {@link List} will be the current or final round of play. Will return an empty + * {@link List} if {@link #getState()} is {@value State#WAITING_FOR_PLAYER}. + * + * @return an immutable copy of the {@link List} of {@link GameRound}s that are part of this {@link Game}, or an + * empty {@link List} if {@link #getState()} is {@value State#WAITING_FOR_PLAYER} */ public List getRounds() { return Collections.unmodifiableList(rounds); } /** - * - * @return true if {@link Game#prepareRound()} needs to be - * called before the next - * {@link Game#submitThrow(int, Player, Throw)}, false - * if it does not + * + * @return true if {@link Game#prepareRound()} needs to be called before the next + * {@link Game#submitThrow(int, Player, Throw)}, false if it does not * @see Game#prepareRound() */ public boolean isRoundPrepared() { @@ -187,8 +179,7 @@ public boolean isRoundPrepared() { GameRound currentRound = rounds.get(currentRoundIndex); /* - * Is the current round complete? (Note that the game isn't marked - * FINISHED.) + * Is the current round complete? (Note that the game isn't marked FINISHED.) */ if (currentRound.getResult() != null) { return false; @@ -200,8 +191,7 @@ public boolean isRoundPrepared() { /** * @return the latest/current {@link GameRound} * @throws IllegalStateException - * An {@link IllegalStateException} will be thrown if this is - * called while {@link #getState()} is + * An {@link IllegalStateException} will be thrown if this is called while {@link #getState()} is * {@link State#WAITING_FOR_PLAYER}. */ public GameRound getCurrentRound() { @@ -214,10 +204,8 @@ public GameRound getCurrentRound() { /** * @return the latest {@link GameRound#getThrowForPlayer1Timestamp()} / - * {@link GameRound#getThrowForPlayer2Timestamp()} value for the - * {@link GameRound}s in this {@link Game}, or - * {@link Game#getCreatedTimestamp()} if no throws have yet been - * made + * {@link GameRound#getThrowForPlayer2Timestamp()} value for the {@link GameRound}s in this {@link Game}, or + * {@link Game#getCreatedTimestamp()} if no throws have yet been made */ public Instant getLastThrowTimestamp() { Instant lastThrowTime = createdTimestamp; @@ -235,8 +223,7 @@ public Instant getLastThrowTimestamp() { } /** - * @return the number of {@link GameRound}s in {@link #getRounds()} that - * {@link #getPlayer1()} has won + * @return the number of {@link GameRound}s in {@link #getRounds()} that {@link #getPlayer1()} has won */ @XmlElement @JsonProperty @@ -247,8 +234,7 @@ public int getScoreForPlayer1() { } /** - * @return the number of {@link GameRound}s in {@link #getRounds()} that - * {@link #getPlayer2()} has won + * @return the number of {@link GameRound}s in {@link #getRounds()} that {@link #getPlayer2()} has won */ @XmlElement @JsonProperty @@ -261,15 +247,14 @@ public int getScoreForPlayer2() { /** * @param result * the {@link GameRound#getResult()} value to match - * @return the number of {@link GameRound}s in {@link #getRounds()} with the - * specified {@link GameRound#getResult()} value + * @return the number of {@link GameRound}s in {@link #getRounds()} with the specified {@link GameRound#getResult()} + * value */ private int countRoundsWithResult(Result result) { int playerWins = 0; for (GameRound round : rounds) { /* - * If this round isn't complete, the game is still in-progress and - * we can stop counting early. + * If this round isn't complete, the game is still in-progress and we can stop counting early. */ if (round.getResult() == null) break; @@ -282,10 +267,9 @@ private int countRoundsWithResult(Result result) { } /** - * Determines the {@link Player} that won this {@link Game}, or - * null if {@link Game#getState()} is not yet - * {@link State#FINISHED}. - * + * Determines the {@link Player} that won this {@link Game}, or null if {@link Game#getState()} is not + * yet {@link State#FINISHED}. + * * @return the {@link Player} that won this {@link Game}. */ @XmlElement @@ -296,8 +280,7 @@ public Player getWinner() { } /** - * @return the {@link Player} that won this {@link Game}, or - * null if the game is still in-progress + * @return the {@link Player} that won this {@link Game}, or null if the game is still in-progress */ protected Player checkForWinner() { if (state == State.WAITING_FOR_PLAYER) @@ -323,7 +306,7 @@ else if (player2Wins > player1Wins) /** * Note: Player order has no effect on gameplay. - * + * * @return the first {@link Player} */ public Player getPlayer1() { @@ -332,9 +315,8 @@ public Player getPlayer1() { /** * Note: Player order has no effect on gameplay. - * - * @return the second {@link Player}, or null if they have not - * yet been identified + * + * @return the second {@link Player}, or null if they have not yet been identified */ public Player getPlayer2() { return player2; @@ -342,12 +324,11 @@ public Player getPlayer2() { /** * A utility method for working with game {@link Player}s. - * + * * @param player * the {@link Player} to check - * @return true if the specified {@link Player} represents - * {@link #getPlayer1()} or {@link #getPlayer2()}, - * false otherwise + * @return true if the specified {@link Player} represents {@link #getPlayer1()} or + * {@link #getPlayer2()}, false otherwise */ public boolean isPlayer(Player player) { if (player == null) @@ -367,12 +348,11 @@ public boolean isPlayer(Player player) { /** * A utility method for working with game {@link Player}s. - * + * * @param account * the {@link Account} to check - * @return true if the specified {@link Account} represents - * {@link #getPlayer1()} or {@link #getPlayer2()}, - * false otherwise + * @return true if the specified {@link Account} represents {@link #getPlayer1()} or + * {@link #getPlayer2()}, false otherwise */ public boolean isPlayer(Account account) { if (account == null) @@ -394,12 +374,10 @@ && getPlayer2().getHumanAccount().equals(account)) /** * A utility method for working with game {@link Player}s. - * + * * @param player - * the {@link Player} to determine the {@link PlayerRole}s for in - * this {@link AbstractGame} - * @return the {@link PlayerRole}s represented by the specified - * {@link Player} in this {@link AbstractGame} + * the {@link Player} to determine the {@link PlayerRole}s for in this {@link AbstractGame} + * @return the {@link PlayerRole}s represented by the specified {@link Player} in this {@link AbstractGame} */ public PlayerRole[] getPlayerRoles(Player player) { List roles = new ArrayList<>(2); @@ -412,19 +390,16 @@ public PlayerRole[] getPlayerRoles(Player player) { /** * A utility method for working with game {@link Player}s. - * + * * @param account - * the {@link Account} to select the opponent of (from this - * {@link AbstractGame}), which must be one of the two players - * @return if the specified {@link Account} is represented by - * {@link #getPlayer1()} this will return the value of - * {@link #getPlayer2()}, or if the specified {@link Account} is - * represented by {@link #getPlayer1()} this will return the value - * of {@link #getPlayer1()} + * the {@link Account} to select the opponent of (from this {@link AbstractGame}), which must be one of + * the two players + * @return if the specified {@link Account} is represented by {@link #getPlayer1()} this will return the value of + * {@link #getPlayer2()}, or if the specified {@link Account} is represented by {@link #getPlayer1()} this + * will return the value of {@link #getPlayer1()} * @throws IllegalArgumentException - * An {@link IllegalArgumentException} will be thrown if - * {@link #isPlayer(Account)} returns false for the - * specified {@link Account}. + * An {@link IllegalArgumentException} will be thrown if {@link #isPlayer(Account)} returns + * false for the specified {@link Account}. */ public Player determineOpponent(Account account) { // Are they Player 1? @@ -443,14 +418,11 @@ && getPlayer2().getHumanAccount().equals(account)) /** * @param playerAccount - * the {@link Account} of one of the {@link Player}s in this - * {@link AbstractGame} - * @return the {@link Player} in this {@link AbstractGame} that corresponds - * to the specified {@link Account} + * the {@link Account} of one of the {@link Player}s in this {@link AbstractGame} + * @return the {@link Player} in this {@link AbstractGame} that corresponds to the specified {@link Account} * @throws IllegalArgumentException - * An {@link IllegalArgumentException} will be thrown if the - * specified {@link Account} does not correspond to - * {@link #getPlayer1()} or {@link #getPlayer2()}. + * An {@link IllegalArgumentException} will be thrown if the specified {@link Account} does not + * correspond to {@link #getPlayer1()} or {@link #getPlayer2()}. */ public Player getPlayer(Account playerAccount) { if (getPlayer1().getHumanAccount() != null && getPlayer1().getHumanAccount().equals(playerAccount)) @@ -463,11 +435,9 @@ else if (getPlayer2().getHumanAccount() != null && getPlayer2().getHumanAccount( /** * @param player - * the {@link Player} in this {@link AbstractGame} to calculate - * the score of - * @return the score for the specified {@link Player} in this - * {@link AbstractGame}, or 0 if a null - * {@link Player} was specified + * the {@link Player} in this {@link AbstractGame} to calculate the score of + * @return the score for the specified {@link Player} in this {@link AbstractGame}, or 0 if a + * null {@link Player} was specified */ public int getScoreForPlayer(Player player) { if (player == null) @@ -508,9 +478,8 @@ public String toString() { */ public static final class GamePk implements Serializable { /* - * Design note: This IDClass is required because GameRound has a - * compound PK-and-FK relationship to Game, and its IdClass must - * reference this one. + * Design note: This IDClass is required because GameRound has a compound PK-and-FK relationship to Game, and + * its IdClass must reference this one. */ private static final long serialVersionUID = -2542571612762568669L; @@ -524,8 +493,7 @@ public GamePk() { } /** - * @return this {@link IdClass} field corresponds to - * {@link Game#getId()} + * @return this {@link IdClass} field corresponds to {@link Game#getId()} */ public String getId() { return id; @@ -545,8 +513,7 @@ public void setId(String id) { @Override public int hashCode() { /* - * This method was generated via Eclipse's 'Source > Generate - * hashCode() and equals()...' function. + * This method was generated via Eclipse's 'Source > Generate hashCode() and equals()...' function. */ final int prime = 31; @@ -561,8 +528,7 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * This method was generated via Eclipse's 'Source > Generate - * hashCode() and equals()...' function. + * This method was generated via Eclipse's 'Source > Generate hashCode() and equals()...' function. */ if (this == obj) @@ -580,4 +546,4 @@ public boolean equals(Object obj) { return true; } } -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Game.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Game.java index 45a0d78d..76799804 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Game.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Game.java @@ -19,8 +19,8 @@ /** *

- * Models a given play session of the game: tracking the moves that have been - * made, determining the winner (if any), etc. + * Models a given play session of the game: tracking the moves that have been made, determining the winner (if any), + * etc. *

*

* Here are the rules: @@ -28,22 +28,18 @@ *

    *
  • Each game will last a pre-specified (odd) number of rounds.
  • *
  • Each round of the game, players select a {@link Throw}.
  • - *
  • If the two throws are different, one of the players will have won the - * round. If the two throws are the same, the players have tied. Tied rounds do - * not count towards the agreed-upon total number of rounds.
  • - *
  • {@link Throw#ROCK} beats {@link Throw#SCISSORS}, {@link Throw#SCISSORS} - * beats {@link Throw#PAPER}, and {@link Throw#PAPER} beats {@link Throw#ROCK}. - * (This logic is captured in {@link GameRound#getResult()}.)
  • - *
  • The player that wins the most rounds wins the game. (The game stops at - * whatever point it becomes impossible for one player to win.)
  • + *
  • If the two throws are different, one of the players will have won the round. If the two throws are the same, the + * players have tied. Tied rounds do not count towards the agreed-upon total number of rounds.
  • + *
  • {@link Throw#ROCK} beats {@link Throw#SCISSORS}, {@link Throw#SCISSORS} beats {@link Throw#PAPER}, and + * {@link Throw#PAPER} beats {@link Throw#ROCK}. (This logic is captured in {@link GameRound#getResult()}.)
  • + *
  • The player that wins the most rounds wins the game. (The game stops at whatever point it becomes impossible for + * one player to win.)
  • *
*

- * Warning: This class is not at all immutable or thread-safe. - * It's the responsibility of the application using the class to ensure that - * conflicting modifications aren't made. In the common case, where the - * {@link Game} is being used with a database, it's recommended that each single - * operation on the {@link Game} be a pessimistic transaction. This allows the - * database to act as the mediator/enforcer of thread safety. + * Warning: This class is not at all immutable or thread-safe. It's the responsibility of the + * application using the class to ensure that conflicting modifications aren't made. In the common case, where the + * {@link Game} is being used with a database, it's recommended that each single operation on the {@link Game} be a + * pessimistic transaction. This allows the database to act as the mediator/enforcer of thread safety. *

*/ @Entity @@ -71,7 +67,7 @@ public class Game extends AbstractGame { /** * Constructs a new {@link Game} instance. - * + * * @param player1 * the value to use for {@link #getPlayer1()} */ @@ -81,16 +77,14 @@ public Game(Player player1) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated Game() { } /** - * @return a random value for the {@link #getId()} field, of exactly 10 - * alphabetic characters + * @return a random value for the {@link #getId()} field, of exactly 10 alphabetic characters */ private static String generateRandomId() { StringBuilder id = new StringBuilder(10); @@ -118,17 +112,15 @@ private static String generateRandomId() { * Sets a new value for {@link #getMaxRounds()}. *

*

- * Concurrency/JPA safety: This method is not safe for use when the - * {@link Game} is being stored in a JPA database and being modified by more - * than one thread/client/whatever. + * Concurrency/JPA safety: This method is not safe for use when the {@link Game} is being stored in a JPA database + * and being modified by more than one thread/client/whatever. *

- * + * * @param maxRounds * the value to use for {@link #getMaxRounds()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if - * {@link #getState()} is not {@link State#WAITING_FOR_PLAYER} - * or {@link State#WAITING_FOR_FIRST_THROW}. + * A {@link GameConflictException} will be thrown if {@link #getState()} is not + * {@link State#WAITING_FOR_PLAYER} or {@link State#WAITING_FOR_FIRST_THROW}. */ public void setMaxRounds(int maxRounds) { validateMaxRoundsValue(maxRounds); @@ -141,12 +133,11 @@ public void setMaxRounds(int maxRounds) { /** * Validates the proposed {@link #setMaxRounds(int)} value. - * + * * @param maxRounds * a value that might be passed to {@link #setMaxRounds(int)} * @throws IllegalArgumentException - * An {@link IllegalArgumentException} will be thrown if the - * specified number of rounds is not allowed. + * An {@link IllegalArgumentException} will be thrown if the specified number of rounds is not allowed. */ public static void validateMaxRoundsValue(int maxRounds) { if (maxRounds < 1) @@ -161,44 +152,36 @@ public static void validateMaxRoundsValue(int maxRounds) { /** *

- * Before calling {@link #submitThrow(int, Player, Throw)} each - * {@link GameRound}, players/clients must first do the following: + * Before calling {@link #submitThrow(int, Player, Throw)} each {@link GameRound}, players/clients must first do the + * following: *

- * + * *
 	 * Game game = ...;
-	 * 
+	 *
 	 * if (!game.isRoundPrepared()) {
 	 *   game.prepareRound();
 	 * }
 	 * 
*

- * The call to {@link #prepareRound()} will first check to see if the game - * is still in progress or if it has been won. If it's been won, it will set - * {@link #getState()} to {@link State#FINISHED}. If it's still in-progress, - * it will create the next {@link GameRound} and append it to - * {@link #getRounds()}. Subsequent calls {@link #prepareRound()} within the - * same actual round will not do anything. + * The call to {@link #prepareRound()} will first check to see if the game is still in progress or if it has been + * won. If it's been won, it will set {@link #getState()} to {@link State#FINISHED}. If it's still in-progress, it + * will create the next {@link GameRound} and append it to {@link #getRounds()}. Subsequent calls + * {@link #prepareRound()} within the same actual round will not do anything. *

*

- * Caution: If the {@link Game} being used is persistent - * (to a DB via JPA), then any call to this method must be be made by itself - * in a single transaction. Please note that multiple concurrent calls to - * {@link #prepareRound()} by clients with different copies of the - * {@link Game} (from the DB) may lead to DB constraint violations for some - * of the calls. Such errors can be safely ignored, as they simply indicate - * that another client's call was successful. + * Caution: If the {@link Game} being used is persistent (to a DB via JPA), then any call to this + * method must be be made by itself in a single transaction. Please note that multiple concurrent calls to + * {@link #prepareRound()} by clients with different copies of the {@link Game} (from the DB) may lead to DB + * constraint violations for some of the calls. Such errors can be safely ignored, as they simply indicate that + * another client's call was successful. *

*

- * Design note: Originally, this method's logic was part of - * {@link #submitThrow(int, Player, Throw)}. However, in the face of - * concurrent clients/players, it's quite likely that both players will make - * their move at the same time, and thus each copy of the {@link Game} will - * not realize that the round is complete. By splitting this logic into a - * separate method, we also ensure that - * {@link #submitThrow(int, Player, Throw)} won't generate DB constraint - * errors; isolating the logic that might cause such errors in a separate - * method seems prudent. + * Design note: Originally, this method's logic was part of {@link #submitThrow(int, Player, Throw)}. However, in + * the face of concurrent clients/players, it's quite likely that both players will make their move at the same + * time, and thus each copy of the {@link Game} will not realize that the round is complete. By splitting this logic + * into a separate method, we also ensure that {@link #submitThrow(int, Player, Throw)} won't generate DB constraint + * errors; isolating the logic that might cause such errors in a separate method seems prudent. *

*/ public void prepareRound() { @@ -233,28 +216,24 @@ public void prepareRound() { } /** - * Submits the specified {@link Throw} for the specified {@link Player}, to - * the current {@link GameRound}. - * + * Submits the specified {@link Throw} for the specified {@link Player}, to the current {@link GameRound}. + * * @param roundIndex - * the {@link GameRound#getRoundIndex()} of the current round - * (used to verify that gameplay is correctly synchronized) + * the {@link GameRound#getRoundIndex()} of the current round (used to verify that gameplay is correctly + * synchronized) * @param player * the {@link Player} to submit the {@link Throw} for * @param throwForPlayer * the {@link Throw} to submit for the {@link Player} * @throws GameConflictException *

- * An {@link GameConflictException} will be thrown in the - * following cases: + * An {@link GameConflictException} will be thrown in the following cases: *

*
    *
  • If {@link #getState()} is not {@link State#STARTED}.
  • - *
  • If the specified roundIndex is not the same - * as {@link GameRound#getRoundIndex()} in the last/current - * round.
  • - *
  • If the {@link Player} has already submitted a - * {@link Throw} for the {@link GameRound}.
  • + *
  • If the specified roundIndex is not the same as {@link GameRound#getRoundIndex()} in + * the last/current round.
  • + *
  • If the {@link Player} has already submitted a {@link Throw} for the {@link GameRound}.
  • *
*/ public void submitThrow(int roundIndex, Player player, Throw throwForPlayer) { @@ -268,15 +247,13 @@ public void submitThrow(int roundIndex, Player player, Throw throwForPlayer) { throw new GameConflictException(ConflictType.THROW_INVALID); /* - * We need to ensure that the move clients think they're making is for - * the actual current round. This is to prevent (and expose) gameplay - * synchronization issues. + * We need to ensure that the move clients think they're making is for the actual current round. This is to + * prevent (and expose) gameplay synchronization issues. */ GameRound currentRound = rounds.get(rounds.size() - 1); if (roundIndex != currentRound.getRoundIndex()) { /* - * Either the client is out-of-synch or it neglected to call - * prepareRound() first. + * Either the client is out-of-synch or it neglected to call prepareRound() first. */ LOGGER.warn("Specified round '{}' is not current round '{}': {}", new Object[] { roundIndex, currentRound.getRoundIndex(), rounds.toString() }); @@ -297,12 +274,10 @@ else if (player.equals(player2)) } /* - * To hopefully save a write transaction, we'll call isRoundPrepared() - * and prepareRound() here. This isn't mentioned in the JavaDocs, - * though, as clients always need to duplicate this themselves. This is - * because, in the case of concurrent clients, neither players' round - * may "look" complete until after both of their throws' transaction - * have committed. + * To hopefully save a write transaction, we'll call isRoundPrepared() and prepareRound() here. This isn't + * mentioned in the JavaDocs, though, as clients always need to duplicate this themselves. This is because, in + * the case of concurrent clients, neither players' round may "look" complete until after both of their throws' + * transaction have committed. */ if (!isRoundPrepared()) prepareRound(); @@ -310,20 +285,18 @@ else if (player.equals(player2)) /** *

- * This method may only be called if {@link #getPlayer2()} is - * null; {@link Player}s may not be removed from a game, once - * joined to it. + * This method may only be called if {@link #getPlayer2()} is null; {@link Player}s may not be removed + * from a game, once joined to it. *

*

- * Calling this method will also transition {@link #getState()} to - * {@value State#STARTED}. + * Calling this method will also transition {@link #getState()} to {@value State#STARTED}. *

- * + * * @param player2 * the value to use for {@link #getPlayer2()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if - * {@link #getState()} is not {@link State#WAITING_FOR_PLAYER}. + * A {@link GameConflictException} will be thrown if {@link #getState()} is not + * {@link State#WAITING_FOR_PLAYER}. */ public void setPlayer2(Player player2) { // Once set, the player can't be changed. @@ -344,10 +317,10 @@ public void setPlayer2(Player player2) { /** *

- * This method is intended for use in {@link Account} management operations, - * such as when {@link Account}s are merged. + * This method is intended for use in {@link Account} management operations, such as when {@link Account}s are + * merged. *

- * + * * @param player1 * the new value to use for {@link #getPlayer1()} */ @@ -364,16 +337,15 @@ public void replacePlayer1(Player player1) { /** *

- * This method may only be called if {@link #getPlayer2()} is not - * null. It is intended for use in {@link Account} management - * operations, such as when {@link Account}s are merged. + * This method may only be called if {@link #getPlayer2()} is not null. It is intended for use in + * {@link Account} management operations, such as when {@link Account}s are merged. *

- * + * * @param player2 * the new value to use for {@link #getPlayer2()} * @throws IllegalStateException - * An {@link IllegalStateException} will be thrown if - * {@link #getPlayer2()} was not already non-null. + * An {@link IllegalStateException} will be thrown if {@link #getPlayer2()} was not already + * non-null. */ public void replacePlayer2(Player player2) { if (this.player2 == null) @@ -387,8 +359,7 @@ public void replacePlayer2(Player player2) { } /** - * Will initialize {@link #getRounds()} and then transition - * {@link #getState()} to {@link State#STARTED}. + * Will initialize {@link #getRounds()} and then transition {@link #getState()} to {@link State#STARTED}. */ private void player2Joined() { GameRound firstRound = new GameRound(this, 0, 0); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameConflictException.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameConflictException.java index 8cdf754f..8a2bf555 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameConflictException.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameConflictException.java @@ -7,14 +7,13 @@ /** *

- * A runtime exception indicating that an attempt was made to modify a - * {@link Game}'s state in an incorrect way. These are typically caused by - * "mid-air collision" issues, when two users/clients try to update a - * {@link Game} at the same time. + * A runtime exception indicating that an attempt was made to modify a {@link Game}'s state in an incorrect way. These + * are typically caused by "mid-air collision" issues, when two users/clients try to update a {@link Game} at the same + * time. *

*

- * Gets translated to a {@link javax.ws.rs.core.Response.Status#CONFLICT - * conflict} status type in JAX-RS requests and responses. + * Gets translated to a {@link javax.ws.rs.core.Response.Status#CONFLICT conflict} status type in JAX-RS requests and + * responses. *

*/ public final class GameConflictException extends ClientErrorException { @@ -24,7 +23,7 @@ public final class GameConflictException extends ClientErrorException { /** * Construct a new {@link GameConflictException} instance. - * + * * @param type * the value to use for {@link #getType()} */ @@ -35,29 +34,24 @@ public GameConflictException(ConflictType type) { /** * Construct a new {@link GameConflictException} instance. - * + * * @param response - * the {@link Response} that this {@link GameConflictException} - * was indicated/caused by + * the {@link Response} that this {@link GameConflictException} was indicated/caused by */ public GameConflictException(Response response) { this(extractTypeFromResponse(response)); } /** - * Used to extract a {@link GameConflictException} / {@link ConflictType} - * from an HTTP {@link Response}. - * + * Used to extract a {@link GameConflictException} / {@link ConflictType} from an HTTP {@link Response}. + * * @param response * the HTTP {@link Response} to translate - * @return the {@link ConflictType} (for a {@link GameConflictException}) - * that was embedded in the specified {@link Response}, or - * {@link ConflictType#UNKNOWN} if that could not be determined (as - * might happen if the server supports {@link ConflictType}s that - * the client is not familiar with) + * @return the {@link ConflictType} (for a {@link GameConflictException}) that was embedded in the specified + * {@link Response}, or {@link ConflictType#UNKNOWN} if that could not be determined (as might happen if the + * server supports {@link ConflictType}s that the client is not familiar with) * @throws IllegalArgumentException - * An {@link IllegalArgumentException} will be thrown if the - * {@link Response#getStatus()} type is not + * An {@link IllegalArgumentException} will be thrown if the {@link Response#getStatus()} type is not * {@link Status#CONFLICT}. */ private static ConflictType extractTypeFromResponse(Response response) { @@ -79,8 +73,7 @@ private static ConflictType extractTypeFromResponse(Response response) { } /** - * @return the {@link ConflictType} that indicates the type of problem/issue - * that was encountered + * @return the {@link ConflictType} that indicates the type of problem/issue that was encountered */ public ConflictType getType() { return type; @@ -100,13 +93,11 @@ public Response toResponse(GameConflictException exception) { } /** - * Enumerates the various types of {@link GameConflictException}s that can - * occur. + * Enumerates the various types of {@link GameConflictException}s that can occur. */ public static enum ConflictType { /** - * Users cannot call {@link Game#setMaxRounds(int)} after a game has - * started. + * Users cannot call {@link Game#setMaxRounds(int)} after a game has started. */ ROUNDS_FINALIZED, @@ -116,52 +107,45 @@ public static enum ConflictType { ROUNDS_INVALID, /** - * When trying to set the maximum rounds for a game, the user supplied a - * stale/incorrect "old" value. + * When trying to set the maximum rounds for a game, the user supplied a stale/incorrect "old" value. */ ROUNDS_STALE, /** - * Indicates that a user is trying to call - * {@link Game#setPlayer2(Player)} after someone else has already been + * Indicates that a user is trying to call {@link Game#setPlayer2(Player)} after someone else has already been * set as Player 2. */ PLAYER_2_FINALIZED, /** - * Indicates that a user is trying to set a throw before the game has - * started (i.e. before Player 2 has joined). + * Indicates that a user is trying to set a throw before the game has started (i.e. before Player 2 has joined). */ THROW_BEFORE_START, /** - * Indicates that a user is trying to set their throw to an invalid - * value. + * Indicates that a user is trying to set their throw to an invalid value. */ THROW_INVALID, /** - * Indicates that a user is trying to set a throw for a round other than - * the current one. + * Indicates that a user is trying to set a throw for a round other than the current one. */ THROW_WRONG_ROUND, /** - * Indicates that a user is trying to set their throw for the same - * {@link GameRound} more than once, which is disallowed. + * Indicates that a user is trying to set their throw for the same {@link GameRound} more than once, which is + * disallowed. */ THROW_ALREADY_SET, /** - * Indicates that a user is trying to set a throw after the game has - * finished. + * Indicates that a user is trying to set a throw after the game has finished. */ THROW_AFTER_FINISH, /** - * Indicates that some unknown error condition occurred. This should - * never be used directly by server-side {@link IGameResource} - * implementations. + * Indicates that some unknown error condition occurred. This should never be used directly by server-side + * {@link IGameResource} implementations. */ UNKNOWN; } diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameRound.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameRound.java index f1e24c86..cec6a3ae 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameRound.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameRound.java @@ -34,11 +34,9 @@ * Represents a round of a {@link Game}, tracking the moves made by the players. *

*

- * Please note that instances of this class are not immutable: - * the {@link #setThrowForPlayer1(Throw)} and {@link #setThrowForPlayer2(Throw)} - * methods will modify data. However, as both of those methods may only be - * called once, instances are effectively immutable after they've both been - * supplied with a value. + * Please note that instances of this class are not immutable: the {@link #setThrowForPlayer1(Throw)} + * and {@link #setThrowForPlayer2(Throw)} methods will modify data. However, as both of those methods may only be called + * once, instances are effectively immutable after they've both been supplied with a value. *

*/ @Entity @@ -52,8 +50,7 @@ public class GameRound { @Id /* - * FIXME This column can't be quoted unless/until - * https://hibernate.atlassian.net/browse/HHH-9427 is resolved. + * FIXME This column can't be quoted unless/until https://hibernate.atlassian.net/browse/HHH-9427 is resolved. */ @JoinColumn(name = "gameId", nullable = false) @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, @@ -92,7 +89,7 @@ public class GameRound { /** * Constructs a new {@link GameRound} instance. - * + * * @param game * the value to use for {@link #getGame()} * @param roundIndex @@ -120,66 +117,58 @@ public GameRound(Game game, int roundIndex, int adjustedRoundIndex) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated GameRound() { } /** - * @return the {@link Game} that this {@link GameRound} is a part of, or - * null if this {@link GameRound} was accessed via an - * unmarshalled {@link GameView} + * @return the {@link Game} that this {@link GameRound} is a part of, or null if this {@link GameRound} + * was accessed via an unmarshalled {@link GameView} */ public Game getGame() { return game; } /** - * @return the index of this {@link GameRound} in the {@link Game} it's part - * of + * @return the index of this {@link GameRound} in the {@link Game} it's part of */ public int getRoundIndex() { return roundIndex; } /** - * @return the index of this {@link GameRound} as if the {@link Game} it's - * part of had not had any ties + * @return the index of this {@link GameRound} as if the {@link Game} it's part of had not had any ties */ public int getAdjustedRoundIndex() { return adjustedRoundIndex; } /** - * @return the {@link Throw} that was selected by the first player in this - * {@link GameRound}, or null if that player has not - * yet selected their move + * @return the {@link Throw} that was selected by the first player in this {@link GameRound}, or null + * if that player has not yet selected their move */ public Throw getThrowForPlayer1() { return throwForPlayer1; } /** - * @return the date-time that {@link #setThrowForPlayer1(Throw)} was called - * (with a valid value) for this {@link GameRound}, or - * null if it hasn't yet + * @return the date-time that {@link #setThrowForPlayer1(Throw)} was called (with a valid value) for this + * {@link GameRound}, or null if it hasn't yet */ public Instant getThrowForPlayer1Timestamp() { return throwForPlayer1Timestamp; } /** - * Note: this method may only be called once, and should only be called by - * {@link Game}. - * + * Note: this method may only be called once, and should only be called by {@link Game}. + * * @param throwForPlayer1 * the value to use for {@link #getThrowForPlayer1()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if the - * {@link Player} has already submitted a {@link Throw} for this - * {@link GameRound}. + * A {@link GameConflictException} will be thrown if the {@link Player} has already submitted a + * {@link Throw} for this {@link GameRound}. * @see Game#submitThrow(int, Player, Throw) */ void setThrowForPlayer1(Throw throwForPlayer1) { @@ -187,17 +176,15 @@ void setThrowForPlayer1(Throw throwForPlayer1) { } /** - * Note: this method may only be called once, and should only be called by - * {@link GameView}. - * + * Note: this method may only be called once, and should only be called by {@link GameView}. + * * @param throwForPlayer1 * the value to use for {@link #getThrowForPlayer1()} * @param throwForPlayer1Timestamp * the value to use for {@link #getThrowForPlayer1Timestamp()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if the - * {@link Player} has already submitted a {@link Throw} for this - * {@link GameRound}. + * A {@link GameConflictException} will be thrown if the {@link Player} has already submitted a + * {@link Throw} for this {@link GameRound}. * @see Game#submitThrow(int, Player, Throw) */ void setThrowForPlayer1(Throw throwForPlayer1, Instant throwForPlayer1Timestamp) { @@ -213,33 +200,29 @@ void setThrowForPlayer1(Throw throwForPlayer1, Instant throwForPlayer1Timestamp) } /** - * @return the {@link Throw} that was selected by the second player in this - * {@link GameRound}, or null if that player has not - * yet selected their move + * @return the {@link Throw} that was selected by the second player in this {@link GameRound}, or null + * if that player has not yet selected their move */ public Throw getThrowForPlayer2() { return throwForPlayer2; } /** - * @return the date-time that {@link #setThrowForPlayer2(Throw)} was called - * (with a valid value) for this {@link GameRound}, or - * null if it hasn't yet + * @return the date-time that {@link #setThrowForPlayer2(Throw)} was called (with a valid value) for this + * {@link GameRound}, or null if it hasn't yet */ public Instant getThrowForPlayer2Timestamp() { return throwForPlayer2Timestamp; } /** - * Note: this method may only be called once, and should only be called by - * {@link Game}. - * + * Note: this method may only be called once, and should only be called by {@link Game}. + * * @param throwForPlayer2 * the value to use for {@link #getThrowForPlayer2()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if the - * {@link Player} has already submitted a {@link Throw} for this - * {@link GameRound}. + * A {@link GameConflictException} will be thrown if the {@link Player} has already submitted a + * {@link Throw} for this {@link GameRound}. * @see Game#submitThrow(int, Player, Throw) */ void setThrowForPlayer2(Throw throwForPlayer2) { @@ -247,17 +230,15 @@ void setThrowForPlayer2(Throw throwForPlayer2) { } /** - * Note: this method may only be called once, and should only be called by - * {@link GameView}. - * + * Note: this method may only be called once, and should only be called by {@link GameView}. + * * @param throwForPlayer2 * the value to use for {@link #getThrowForPlayer2()} * @param throwForPlayer2Timestamp * the value to use for {@link #getThrowForPlayer2Timestamp()} * @throws GameConflictException - * A {@link GameConflictException} will be thrown if the - * {@link Player} has already submitted a {@link Throw} for this - * {@link GameRound}. + * A {@link GameConflictException} will be thrown if the {@link Player} has already submitted a + * {@link Throw} for this {@link GameRound}. * @see Game#submitThrow(int, Player, Throw) */ void setThrowForPlayer2(Throw throwForPlayer2, Instant throwForPlayer2Timestamp) { @@ -275,8 +256,7 @@ void setThrowForPlayer2(Throw throwForPlayer2, Instant throwForPlayer2Timestamp) /** * @param role * the {@link PlayerRole} to get the {@link Throw} (if any) for - * @return the result of either {@link #getThrowForPlayer1()} or - * {@link #getThrowForPlayer2()}, as specified + * @return the result of either {@link #getThrowForPlayer1()} or {@link #getThrowForPlayer2()}, as specified */ public Throw getThrowForPlayer(PlayerRole role) { if (role == null) @@ -292,16 +272,16 @@ else if (role == PlayerRole.PLAYER_2) } /** - * @return the {@link Result} of this {@link GameRound}, or - * null if the {@link GameRound} has not yet completed. + * @return the {@link Result} of this {@link GameRound}, or null if the {@link GameRound} has not yet + * completed. */ public Result getResult() { if (throwForPlayer1 == null || throwForPlayer2 == null) return null; /* - * Eventually, I may want to abstract out this logic to allow for custom - * Throw types. For right now, though, this works. + * Eventually, I may want to abstract out this logic to allow for custom Throw types. For right now, though, + * this works. */ if (throwForPlayer1.equals(throwForPlayer2)) return Result.TIED; @@ -354,7 +334,7 @@ public static enum Result { /** * Enum constant constructor. - * + * * @param playerRole * the value to use for {@link #getWinningPlayerRole()} */ @@ -363,8 +343,8 @@ private Result(PlayerRole playerRole) { } /** - * @return the winning {@link PlayerRole} represented by this - * {@link Result}, or null for {@link Result#TIED} + * @return the winning {@link PlayerRole} represented by this {@link Result}, or null for + * {@link Result#TIED} */ public PlayerRole getWinningPlayerRole() { return playerRole; @@ -387,9 +367,8 @@ public GameRoundPk() { } /** - * @return this {@link IdClass} field corresponds to - * {@link GameRound#getGame()}, which is mapped as a foreign key - * to {@link Game#getId()} + * @return this {@link IdClass} field corresponds to {@link GameRound#getGame()}, which is mapped as a foreign + * key to {@link Game#getId()} */ public GamePk getGame() { return game; @@ -404,8 +383,7 @@ public void setGame(GamePk game) { } /** - * @return this {@link IdClass} field corresponds to - * {@link GameRound#getRoundIndex()} + * @return this {@link IdClass} field corresponds to {@link GameRound#getRoundIndex()} */ public int getRoundIndex() { return roundIndex; @@ -425,8 +403,7 @@ public void setRoundIndex(int roundIndex) { @Override public int hashCode() { /* - * This method was generated via Eclipse's 'Source > Generate - * hashCode() and equals()...' function. + * This method was generated via Eclipse's 'Source > Generate hashCode() and equals()...' function. */ final int prime = 31; @@ -442,8 +419,7 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * This method was generated via Eclipse's 'Source > Generate - * hashCode() and equals()...' function. + * This method was generated via Eclipse's 'Source > Generate hashCode() and equals()...' function. */ if (this == obj) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameView.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameView.java index 963f33d3..542dc6ef 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameView.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/GameView.java @@ -14,16 +14,15 @@ /** *

- * An immutable, point-in-time view of a {@link Game}'s state, filtered to hide - * moves that shouldn't yet be revealed to other players. + * An immutable, point-in-time view of a {@link Game}'s state, filtered to hide moves that shouldn't yet be revealed to + * other players. *

*

- * Instances of this class, rather than {@link Game}, should be returned by the - * web service in order to: + * Instances of this class, rather than {@link Game}, should be returned by the web service in order to: *

*
    - *
  • Prevent web service users from trying to directly modify the game state, - * rather than going through the web service.
  • + *
  • Prevent web service users from trying to directly modify the game state, rather than going through the web + * service.
  • *
  • Hide moves made by players in rounds that aren't yet complete.
  • *
*/ @@ -36,10 +35,9 @@ public final class GameView extends AbstractGame { /** * Constructs a new {@link GameView} instance. - * + * * @param gameToWrap - * the {@link Game} instance that the new {@link GameView} will - * be a view of + * the {@link Game} instance that the new {@link GameView} will be a view of * @param viewPlayer * the value to use for {@link #getViewPlayer()} */ @@ -51,8 +49,7 @@ public GameView(Game gameToWrap, Player viewPlayer) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB spec. + * Not intended for use: This constructor is only provided to comply with the JAXB spec. */ @Deprecated GameView() { @@ -61,14 +58,11 @@ public GameView(Game gameToWrap, Player viewPlayer) { /** * @param gameToWrap - * the {@link Game} instance to filter the - * {@link Game#getRounds()} of + * the {@link Game} instance to filter the {@link Game#getRounds()} of * @param player - * the {@link Player} who requested or will be shown the - * resulting {@link GameView}, or null if it's for - * someone other than one of the game's players - * @return the filtered {@link GameRound}s that should be visible to the - * specified {@link Player} + * the {@link Player} who requested or will be shown the resulting {@link GameView}, or null + * if it's for someone other than one of the game's players + * @return the filtered {@link GameRound}s that should be visible to the specified {@link Player} */ private static List filterRoundsForPlayer(Game gameToWrap, Player player) { boolean isPlayer1 = player != null && player.equals(gameToWrap.getPlayer1()); @@ -101,11 +95,9 @@ private static List filterRoundsForPlayer(Game gameToWrap, Player pla } /** - * @return the {@link Player} in the {@link Game} who requested or will be - * shown the resulting {@link GameView}, which will be used to - * determine how to filter {@link GameView#getRounds()}, or - * null if it will be displayed to someone who is not - * one of the {@link Game}'s {@link Player}s + * @return the {@link Player} in the {@link Game} who requested or will be shown the resulting {@link GameView}, + * which will be used to determine how to filter {@link GameView#getRounds()}, or null if it + * will be displayed to someone who is not one of the {@link Game}'s {@link Player}s */ public Player getViewPlayer() { return viewPlayer; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IGameResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IGameResource.java index b0c80a5f..ad7bef69 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IGameResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IGameResource.java @@ -16,9 +16,8 @@ import com.justdavis.karl.rpstourney.service.api.game.ai.BuiltInAi; /** - * This service allows users to create, retrieve, and play games. Please note - * that all {@link Game} instances returned by this service should be treated as - * read-only: remote clients wishing to modify game state may only do so through + * This service allows users to create, retrieve, and play games. Please note that all {@link Game} instances returned + * by this service should be treated as read-only: remote clients wishing to modify game state may only do so through * the methods in this interface. */ @Path(IGameResource.SERVICE_PATH) @@ -39,8 +38,7 @@ public interface IGameResource { public static final String SERVICE_PATH_GAMES_FOR_PLAYER = "/"; /** - * The {@link Path} variable for methods that take in {@link Game#getId()} - * as a {@link PathParam}. + * The {@link Path} variable for methods that take in {@link Game#getId()} as a {@link PathParam}. */ public static final String SERVICE_PATH_GAME_ID = "/{gameId}"; @@ -71,10 +69,10 @@ public interface IGameResource { /** *

- * Creates a new game, with the first player set as the user calling this - * method, and leaving the identity of the second player to be set later. + * Creates a new game, with the first player set as the user calling this method, and leaving the identity of the + * second player to be set later. *

- * + * * @return a {@link GameView} of the new {@link Game} instance * @see Game#Game(Player) */ @@ -85,14 +83,12 @@ public interface IGameResource { /** *

- * Returns all games that the the user who calls this method is a - * {@link Player} in. + * Returns all games that the the user who calls this method is a {@link Player} in. *

- * - * @return a {@link List} of {@link GameView}s for the {@link Game}s that - * the the user who calls this method is a {@link Player} in, or an - * empty {@link List} if there are no such {@link Game}s or if the - * user is not authenticated + * + * @return a {@link List} of {@link GameView}s for the {@link Game}s that the the user who calls this method is a + * {@link Player} in, or an empty {@link List} if there are no such {@link Game}s or if the user is not + * authenticated * @see Game#setPlayer2(Player) */ @GET @@ -104,13 +100,12 @@ public interface IGameResource { *

* Returns a {@link GameView} of the specified {@link Game}. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to return * @return a {@link GameView} of the matching {@link Game} instance * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. */ @GET @Path(IGameResource.SERVICE_PATH_GAME_ID) @@ -121,29 +116,25 @@ public interface IGameResource { *

* A web service proxy for the {@link Game#setMaxRounds(int)} method. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to modify * @param oldMaxRoundsValue - * the previous value of {@link Game#getMaxRounds()} (used to - * help prevent synchronization issues) + * the previous value of {@link Game#getMaxRounds()} (used to help prevent synchronization issues) * @param newMaxRoundsValue * the value to use for {@link Game#getMaxRounds()} * @return a {@link GameView} of the modified {@link Game} instance * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. * @throws GameConflictException *

- * An {@link GameConflictException} will be thrown in the - * following cases: + * An {@link GameConflictException} will be thrown in the following cases: *

*
    - *
  • If {@link Game#getState()} is not - * {@link State#WAITING_FOR_PLAYER} or + *
  • If {@link Game#getState()} is not {@link State#WAITING_FOR_PLAYER} or * {@link State#WAITING_FOR_FIRST_THROW}.
  • - *
  • If the oldMaxRoundsValue does not match the - * actual, current value of {@link Game#getMaxRounds()}.
  • + *
  • If the oldMaxRoundsValue does not match the actual, current value of + * {@link Game#getMaxRounds()}.
  • *
* @see Game#setMaxRounds(int) */ @@ -158,25 +149,20 @@ GameView setMaxRounds(@PathParam("gameId") String gameId, @FormParam("oldMaxRoun * Invites the specified {@link Player} to join the specified {@link Game}. *

*

- * Note: Currently, this method may only be used to invite - * {@link BuiltInAi} players to join a game created by the human opponent - * inviting them to it. As this is always allowed, this method will just set - * the {@link Game#getPlayer2()} to the requested {@link Player} before - * returning. Additional uses for this method are expected in the future, - * but not yet supported. + * Note: Currently, this method may only be used to invite {@link BuiltInAi} players to join a game + * created by the human opponent inviting them to it. As this is always allowed, this method will just set the + * {@link Game#getPlayer2()} to the requested {@link Player} before returning. Additional uses for this method are + * expected in the future, but not yet supported. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to modify * @param playerId - * the {@link Player#getId()} value of the {@link Player} to - * invite to join the specified {@link Game} + * the {@link Player#getId()} value of the {@link Player} to invite to join the specified {@link Game} * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. * @throws GameConflictException - * A {@link GameConflictException} will be thrown if - * {@link Game#getState()} is not + * A {@link GameConflictException} will be thrown if {@link Game#getState()} is not * {@link State#WAITING_FOR_PLAYER}. */ @POST @@ -187,19 +173,17 @@ void inviteOpponent(@PathParam("gameId") String gameId, @FormParam("playerId") l /** *

- * Joins the user who calls this method to the specified {@link Game} as - * {@link Game#getPlayer2()}, if that field is still null. + * Joins the user who calls this method to the specified {@link Game} as {@link Game#getPlayer2()}, if that field is + * still null. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to modify * @return a {@link GameView} of the modified {@link Game} instance * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. * @throws GameConflictException - * A {@link GameConflictException} will be thrown if - * {@link Game#getState()} is not + * A {@link GameConflictException} will be thrown if {@link Game#getState()} is not * {@link State#WAITING_FOR_PLAYER}. * @see Game#setPlayer2(Player) */ @@ -210,27 +194,24 @@ void inviteOpponent(@PathParam("gameId") String gameId, @FormParam("playerId") l /** *

- * A web service proxy for several {@link Game} methods, analogous to the - * following code snippet: + * A web service proxy for several {@link Game} methods, analogous to the following code snippet: *

- * + * *
 	 * Game game = ...;
-	 * 
+	 *
 	 * if(!game.isRoundPrepared()) {
 	 *   game.prepareRound();
 	 * }
-	 * 
+	 *
 	 * return game;
 	 * 
- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to modify - * @return a {@link GameView} of the (possibly updated) {@link Game} - * instance + * @return a {@link GameView} of the (possibly updated) {@link Game} instance * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. * @see Game#prepareRound() */ @POST @@ -240,35 +221,29 @@ void inviteOpponent(@PathParam("gameId") String gameId, @FormParam("playerId") l /** *

- * A web service proxy for the {@link Game#submitThrow(int, Player, Throw)} - * method, where the {@link Player} passed to that call is the user who - * makes this web service call. + * A web service proxy for the {@link Game#submitThrow(int, Player, Throw)} method, where the {@link Player} passed + * to that call is the user who makes this web service call. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to modify * @param roundIndex - * the {@link GameRound#getRoundIndex()} of the current round - * (used to verify that gameplay is correctly synchronized) + * the {@link GameRound#getRoundIndex()} of the current round (used to verify that gameplay is correctly + * synchronized) * @param throwToPlay * the {@link Throw} to submit for the {@link Player} * @return a {@link GameView} of the modified {@link Game} instance * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. * @throws GameConflictException *

- * An {@link GameConflictException} will be thrown in the - * following cases: + * An {@link GameConflictException} will be thrown in the following cases: *

*
    - *
  • If {@link Game#getState()} is not {@link State#STARTED}. - *
  • - *
  • If the specified roundIndex is not the same - * as {@link GameRound#getRoundIndex()} in the last/current - * round.
  • - *
  • If the {@link Player} has already submitted a - * {@link Throw} for the {@link GameRound}.
  • + *
  • If {@link Game#getState()} is not {@link State#STARTED}.
  • + *
  • If the specified roundIndex is not the same as {@link GameRound#getRoundIndex()} in + * the last/current round.
  • + *
  • If the {@link Player} has already submitted a {@link Throw} for the {@link GameRound}.
  • *
* @see Game#submitThrow(int, Player, Throw) */ @@ -280,17 +255,16 @@ GameView submitThrow(@PathParam("gameId") String gameId, @FormParam("roundIndex" /** *

- * Deletes the specified {@link Game} from the service/database. This - * operation is restricted to {@link SecurityRole#ADMINS} only. + * Deletes the specified {@link Game} from the service/database. This operation is restricted to + * {@link SecurityRole#ADMINS} only. *

- * + * * @param gameId * the {@link Game#getId()} value of the {@link Game} to delete * @throws NotFoundException - * A {@link NotFoundException} will be thrown if no matching - * {@link Game} can be found. + * A {@link NotFoundException} will be thrown if no matching {@link Game} can be found. */ @DELETE @Path(IGameResource.SERVICE_PATH_GAME_ID) void deleteGame(@PathParam("gameId") String gameId) throws NotFoundException; -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IPlayersResource.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IPlayersResource.java index 16137e87..b20d5ce0 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IPlayersResource.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/IPlayersResource.java @@ -17,8 +17,7 @@ @Path(IPlayersResource.SERVICE_PATH) public interface IPlayersResource { /** - * The {@link Path} that this this resource class' methods will be hosted - * at. + * The {@link Path} that this this resource class' methods will be hosted at. */ public static final String SERVICE_PATH = "/players"; @@ -49,4 +48,4 @@ public interface IPlayersResource { @Path(SERVICE_PATH_BUILT_IN_AIS) @Produces(MediaType.TEXT_XML) Set getPlayersForBuiltInAis(@QueryParam("ais") List ais); -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockGameClient.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockGameClient.java index 183cdf32..2ac74013 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockGameClient.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockGameClient.java @@ -13,10 +13,9 @@ public class MockGameClient implements IGameResource { /** * Constructs a new {@link MockGameClient} instance. - * + * * @param games - * the {@link GameView} instances that will be returned by this - * {@link IGameResource} + * the {@link GameView} instances that will be returned by this {@link IGameResource} */ public MockGameClient(GameView... games) { this.games = games; @@ -24,10 +23,10 @@ public MockGameClient(GameView... games) { /** * Constructs a new {@link MockGameClient} instance. - * + * * @param games - * the {@link Game} instances that will be wrapped in - * {@link GameView}s and returned by this {@link IGameResource} + * the {@link Game} instances that will be wrapped in {@link GameView}s and returned by this + * {@link IGameResource} */ public MockGameClient(Game... games) { this(wrapInGameViews(games)); @@ -36,8 +35,7 @@ public MockGameClient(Game... games) { /** * @param games * the {@link Game}s to wrap - * @return an array of {@link GameView}s wrapping each of the specified - * {@link Game}s + * @return an array of {@link GameView}s wrapping each of the specified {@link Game}s */ private static GameView[] wrapInGameViews(Game[] games) { if (games == null) @@ -83,8 +81,7 @@ public GameView getGame(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, - * int, int) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, int, int) */ @Override public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsValue) { @@ -92,8 +89,7 @@ public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRou } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, - * long) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, long) */ @Override public void inviteOpponent(String gameId, long playerId) throws NotFoundException, GameConflictException { @@ -117,8 +113,8 @@ public GameView prepareRound(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, - * int, com.justdavis.karl.rpstourney.service.api.game.Throw) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, int, + * com.justdavis.karl.rpstourney.service.api.game.Throw) */ @Override public GameView submitThrow(String gameId, int roundIndex, Throw throwToPlay) { @@ -132,4 +128,4 @@ public GameView submitThrow(String gameId, int roundIndex, Throw throwToPlay) { public void deleteGame(String gameId) throws NotFoundException { throw new UnsupportedOperationException(); } -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockPlayersClient.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockPlayersClient.java index 53c50f32..15d2e9a6 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockPlayersClient.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/MockPlayersClient.java @@ -14,10 +14,9 @@ public class MockPlayersClient implements IPlayersResource { /** * Constructs a new {@link MockPlayersClient} instance. - * + * * @param players - * the {@link Player} instances that will be returned by this - * {@link IGameResource} + * the {@link Player} instances that will be returned by this {@link IGameResource} */ public MockPlayersClient(Player... players) { this.players = players; @@ -46,4 +45,4 @@ public Set getPlayersForBuiltInAis(List ais) { return results; } -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Player.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Player.java index c4e06be5..fb77f92d 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Player.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/Player.java @@ -22,12 +22,10 @@ import com.justdavis.karl.rpstourney.service.api.game.ai.BuiltInAi; /** - * Models a player in a {@link Game}. This class allows other code to abstract - * away the difference between human and AI players. While it's not enforced by - * database constraints, whatever logic is used to create {@link Player} - * instances should ensure that no more than one {@link Player} instance exists - * for a given human or AI player; {@link Player} instances should be shared - * between {@link Game}s. + * Models a player in a {@link Game}. This class allows other code to abstract away the difference between human and AI + * players. While it's not enforced by database constraints, whatever logic is used to create {@link Player} instances + * should ensure that no more than one {@link Player} instance exists for a given human or AI player; {@link Player} + * instances should be shared between {@link Game}s. */ @Entity @Table(name = "`Players`") @@ -61,7 +59,7 @@ public class Player { /** * Constructs a new {@link Player} instance to represent a human player. - * + * * @param humanAccount * the value to use for {@link #getHumanAccount()} */ @@ -72,9 +70,8 @@ public Player(Account humanAccount) { } /** - * Constructs a new {@link Player} instance to represent a {@link BuiltInAi} - * computer player. - * + * Constructs a new {@link Player} instance to represent a {@link BuiltInAi} computer player. + * * @param builtInAi * the value to use for {@link #getBuiltInAi()} */ @@ -85,8 +82,7 @@ public Player(BuiltInAi builtInAi) { } /** - * Not intended for use: This constructor is only provided - * to comply with the JAXB and JPA specs. + * Not intended for use: This constructor is only provided to comply with the JAXB and JPA specs. */ @Deprecated Player() { @@ -95,9 +91,8 @@ public Player(BuiltInAi builtInAi) { } /** - * @return true if this {@link Player} has been assigned an ID - * (which it should if it's been persisted), false if - * it has not + * @return true if this {@link Player} has been assigned an ID (which it should if it's been + * persisted), false if it has not */ public boolean hasId() { return id > -1; @@ -105,16 +100,14 @@ public boolean hasId() { /** *

- * Returns the unique integer that identifies and represents this - * {@link Player} instance. + * Returns the unique integer that identifies and represents this {@link Player} instance. *

*

- * This value will be assigned by JPA when the {@link Entity} is persisted. - * Until then, this value should not be accessed. + * This value will be assigned by JPA when the {@link Entity} is persisted. Until then, this value should not be + * accessed. *

- * - * @return the unique integer that identifies and represents this - * {@link Player} instance + * + * @return the unique integer that identifies and represents this {@link Player} instance */ public long getId() { if (!hasId()) @@ -124,8 +117,7 @@ public long getId() { } /** - * @return a user-displayable name for the {@link Player}, or - * null if no such name has been assigned + * @return a user-displayable name for the {@link Player}, or null if no such name has been assigned */ @JsonProperty public String getName() { @@ -133,25 +125,23 @@ public String getName() { } /** - * @return the {@link Account} for the human player, or null if - * this {@link Player} instance represents an AI player + * @return the {@link Account} for the human player, or null if this {@link Player} instance represents + * an AI player */ public Account getHumanAccount() { return humanAccount; } /** - * @return the {@link BuiltInAi} constant for the built-in computer AI - * represented by this {@link Player}, or null if this - * is some other type of player + * @return the {@link BuiltInAi} constant for the built-in computer AI represented by this {@link Player}, or + * null if this is some other type of player */ public BuiltInAi getBuiltInAi() { return builtInAi; } /** - * @return true if {@link #getHumanAccount()} is not - * null, false otherwise + * @return true if {@link #getHumanAccount()} is not null, false otherwise */ public boolean isHuman() { return humanAccount != null; @@ -163,15 +153,13 @@ public boolean isHuman() { @Override public int hashCode() { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to the superclass' implementation - * (mostly for the benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to the + * superclass' implementation (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ final int prime = 31; int result = 1; @@ -188,15 +176,13 @@ public int hashCode() { @Override public boolean equals(Object obj) { /* - * Uses the id field (which has a UNIQUE constraint in the DB) when - * present, otherwise falls back to instance equality (mostly for the - * benefit of unit tests). + * Uses the id field (which has a UNIQUE constraint in the DB) when present, otherwise falls back to instance + * equality (mostly for the benefit of unit tests). */ if (hasId()) { /* - * Generated by Eclipse's - * "Source > Generate hashCode() and equals()..." function. + * Generated by Eclipse's "Source > Generate hashCode() and equals()..." function. */ if (this == obj) return true; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/State.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/State.java index 58016213..35fcc0a2 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/State.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/State.java @@ -3,37 +3,32 @@ import java.util.List; /** - * These values for the {@link Game#getState()} field represent a very simple - * state machine for the state of each game. + * These values for the {@link Game#getState()} field represent a very simple state machine for the state of each game. */ public enum State { /** - * {@link Game}s in this state are waiting for {@link Game#getPlayer2()} to - * be identified. In this {@link State}, the {@link Game#setMaxRounds(int)} - * and {@link Game#setPlayer2(Player)} methods may be used, and + * {@link Game}s in this state are waiting for {@link Game#getPlayer2()} to be identified. In this {@link State}, + * the {@link Game#setMaxRounds(int)} and {@link Game#setPlayer2(Player)} methods may be used, and * {@link Game#getRounds()} will return an empty {@link List}. */ WAITING_FOR_PLAYER, /** - * {@link Game}s in this state are ready to be played, but have not yet had - * a call to {@link Game#submitThrow(int, Player, Throw)} complete yet. In - * this {@link State}, the {@link Game#setMaxRounds(int)} method may be - * used, and {@link Game#getRounds()} will return a {@link List} with just - * the first {@link GameRound} in it. + * {@link Game}s in this state are ready to be played, but have not yet had a call to + * {@link Game#submitThrow(int, Player, Throw)} complete yet. In this {@link State}, the + * {@link Game#setMaxRounds(int)} method may be used, and {@link Game#getRounds()} will return a {@link List} with + * just the first {@link GameRound} in it. */ WAITING_FOR_FIRST_THROW, /** - * {@link Game}s in this state represent games that are in-progress. None of - * the {@link Game} setters may be used, and {@link Game#getRounds()} will - * return a non-null, non-empty {@link List}. + * {@link Game}s in this state represent games that are in-progress. None of the {@link Game} setters may be used, + * and {@link Game#getRounds()} will return a non-null, non-empty {@link List}. */ STARTED, /** - * {@link Game}s in this state represent games that were played and have - * completed. + * {@link Game}s in this state represent games that were played and have completed. */ FINISHED; -} \ No newline at end of file +} diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/BuiltInAi.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/BuiltInAi.java index 33a58cf0..5790dade 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/BuiltInAi.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/BuiltInAi.java @@ -13,44 +13,38 @@ *

*

Modifying This Enum and its AIs

*

- * Entries must never be removed from this enum: doing so would - * break games where these AIs are a player. In addition, statistics can and - * will be calculated for each AI's performance, so significant modifications to - * an existing AI's logic must be avoided. Instead, create a - * new entry for the modified AI, and flag the old entry as retired. + * Entries must never be removed from this enum: doing so would break games where these AIs are a + * player. In addition, statistics can and will be calculated for each AI's performance, so significant modifications to + * an existing AI's logic must be avoided. Instead, create a new entry for the modified AI, and flag + * the old entry as retired. *

*/ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum BuiltInAi { /** - * Represents a {@link ScriptedLoopBrain} {@link IPositronicBrain} - * implementation that always throws {@link Throw#ROCK}. Really only useful - * for testing purposes, so it's marked as retired. + * Represents a {@link ScriptedLoopBrain} {@link IPositronicBrain} implementation that always throws + * {@link Throw#ROCK}. Really only useful for testing purposes, so it's marked as retired. */ ONE_SIDED_DIE_ROCK("oneSidedDieRock", true, new OneSidedDieBrain(Throw.ROCK)), /** - * Represents a {@link ScriptedLoopBrain} {@link IPositronicBrain} - * implementation that always throws {@link Throw#PAPER}. Really only useful - * for testing purposes, so it's marked as retired. + * Represents a {@link ScriptedLoopBrain} {@link IPositronicBrain} implementation that always throws + * {@link Throw#PAPER}. Really only useful for testing purposes, so it's marked as retired. */ ONE_SIDED_DIE_PAPER("oneSidedDiePaper", true, new OneSidedDieBrain(Throw.PAPER)), /** - * Represents the {@link ThreeSidedDieBrain} {@link IPositronicBrain} - * implementation. + * Represents the {@link ThreeSidedDieBrain} {@link IPositronicBrain} implementation. */ THREE_SIDED_DIE_V1("threeSidedDie", false, new ThreeSidedDieBrain()), /** - * Represents the {@link WinStayLoseShiftBrain} {@link IPositronicBrain} - * implementation. + * Represents the {@link WinStayLoseShiftBrain} {@link IPositronicBrain} implementation. */ WIN_STAY_LOSE_SHIFT_V1("winStayLoseShift", false, new WinStayLoseShiftBrain()), /** - * Represents the {@link MetaWinStayLoseShiftBrain} {@link IPositronicBrain} - * implementation. + * Represents the {@link MetaWinStayLoseShiftBrain} {@link IPositronicBrain} implementation. */ META_WIN_STAY_LOSE_SHIFT_V1("metaWinStayLoseShift", false, new MetaWinStayLoseShiftBrain()); @@ -60,7 +54,7 @@ public enum BuiltInAi { /** * Enum constant constructor. - * + * * @param displayNameKey * the value to use for {@link #getDisplayNameKey()} * @param retired @@ -75,26 +69,24 @@ private BuiltInAi(String displayNameKey, boolean retired, IPositronicBrain posit } /** - * @return a display/resource string lookup key (or key suffix) that - * applications can associate with the display name to use for this - * {@link BuiltInAi} + * @return a display/resource string lookup key (or key suffix) that applications can associate with the display + * name to use for this {@link BuiltInAi} */ public String getDisplayNameKey() { return displayNameKey; } /** - * @return if true, indicates that this particular - * {@link BuiltInAi} should no longer be allowed to join new games + * @return if true, indicates that this particular {@link BuiltInAi} should no longer be allowed to + * join new games */ public boolean isRetired() { return retired; } /** - * @return a singleton instance of the {@link IPositronicBrain} - * implementation that is associated with/represented by this - * particular {@link BuiltInAi} + * @return a singleton instance of the {@link IPositronicBrain} implementation that is associated with/represented + * by this particular {@link BuiltInAi} */ @JsonIgnore public IPositronicBrain getPositronicBrain() { @@ -102,8 +94,7 @@ public IPositronicBrain getPositronicBrain() { } /** - * @return a {@link List} of all the {@link BuiltInAi}s where - * {@link BuiltInAi#isRetired()} is false + * @return a {@link List} of all the {@link BuiltInAi}s where {@link BuiltInAi#isRetired()} is false */ public static List active() { List activeAis = new ArrayList<>(); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/IPositronicBrain.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/IPositronicBrain.java index 843fbaf8..cf4db336 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/IPositronicBrain.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/IPositronicBrain.java @@ -6,21 +6,17 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * Implementations of {@link IPositronicBrain} provide the logic used by the - * game's AI players, capable of analyzing game history and deciding which - * {@link Throw} to make next. + * Implementations of {@link IPositronicBrain} provide the logic used by the game's AI players, capable of analyzing + * game history and deciding which {@link Throw} to make next. */ public interface IPositronicBrain { /** * @param game - * A {@link GameView} of the game to calculate a {@link Throw} - * for the current {@link GameRound} of. Implementations may - * assume that this method will only be called when there is a - * valid {@link Throw} to be made (i.e. not before the game has - * started or after it has finished). + * A {@link GameView} of the game to calculate a {@link Throw} for the current {@link GameRound} of. + * Implementations may assume that this method will only be called when there is a valid {@link Throw} to + * be made (i.e. not before the game has started or after it has finished). * @param role - * the {@link PlayerRole} that the {@link Throw} should be - * calculated for + * the {@link PlayerRole} that the {@link Throw} should be calculated for * @return the {@link Throw} chosen by this {@link IPositronicBrain} */ Throw calculateNextThrow(GameView game, PlayerRole role); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrain.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrain.java index ca8d4f03..1da733e1 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrain.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrain.java @@ -6,12 +6,10 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * This {@link IPositronicBrain} is referred to as "the best way to win", per - * the following article: Scientists find a winning strategy for rock-paper-scissors. Note that - * this isn't the "win-stay, lose-shift" strategy that is - * referred to there; it's the strategy designed to beat that one. + * This {@link IPositronicBrain} is referred to as "the best way to win", per the following article: + * Scientists + * find a winning strategy for rock-paper-scissors. Note that this isn't the "win-stay, lose-shift" + * strategy that is referred to there; it's the strategy designed to beat that one. */ public final class MetaWinStayLoseShiftBrain implements IPositronicBrain { /** @@ -27,10 +25,9 @@ public Throw calculateNextThrow(GameView game, PlayerRole role) { return ThreeSidedDieBrain.calculateRandomThrow(); /* - * "... if you lose the first round, switch to the thing that beats the - * thing your opponent just played. If you win, don't keep playing the - * same thing, but instead switch to the thing that would beat the thing - * that you just played." + * "... if you lose the first round, switch to the thing that beats the thing your opponent just played. If you + * win, don't keep playing the same thing, but instead switch to the thing that would beat the thing that you + * just played." */ GameRound previousRound = game.getRounds().get(currentRoundIndex - 1); boolean wonPreviousRound = role.equals(previousRound.getResult().getWinningPlayerRole()); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/OneSidedDieBrain.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/OneSidedDieBrain.java index ceca34c3..08956972 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/OneSidedDieBrain.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/OneSidedDieBrain.java @@ -5,19 +5,17 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * This {@link IPositronicBrain} rolls a "one-sided die" to determine which - * {@link Throw} to make (that's a joke: it always throws the same thing). As - * might be expected, this is really only useful in tests. + * This {@link IPositronicBrain} rolls a "one-sided die" to determine which {@link Throw} to make (that's a joke: it + * always throws the same thing). As might be expected, this is really only useful in tests. */ public final class OneSidedDieBrain implements IPositronicBrain { private final Throw throwToMakeOverAndOverAndOverEtc; /** * Constructs a new {@link OneSidedDieBrain} instance. - * + * * @param throwToMakeOverAndOverAndOverEtc - * the {@link Throw} that will always be returned by - * {@link #calculateNextThrow(GameView, PlayerRole)} + * the {@link Throw} that will always be returned by {@link #calculateNextThrow(GameView, PlayerRole)} */ public OneSidedDieBrain(Throw throwToMakeOverAndOverAndOverEtc) { this.throwToMakeOverAndOverAndOverEtc = throwToMakeOverAndOverAndOverEtc; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/ThreeSidedDieBrain.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/ThreeSidedDieBrain.java index 4f640416..2bf7200f 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/ThreeSidedDieBrain.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/ThreeSidedDieBrain.java @@ -7,9 +7,8 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * This {@link IPositronicBrain} rolls a "three-sided die" to determine which - * {@link Throw} to make. It's just random; history and tactics are completely - * ignored. + * This {@link IPositronicBrain} rolls a "three-sided die" to determine which {@link Throw} to make. It's just random; + * history and tactics are completely ignored. */ public final class ThreeSidedDieBrain implements IPositronicBrain { /** @@ -22,12 +21,10 @@ public Throw calculateNextThrow(GameView game, PlayerRole role) { } /** - * This has been extracted into a static method for the convenience of other - * {@link IPositronicBrain} implementations, as many of them will sometimes - * need to select a random {@link Throw}. - * - * @return a random {@link Throw}, where all possibilities are weighted - * equally + * This has been extracted into a static method for the convenience of other {@link IPositronicBrain} + * implementations, as many of them will sometimes need to select a random {@link Throw}. + * + * @return a random {@link Throw}, where all possibilities are weighted equally */ static Throw calculateRandomThrow() { ThreadLocalRandom rng = ThreadLocalRandom.current(); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrain.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrain.java index bf675b1c..ac35664f 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrain.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrain.java @@ -6,13 +6,11 @@ import com.justdavis.karl.rpstourney.service.api.game.Throw; /** - * This {@link IPositronicBrain} employs a "win-stay, lose-shift" strategy, per - * the following article: Scientists find a winning strategy for rock-paper-scissors. Note that - * this isn't the strategy that is referred to as - * "the best way to win"; it's the strategy that other, best way is designed to - * beat. Instead, this strategy is analogous to how most humans play. + * This {@link IPositronicBrain} employs a "win-stay, lose-shift" strategy, per the following article: + * Scientists + * find a winning strategy for rock-paper-scissors. Note that this isn't the strategy that is + * referred to as "the best way to win"; it's the strategy that other, best way is designed to beat. Instead, this + * strategy is analogous to how most humans play. */ public final class WinStayLoseShiftBrain implements IPositronicBrain { /** @@ -26,9 +24,8 @@ public Throw calculateNextThrow(GameView game, PlayerRole role) { } /** - * This has been extracted into a static method for the convenience of other - * {@link IPositronicBrain} implementations, as some of them will want to - * "borrow" this strategy. As an added convenience, it also lets users + * This has been extracted into a static method for the convenience of other {@link IPositronicBrain} + * implementations, as some of them will want to "borrow" this strategy. As an added convenience, it also lets users * specify which round to calculate a Throw for. * * @param game @@ -36,9 +33,8 @@ public Throw calculateNextThrow(GameView game, PlayerRole role) { * @param role * (see {@link #calculateNextThrow(GameView, PlayerRole)}) * @param roundIndex - * the {@link GameRound#getRoundIndex()} of the {@link GameRound} - * to calculate a Throw for (must be less than or equal to the - * actual current round in the specified {@link GameView}) + * the {@link GameRound#getRoundIndex()} of the {@link GameRound} to calculate a Throw for (must be less + * than or equal to the actual current round in the specified {@link GameView}) * @return the {@link Throw} to make */ static Throw calculateThrowForRound(GameView game, PlayerRole role, int roundIndex) { @@ -47,8 +43,7 @@ static Throw calculateThrowForRound(GameView game, PlayerRole role, int roundInd return ThreeSidedDieBrain.calculateRandomThrow(); /* - * The strategy for other rounds is dependent on whether or not the last - * round's Throw won. + * The strategy for other rounds is dependent on whether or not the last round's Throw won. */ GameRound previousRound = game.getRounds().get(roundIndex - 1); boolean wonPreviousRound = role.equals(previousRound.getResult().getWinningPlayerRole()); diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/package-info.java index c37974f9..0aabf4b0 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/ai/package-info.java @@ -1,5 +1,4 @@ /** - * Contains the base interfaces, types, etc. required for the game's support of - * AI players. + * Contains the base interfaces, types, etc. required for the game's support of AI players. */ -package com.justdavis.karl.rpstourney.service.api.game.ai; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.api.game.ai; diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/package-info.java index 2ae2b50d..9c30710d 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/package-info.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/game/package-info.java @@ -1,6 +1,6 @@ /** - * Contains the JPA {@link javax.persistence.Entity} classes and JAX-RS - * resources/services involved in actually playing the game. + * Contains the JPA {@link javax.persistence.Entity} classes and JAX-RS resources/services involved in actually playing + * the game. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/InternetAddressUserType.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/InternetAddressUserType.java index 6d2fcd47..06f1fb8a 100644 --- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/InternetAddressUserType.java +++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/InternetAddressUserType.java @@ -19,11 +19,10 @@ /** *

- * A Hibernate {@link UserType} for persisting {@link InternetAddress} fields. - * Any JPA field that's an {@link InternetAddress} will have to add a Hibernate - * {@link Type} annotation referencing this class, e.g.: + * A Hibernate {@link UserType} for persisting {@link InternetAddress} fields. Any JPA field that's an + * {@link InternetAddress} will have to add a Hibernate {@link Type} annotation referencing this class, e.g.: *

- * + * *
  * @Entity
  * public class SomeEntity {
@@ -35,8 +34,8 @@
  */
 public class InternetAddressUserType implements UserType {
 	/**
-	 * The same as {@code InternetAddressUserType.class.getName()}, but a
-	 * constant expression that can be referenced in annotations.
+	 * The same as {@code InternetAddressUserType.class.getName()}, but a constant expression that can be referenced in
+	 * annotations.
 	 */
 	public static final String TYPE_NAME = "com.justdavis.karl.rpstourney.service.api.hibernate.InternetAddressUserType";
 
@@ -57,8 +56,7 @@ public Class returnedClass() {
 	}
 
 	/**
-	 * @see org.hibernate.usertype.UserType#equals(java.lang.Object,
-	 *      java.lang.Object)
+	 * @see org.hibernate.usertype.UserType#equals(java.lang.Object, java.lang.Object)
 	 */
 	@Override
 	public boolean equals(Object x, Object y) throws HibernateException {
@@ -72,12 +70,10 @@ public boolean equals(Object x, Object y) throws HibernateException {
 	public int hashCode(Object x) throws HibernateException {
 		return x.hashCode();
 	}
-	
+
 	/**
-	 * @see org.hibernate.usertype.UserType#nullSafeGet(java.sql.ResultSet,
-	 *      java.lang.String[],
-	 *      org.hibernate.engine.spi.SharedSessionContractImplementor,
-	 *      java.lang.Object)
+	 * @see org.hibernate.usertype.UserType#nullSafeGet(java.sql.ResultSet, java.lang.String[],
+	 *      org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
 	 */
 	@Override
 	public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
@@ -95,9 +91,10 @@ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImp
 		else
 			return null;
 	}
-	
+
 	/**
-	 * @see org.hibernate.usertype.UserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int, org.hibernate.engine.spi.SharedSessionContractImplementor)
+	 * @see org.hibernate.usertype.UserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int,
+	 *      org.hibernate.engine.spi.SharedSessionContractImplementor)
 	 */
 	@Override
 	public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
@@ -150,8 +147,7 @@ public Serializable disassemble(Object value) throws HibernateException {
 	}
 
 	/**
-	 * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable,
-	 *      java.lang.Object)
+	 * @see org.hibernate.usertype.UserType#assemble(java.io.Serializable, java.lang.Object)
 	 */
 	@Override
 	public Object assemble(Serializable cached, Object owner) throws HibernateException {
@@ -169,8 +165,7 @@ public Object assemble(Serializable cached, Object owner) throws HibernateExcept
 	}
 
 	/**
-	 * @see org.hibernate.usertype.UserType#replace(java.lang.Object,
-	 *      java.lang.Object, java.lang.Object)
+	 * @see org.hibernate.usertype.UserType#replace(java.lang.Object, java.lang.Object, java.lang.Object)
 	 */
 	@Override
 	public Object replace(Object original, Object target, Object owner) throws HibernateException {
diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/package-info.java
index 6f7b0e96..857789f2 100644
--- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/package-info.java
+++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/hibernate/package-info.java
@@ -1,5 +1,4 @@
 /**
- * Contains classes required to enable the usage of Hibernate/JPA in the
- * webservice.
+ * Contains classes required to enable the usage of Hibernate/JPA in the webservice.
  */
-package com.justdavis.karl.rpstourney.service.api.hibernate;
\ No newline at end of file
+package com.justdavis.karl.rpstourney.service.api.hibernate;
diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/InstantJaxbAdapter.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/InstantJaxbAdapter.java
index f8ac6981..8dc993f3 100644
--- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/InstantJaxbAdapter.java
+++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/InstantJaxbAdapter.java
@@ -5,10 +5,8 @@
 
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 
-
 /**
- * This JAXB {@link XmlAdapter} marshalls/unmarshalls {@link Instant}s as
- * {@link String}s.
+ * This JAXB {@link XmlAdapter} marshalls/unmarshalls {@link Instant}s as {@link String}s.
  */
 public final class InstantJaxbAdapter extends XmlAdapter {
 	/**
@@ -32,4 +30,4 @@ public String marshal(Instant v) throws Exception {
 
 		return DateTimeFormatter.ISO_INSTANT.format(v);
 	}
-}
\ No newline at end of file
+}
diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/package-info.java
index a77e448f..6dbbb93e 100644
--- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/package-info.java
+++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/jaxb/package-info.java
@@ -1,4 +1,4 @@
 /**
  * Contains utility classes related to JAXB.
  */
-package com.justdavis.karl.rpstourney.service.api.jaxb;
\ No newline at end of file
+package com.justdavis.karl.rpstourney.service.api.jaxb;
diff --git a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/package-info.java b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/package-info.java
index d61021ba..024bd80f 100644
--- a/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/package-info.java
+++ b/rps-tourney-service-api/src/main/java/com/justdavis/karl/rpstourney/service/api/package-info.java
@@ -1,6 +1,5 @@
 /**
- * The base package for the application's webservice API project. Contains the
- * model classes and interfaces that define (but not implement) the web
- * service's functionality.
+ * The base package for the application's webservice API project. Contains the model classes and interfaces that define
+ * (but not implement) the web service's functionality.
  */
-package com.justdavis.karl.rpstourney.service.api;
\ No newline at end of file
+package com.justdavis.karl.rpstourney.service.api;
diff --git a/rps-tourney-service-api/src/main/resources/META-INF/persistence.xml b/rps-tourney-service-api/src/main/resources/META-INF/persistence.xml
index 9b2248d2..8e7cfe4d 100644
--- a/rps-tourney-service-api/src/main/resources/META-INF/persistence.xml
+++ b/rps-tourney-service-api/src/main/resources/META-INF/persistence.xml
@@ -1,14 +1,13 @@
-
 
 	
 		org.hibernate.jpa.HibernatePersistenceProvider
 		
 			
-			
+			
 		
 	
-
\ No newline at end of file
+
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AccountTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AccountTest.java
index f14cb433..6cc04bb7 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AccountTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AccountTest.java
@@ -36,8 +36,7 @@
  */
 public final class AccountTest {
 	/**
-	 * Ensures that {@link Account#getAuthToken(java.util.UUID)} works as
-	 * expected.
+	 * Ensures that {@link Account#getAuthToken(java.util.UUID)} works as expected.
 	 */
 	@Test
 	public void getAuthTokenForUuid() {
@@ -81,7 +80,7 @@ public void isValidToken() {
 
 	/**
 	 * Ensures that {@link Account} instances can be marshalled.
-	 * 
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -142,7 +141,7 @@ public void jaxbMarshalling() throws JAXBException, XPathExpressionException, Ad
 
 	/**
 	 * Ensures that {@link Account} instances can be unmarshalled.
-	 * 
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -171,7 +170,7 @@ public void jaxbUnmarshalling() throws JAXBException, XPathExpressionException {
 
 	/**
 	 * Tests {@link Account#equals(Object)} and {@link Account#hashCode()}.
-	 * 
+	 *
 	 * @throws SecurityException
 	 *             (won't happen)
 	 * @throws NoSuchFieldException
@@ -194,10 +193,9 @@ public void equalsAndHashCode()
 		Assert.assertNotEquals(accountA, accountB);
 
 		/*
-		 * The logic for Account.equals(...) is different for persisted vs.
-		 * non-persisted objects, and we want to cover that logic with this
-		 * test. To avoid having to involve the DB here (and actually persist
-		 * things), we'll cheat and set the fields' values via reflection.
+		 * The logic for Account.equals(...) is different for persisted vs. non-persisted objects, and we want to cover
+		 * that logic with this test. To avoid having to involve the DB here (and actually persist things), we'll cheat
+		 * and set the fields' values via reflection.
 		 */
 		Field accountIdField = Account.class.getDeclaredField("id");
 		accountIdField.setAccessible(true);
@@ -216,9 +214,8 @@ public void equalsAndHashCode()
 	}
 
 	/**
-	 * Verifies that {@link Account}s can be properly serialized and
-	 * deserialized.
-	 * 
+	 * Verifies that {@link Account}s can be properly serialized and deserialized.
+	 *
 	 * @throws IOException
 	 *             Might be thrown if serialization or deserialization fails.
 	 * @throws ClassNotFoundException
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMergeTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMergeTest.java
index 21e4df7e..a4d65dbe 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMergeTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuditAccountMergeTest.java
@@ -10,13 +10,12 @@
 import org.junit.Test;
 
 /**
- * Unit tests for {@link AuditAccountMerge} and {@link AuditAccountGameMerge}
- * (they're always used together).
+ * Unit tests for {@link AuditAccountMerge} and {@link AuditAccountGameMerge} (they're always used together).
  */
 public final class AuditAccountMergeTest {
 	/**
 	 * Tests {@link Account#equals(Object)} and {@link Account#hashCode()}.
-	 * 
+	 *
 	 * @throws SecurityException
 	 *             (won't happen)
 	 * @throws NoSuchFieldException
@@ -47,11 +46,9 @@ public void equalsAndHashCode() throws IllegalArgumentException, IllegalAccessEx
 		Assert.assertNotEquals(auditEntryA, auditEntryB);
 
 		/*
-		 * The logic for AuditAccountMerge.equals(...) is different for
-		 * persisted vs. non-persisted objects, and we want to cover that logic
-		 * with this test. To avoid having to involve the DB here (and actually
-		 * persist things), we'll cheat and set the fields' values via
-		 * reflection.
+		 * The logic for AuditAccountMerge.equals(...) is different for persisted vs. non-persisted objects, and we want
+		 * to cover that logic with this test. To avoid having to involve the DB here (and actually persist things),
+		 * we'll cheat and set the fields' values via reflection.
 		 */
 		Field auditIdField = AuditAccountMerge.class.getDeclaredField("id");
 		auditIdField.setAccessible(true);
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenTest.java
index 8eaff87d..20ab1318 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/AuthTokenTest.java
@@ -28,7 +28,7 @@
 public final class AuthTokenTest {
 	/**
 	 * Ensures that {@link AuthToken} instances can be marshalled.
-	 * 
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -71,7 +71,7 @@ public void jaxbMarshalling() throws JAXBException, XPathExpressionException {
 
 	/**
 	 * Ensures that {@link AuthToken} instances can be unmarshalled.
-	 * 
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentityTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentityTest.java
index bbdc2f60..0193d243 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentityTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/game/GameLoginIdentityTest.java
@@ -14,15 +14,15 @@
 public final class GameLoginIdentityTest {
 	/**
 	 * Tests normal usage of {@link GameLoginIdentity}.
-	 * 
+	 *
 	 * @throws AddressException
 	 *             (should not occur if test is successful)
 	 */
 	@Test
 	public void simpleUsage() throws AddressException {
 		/*
-		 * This is a silly & pointless test. It's really just a placeholder for
-		 * now. Once persistence has been added, it'll be worth testing that.
+		 * This is a silly & pointless test. It's really just a placeholder for now. Once persistence has been added,
+		 * it'll be worth testing that.
 		 */
 
 		Account account = new Account();
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentityTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentityTest.java
index a1567a7c..640c3f11 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentityTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/auth/guest/GuestLoginIdentityTest.java
@@ -15,8 +15,8 @@ public final class GuestLoginIdentityTest {
 	@Test
 	public void simpleUsage() {
 		/*
-		 * This is a silly & pointless test. It's really just a placeholder for
-		 * now. Once persistence has been added, it'll be worth testing that.
+		 * This is a silly & pointless test. It's really just a placeholder for now. Once persistence has been added,
+		 * it'll be worth testing that.
 		 */
 
 		Account account = new Account();
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameTest.java
index 8047b1ac..0e49aafe 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameTest.java
@@ -10,14 +10,12 @@
 import com.justdavis.karl.rpstourney.service.api.game.GameRound.Result;
 
 /**
- * Unit tests for {@link Game}. The JAXB tests here also cover {@link Player}
- * and {@link GameRound}.
+ * Unit tests for {@link Game}. The JAXB tests here also cover {@link Player} and {@link GameRound}.
  */
 public final class GameTest {
 	/**
-	 * Ensures that {@link Game} instances' state transitions correctly at the
-	 * start of a game.
-	 * 
+	 * Ensures that {@link Game} instances' state transitions correctly at the start of a game.
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -56,9 +54,8 @@ public void gameStartStateTransitions() throws JAXBException, XPathExpressionExc
 	}
 
 	/**
-	 * Ensures that {@link Game} instances' state transitions correctly as
-	 * rounds are completed.
-	 * 
+	 * Ensures that {@link Game} instances' state transitions correctly as rounds are completed.
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -211,9 +208,8 @@ public void multipleRoundsWithTie() {
 	}
 
 	/**
-	 * Tests a game where a player wins "early" (in less than the maximum amount
-	 * of rounds). The game should end as soon as it becomes impossible for the
-	 * other player to win, regardless of the number of rounds left.
+	 * Tests a game where a player wins "early" (in less than the maximum amount of rounds). The game should end as soon
+	 * as it becomes impossible for the other player to win, regardless of the number of rounds left.
 	 */
 	@Test
 	public void earlyWinner() {
@@ -246,8 +242,7 @@ public void earlyWinner() {
 	}
 
 	/**
-	 * Tests that {@link Game#setMaxRounds(int)} throws a
-	 * {@link GameConflictException} when it should.
+	 * Tests that {@link Game#setMaxRounds(int)} throws a {@link GameConflictException} when it should.
 	 */
 	@Test(expected = GameConflictException.class)
 	public void setMaxRounds_conflicts() {
@@ -262,8 +257,8 @@ public void setMaxRounds_conflicts() {
 	}
 
 	/**
-	 * Tests that {@link Game#submitThrow(int, Player, Throw)} throws a
-	 * {@link GameConflictException} when the wrong round is specified.
+	 * Tests that {@link Game#submitThrow(int, Player, Throw)} throws a {@link GameConflictException} when the wrong
+	 * round is specified.
 	 */
 	@Test(expected = GameConflictException.class)
 	public void submitThrow_conflictingRound() {
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameViewTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameViewTest.java
index 26d5a37d..d8f25845 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameViewTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/GameViewTest.java
@@ -27,9 +27,9 @@
  */
 public final class GameViewTest {
 	/**
-	 * Ensures that {@link GameView} instances can be marshalled when
-	 * {@link GameView#getState()} is {@link State#WAITING_FOR_PLAYER}.
-	 * 
+	 * Ensures that {@link GameView} instances can be marshalled when {@link GameView#getState()} is
+	 * {@link State#WAITING_FOR_PLAYER}.
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -77,9 +77,9 @@ public void jaxbMarshallingWaiting() throws JAXBException, XPathExpressionExcept
 	}
 
 	/**
-	 * Ensures that {@link GameView} instances can be marshalled when
-	 * {@link GameView#getState()} is {@link State#STARTED}.
-	 * 
+	 * Ensures that {@link GameView} instances can be marshalled when {@link GameView#getState()} is
+	 * {@link State#STARTED}.
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -135,7 +135,7 @@ public void jaxbMarshallingStarted() throws JAXBException, XPathExpressionExcept
 
 	/**
 	 * Ensures that {@link GameView} instances can be unmarshalled.
-	 * 
+	 *
 	 * @throws JAXBException
 	 *             (shouldn't be thrown if things are working)
 	 * @throws XPathExpressionException
@@ -196,8 +196,7 @@ public void roundFiltering() {
 		Assert.assertNull(gameViewForNullPlayer.getRounds().get(0).getThrowForPlayer1());
 
 		/*
-		 * Move to the next round, have Player 2 go first, and verify that the
-		 * rounds are filtered as expected.
+		 * Move to the next round, have Player 2 go first, and verify that the rounds are filtered as expected.
 		 */
 		game.submitThrow(0, player2, Throw.PAPER);
 		game.submitThrow(1, player2, Throw.SCISSORS);
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/PlayerTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/PlayerTest.java
index 5b45e683..407e97af 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/PlayerTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/PlayerTest.java
@@ -17,7 +17,7 @@
 public final class PlayerTest {
 	/**
 	 * Tests {@link Player#equals(Object)} and {@link Player#hashCode()}.
-	 * 
+	 *
 	 * @throws SecurityException
 	 *             (won't happen)
 	 * @throws NoSuchFieldException
@@ -42,10 +42,9 @@ public void equalsAndHashCode()
 		Assert.assertNotEquals(playerA, playerB);
 
 		/*
-		 * The logic for Player.equals(...) is different for persisted vs.
-		 * non-persisted objects, and we want to cover that logic with this
-		 * test. To avoid having to involve the DB here (and actually persist
-		 * things), we'll cheat and set the fields' values via reflection.
+		 * The logic for Player.equals(...) is different for persisted vs. non-persisted objects, and we want to cover
+		 * that logic with this test. To avoid having to involve the DB here (and actually persist things), we'll cheat
+		 * and set the fields' values via reflection.
 		 */
 		Field accountIdField = Account.class.getDeclaredField("id");
 		accountIdField.setAccessible(true);
@@ -71,7 +70,7 @@ public void equalsAndHashCode()
 
 	/**
 	 * Verifies that instances serialize correctly with Jackson.
-	 * 
+	 *
 	 * @throws JsonProcessingException
 	 *             (indicates a test failure)
 	 * @throws SecurityException
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrainTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrainTest.java
index a2e14a2f..d1d385f0 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrainTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/MetaWinStayLoseShiftBrainTest.java
@@ -28,8 +28,7 @@ public void normalUsage() {
 		game.submitThrow(0, game.getPlayer2(), Throw.PAPER);
 
 		/*
-		 * The AI didn't win that round, so it should throw the opposite of the
-		 * other player's move from it.
+		 * The AI didn't win that round, so it should throw the opposite of the other player's move from it.
 		 */
 		game.submitThrow(1, game.getPlayer1(), Throw.PAPER);
 		Throw aiThrowSecond = ai.calculateNextThrow(new GameView(game, game.getPlayer2()), PlayerRole.PLAYER_2);
@@ -37,8 +36,7 @@ public void normalUsage() {
 		game.submitThrow(1, game.getPlayer2(), aiThrowSecond);
 
 		/*
-		 * The AI did win that round, so it should throw the thing that would
-		 * beat the one it just played.
+		 * The AI did win that round, so it should throw the thing that would beat the one it just played.
 		 */
 		Throw aiThrowThird = ai.calculateNextThrow(new GameView(game, game.getPlayer2()), PlayerRole.PLAYER_2);
 		Assert.assertEquals(Throw.ROCK, aiThrowThird);
diff --git a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrainTest.java b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrainTest.java
index 34748d3c..af78cf9e 100644
--- a/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrainTest.java
+++ b/rps-tourney-service-api/src/test/java/com/justdavis/karl/rpstourney/service/api/game/ai/WinStayLoseShiftBrainTest.java
@@ -28,8 +28,7 @@ public void normalUsage() {
 		game.submitThrow(0, game.getPlayer2(), Throw.ROCK);
 
 		/*
-		 * The AI didn't win that round, so it should make the "opposite" Throw
-		 * this round.
+		 * The AI didn't win that round, so it should make the "opposite" Throw this round.
 		 */
 		game.submitThrow(1, game.getPlayer1(), Throw.ROCK);
 		Throw aiThrowSecond = ai.calculateNextThrow(new GameView(game, game.getPlayer2()), PlayerRole.PLAYER_2);
@@ -37,8 +36,7 @@ public void normalUsage() {
 		game.submitThrow(1, game.getPlayer2(), aiThrowSecond);
 
 		/*
-		 * The AI did win that round, so it should make the same Throw this
-		 * round.
+		 * The AI did win that round, so it should make the same Throw this round.
 		 */
 		Throw aiThrowThird = ai.calculateNextThrow(new GameView(game, game.getPlayer2()), PlayerRole.PLAYER_2);
 		Assert.assertEquals(Throw.PAPER, aiThrowThird);
diff --git a/rps-tourney-service-api/src/test/resources/sample-xml/account-1.xml b/rps-tourney-service-api/src/test/resources/sample-xml/account-1.xml
index a6faf5b7..bcffa94b 100644
--- a/rps-tourney-service-api/src/test/resources/sample-xml/account-1.xml
+++ b/rps-tourney-service-api/src/test/resources/sample-xml/account-1.xml
@@ -7,13 +7,11 @@
 		USERS
 	
 	
-		
+		
 			3
 			2007-12-03T10:15:30Z
 		
-		
+		
 			3
 			2007-12-03T10:15:30Z
 			foo@example.com
diff --git a/rps-tourney-service-app/pom.xml b/rps-tourney-service-app/pom.xml
index 4c019ba4..2a322d20 100644
--- a/rps-tourney-service-app/pom.xml
+++ b/rps-tourney-service-app/pom.xml
@@ -12,10 +12,14 @@
 	war
 
 	rps-tourney-service-app
-	
-		The server-side implementation of the web service layer of the 
-		"Rock-Paper-Scissors Tourney" game, which allow for play over the Internet.
-	
+	The server-side implementation of the web service layer of the
+		"Rock-Paper-Scissors Tourney" game, which allow for play over the Internet.
+
+	
+		
+		${project.basedir}/../dev
+	
 
 	
 		
@@ -24,14 +28,14 @@
 		
 
 		
-			
 			org.apache.cxf
 			cxf-rt-frontend-jaxrs
 			${cxf.version}
 		
 		
-			
 			javax.servlet
 			javax.servlet-api
@@ -50,21 +54,21 @@
 			spring-web
 			
 				
-					
 					commons-logging
-					commons-logging
 				
 			
 		
 		
-			
 			org.slf4j
 			jcl-over-slf4j
 		
 		
-			
 			org.springframework.data
 			spring-data-jpa
@@ -72,16 +76,16 @@
 		
 
 		
-			
 			org.hibernate
 			hibernate-entitymanager
 			${hibernate.version}
 			
 				
+					xml-apis
 					
 					xml-apis
-					xml-apis
 				
 			
 		
@@ -94,36 +98,36 @@
 			${hibernate.version}
 		
 		
-			
 			org.postgresql
 			postgresql
 		
 		
-			
-			
 			org.hsqldb
 			hsqldb
 		
 
 		
-			
 			org.hibernate.validator
 			hibernate-validator
 			6.0.7.Final
 		
 		
-			
 			javax.el
 			javax.el-api
 			3.0.0
 		
 		
-			
 			org.glassfish
 			javax.el
@@ -137,28 +141,28 @@
 		
 
 		
-			
 			ch.qos.logback
 			logback-classic
 		
 		
-			
-			
 			org.slf4j
 			jul-to-slf4j
 		
 		
-			
 			org.slf4j
 			log4j-over-slf4j
 		
 
 		
-			
 			com.lambdaworks
 			scrypt
@@ -172,9 +176,9 @@
 			test
 		
 		
-			
 			com.justdavis.karl.rpstourney
 			rps-tourney-service-client
@@ -216,14 +220,14 @@
 					org.apache.maven.plugins
 					maven-failsafe-plugin
 					
-						
 						false
 
-						
 						false
 					
@@ -236,10 +240,10 @@
 				jacoco-maven-plugin
 				
 					
-						
 						default-prepare-agent
 						
@@ -247,10 +251,10 @@
 						
 					
 					
-						
 						default-prepare-agent-integration
 						
@@ -260,7 +264,7 @@
 				
 			
 			
-				
 				org.apache.maven.plugins
 				maven-failsafe-plugin
diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ConfigLoaderBindingForProduction.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ConfigLoaderBindingForProduction.java
index 10839e66..f6b08894 100644
--- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ConfigLoaderBindingForProduction.java
+++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ConfigLoaderBindingForProduction.java
@@ -9,16 +9,14 @@
 import com.justdavis.karl.rpstourney.service.app.config.XmlConfigLoader;
 
 /**
- * The Spring {@link Configuration} for the {@link IConfigLoader} to use in
- * {@link SpringProfile#PRODUCTION}.
+ * The Spring {@link Configuration} for the {@link IConfigLoader} to use in {@link SpringProfile#PRODUCTION}.
  */
 @Configuration
 @Profile(value = SpringProfile.PRODUCTION)
 public class ConfigLoaderBindingForProduction {
 	/**
 	 * @param dsConnectorsManager
-	 *            the injected {@link DataSourceConnectorsManager} for the
-	 *            application
+	 *            the injected {@link DataSourceConnectorsManager} for the application
 	 * @return the {@link IConfigLoader} implementation for the application
 	 */
 	@Bean
diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/CxfBeanValidationInInterceptor.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/CxfBeanValidationInInterceptor.java
index 948dd635..45c504d2 100644
--- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/CxfBeanValidationInInterceptor.java
+++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/CxfBeanValidationInInterceptor.java
@@ -8,24 +8,21 @@
 
 /**
  * 

- * This is a replacement for CXF's builtin - * {@link JAXRSBeanValidationInInterceptor}. This customization supports - * validation of messages handled by non-singleton JAX-RS resource beans. This - * is needed as many of the beans in this project are request-scoped. + * This is a replacement for CXF's builtin {@link JAXRSBeanValidationInInterceptor}. This customization supports + * validation of messages handled by non-singleton JAX-RS resource beans. This is needed as many of the beans in this + * project are request-scoped. *

*

- * Warning: I'm not sure that this is entirely safe. I've - * posted the following Stack Overflow question asking about that: Warning: I'm not sure that this is entirely safe. I've posted the following Stack Overflow question + * asking about that: Is it safe to override Apache CXF's JAXRSBeanValidationInInterceptor to - * support request-scoped resources?. + * >Is it safe to override Apache CXF's JAXRSBeanValidationInInterceptor to support request-scoped resources?. *

*/ public class CxfBeanValidationInInterceptor extends JAXRSBeanValidationInInterceptor { /** - * This is a customization of the code in CXF's builtin - * {@link ValidationUtils#getResourceInstance(Message)}. - * + * This is a customization of the code in CXF's builtin {@link ValidationUtils#getResourceInstance(Message)}. + * * @see org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor#getServiceObject(org.apache.cxf.message.Message) */ @Override diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/GameServiceApplicationInitializer.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/GameServiceApplicationInitializer.java index 1ed82d21..add188b1 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/GameServiceApplicationInitializer.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/GameServiceApplicationInitializer.java @@ -18,29 +18,25 @@ * Initializes the JAX-RS game web service application via Spring. *

*

- * If deployed in a Servlet 3.0 container, this application will be found and - * loaded automagically, as this project includes Spring's - * {@link SpringServletContainerInitializer} in its dependencies. That class is - * a registered {@link ServletContainerInitializer} SPI and will in turn search - * for and enable any {@link WebApplicationInitializer} implementations (such as - * this class). + * If deployed in a Servlet 3.0 container, this application will be found and loaded automagically, as this project + * includes Spring's {@link SpringServletContainerInitializer} in its dependencies. That class is a registered + * {@link ServletContainerInitializer} SPI and will in turn search for and enable any {@link WebApplicationInitializer} + * implementations (such as this class). *

*

- * By default, this will create a new standalone Spring - * {@link ApplicationContext}. If, however, this will be running inside of a - * parent Spring {@link ApplicationContext} (as is the case with some of this - * project's integration tests), that parent context should be provided via the - * {@link #SPRING_PARENT_CONTEXT} mechanism. + * By default, this will create a new standalone Spring {@link ApplicationContext}. If, however, this will be running + * inside of a parent Spring {@link ApplicationContext} (as is the case with some of this project's integration tests), + * that parent context should be provided via the {@link #SPRING_PARENT_CONTEXT} mechanism. *

- * + * * @see SpringBindingsForWebServices */ public final class GameServiceApplicationInitializer implements WebApplicationInitializer { /** - * The web application context-wide initialization parameter that specifies - * the Spring parent {@link ApplicationContext} instance that should used - * (if any). This is mostly intended for use by integration tests. - * + * The web application context-wide initialization parameter that specifies the Spring parent + * {@link ApplicationContext} instance that should used (if any). This is mostly intended for use by integration + * tests. + * * @see ServletContext#setAttribute(String, Object) */ public static final String SPRING_PARENT_CONTEXT = "spring.context.parent"; @@ -54,12 +50,10 @@ public void onStartup(ServletContext container) { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); /* - * If a parent Spring ApplicationContext is available, we'll use its - * configuration. If one is not available, we'll configure things - * ourselves. It's expected that any integration tests that use Jetty as - * the web application container will provide a parent - * ApplicationContext. (See com.justdavis.karl.rpstourney.service.app. - * SpringBindingsForWebServiceITs for more details.) + * If a parent Spring ApplicationContext is available, we'll use its configuration. If one is not available, + * we'll configure things ourselves. It's expected that any integration tests that use Jetty as the web + * application container will provide a parent ApplicationContext. (See + * com.justdavis.karl.rpstourney.service.app. SpringBindingsForWebServiceITs for more details.) */ ApplicationContext springParentContext = findSpringParentContext(container); if (springParentContext != null) { @@ -91,16 +85,13 @@ public void onStartup(ServletContext container) { } /** - * Allow the web application context's attributes to provide a parent - * {@link ApplicationContext} for Spring. This is intended for use in - * integration tests, where the container (i.e. Jetty) will be created in - * the parent context and the JAX-RS application will be created in its own - * child context. - * + * Allow the web application context's attributes to provide a parent {@link ApplicationContext} for Spring. This is + * intended for use in integration tests, where the container (i.e. Jetty) will be created in the parent context and + * the JAX-RS application will be created in its own child context. + * * @param container * the {@link ServletContext} being configured - * @return the parent {@link ApplicationContext} for Spring, or - * null if none was found + * @return the parent {@link ApplicationContext} for Spring, or null if none was found */ private static ApplicationContext findSpringParentContext(ServletContext container) { ApplicationContext springParentContext = (ApplicationContext) container.getAttribute(SPRING_PARENT_CONTEXT); @@ -109,4 +100,4 @@ private static ApplicationContext findSpringParentContext(ServletContext contain return springParentContext; } -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForInbound.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForInbound.java index 40d9cffe..e21e01cd 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForInbound.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForInbound.java @@ -9,20 +9,18 @@ import com.justdavis.karl.rpstourney.service.api.auth.game.IGameAuthResource; /** - * A custom {@link LoggingInInterceptor} subclass that doesn't add linebreaks to - * the log output and attempts to prevent passwords from ending up in the log. + * A custom {@link LoggingInInterceptor} subclass that doesn't add linebreaks to the log output and attempts to prevent + * passwords from ending up in the log. */ public final class LoggerForInbound extends LoggingInInterceptor { /** - * The number of bytes of each message to log out, before truncating the - * rest. + * The number of bytes of each message to log out, before truncating the rest. */ static final int MESSAGE_BYTES_TRUNCATION_LIMIT = 1000; /** * Should match password strings in {@link LoggingMessage#getPayload()} from - * {@link IGameAuthResource#createGameLogin(javax.mail.internet.InternetAddress, String)} - * requests/responses. + * {@link IGameAuthResource#createGameLogin(javax.mail.internet.InternetAddress, String)} requests/responses. */ static final Pattern GAME_ACCOUNT_PASSWORD_REGEX = Pattern.compile("password=[^&]*"); @@ -40,8 +38,7 @@ public LoggerForInbound() { loggingMessageIdField.setAccessible(true); /* - * Thread safety: this might get set multiple times, but that's - * not actually a problem. + * Thread safety: this might get set multiple times, but that's not actually a problem. */ LoggerForInbound.loggingMessageIdField = loggingMessageIdField; } catch (NoSuchFieldException e) { @@ -82,10 +79,8 @@ protected String formatLoggingMessage(LoggingMessage loggingMessage) { /** * @param loggingMessage - * the {@link LoggingMessage} to get the id field's - * value for - * @return the value of the specified {@link LoggingMessage}'s private - * id field + * the {@link LoggingMessage} to get the id field's value for + * @return the value of the specified {@link LoggingMessage}'s private id field */ private String getId(LoggingMessage loggingMessage) { if (loggingMessage == null) @@ -100,11 +95,9 @@ private String getId(LoggingMessage loggingMessage) { /** * @param loggingMessage - * the {@link LoggingMessage} to get the - * {@link LoggingMessage#getPayload()} value for - * @return the {@link LoggingMessage#getPayload()} value from the specified - * {@link LoggingMessage}, with (hopefully) any sensitive contents - * stripped out + * the {@link LoggingMessage} to get the {@link LoggingMessage#getPayload()} value for + * @return the {@link LoggingMessage#getPayload()} value from the specified {@link LoggingMessage}, with (hopefully) + * any sensitive contents stripped out */ private String getPayload(LoggingMessage loggingMessage) { String address = loggingMessage.getAddress().toString(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForOutbound.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForOutbound.java index c7af1c9c..9094a71b 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForOutbound.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/LoggerForOutbound.java @@ -6,9 +6,8 @@ import org.apache.cxf.interceptor.LoggingOutInterceptor; /** - * A custom {@link LoggingOutInterceptor} subclass that doesn't add linebreaks - * to the log output and attempts to prevent passwords from ending up in the - * log. + * A custom {@link LoggingOutInterceptor} subclass that doesn't add linebreaks to the log output and attempts to prevent + * passwords from ending up in the log. */ public final class LoggerForOutbound extends LoggingOutInterceptor { private static Field loggingMessageIdField; @@ -25,8 +24,7 @@ public LoggerForOutbound() { loggingMessageIdField.setAccessible(true); /* - * Thread safety: this might get set multiple times, but that's - * not actually a problem. + * Thread safety: this might get set multiple times, but that's not actually a problem. */ LoggerForOutbound.loggingMessageIdField = loggingMessageIdField; } catch (NoSuchFieldException e) { @@ -67,10 +65,8 @@ protected String formatLoggingMessage(LoggingMessage loggingMessage) { /** * @param loggingMessage - * the {@link LoggingMessage} to get the id field's - * value for - * @return the value of the specified {@link LoggingMessage}'s private - * id field + * the {@link LoggingMessage} to get the id field's value for + * @return the value of the specified {@link LoggingMessage}'s private id field */ private String getId(LoggingMessage loggingMessage) { if (loggingMessage == null) @@ -85,11 +81,9 @@ private String getId(LoggingMessage loggingMessage) { /** * @param loggingMessage - * the {@link LoggingMessage} to get the - * {@link LoggingMessage#getPayload()} value for - * @return the {@link LoggingMessage#getPayload()} value from the specified - * {@link LoggingMessage}, with (hopefully) any sensitive contents - * stripped out + * the {@link LoggingMessage} to get the {@link LoggingMessage#getPayload()} value for + * @return the {@link LoggingMessage#getPayload()} value from the specified {@link LoggingMessage}, with (hopefully) + * any sensitive contents stripped out */ private String getPayload(LoggingMessage loggingMessage) { String address = loggingMessage.getAddress().toString(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/RequestScopeResourceFactory.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/RequestScopeResourceFactory.java index 9a0fe2f5..9d4dc6f3 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/RequestScopeResourceFactory.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/RequestScopeResourceFactory.java @@ -6,19 +6,18 @@ import org.springframework.context.annotation.Bean; /** - * This CXF {@link ResourceProvider} and Spring {@link ApplicationContextAware} - * listener should be used to wrap all of the application's request-scope beans. - * This is needed to ensure that those beans aren't treated as singletons and as - * part of the configuration necessary to ensure they're only instantiated - * during requests (rather than at application initialization). + * This CXF {@link ResourceProvider} and Spring {@link ApplicationContextAware} listener should be used to wrap all of + * the application's request-scope beans. This is needed to ensure that those beans aren't treated as singletons and as + * part of the configuration necessary to ensure they're only instantiated during requests (rather than at application + * initialization). */ public class RequestScopeResourceFactory extends SpringResourceFactory { /** * Constructs a new {@link RequestScopeResourceFactory} instance. - * + * * @param beanName - * the {@link Bean#name()} value for the Spring bean that will be - * used as a (request-scoped) JAX-RS resource + * the {@link Bean#name()} value for the Spring bean that will be used as a (request-scoped) JAX-RS + * resource */ public RequestScopeResourceFactory(String beanName) { super(beanName); @@ -35,4 +34,4 @@ public boolean isSingleton() { return false; } -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceApplication.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceApplication.java index 05aa8ff8..9b764951 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceApplication.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceApplication.java @@ -4,10 +4,9 @@ import javax.ws.rs.core.Application; /** - * The JAX-RS {@link Application} for the game web service. In a non-Spring - * setup, this would specify all of the services and resources that will be - * hosted by the application. However, since Spring is being used, that - * is all handled in {@link GameServiceApplicationInitializer}. + * The JAX-RS {@link Application} for the game web service. In a non-Spring setup, this would specify all of the + * services and resources that will be hosted by the application. However, since Spring is being used, that is + * all handled in {@link GameServiceApplicationInitializer}. */ @ApplicationPath("/") public final class ServiceApplication extends Application { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceStatusResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceStatusResourceImpl.java index c5763aef..f56aae13 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceStatusResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/ServiceStatusResourceImpl.java @@ -20,8 +20,7 @@ public class ServiceStatusResourceImpl implements IServiceStatusResource { private final String version; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public ServiceStatusResourceImpl() { try { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaos.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaos.java index 7947d267..bfea26da 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaos.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaos.java @@ -12,13 +12,11 @@ /** *

- * The Spring {@link Configuration} required by this project's DAOs (and their - * ITs). + * The Spring {@link Configuration} required by this project's DAOs (and their ITs). *

*

- * Design Note: This specifically does not import - * {@link SpringBindingsForJpa}, as the DAO ITs manage all of that themselves. - * Instead, that is included in {@link SpringBindingsForWebServices}. + * Design Note: This specifically does not import {@link SpringBindingsForJpa}, as the DAO ITs manage + * all of that themselves. Instead, that is included in {@link SpringBindingsForWebServices}. *

*/ @Configuration @@ -30,9 +28,8 @@ public class SpringBindingsForDaos { @Bean public IDataSourceSchemaManager schemaManager(DataSourceConnectorsManager connectorsManager) { /* - * The rps-tourney-webservice/src/main/resources/liquibase-change-log - * .xml file contains the Liquibase schema changelog, which will be - * applied at application startup via the DatabaseSchemaInitializer. + * The rps-tourney-webservice/src/main/resources/liquibase-change-log .xml file contains the Liquibase schema + * changelog, which will be applied at application startup via the DatabaseSchemaInitializer. */ return new LiquibaseSchemaManager(connectorsManager, "liquibase-change-log.xml"); } diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServices.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServices.java index e72319fa..6d31074b 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServices.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServices.java @@ -44,9 +44,8 @@ @Import({ SpringBindingsForDaos.class, SpringBindingsForJpa.class }) public class SpringBindingsForWebServices { /** - * @return Returns the {@link SpringBus} that the CXF application uses. Such - * a {@link SpringBus} instance must be provided in - * the application's {@link Configuration}. + * @return Returns the {@link SpringBus} that the CXF application uses. Such a {@link SpringBus} instance + * must be provided in the application's {@link Configuration}. */ @Bean(destroyMethod = "shutdown") SpringBus cxf() { @@ -54,9 +53,8 @@ SpringBus cxf() { /* * Enable request/response logging. These messages will use the - * 'org.apache.cxf.interceptor.LoggingInInterceptor' and - * 'org.apache.cxf.interceptor.LoggingOutInterceptor' logging - * categories, at the 'INFO' level. + * 'org.apache.cxf.interceptor.LoggingInInterceptor' and 'org.apache.cxf.interceptor.LoggingOutInterceptor' + * logging categories, at the 'INFO' level. */ LoggerForInbound inInterceptor = new LoggerForInbound(); LoggerForOutbound outInterceptor = new LoggerForOutbound(); @@ -69,10 +67,8 @@ SpringBus cxf() { } /** - * @return Returns the {@link Application} instance that the JAX-RS - * application uses. Such an {@link Application} instance - * must be provided in the application's - * {@link Configuration}. + * @return Returns the {@link Application} instance that the JAX-RS application uses. Such an {@link Application} + * instance must be provided in the application's {@link Configuration}. */ @Bean ServiceApplication jaxRsApiApplication() { @@ -81,17 +77,13 @@ ServiceApplication jaxRsApiApplication() { /** * @param springApplicationContext - * the Spring {@link ApplicationContext} that the {@link Server} - * will be running in + * the Spring {@link ApplicationContext} that the {@link Server} will be running in * @param authenticationFilter - * the injected {@link AuthenticationFilter} bean for the - * application - * @return Returns the {@link Server} instance that the CXF application - * uses. Such an {@link Server} instance must be - * provided in the application's {@link Configuration}. This largely - * replaces the resource/provider declarations that would be - * included in an {@link Application} instance for non-Spring JAX-RS - * applications. + * the injected {@link AuthenticationFilter} bean for the application + * @return Returns the {@link Server} instance that the CXF application uses. Such an {@link Server} instance + * must be provided in the application's {@link Configuration}. This largely replaces the + * resource/provider declarations that would be included in an {@link Application} instance for non-Spring + * JAX-RS applications. */ @Bean @DependsOn({ "cxf" }) @@ -116,18 +108,16 @@ Server jaxRsServer(ApplicationContext springApplicationContext, AuthenticationFi resourceProviders.add(new RequestScopeResourceFactory("gameResourceImpl")); /* - * Initialize all of the SpringResourceFactory instances. This - * non-obvious step is required, and I came across the idea here: - * https://issues.apache.org/jira/browse/CXF-3725 + * Initialize all of the SpringResourceFactory instances. This non-obvious step is required, and I came across + * the idea here: https://issues.apache.org/jira/browse/CXF-3725 */ for (ResourceProvider resourceProvider : resourceProviders) if (resourceProvider instanceof SpringResourceFactory) ((SpringResourceFactory) resourceProvider).setApplicationContext(springApplicationContext); /* - * This is equivalent to elements in a Spring - * XML configuration, as can be seen in org.apache.cxf.jaxrs.spring - * .JAXRSServerFactoryBeanDefinitionParser.mapElement(...). + * This is equivalent to elements in a Spring XML configuration, as can be seen in + * org.apache.cxf.jaxrs.spring .JAXRSServerFactoryBeanDefinitionParser.mapElement(...). */ factory.setResourceProviders(resourceProviders); @@ -142,20 +132,17 @@ Server jaxRsServer(ApplicationContext springApplicationContext, AuthenticationFi } /** - * @return The {@link List} of JAX-RS/CXF providers that Spring/CXF should - * register via {@link JAXRSServerFactoryBean#setProviders(List)}. - * Basically, this would be anything else that can be a singleton - * that might have been specified in - * {@link Application#getClasses()} or + * @return The {@link List} of JAX-RS/CXF providers that Spring/CXF should register via + * {@link JAXRSServerFactoryBean#setProviders(List)}. Basically, this would be anything else that can be a + * singleton that might have been specified in {@link Application#getClasses()} or * {@link Application#getSingletons()}. */ private static List getProviders() { List providers = new LinkedList<>(); /* - * Right now, these providers are all being created manually. However, - * if any of them require injection, they'd need to be injected into - * here via Spring. + * Right now, these providers are all being created manually. However, if any of them require injection, they'd + * need to be injected into here via Spring. */ // Register the entity translators. @@ -182,8 +169,7 @@ HelloWorldServiceImpl helloWorldResource() { /** * @param configLoader * the injected {@link IConfigLoader} for the application - * @return the application's settings, as represented by a - * {@link ServiceConfig} instance + * @return the application's settings, as represented by a {@link ServiceConfig} instance */ @Bean ServiceConfig serviceConfig(IConfigLoader configLoader) { @@ -192,8 +178,7 @@ ServiceConfig serviceConfig(IConfigLoader configLoader) { /** * @param dsConnectorsManager - * the injected {@link DataSourceConnectorsManager} for the - * application + * the injected {@link DataSourceConnectorsManager} for the application * @param serviceConfig * the injected {@link ServiceConfig} for the application * @return the {@link DataSource} for the application's database @@ -202,4 +187,4 @@ ServiceConfig serviceConfig(IConfigLoader configLoader) { public DataSource dataSource(DataSourceConnectorsManager dsConnectorsManager, ServiceConfig serviceConfig) { return dsConnectorsManager.createDataSource(serviceConfig.getDataSourceCoordinates()); } -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringProfile.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringProfile.java index 722db5b9..7b0609b7 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringProfile.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/SpringProfile.java @@ -3,28 +3,25 @@ import org.springframework.context.annotation.Profile; /** - * Enumerates the various Spring {@link Profile}s supported in the application's - * Spring configuration. (Not an actual enum, as the values need to be - * referenced within annotations.) + * Enumerates the various Spring {@link Profile}s supported in the application's Spring configuration. (Not an actual + * enum, as the values need to be referenced within annotations.) */ public final class SpringProfile { /** - * The default {@link Profile}. Contains the configuration for use when the - * application is deployed in production. - * + * The default {@link Profile}. Contains the configuration for use when the application is deployed in production. + * * @see GameWebApplicationInitializer#onStartup(javax.servlet.ServletContext) */ public static final String PRODUCTION = "production"; /** - * Contains the configuration for use when the application is running in - * integration tests. + * Contains the configuration for use when the application is running in integration tests. */ public static final String INTEGRATION_TESTS = "integration-tests"; /** - * Contains the configuration for use when the application is running in - * integration tests, using an embedded Jetty server. + * Contains the configuration for use when the application is running in integration tests, using an embedded Jetty + * server. */ public static final String INTEGRATION_TESTS_WITH_JETTY = "integration-tests-jetty"; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountSecurityContext.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountSecurityContext.java index ed977193..c8aea669 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountSecurityContext.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountSecurityContext.java @@ -8,8 +8,8 @@ import com.justdavis.karl.rpstourney.service.api.auth.SecurityRole; /** - * This {@link SecurityContext} implementation uses {@link Account}s for - * {@link #getUserPrincipal()} and {@link #isUserInRole(String)}. + * This {@link SecurityContext} implementation uses {@link Account}s for {@link #getUserPrincipal()} and + * {@link #isUserInRole(String)}. */ public final class AccountSecurityContext implements SecurityContext { private final Account account; @@ -17,15 +17,13 @@ public final class AccountSecurityContext implements SecurityContext { /** * Constructs a new {@link AccountSecurityContext} instance. - * + * * @param account - * the {@link Account}/{@link Principal} that has authenticated - * with the application, or null if the user is - * anonymous + * the {@link Account}/{@link Principal} that has authenticated with the application, or + * null if the user is anonymous * @param secure - * true if the connection for the request is - * encrypted (e.g. https), false if - * it's not + * true if the connection for the request is encrypted (e.g. https), + * false if it's not */ public AccountSecurityContext(Account account, boolean secure) { this.account = account; @@ -34,11 +32,10 @@ public AccountSecurityContext(Account account, boolean secure) { /** * Constructs a new {@link AccountSecurityContext} instance. - * + * * @param account - * the {@link Account}/{@link Principal} that has authenticated - * with the application, or null if the user is - * anonymous + * the {@link Account}/{@link Principal} that has authenticated with the application, or + * null if the user is anonymous */ public AccountSecurityContext(Account account) { this(account, false); @@ -88,4 +85,4 @@ public boolean isSecure() { public String getAuthenticationScheme() { return AuthenticationFilter.AUTH_SCHEME; } -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImpl.java index ae1dd28a..4190c6fd 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImpl.java @@ -38,8 +38,7 @@ public AccountsDaoImpl() { /** * @param entityManager - * a JPA {@link EntityManager} connected to the application's - * database + * a JPA {@link EntityManager} connected to the application's database */ @PersistenceContext public void setEntityManager(EntityManager entityManager) { @@ -138,9 +137,8 @@ public Account getAccountByAuthToken(UUID authTokenValue) { // Verify the results. if (authTokenValue != null && results.isEmpty()) { /* - * If there was an auth token, a match for it wasn't found. Either - * someone's trying to hack, the Account has been deleted, or - * something's gone fairly badly wrong. + * If there was an auth token, a match for it wasn't found. Either someone's trying to hack, the Account has + * been deleted, or something's gone fairly badly wrong. */ LOGGER.warn("Unable to find an existing account for auth token: {}", authTokenValue); } @@ -173,8 +171,7 @@ public AuthToken selectOrCreateAuthToken(Account account) { authToken = new AuthToken(account, UUID.randomUUID()); account.getAuthTokens().add(authToken); /* - * Note: If this needs to support detached instances, things will have - * to be reworked. + * Note: If this needs to support detached instances, things will have to be reworked. */ entityManager.persist(account); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImpl.java index 66a31125..f51b509d 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImpl.java @@ -49,16 +49,15 @@ public class AccountsResourceImpl implements IAccountsResource { private IGamesDao gamesDao; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public AccountsResourceImpl() { } /** * @param securityContext - * the {@link SecurityContext} for the request that the - * {@link AccountsResourceImpl} was instantiated to handle + * the {@link SecurityContext} for the request that the {@link AccountsResourceImpl} was instantiated to + * handle */ @Context public void setSecurityContext(SecurityContext securityContext) { @@ -129,8 +128,8 @@ public Account getAccount() { throw new BadCodeMonkeyException("RolesAllowed not working."); /* - * Return a response with the account and the auth token (as a cookie, - * so the login is persisted between requests). + * Return a response with the account and the auth token (as a cookie, so the login is persisted between + * requests). */ return authenticatedAccount; } @@ -170,9 +169,8 @@ public Account updateAccount(Account accountToUpdate) { throw new ForbiddenException(); /* - * Prevent AuthTokens and logins from being affected by the merge. All - * or some of the fields in these objects are excluded from JAXB, so the - * passed in Account will be incomplete for these fields. + * Prevent AuthTokens and logins from being affected by the merge. All or some of the fields in these objects + * are excluded from JAXB, so the passed in Account will be incomplete for these fields. */ accountToUpdate.getAuthTokens().addAll(existingAccount.getAuthTokens()); accountToUpdate.getLogins().clear(); @@ -202,8 +200,7 @@ public AuthToken selectOrCreateAuthToken() { } /** - * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, - * java.util.UUID) + * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, java.util.UUID) */ @Override @RolesAllowed({ SecurityRole.ID_USERS }) @@ -226,16 +223,14 @@ public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) throw new IllegalArgumentException("Unable to find source account with specified AuthToken"); /* - * Verify that the target Account is the current user (unless the - * current user is an admin). + * Verify that the target Account is the current user (unless the current user is an admin). */ boolean userIsTarget = authenticatedAccount.getId() == targetAccountId; if (!userIsTarget && !userIsAdmin) throw new ForbiddenException(); /* - * Verify that the source Account is anonymous (unless the current user - * is an admin). + * Verify that the source Account is anonymous (unless the current user is an admin). */ boolean sourceIsAnon = sourceAccount.isAnonymous(); if (!sourceIsAnon && !userIsAdmin) @@ -290,8 +285,7 @@ public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) } /* - * Save the audit entries and the target Account, then delete the (now - * empty) source Account. + * Save the audit entries and the target Account, then delete the (now empty) source Account. */ accountsDao.save(targetAccount); accountsDao.save(auditAccountEntry); @@ -301,13 +295,12 @@ public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) } /** - * @return the {@link Account} of the currently-authenticated user/client, - * or null if the user/client is not authenticated + * @return the {@link Account} of the currently-authenticated user/client, or null if the user/client + * is not authenticated */ private Account getAuthenticatedAccount() { /* - * Grab the requestor's Account from the SecurityContext. This will have - * been set by the AuthenticationFilter. + * Grab the requestor's Account from the SecurityContext. This will have been set by the AuthenticationFilter. */ Principal userPrincipal = securityContext.getUserPrincipal(); if (userPrincipal == null) diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializer.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializer.java index 25cbb121..3728cca8 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializer.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializer.java @@ -23,10 +23,9 @@ import com.justdavis.karl.rpstourney.service.app.config.ServiceConfig; /** - * This {@link ServletContextListener} runs at application startup to ensure - * that the application has the expected default {@link SecurityRole#ADMINS} - * {@link GameLoginIdentity}. If not, it fixes that. - * + * This {@link ServletContextListener} runs at application startup to ensure that the application has the expected + * default {@link SecurityRole#ADMINS} {@link GameLoginIdentity}. If not, it fixes that. + * * @see ServiceConfig#getAdminAccountConfig() */ @Component @@ -40,7 +39,7 @@ public class AdminAccountInitializer implements ApplicationListener - * {@link AuthenticationFilter} will filter both requests and responses, to - * apply the application's authentication scheme to them. + * {@link AuthenticationFilter} will filter both requests and responses, to apply the application's authentication + * scheme to them. *

*

- * For requests, it checks for authentication token cookies, and if found, sets - * the {@link SecurityContext} for the rest of the request to use the logged-in - * {@link Account}. For responses, it sets/refreshes those authentication token - * cookies, to ensure that the expiration date and other properties of those - * cookies are updated every time a client makes a webservice call. + * For requests, it checks for authentication token cookies, and if found, sets the {@link SecurityContext} for the rest + * of the request to use the logged-in {@link Account}. For responses, it sets/refreshes those authentication token + * cookies, to ensure that the expiration date and other properties of those cookies are updated every time a client + * makes a webservice call. *

*/ @Priority(Priorities.AUTHENTICATION) @@ -51,17 +50,15 @@ public class AuthenticationFilter implements ContainerRequestFilter, ContainerRe /** * The custom authentication scheme ID used by the application. - * + * * @see SecurityContext#getAuthenticationScheme() */ public static String AUTH_SCHEME = "GameAuth"; /** - * The {@link HttpServletRequest#getAttribute(String)} key that should be - * used to signal/record successful logon events. If the value of this - * attribute is a valid {@link AuthToken} instance, the - * {@link AuthenticationFilter} will set a cookie on outgoing responses - * that, if returned, will be used to authenticate that user/account on + * The {@link HttpServletRequest#getAttribute(String)} key that should be used to signal/record successful logon + * events. If the value of this attribute is a valid {@link AuthToken} instance, the {@link AuthenticationFilter} + * will set a cookie on outgoing responses that, if returned, will be used to authenticate that user/account on * future requests. */ public static final String LOGIN_PROPERTY = AuthenticationFilter.class.getName() + ".login"; @@ -69,8 +66,7 @@ public class AuthenticationFilter implements ContainerRequestFilter, ContainerRe private IAccountsDao accountsDao; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public AuthenticationFilter() { } @@ -89,18 +85,16 @@ public void setAccountDao(IAccountsDao accountsDao) { } /** - * This callback will be passed each request towards the start of the - * processing chain for it. It checks the request for a cookie containing an - * authentication token. If such a cookie is found, it sets the - * {@link SecurityContext} for the request to reflect the {@link Account} of - * the user/client making the request. - * + * This callback will be passed each request towards the start of the processing chain for it. It checks the request + * for a cookie containing an authentication token. If such a cookie is found, it sets the {@link SecurityContext} + * for the request to reflect the {@link Account} of the user/client making the request. + * * @see javax.ws.rs.container.ContainerRequestFilter#filter(javax.ws.rs.container.ContainerRequestContext) */ @Override public void filter(ContainerRequestContext requestContext) throws IOException { LOGGER.trace("Entering {}.filter(...)", AuthenticationFilter.class); - + // Is there an auth token cookie? If so, grab the Account for it. Cookie authTokenCookie = requestContext.getCookies().get(AuthTokenCookieHelper.COOKIE_NAME_AUTH_TOKEN); Account userAccount = null; @@ -118,12 +112,10 @@ public void filter(ContainerRequestContext requestContext) throws IOException { } /** - * This callback will be passed each request and response towards the end of - * the processing chain for it. It checks the {@link SecurityContext} for - * the request, and if it contains a valid {@link Account} for the - * user/client that made the request, it will refresh the cookie containing - * the authentication token for that {@link Account}. - * + * This callback will be passed each request and response towards the end of the processing chain for it. It checks + * the {@link SecurityContext} for the request, and if it contains a valid {@link Account} for the user/client that + * made the request, it will refresh the cookie containing the authentication token for that {@link Account}. + * * @see javax.ws.rs.container.ContainerResponseFilter#filter(javax.ws.rs.container.ContainerRequestContext, * javax.ws.rs.container.ContainerResponseContext) */ @@ -131,16 +123,14 @@ public void filter(ContainerRequestContext requestContext) throws IOException { public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { /* - * This filter method will be run towards the end of each request's - * response chain. + * This filter method will be run towards the end of each request's response chain. */ // Pull the login the request came in with (if any). AccountSecurityContext securityContext = (AccountSecurityContext) requestContext.getSecurityContext(); /* - * Pull the auth token for the login that was set during the response - * (if any). + * Pull the auth token for the login that was set during the response (if any). */ AuthToken authTokenForLogin = (AuthToken) requestContext.getProperty(LOGIN_PROPERTY); @@ -158,13 +148,12 @@ public void filter(ContainerRequestContext requestContext, ContainerResponseCont *

*

* Should be used instead of - * {@link #refreshLoginCookie(AccountSecurityContext, ContainerRequestContext, ContainerResponseContext)} - * when the request didn't already come in with a valid login/cookie. + * {@link #refreshLoginCookie(AccountSecurityContext, ContainerRequestContext, ContainerResponseContext)} when the + * request didn't already come in with a valid login/cookie. *

- * + * * @param authTokenForLogin - * the {@link AuthToken} to be included as a cookie in the - * response + * the {@link AuthToken} to be included as a cookie in the response * @param requestContext * the request being processed * @param responseContext @@ -181,18 +170,16 @@ private static void setLoginCookie(AuthToken authTokenForLogin, ContainerRequest /** *

- * Refreshes the current login {@link AuthToken} cookie on the outgoing - * response being generated. + * Refreshes the current login {@link AuthToken} cookie on the outgoing response being generated. *

*

* Should be used instead of - * {@link #refreshLoginCookie(AccountSecurityContext, ContainerRequestContext, ContainerResponseContext)} - * when the request didn't already come in with a valid login/cookie. + * {@link #refreshLoginCookie(AccountSecurityContext, ContainerRequestContext, ContainerResponseContext)} when the + * request didn't already come in with a valid login/cookie. *

- * + * * @param securityContext - * the {@link AccountSecurityContext} containing the active login - * to be refreshed + * the {@link AccountSecurityContext} containing the active login to be refreshed * @param requestContext * the request being processed * @param responseContext @@ -219,21 +206,17 @@ private void refreshLoginCookie(AccountSecurityContext securityContext, Containe } /** - * Adds the specified {@link NewCookie} instance to the specified - * {@link ContainerResponseContext} response instance. Will replace any - * existing cookie that matches the specified cookie's - * {@link NewCookie#getName()}. - * + * Adds the specified {@link NewCookie} instance to the specified {@link ContainerResponseContext} response + * instance. Will replace any existing cookie that matches the specified cookie's {@link NewCookie#getName()}. + * * @param responseContext - * the {@link ContainerResponseContext} instance that represents - * the response being generated + * the {@link ContainerResponseContext} instance that represents the response being generated * @param authTokenCookie * the {@link NewCookie} to include in the response */ private static void addCookieToResponse(ContainerResponseContext responseContext, NewCookie authTokenCookie) { /* - * Loop through the Cookies, checking to see if any match the one being - * set. + * Loop through the Cookies, checking to see if any match the one being set. */ boolean matchingCookieFound = false; if (responseContext.getHeaders().containsKey(HttpHeaders.SET_COOKIE)) { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilter.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilter.java index 34634fb5..435aaf43 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilter.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilter.java @@ -23,14 +23,12 @@ /** *

- * {@link AuthorizationFilter} instances can be registered for specific JAX-RS - * resources, and will ensure that the {@link SecurityContext} of users - * requesting the resource is in at least one of the required roles. + * {@link AuthorizationFilter} instances can be registered for specific JAX-RS resources, and will ensure that the + * {@link SecurityContext} of users requesting the resource is in at least one of the required roles. *

*

- * This filter will typically be dynamically registered by - * {@link AuthorizationFilterFeature}, but only for those webservice methods and - * classes marked with {@link DenyAll} and/or {@link RolesAllowed} annotations. + * This filter will typically be dynamically registered by {@link AuthorizationFilterFeature}, but only for those + * webservice methods and classes marked with {@link DenyAll} and/or {@link RolesAllowed} annotations. *

*/ @Priority(Priorities.AUTHORIZATION) @@ -39,12 +37,10 @@ public final class AuthorizationFilter implements ContainerRequestFilter { /** * Constructs a new instance of the {@link AuthorizationFilter}. - * + * * @param rolesAllowed - * the whitelist of {@link SecurityContext} roles that are - * allowed to access resources "guarded" by the - * {@link AuthorizationFilter} ( null values/entries - * are ignored) + * the whitelist of {@link SecurityContext} roles that are allowed to access resources "guarded" by the + * {@link AuthorizationFilter} ( null values/entries are ignored) */ public AuthorizationFilter(String... rolesAllowed) { this.rolesAllowed = rolesAllowed; @@ -52,9 +48,8 @@ public AuthorizationFilter(String... rolesAllowed) { /** * Only for use in testing. - * - * @return the array of role IDs that was passed to - * {@link #AuthorizationFilter(String...)} + * + * @return the array of role IDs that was passed to {@link #AuthorizationFilter(String...)} */ String[] getRolesAllowed() { return Arrays.copyOf(rolesAllowed, rolesAllowed.length); @@ -66,10 +61,8 @@ String[] getRolesAllowed() { @Override public void filter(ContainerRequestContext requestContext) throws IOException { /* - * Grab the SecurityContext, which should have been setup by the - * AuthenticationFilter. FIXME Grabbing it from a property is a - * workaround for a bug in CXF 2.7. See AccountSecurityContextProvider - * for details. + * Grab the SecurityContext, which should have been setup by the AuthenticationFilter. FIXME Grabbing it from a + * property is a workaround for a bug in CXF 2.7. See AccountSecurityContextProvider for details. */ SecurityContext securityContext = requestContext.getSecurityContext(); // SecurityContext securityContext = (SecurityContext) requestContext @@ -85,9 +78,8 @@ public void filter(ContainerRequestContext requestContext) throws IOException { } /** - * This {@link DynamicFeature} will register {@link AuthorizationFilter} (as - * appropriate) for JAX-RS webservice methods and classes that are marked up - * with any of the {@link PermitAll}, {@link DenyAll}, and/or + * This {@link DynamicFeature} will register {@link AuthorizationFilter} (as appropriate) for JAX-RS webservice + * methods and classes that are marked up with any of the {@link PermitAll}, {@link DenyAll}, and/or * {@link RolesAllowed} annotations. */ public static final class AuthorizationFilterFeature implements DynamicFeature { @@ -100,19 +92,16 @@ public static final class AuthorizationFilterFeature implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { /* - * This method will be called once for every webservice method that - * is registered with the JAX-RS application. The Configurable can - * be used to register ContainerRequestFilter (or other related - * features, e.g. ContainerResponseFilter) implementations, "tying" - * them to the specific webservice methods. This is opposed to - * registering/declaring them in the JAX-RS application globally, - * where the features would be active for all webservice methods. + * This method will be called once for every webservice method that is registered with the JAX-RS + * application. The Configurable can be used to register ContainerRequestFilter (or other related features, + * e.g. ContainerResponseFilter) implementations, "tying" them to the specific webservice methods. This is + * opposed to registering/declaring them in the JAX-RS application globally, where the features would be + * active for all webservice methods. */ /* - * Evaluate the security annotations on the webservice method & - * class. This has to be done here, as AuthFilter.filter(...) - * doesn't have access to the info. + * Evaluate the security annotations on the webservice method & class. This has to be done here, as + * AuthFilter.filter(...) doesn't have access to the info. */ Class webServiceClass = resourceInfo.getResourceClass(); RolesAllowed rolesAllowedForClass = webServiceClass.getAnnotation(RolesAllowed.class); @@ -122,9 +111,8 @@ public void configure(ResourceInfo resourceInfo, FeatureContext context) { RolesAllowed rolesAllowedForMethod = webServiceMethod.getAnnotation(RolesAllowed.class); /* - * The overriding rules specified for these annotations (in their - * JavaDoc) are a bit complex, but in general, method-level - * annotations always override class-level ones. + * The overriding rules specified for these annotations (in their JavaDoc) are a bit complex, but in + * general, method-level annotations always override class-level ones. */ RolesAllowed rolesAllowed = rolesAllowedForMethod != null ? rolesAllowedForMethod : rolesAllowedForClass; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/IAccountsDao.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/IAccountsDao.java index 765e8962..eab439a2 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/IAccountsDao.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/IAccountsDao.java @@ -13,8 +13,7 @@ public interface IAccountsDao { /** * @param account - * the {@link Account} instance to be inserted/updated in the - * database + * the {@link Account} instance to be inserted/updated in the database */ void save(Account account); @@ -26,18 +25,15 @@ public interface IAccountsDao { /** * @param account - * the {@link Account} instance to get a re-attached copy of, and - * whose modified state should be applied to the persistence - * context - * @return a new, attached copy of the specified {@link Account} (the - * version passed in will be left detached) + * the {@link Account} instance to get a re-attached copy of, and whose modified state should be applied + * to the persistence context + * @return a new, attached copy of the specified {@link Account} (the version passed in will be left detached) */ Account merge(Account account); /** - * Note: This method is really only appropriate for use in testing; it's a - * bad idea to use it in production code. - * + * Note: This method is really only appropriate for use in testing; it's a bad idea to use it in production code. + * * @return all of the {@link Account} instances in the database */ List getAccounts(); @@ -45,48 +41,40 @@ public interface IAccountsDao { /** * @param id * the {@link Account#getId()} value to match against - * @return the {@link Account} instance with the specified - * {@link Account#getId()} value, or null if no match - * was found + * @return the {@link Account} instance with the specified {@link Account#getId()} value, or null if no + * match was found */ Account getAccountById(long id); /** * @param authTokenValue - * the {@link AuthToken#getToken()} value to match against - * {@link Account#getAuthTokens()} - * @return the {@link Account} instance with the specified - * {@link Account#getAuthTokens()} {@link AuthToken#getToken()} - * value, or null if no match was found + * the {@link AuthToken#getToken()} value to match against {@link Account#getAuthTokens()} + * @return the {@link Account} instance with the specified {@link Account#getAuthTokens()} + * {@link AuthToken#getToken()} value, or null if no match was found */ Account getAccountByAuthToken(UUID authTokenValue); /** - * Selects the most recent active {@link AuthToken} for the specified - * {@link Account} or, if no such {@link AuthToken} exists, creates a new - * one, persists it, and returns that. - * + * Selects the most recent active {@link AuthToken} for the specified {@link Account} or, if no such + * {@link AuthToken} exists, creates a new one, persists it, and returns that. + * * @param account * the {@link Account} to get an {@link AuthToken} for - * @return the most recent active {@link AuthToken} for the specified - * {@link Account} (or a new one) + * @return the most recent active {@link AuthToken} for the specified {@link Account} (or a new one) */ AuthToken selectOrCreateAuthToken(Account account); /** * @param auditAccountEntries - * the {@link AuditAccountMerge} instances to be inserted/updated - * in the database + * the {@link AuditAccountMerge} instances to be inserted/updated in the database */ void save(AuditAccountMerge... auditAccountEntries); /** * @param targetAccount - * the {@link AuditAccountMerge#getTargetAccount()} value to - * match against - * @return the {@link AuditAccountMerge} instances with the specified - * {@link AuditAccountMerge#getTargetAccount()} value, or an empty - * {@link List} if no matches were found + * the {@link AuditAccountMerge#getTargetAccount()} value to match against + * @return the {@link AuditAccountMerge} instances with the specified {@link AuditAccountMerge#getTargetAccount()} + * value, or an empty {@link List} if no matches were found */ List getAccountAuditEntries(Account targetAccount); } diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImpl.java index fb860042..63e256ce 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImpl.java @@ -34,16 +34,14 @@ public class GameAuthResourceImpl implements IGameAuthResource { private IGameLoginIndentitiesDao loginsDao; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public GameAuthResourceImpl() { } /** * @param httpRequest - * the {@link HttpServletRequest} that the - * {@link GameAuthResourceImpl} was instantiated to handle + * the {@link HttpServletRequest} that the {@link GameAuthResourceImpl} was instantiated to handle */ @Context public void setHttpServletRequest(HttpServletRequest httpRequest) { @@ -56,8 +54,8 @@ public void setHttpServletRequest(HttpServletRequest httpRequest) { /** * @param securityContext - * the {@link SecurityContext} for the request that the - * {@link GameAuthResourceImpl} was instantiated to handle + * the {@link SecurityContext} for the request that the {@link GameAuthResourceImpl} was instantiated to + * handle */ @Context public void setSecurityContext(SecurityContext securityContext) { @@ -102,8 +100,8 @@ public void setGameLoginIdentitiesDao(IGameLoginIndentitiesDao loginsDao) { @Transactional public Account loginWithGameAccount(InternetAddress emailAddress, String password) { /* - * Never, ever allow this method to kill an existing login. If - * users/clients want to log out, they must do so explicitly. + * Never, ever allow this method to kill an existing login. If users/clients want to log out, they must do so + * explicitly. */ if (securityContext.getUserPrincipal() != null) throw new WebApplicationException("User already logged in.", Status.CONFLICT); @@ -123,8 +121,7 @@ public Account loginWithGameAccount(InternetAddress emailAddress, String passwor AuthToken authTokenForLogin = accountsDao.selectOrCreateAuthToken(login.getAccount()); /* - * Store the login in the HTTP request, so the response - * AuthenticationFilter can record it in a cookie. + * Store the login in the HTTP request, so the response AuthenticationFilter can record it in a cookie. */ httpRequest.setAttribute(AuthenticationFilter.LOGIN_PROPERTY, authTokenForLogin); @@ -170,8 +167,7 @@ public Account createGameLogin(InternetAddress emailAddress, String password) { AuthToken authTokenForLogin = accountsDao.selectOrCreateAuthToken(login.getAccount()); /* - * Store the new login in the HTTP request, so the response - * AuthenticationFilter can record it in a cookie. + * Store the new login in the HTTP request, so the response AuthenticationFilter can record it in a cookie. */ httpRequest.setAttribute(AuthenticationFilter.LOGIN_PROPERTY, authTokenForLogin); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImpl.java index 57d36ea1..fa256c65 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImpl.java @@ -30,8 +30,7 @@ public GameLoginIdentitiesDaoImpl() { /** * @param entityManager - * a JPA {@link EntityManager} connected to the application's - * database + * a JPA {@link EntityManager} connected to the application's database */ @PersistenceContext public void setEntityManager(EntityManager entityManager) { @@ -66,8 +65,7 @@ public GameLoginIdentity find(InternetAddress emailAddress) { List results = query.getResultList(); /* - * The GameLoginIdentity.emailAddress field should have a UNIQUE - * constraint. + * The GameLoginIdentity.emailAddress field should have a UNIQUE constraint. */ if (results.isEmpty()) return null; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/IGameLoginIndentitiesDao.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/IGameLoginIndentitiesDao.java index 5c7e158d..8472b658 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/IGameLoginIndentitiesDao.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/IGameLoginIndentitiesDao.java @@ -12,24 +12,21 @@ public interface IGameLoginIndentitiesDao { /** * @param login - * the {@link GameLoginIdentity} instance to be inserted/updated - * in the database + * the {@link GameLoginIdentity} instance to be inserted/updated in the database */ void save(GameLoginIdentity login); /** * @param emailAddress - * the email address to match against - * {@link GameLoginIdentity#getEmailAddress()} - * @return the {@link GameLoginIdentity} that matches the specified - * parameters, or null if no match was found + * the email address to match against {@link GameLoginIdentity#getEmailAddress()} + * @return the {@link GameLoginIdentity} that matches the specified parameters, or null if no match was + * found */ GameLoginIdentity find(InternetAddress emailAddress); /** - * Note: This method is really only appropriate for use in testing; it's a - * bad idea to use it in production code. - * + * Note: This method is really only appropriate for use in testing; it's a bad idea to use it in production code. + * * @return all of the {@link GameLoginIdentity} instances in the database */ List getLogins(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/InternetAddressReader.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/InternetAddressReader.java index 5002e4ea..329964c9 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/InternetAddressReader.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/InternetAddressReader.java @@ -18,15 +18,13 @@ import org.apache.cxf.jaxrs.utils.HttpUtils; /** - * Allows web service methods to accept email addresses, in the form of - * {@link InternetAddress} instances. + * Allows web service methods to accept email addresses, in the form of {@link InternetAddress} instances. */ @Provider public final class InternetAddressReader implements MessageBodyReader { /** - * @see javax.ws.rs.ext.MessageBodyReader#isReadable(java.lang.Class, - * java.lang.reflect.Type, java.lang.annotation.Annotation[], - * javax.ws.rs.core.MediaType) + * @see javax.ws.rs.ext.MessageBodyReader#isReadable(java.lang.Class, java.lang.reflect.Type, + * java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType) */ @Override public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { @@ -34,15 +32,14 @@ public boolean isReadable(Class type, Type genericType, Annotation[] annotati } /** - * @see javax.ws.rs.ext.MessageBodyReader#readFrom(java.lang.Class, - * java.lang.reflect.Type, java.lang.annotation.Annotation[], - * javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, + * @see javax.ws.rs.ext.MessageBodyReader#readFrom(java.lang.Class, java.lang.reflect.Type, + * java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, * java.io.InputStream) */ @Override public InternetAddress readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) - throws IOException, WebApplicationException { + throws IOException, WebApplicationException { // Pull the email address out of the stream as a String. String emailAddressString = IOUtils.toString(entityStream, HttpUtils.getEncoding(mediaType, "UTF-8")); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/PasswordUtils.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/PasswordUtils.java index 5c8a4a54..e7700cce 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/PasswordUtils.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/PasswordUtils.java @@ -8,28 +8,25 @@ */ public final class PasswordUtils { /** - * The CPU cost factor ("N") that will be passed to - * {@link SCryptUtil#scrypt(String, int, int, int)} when new passwords are - * first converted to hashes. - * + * The CPU cost factor ("N") that will be passed to {@link SCryptUtil#scrypt(String, int, int, int)} + * when new passwords are first converted to hashes. + * * @see http://stackoverflow.com/a/12581268/1851299 */ private static final int SCRYPT_CPU_COST = (int) Math.pow(2, 14); /** - * The memory cost factor ("r") that will be passed to - * {@link SCryptUtil#scrypt(String, int, int, int)} when new passwords are - * first converted to hashes. - * + * The memory cost factor ("r") that will be passed to {@link SCryptUtil#scrypt(String, int, int, int)} + * when new passwords are first converted to hashes. + * * @see http://stackoverflow.com/a/12581268/1851299 */ private static final int SCRYPT_MEMORY_COST = 8; /** * The parallelization factor ("p") that will be passed to - * {@link SCryptUtil#scrypt(String, int, int, int)} when new passwords are - * first converted to hashes. - * + * {@link SCryptUtil#scrypt(String, int, int, int)} when new passwords are first converted to hashes. + * * @see http://stackoverflow.com/a/12581268/1851299 */ private static final int SCRYPT_PARALLELIZATION = 1; @@ -46,12 +43,10 @@ public static String hashPassword(String password) { /** * @param password - * the password to compare against the hash in - * {@link GameLoginIdentity#getPasswordHash()} + * the password to compare against the hash in {@link GameLoginIdentity#getPasswordHash()} * @param login * the {@link GameLoginIdentity} to pull the password hash from - * @return true if the the specified password matches the - * specified password hash (as created by + * @return true if the the specified password matches the specified password hash (as created by * {@link #hashPassword(String)}), false if it does not */ public static boolean checkPassword(String password, GameLoginIdentity login) { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/package-info.java index 560d82c0..70588d51 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/game/package-info.java @@ -1,8 +1,6 @@ /** - * Contains - * {@link com.justdavis.karl.rpstourney.service.app.auth.game.GameAuthResourceImpl} - * , which allows users to login via game-specific accounts associated with an - * email address. + * Contains {@link com.justdavis.karl.rpstourney.service.app.auth.game.GameAuthResourceImpl} , which allows users to + * login via game-specific accounts associated with an email address. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImpl.java index a3b28921..09b3b731 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImpl.java @@ -32,16 +32,14 @@ public class GuestAuthResourceImpl implements IGuestAuthResource { private IGuestLoginIndentitiesDao loginsDao; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public GuestAuthResourceImpl() { } /** * @param httpRequest - * the {@link HttpServletRequest} that the - * {@link GuestAuthResourceImpl} was instantiated to handle + * the {@link HttpServletRequest} that the {@link GuestAuthResourceImpl} was instantiated to handle */ @Context public void setHttpServletRequest(HttpServletRequest httpRequest) { @@ -54,8 +52,8 @@ public void setHttpServletRequest(HttpServletRequest httpRequest) { /** * @param securityContext - * the {@link SecurityContext} for the request that the - * {@link GuestAuthResourceImpl} was instantiated to handle + * the {@link SecurityContext} for the request that the {@link GuestAuthResourceImpl} was instantiated to + * handle */ @Context public void setSecurityContext(SecurityContext securityContext) { @@ -99,8 +97,8 @@ public void setGuestLoginIdentitiesDao(IGuestLoginIndentitiesDao loginsDao) { @Transactional public Account loginAsGuest() { /* - * Never, ever allow this method to kill an existing login. If - * users/clients want to log out, they must do so explicitly. + * Never, ever allow this method to kill an existing login. If users/clients want to log out, they must do so + * explicitly. */ if (securityContext.getUserPrincipal() != null) throw new WebApplicationException("User already logged in.", Status.CONFLICT); @@ -110,14 +108,13 @@ public Account loginAsGuest() { AuthToken authTokenForLogin = accountsDao.selectOrCreateAuthToken(login.getAccount()); /* - * Store the new login's auth token in the HTTP request, so the response - * AuthenticationFilter can record it in a cookie. + * Store the new login's auth token in the HTTP request, so the response AuthenticationFilter can record it in a + * cookie. */ httpRequest.setAttribute(AuthenticationFilter.LOGIN_PROPERTY, authTokenForLogin); /* - * Return a response with the new account that's associated with the - * login. + * Return a response with the new account that's associated with the login. */ return login.getAccount(); } diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImpl.java index c6acb2b9..8cdd8c81 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImpl.java @@ -27,8 +27,7 @@ public GuestLoginIdentitiesDaoImpl() { /** * @param entityManager - * a JPA {@link EntityManager} connected to the application's - * database + * a JPA {@link EntityManager} connected to the application's database */ @PersistenceContext public void setEntityManager(EntityManager entityManager) { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/IGuestLoginIndentitiesDao.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/IGuestLoginIndentitiesDao.java index a0375357..92cb63eb 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/IGuestLoginIndentitiesDao.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/IGuestLoginIndentitiesDao.java @@ -10,15 +10,13 @@ public interface IGuestLoginIndentitiesDao { /** * @param login - * the {@link GuestLoginIdentity} instance to be inserted/updated - * in the database + * the {@link GuestLoginIdentity} instance to be inserted/updated in the database */ void save(GuestLoginIdentity login); /** - * Note: This method is really only appropriate for use in testing; it's a - * bad idea to use it in production code. - * + * Note: This method is really only appropriate for use in testing; it's a bad idea to use it in production code. + * * @return all of the {@link GuestLoginIdentity} instances in the database */ List getLogins(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/package-info.java index 47363511..0abfede0 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/auth/guest/package-info.java @@ -1,7 +1,6 @@ /** - * Contains - * {@link com.justdavis.karl.rpstourney.service.app.auth.guest.GuestAuthResourceImpl} - * , which allows users to login via persisted guest accounts. + * Contains {@link com.justdavis.karl.rpstourney.service.app.auth.guest.GuestAuthResourceImpl} , which allows users to + * login via persisted guest accounts. */ @XmlSchema(namespace = XmlNamespace.RPSTOURNEY_API, xmlns = { @XmlNs(prefix = "rps", namespaceURI = XmlNamespace.RPSTOURNEY_API) }, elementFormDefault = XmlNsForm.QUALIFIED) diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/AdminAccountConfig.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/AdminAccountConfig.java index b60248fe..2a111153 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/AdminAccountConfig.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/AdminAccountConfig.java @@ -12,9 +12,8 @@ import com.justdavis.karl.rpstourney.service.api.exceptions.UncheckedAddressException; /** - * Models the configuration of the application's default - * {@link SecurityRole#ADMINS} {@link Account}. - * + * Models the configuration of the application's default {@link SecurityRole#ADMINS} {@link Account}. + * * @see ServiceConfig */ public final class AdminAccountConfig { @@ -27,7 +26,7 @@ public final class AdminAccountConfig { /** * Constructs a new {@link AdminAccountConfig} instance. - * + * * @param address * the value to use for {@link #getAddress()} * @param password @@ -40,7 +39,7 @@ public AdminAccountConfig(InternetAddress address, String password) { /** * Constructs a new {@link AdminAccountConfig} instance. - * + * * @param address * the value to use for {@link #getAddress()} * @param password @@ -52,8 +51,7 @@ public AdminAccountConfig(String address, String password) { /** * @param address - * the value to pass in to - * {@link InternetAddress#InternetAddress(String)} + * the value to pass in to {@link InternetAddress#InternetAddress(String)} * @return a new {@link InternetAddress} instance */ private static InternetAddress createInternetAddress(String address) { @@ -74,25 +72,23 @@ private AdminAccountConfig() { } /** - * @return the {@link GameLoginIdentity#getEmailAddress()} value for the - * application's default {@link SecurityRole#ADMINS} {@link Account} + * @return the {@link GameLoginIdentity#getEmailAddress()} value for the application's default + * {@link SecurityRole#ADMINS} {@link Account} */ public InternetAddress getAddress() { return address; } /** - * @return the (not yet hashed) {@link GameLoginIdentity#getPasswordHash()} - * value for the application's default {@link SecurityRole#ADMINS} - * {@link Account} + * @return the (not yet hashed) {@link GameLoginIdentity#getPasswordHash()} value for the application's default + * {@link SecurityRole#ADMINS} {@link Account} */ public String getPassword() { return password; } /** - * This JAX-B {@link XmlAdapter} marshalls {@link InternetAddress} instances - * as {@link String}s. + * This JAX-B {@link XmlAdapter} marshalls {@link InternetAddress} instances as {@link String}s. */ private static final class InternetAddressStringAdapter extends XmlAdapter { /** diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/IConfigLoader.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/IConfigLoader.java index aae571f9..feed72ed 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/IConfigLoader.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/IConfigLoader.java @@ -2,19 +2,17 @@ /** *

- * Implementations of this interface are responsible for loading/providing the - * application with the {@link ServiceConfig} data object to use. + * Implementations of this interface are responsible for loading/providing the application with the + * {@link ServiceConfig} data object to use. *

*

- * Implementations of this interface must cache {@link ServiceConfig} data after - * it has been loaded once. Accordingly, the only way for changes to the - * application's configuration to be applied is to restart the application. + * Implementations of this interface must cache {@link ServiceConfig} data after it has been loaded once. Accordingly, + * the only way for changes to the application's configuration to be applied is to restart the application. *

*/ public interface IConfigLoader { /** - * @return the just-loaded or previously-loaded-and-now-cached - * {@link ServiceConfig} data object for the application + * @return the just-loaded or previously-loaded-and-now-cached {@link ServiceConfig} data object for the application */ ServiceConfig getConfig(); } diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfig.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfig.java index b78e98fb..a33f229b 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfig.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfig.java @@ -10,9 +10,9 @@ import com.justdavis.karl.rpstourney.service.app.auth.AdminAccountInitializer; /** - * Represents the game web service application's configuration data. Please note - * that instances of this class can be marshalled/unmarshalled via JAX-B. - * + * Represents the game web service application's configuration data. Please note that instances of this class can be + * marshalled/unmarshalled via JAX-B. + * * @see IConfigLoader */ @XmlRootElement @@ -34,7 +34,7 @@ private ServiceConfig() { /** * Constructs a new {@link ServiceConfig} instance. - * + * * @param dataSourceCoordinates * the value to use for {@link #getDataSourceCoordinates()} * @param adminAccountConfig @@ -46,18 +46,16 @@ public ServiceConfig(IDataSourceCoordinates dataSourceCoordinates, AdminAccountC } /** - * @return the {@link IDataSourceCoordinates} that identify the database - * that the application will persist all of its relational data to + * @return the {@link IDataSourceCoordinates} that identify the database that the application will persist all of + * its relational data to */ public IDataSourceCoordinates getDataSourceCoordinates() { return dataSourceCoordinates; } /** - * @return the {@link AdminAccountConfig} that specifies the application's - * default {@link SecurityRole#ADMINS} {@link Account}, which will - * be managed by {@link AdminAccountInitializer} at application - * startup + * @return the {@link AdminAccountConfig} that specifies the application's default {@link SecurityRole#ADMINS} + * {@link Account}, which will be managed by {@link AdminAccountInitializer} at application startup */ public AdminAccountConfig getAdminAccountConfig() { return adminAccountConfig; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigException.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigException.java index a5002a87..fa8a3129 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigException.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigException.java @@ -1,15 +1,15 @@ package com.justdavis.karl.rpstourney.service.app.config; /** - * This unchecked {@link RuntimeException} indicates that the application's - * configuration could not be found where expected, parsed, or otherwise loaded. + * This unchecked {@link RuntimeException} indicates that the application's configuration could not be found where + * expected, parsed, or otherwise loaded. */ public final class ServiceConfigException extends RuntimeException { private static final long serialVersionUID = 3353857916686157636L; /** * Constructs a new {@link ServiceConfigException}. - * + * * @param message * the value to use for {@link #getMessage()} * @param cause @@ -21,7 +21,7 @@ public ServiceConfigException(String message, Throwable cause) { /** * Constructs a new {@link ServiceConfigException}. - * + * * @param message * the value to use for {@link #getMessage()} */ diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoader.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoader.java index e41f90cc..73612a3f 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoader.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoader.java @@ -22,35 +22,31 @@ /** *

- * This {@link IConfigLoader} implementation loads the application's - * configuration from a JAX-B-unmarshallable XML file. + * This {@link IConfigLoader} implementation loads the application's configuration from a JAX-B-unmarshallable XML file. *

*

- * By default, the application's configuration will be read from a file located - * at {@link #CONFIG_DEFAULT}, which is in the application's (or container's) - * current working directory. This, however, can be overridden by specifying a + * By default, the application's configuration will be read from a file located at {@link #CONFIG_DEFAULT}, which is in + * the application's (or container's) current working directory. This, however, can be overridden by specifying a * different path via the {@link #CONFIG_PROP} Java system property. *

*/ public class XmlConfigLoader implements IConfigLoader { /** - * The default path that the application's configuration will be read from, - * unless overridden via {@link #CONFIG_PROP}. + * The default path that the application's configuration will be read from, unless overridden via + * {@link #CONFIG_PROP}. */ public static final String CONFIG_DEFAULT = "./rps-service-config.xml"; /** - * The Java system property that specifies the path that the application's - * configuration will be read from, overriding the default path specified in - * {@link #CONFIG_DEFAULT}. - * + * The Java system property that specifies the path that the application's configuration will be read from, + * overriding the default path specified in {@link #CONFIG_DEFAULT}. + * * @see System#getProperty(String) */ public static final String CONFIG_PROP = "rps.service.config.path"; /** - * This static field is used as a cache for the application's - * {@link ServiceConfig}. + * This static field is used as a cache for the application's {@link ServiceConfig}. */ private static ServiceConfig cachedConfig = null; @@ -58,7 +54,7 @@ public class XmlConfigLoader implements IConfigLoader { /** * Constructs a new {@link XmlConfigLoader} instance. - * + * * @param dsConnectorsManager * the application's {@link DataSourceConnectorsManager} */ @@ -73,12 +69,10 @@ public XmlConfigLoader(DataSourceConnectorsManager dsConnectorsManager) { @Override public synchronized ServiceConfig getConfig() { /* - * This method is marked as synchronized to prevent different parts of - * the application from ending up with different config instances. If - * this proves to be a bottleneck, we'll want to create a second - * IConfigLoader implementation that takes an already-loaded config - * value, and set the application to just use that implementation - * (pre-loading the config via this implementation at startup). + * This method is marked as synchronized to prevent different parts of the application from ending up with + * different config instances. If this proves to be a bottleneck, we'll want to create a second IConfigLoader + * implementation that takes an already-loaded config value, and set the application to just use that + * implementation (pre-loading the config via this implementation at startup). */ // Do we already have a cached copy available? @@ -114,7 +108,7 @@ public synchronized ServiceConfig getConfig() { /** * Note: Integration tests may want to override this method. - * + * * @return an {@link InputStream} for the application's configuration file */ protected InputStream retrieveConfigFile() { @@ -134,9 +128,8 @@ protected InputStream retrieveConfigFile() { } /** - * @return an {@link InputStream} for the file available at - * {@link #CONFIG_DEFAULT}, or null if no such file - * exists + * @return an {@link InputStream} for the file available at {@link #CONFIG_DEFAULT}, or null if no such + * file exists */ private static InputStream retrieveConfigFile_default() { try { @@ -153,13 +146,11 @@ private static InputStream retrieveConfigFile_default() { } /** - * @return an {@link InputStream} for the file specified by - * {@link #CONFIG_PROP}, or null if that property - * wasn't set + * @return an {@link InputStream} for the file specified by {@link #CONFIG_PROP}, or null if that + * property wasn't set * @throws ServiceConfigException - * A {@link CodeGenerationException} will be thrown if the - * {@link #CONFIG_PROP} property has been set to a value that - * does not point to an actual file. + * A {@link CodeGenerationException} will be thrown if the {@link #CONFIG_PROP} property has been set to + * a value that does not point to an actual file. */ private static InputStream retrieveConfigFile_overridden() throws ServiceConfigException { try { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/IHelloWorldService.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/IHelloWorldService.java index 6f016739..bb0448cf 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/IHelloWorldService.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/IHelloWorldService.java @@ -19,4 +19,4 @@ public interface IHelloWorldService { @Path("/echo/{phrase}/") @Produces(MediaType.TEXT_PLAIN) String echo(@PathParam("phrase") String phrase); -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/package-info.java index a8553459..e03f02d8 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/demo/package-info.java @@ -1,6 +1,4 @@ /** - * Contains the - * {@link com.justdavis.karl.rpstourney.service.app.demo.IHelloWorldService} - * resource. + * Contains the {@link com.justdavis.karl.rpstourney.service.app.demo.IHelloWorldService} resource. */ -package com.justdavis.karl.rpstourney.service.app.demo; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.app.demo; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelper.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelper.java index 954b7a05..6c31531d 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelper.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelper.java @@ -12,25 +12,21 @@ /** *

- * This class contains helper utilities to advance play in {@link Game}s with AI - * {@link Player}s. + * This class contains helper utilities to advance play in {@link Game}s with AI {@link Player}s. *

*

- * Design Note: This has been pulled out into a separate class because the - * implementation is likely to change wildly over time. Separating it will make - * tracking those changes easier. + * Design Note: This has been pulled out into a separate class because the implementation is likely to change wildly + * over time. Separating it will make tracking those changes easier. *

*/ @Component public class AiGameplayHelper { /** - * Evaluates the specified {@link Game} to see if it has an AI - * {@link Player} or {@link Player}s that can currently make a move. If so, - * it will invoke the AI player(s) logic to do so, and then loop until it - * fails to make a move for either {@link Player}. However, if the specified - * {@link Game} has no AI players or if any AI players in it cannot - * currently make a move, this method will do nothing. - * + * Evaluates the specified {@link Game} to see if it has an AI {@link Player} or {@link Player}s that can currently + * make a move. If so, it will invoke the AI player(s) logic to do so, and then loop until it fails to make a move + * for either {@link Player}. However, if the specified {@link Game} has no AI players or if any AI players in it + * cannot currently make a move, this method will do nothing. + * * @param game * the {@link Game} to (possibly) manipulate */ @@ -43,9 +39,8 @@ public void advanceGameForAiPlayers(Game game) { throw new IllegalArgumentException(); /* - * Loop forever, until the AI was unable to make a move for either - * player in the game. Will ignore non-AI players, so if neither player - * is an AI, this will do nothing and not loop. + * Loop forever, until the AI was unable to make a move for either player in the game. Will ignore non-AI + * players, so if neither player is an AI, this will do nothing and not loop. */ boolean player1AiMadeMove = false; boolean player2AiMadeMove = false; @@ -59,15 +54,13 @@ public void advanceGameForAiPlayers(Game game) { } /** - * Evaluates the specified {@link Game} to see if the specified player is an - * AI and if it can currently make a move. If so, it will invoke that AI - * player's logic to do so, and then return. - * + * Evaluates the specified {@link Game} to see if the specified player is an AI and if it can currently make a move. + * If so, it will invoke that AI player's logic to do so, and then return. + * * @param game * the {@link Game} to (possibly) manipulate * @param playerRole - * the {@link PlayerRole} of the {@link Player} to (possibly) - * make a move for + * the {@link PlayerRole} of the {@link Player} to (possibly) make a move for * @return true if a move was made, false if not */ private boolean advanceGame(Game game, PlayerRole playerRole) { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiPlayerInitializer.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiPlayerInitializer.java index b4f54917..b0c4398c 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiPlayerInitializer.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/AiPlayerInitializer.java @@ -23,13 +23,12 @@ /** *

- * Ensures that {@link Player} records exist for all active {@link BuiltInAi}s - * (where {@link BuiltInAi#isRetired()} is false). + * Ensures that {@link Player} records exist for all active {@link BuiltInAi}s (where {@link BuiltInAi#isRetired()} is + * false). *

*

- * This Spring Bean is registered as an {@link ApplicationListener} for - * {@link ContextRefreshedEvent}s, and will call {@link #initializeAiPlayers()} - * when that event is fired. + * This Spring Bean is registered as an {@link ApplicationListener} for {@link ContextRefreshedEvent}s, and will call + * {@link #initializeAiPlayers()} when that event is fired. *

*/ @Component @@ -42,7 +41,7 @@ public class AiPlayerInitializer implements ApplicationListenerfalse). + * Ensures that {@link Player} records exist for all active {@link BuiltInAi}s (where {@link BuiltInAi#isRetired()} + * is false). */ public void initializeAiPlayers() { // First, figure out which AIs we're looking for. @@ -78,18 +76,15 @@ public void initializeAiPlayers() { /** *

- * Ensures that {@link Player} records exist for the specified - * {@link BuiltInAi}s. + * Ensures that {@link Player} records exist for the specified {@link BuiltInAi}s. *

*

- * This method is mostly intended for use in tests, as it allows the use of - * non-active {@link BuiltInAi}s, such as + * This method is mostly intended for use in tests, as it allows the use of non-active {@link BuiltInAi}s, such as * {@link BuiltInAi#ONE_SIDED_DIE_ROCK}. *

- * + * * @param ais - * the {@link BuiltInAi}s to ensure that {@link Player}s exist - * for + * the {@link BuiltInAi}s to ensure that {@link Player}s exist for */ @Transactional public void initializeAiPlayers(BuiltInAi... ais) { diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImpl.java index bf387212..a0b95e28 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImpl.java @@ -35,8 +35,7 @@ import com.justdavis.karl.rpstourney.service.app.auth.AuthenticationFilter; /** - * The web service implementation of {@link IGameResource}, which is the primary - * service for gameplay interactions. + * The web service implementation of {@link IGameResource}, which is the primary service for gameplay interactions. */ @Component @Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) @@ -49,16 +48,15 @@ public class GameResourceImpl implements IGameResource { private AiGameplayHelper aiHelper; /** - * This public, default/no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default/no-arg constructor is required by Spring (for request-scoped beans). */ public GameResourceImpl() { } /** * @param securityContext - * the {@link SecurityContext} for the request that the - * {@link GameResourceImpl} was instantiated to handle + * the {@link SecurityContext} for the request that the {@link GameResourceImpl} was instantiated to + * handle */ @Context public void setSecurityContext(SecurityContext securityContext) { @@ -170,8 +168,7 @@ public GameView getGame(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, - * int, int) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, int, int) */ @RolesAllowed({ SecurityRole.ID_USERS }) @Transactional @@ -180,8 +177,7 @@ public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRou Game game = getRawGame(gameId); /* - * Check to make sure that the requesting user is one of the two - * players. + * Check to make sure that the requesting user is one of the two players. */ Account userAccount = getUserAccount(); Player userPlayer = playersDao.findOrCreatePlayerForAccount(userAccount); @@ -196,8 +192,7 @@ public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRou } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, - * long) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, long) */ @RolesAllowed({ SecurityRole.ID_USERS }) @Transactional @@ -266,8 +261,7 @@ public GameView joinGame(String gameId) { @Override public GameView prepareRound(String gameId) { /* - * Note: This method is intentionally not marked with @RolesAllowed, as - * it doesn't really matter who calls it. + * Note: This method is intentionally not marked with @RolesAllowed, as it doesn't really matter who calls it. */ LOGGER.trace("Prepare round start."); @@ -291,8 +285,8 @@ public GameView prepareRound(String gameId) { } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, - * int, com.justdavis.karl.rpstourney.service.api.game.Throw) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, int, + * com.justdavis.karl.rpstourney.service.api.game.Throw) */ @RolesAllowed({ SecurityRole.ID_USERS }) @Transactional @@ -336,8 +330,7 @@ public void deleteGame(String gameId) throws NotFoundException { /** * @param gameId * the {@link Game#getId()} value to match - * @return the specified {@link Game} instance (not wrapped in a - * {@link GameView}) + * @return the specified {@link Game} instance (not wrapped in a {@link GameView}) */ private Game getRawGame(String gameId) { // Look up the specified game. @@ -350,11 +343,11 @@ private Game getRawGame(String gameId) { /** * This method should only be used on web service requests annotated with - * @RolesAllowed({ SecurityRole.ID_USERS }), as it assumes that - * the request currently being processed is authenticated. - * - * @return the requestor's Account from {@link #securityContext}, which will - * have been set by the {@link AuthenticationFilter} + * @RolesAllowed({ SecurityRole.ID_USERS }), as it assumes that the request currently being processed + * is authenticated. + * + * @return the requestor's Account from {@link #securityContext}, which will have been set by the + * {@link AuthenticationFilter} */ private Account getUserAccount() { Account userAccount = securityContext.getUserPrincipal(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImpl.java index e56b0ddf..c6a94871 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImpl.java @@ -35,8 +35,7 @@ public GamesDaoImpl() { /** * @param entityManager - * a JPA {@link EntityManager} connected to the application's - * database + * a JPA {@link EntityManager} connected to the application's database */ @PersistenceContext public void setEntityManager(EntityManager entityManager) { @@ -119,8 +118,7 @@ public List getGamesForPlayer(Player player) { } /** - * @see com.justdavis.karl.rpstourney.service.app.game.IGamesDao#setMaxRounds(java.lang.String, - * int, int) + * @see com.justdavis.karl.rpstourney.service.app.game.IGamesDao#setMaxRounds(java.lang.String, int, int) */ @Override public Game setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsValue) { @@ -128,10 +126,9 @@ public Game setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsV Game.validateMaxRoundsValue(newMaxRoundsValue); /* - * Build an update query for the matching game. Note that in addition to - * matching against the game's ID, we also match against the current/old - * maxRounds value. This helps to prevent "mid-air collision" issues - * when multiple users/clients try to update this at the same time. + * Build an update query for the matching game. Note that in addition to matching against the game's ID, we also + * match against the current/old maxRounds value. This helps to prevent "mid-air collision" issues when multiple + * users/clients try to update this at the same time. */ CriteriaBuilder cb = entityManager.getEntityManagerFactory().getCriteriaBuilder(); CriteriaUpdate cu = cb.createCriteriaUpdate(Game.class); @@ -149,9 +146,8 @@ else if (numEntitiesUpdated > 1) throw new BadCodeMonkeyException(); /* - * The executeUpdate(...) above sidesteps the Hibernate entity cache, so - * the Game retrieved here will be stale. Calling refresh(...) fixes - * that. + * The executeUpdate(...) above sidesteps the Hibernate entity cache, so the Game retrieved here will be stale. + * Calling refresh(...) fixes that. */ Game game = findById(gameId); entityManager.refresh(game); @@ -164,10 +160,8 @@ else if (numEntitiesUpdated > 1) @Override public void delete(String gameId) { /* - * Note: I'd prefer to use a CriteriaDelete here, as it saves an extra - * query, but Hibernate 4 doesn't seem to correctly handle - * CascadeType.REMOVE with that API. - * https://hibernate.atlassian.net/browse/HHH-8993 + * Note: I'd prefer to use a CriteriaDelete here, as it saves an extra query, but Hibernate 4 doesn't seem to + * correctly handle CascadeType.REMOVE with that API. https://hibernate.atlassian.net/browse/HHH-8993 */ Game game = findById(gameId); entityManager.remove(game); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IGamesDao.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IGamesDao.java index e26d6922..c4906611 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IGamesDao.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IGamesDao.java @@ -8,39 +8,33 @@ import com.justdavis.karl.rpstourney.service.api.game.Player; /** - * A DAO for {@link Game} JPA entities (and indirectly, its child - * {@link GameRound} entities). + * A DAO for {@link Game} JPA entities (and indirectly, its child {@link GameRound} entities). */ public interface IGamesDao { /** * @param game - * the {@link Game} instance to be inserted/updated in the - * database + * the {@link Game} instance to be inserted/updated in the database */ void save(Game game); /** * @param gameId * the {@link Game#getId()} value to match against - * @return the {@link Game} that matches the specified parameters, or - * null if no match was found + * @return the {@link Game} that matches the specified parameters, or null if no match was found */ Game findById(String gameId); /** - * Note: This method is really only appropriate for use in testing; it's a - * bad idea to use it in production code. - * + * Note: This method is really only appropriate for use in testing; it's a bad idea to use it in production code. + * * @return all of the {@link Game} instances in the database */ List getGames(); /** * @param player - * the {@link Game#getPlayer1()} / {@link Game#getPlayer2()} - * value to match against - * @return the {@link Game}s that match the specified parameters, or an - * empty {@link List} if none are found + * the {@link Game#getPlayer1()} / {@link Game#getPlayer2()} value to match against + * @return the {@link Game}s that match the specified parameters, or an empty {@link List} if none are found */ List getGamesForPlayer(Player player); @@ -49,33 +43,29 @@ public interface IGamesDao { * Alters the value of {@link Game#getMaxRounds()}. *

*

- * This method must be used instead of {@link Game#setMaxRounds(int)} when - * the {@link Game} is being accessed concurrently from a JPA database. + * This method must be used instead of {@link Game#setMaxRounds(int)} when the {@link Game} is being accessed + * concurrently from a JPA database. *

- * + * * @param gameId * the {@link Game#getId()} of the {@link Game} to be modified * @param oldMaxRoundsValue - * the current value of {@link Game#getMaxRounds()} for the - * {@link Game} to be modified + * the current value of {@link Game#getMaxRounds()} for the {@link Game} to be modified * @param newMaxRoundsValue * the new/desired value for {@link Game#getMaxRounds()} - * @return Returns the updated {@link Game}. Please note that the - * {@link Game#getMaxRounds()} value returned may not match the one - * passed in, if another concurrent modification was made between - * this method's update and load operations. + * @return Returns the updated {@link Game}. Please note that the {@link Game#getMaxRounds()} value returned may not + * match the one passed in, if another concurrent modification was made between this method's update and + * load operations. * @throws GameConflictException - * A {@link GameConflictException} indicates that an attempt was - * made to call this method with a stale copy of the - * {@link Game}. Either oldMaxRoundsValue is stale, - * or the {@link Game#getState()} no longer allows for the - * rounds to be modified. + * A {@link GameConflictException} indicates that an attempt was made to call this method with a stale + * copy of the {@link Game}. Either oldMaxRoundsValue is stale, or the + * {@link Game#getState()} no longer allows for the rounds to be modified. */ Game setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsValue); /** * Removes/deletes the specified {@link Game} from the database. - * + * * @param gameId * the {@link Game#getId()} of the {@link Game} to be deleted */ diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IPlayersDao.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IPlayersDao.java index 818605f8..4714ca0a 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IPlayersDao.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/IPlayersDao.java @@ -19,19 +19,17 @@ public interface IPlayersDao { /** * @param playerId - * the {@link Player#getId()} value to find a matching - * {@link Player} for - * @return the existing {@link Player} record that matches the specified - * criteria, or null if no existing record was found + * the {@link Player#getId()} value to find a matching {@link Player} for + * @return the existing {@link Player} record that matches the specified criteria, or null if no + * existing record was found */ Player getPlayer(long playerId); /** * @param account - * the {@link Account} record to find a matching {@link Player} - * for - * @return the existing {@link Player} record that matches the specified - * criteria, or null if no existing record was found + * the {@link Account} record to find a matching {@link Player} for + * @return the existing {@link Player} record that matches the specified criteria, or null if no + * existing record was found */ Player findPlayerForAccount(Account account); @@ -44,11 +42,9 @@ public interface IPlayersDao { /** * @param account - * the {@link Account} record to find/create a matching - * {@link Player} for - * @return the existing {@link Player} record that matches the specified - * criteria, or a new matching {@link Player} record (if no existing - * record was found) + * the {@link Account} record to find/create a matching {@link Player} for + * @return the existing {@link Player} record that matches the specified criteria, or a new matching {@link Player} + * record (if no existing record was found) */ Player findOrCreatePlayerForAccount(Account account); @@ -59,9 +55,8 @@ public interface IPlayersDao { void delete(Player player); /** - * Note: This method is really only appropriate for use in testing; it's a - * bad idea to use it in production code. - * + * Note: This method is really only appropriate for use in testing; it's a bad idea to use it in production code. + * * @return all of the {@link Player} instances in the database */ List getPlayers(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImpl.java index 2768c4c4..1c75dcbd 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImpl.java @@ -35,8 +35,7 @@ public PlayersDaoImpl() { /** * @param entityManager - * a JPA {@link EntityManager} connected to the application's - * database + * a JPA {@link EntityManager} connected to the application's database */ @PersistenceContext public void setEntityManager(EntityManager entityManager) { @@ -73,8 +72,7 @@ public Player getPlayer(long playerId) { List results = query.getResultList(); /* - * The Player.id field should have a UNIQUE constraint, so this should - * only return 0 or 1 results. + * The Player.id field should have a UNIQUE constraint, so this should only return 0 or 1 results. */ if (results.isEmpty()) return null; @@ -131,9 +129,8 @@ public Player findOrCreatePlayerForAccount(Account account) { return existingPlayer; /* - * If the specified Account has already been persisted, look it up - * again, to ensure we have a managed copy of it (rather than a detached - * copy). + * If the specified Account has already been persisted, look it up again, to ensure we have a managed copy of it + * (rather than a detached copy). */ if (account.hasId()) account = entityManager.find(Account.class, account.getId()); @@ -154,10 +151,9 @@ public void delete(Player player) { /** * @param account - * the {@link Player#getHumanAccount()} value to find a matching - * {@link Player} for - * @return the existing {@link Player} record that matches the specified - * criteria, or null if no such record is found + * the {@link Player#getHumanAccount()} value to find a matching {@link Player} for + * @return the existing {@link Player} record that matches the specified criteria, or null if no such + * record is found */ private Player find(Account account) { if (account == null) @@ -177,8 +173,7 @@ private Player find(Account account) { List results = query.getResultList(); /* - * The Player.humanAccount field should have a UNIQUE constraint, so - * this should only return 0 or 1 results. + * The Player.humanAccount field should have a UNIQUE constraint, so this should only return 0 or 1 results. */ if (results.isEmpty()) return null; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImpl.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImpl.java index 43a77a82..5bafb730 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImpl.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImpl.java @@ -33,16 +33,15 @@ public class PlayersResourceImpl implements IPlayersResource { private IPlayersDao playersDao; /** - * This public, default, no-arg constructor is required by Spring (for - * request-scoped beans). + * This public, default, no-arg constructor is required by Spring (for request-scoped beans). */ public PlayersResourceImpl() { } /** * @param securityContext - * the {@link SecurityContext} for the request that the - * {@link PlayersResourceImpl} was instantiated to handle + * the {@link SecurityContext} for the request that the {@link PlayersResourceImpl} was instantiated to + * handle */ @Context public void setSecurityContext(SecurityContext securityContext) { @@ -90,11 +89,11 @@ public Set getPlayersForBuiltInAis(List ais) { /** * This method should only be used on web service requests annotated with - * @RolesAllowed({ SecurityRole.ID_USERS }), as it assumes that - * the request currently being processed is authenticated. - * - * @return the requestor's Account from {@link #securityContext}, which will - * have been set by the {@link AuthenticationFilter} + * @RolesAllowed({ SecurityRole.ID_USERS }), as it assumes that the request currently being processed + * is authenticated. + * + * @return the requestor's Account from {@link #securityContext}, which will have been set by the + * {@link AuthenticationFilter} */ private Account getUserAccount() { Account userAccount = securityContext.getUserPrincipal(); diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/package-info.java index 3ef2710f..57b31057 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/game/package-info.java @@ -1,6 +1,5 @@ /** - * Contains the web service implementation of - * {@link com.justdavis.karl.rpstourney.service.api.game.IGameResource}, and + * Contains the web service implementation of {@link com.justdavis.karl.rpstourney.service.api.game.IGameResource}, and * related code. */ -package com.justdavis.karl.rpstourney.service.app.game; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.app.game; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaInitializer.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaInitializer.java index 53fde919..0b8d11c3 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaInitializer.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaInitializer.java @@ -14,18 +14,15 @@ /** *

- * This Spring {@link Component} runs the application's - * {@link IDataSourceSchemaManager} during its bean initialization. + * This Spring {@link Component} runs the application's {@link IDataSourceSchemaManager} during its bean initialization. *

*

- * This is admittedly a bit of a hack. It would be more appropriate to run this - * after Spring initialization, but before the webapp context has completed - * startup (e.g. as a {@link ServletContextListener}). However, this proved to - * not be possible as Spring cannot lazy-load the application's - * {@link EntityManagerFactory}, which validates the schema as part of its - * initialization: the schema has to be populated before that happens. + * This is admittedly a bit of a hack. It would be more appropriate to run this after Spring initialization, but before + * the webapp context has completed startup (e.g. as a {@link ServletContextListener}). However, this proved to not be + * possible as Spring cannot lazy-load the application's {@link EntityManagerFactory}, which validates the schema as + * part of its initialization: the schema has to be populated before that happens. *

- * + * * @see SpringBindingsForDaos#schemaManager(com.justdavis.karl.misc.datasources.DataSourceConnectorsManager) */ @Component @@ -35,7 +32,7 @@ public class DatabaseSchemaInitializer { /** * Constructs a new {@link DatabaseSchemaInitializer} instance. - * + * * @param schemaManager * the injected {@link IDataSourceSchemaManager} to use * @param config @@ -49,9 +46,7 @@ public DatabaseSchemaInitializer(IDataSourceSchemaManager schemaManager, Service /** *

- * Runs - * {@link IDataSourceSchemaManager#createOrUpgradeSchema(IDataSourceCoordinates)} - * . + * Runs {@link IDataSourceSchemaManager#createOrUpgradeSchema(IDataSourceCoordinates)} . *

*

* This method will be called by Spring after the bean is constructed. diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/HibernateUserTypesIntegrator.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/HibernateUserTypesIntegrator.java index 68db6b58..f4233986 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/HibernateUserTypesIntegrator.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/HibernateUserTypesIntegrator.java @@ -10,20 +10,17 @@ /** *

- * A Hibernate plugin that registers the user type mappings provided by this - * project with Hibernate. + * A Hibernate plugin that registers the user type mappings provided by this project with Hibernate. *

*

* It's "plugged in" via Java's SPI mechanism; see - * src/main/resources/META-INF/services/org.hibernate.integrator.spi.Integrator - * . + * src/main/resources/META-INF/services/org.hibernate.integrator.spi.Integrator . *

*/ public class HibernateUserTypesIntegrator implements Integrator { /** * @see org.hibernate.integrator.spi.Integrator#integrate(org.hibernate.boot.Metadata, - * org.hibernate.engine.spi.SessionFactoryImplementor, - * org.hibernate.service.spi.SessionFactoryServiceRegistry) + * org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.service.spi.SessionFactoryServiceRegistry) */ @Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/SpringBindingsForJpa.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/SpringBindingsForJpa.java index a88411c4..388733a1 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/SpringBindingsForJpa.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/SpringBindingsForJpa.java @@ -28,8 +28,7 @@ @EnableTransactionManagement public class SpringBindingsForJpa { /** - * @return the Spring {@link JpaVendorAdapter} for the application's - * database + * @return the Spring {@link JpaVendorAdapter} for the application's database */ @Bean public JpaVendorAdapter jpaVendorAdapter() { @@ -41,26 +40,21 @@ public JpaVendorAdapter jpaVendorAdapter() { /** *

- * Creates the {@link LocalContainerEntityManagerFactoryBean} which - * manages/creates the application's JPA {@link EntityManagerFactory}. + * Creates the {@link LocalContainerEntityManagerFactoryBean} which manages/creates the application's JPA + * {@link EntityManagerFactory}. *

*

- * Note that the application's persistence.xml has set the - * Hibernate "schema creation" flag to "validate (not create) the schema". - * for this validation to succeed, the database schema must be - * created/updated before this Spring bean is created, which is why this - * method has a {@link DependsOn} annotation. + * Note that the application's persistence.xml has set the Hibernate "schema creation" flag to + * "validate (not create) the schema". for this validation to succeed, the database schema must be created/updated + * before this Spring bean is created, which is why this method has a {@link DependsOn} annotation. *

- * + * * @param dataSource - * the injected {@link DataSource} that the JPA - * {@link EntityManagerFactory} should be connected to + * the injected {@link DataSource} that the JPA {@link EntityManagerFactory} should be connected to * @param jpaVendorAdapter * the injected {@link JpaVendorAdapter} for the application - * @return the {@link LocalContainerEntityManagerFactoryBean} instance that - * Spring will use to inject the application's - * {@link EntityManagerFactory} and {@link EntityManager}s, when - * requested + * @return the {@link LocalContainerEntityManagerFactoryBean} instance that Spring will use to inject the + * application's {@link EntityManagerFactory} and {@link EntityManager}s, when requested */ @Bean @DependsOn({ "databaseSchemaInitializer" }) @@ -74,11 +68,9 @@ public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource da /** * @param entityManagerFactoryBean - * the injected {@link LocalContainerEntityManagerFactoryBean} - * that the {@link PlatformTransactionManager} will be associated - * with - * @return the {@link PlatformTransactionManager} that Spring will use for - * its managed transactions + * the injected {@link LocalContainerEntityManagerFactoryBean} that the + * {@link PlatformTransactionManager} will be associated with + * @return the {@link PlatformTransactionManager} that Spring will use for its managed transactions */ @Bean public PlatformTransactionManager transactionManager( @@ -89,9 +81,8 @@ public PlatformTransactionManager transactionManager( } /** - * @return a Spring {@link BeanPostProcessor} that enables the use of the - * JPA {@link PersistenceUnit} and {@link PersistenceContext} - * annotations for injection of {@link EntityManagerFactory} and + * @return a Spring {@link BeanPostProcessor} that enables the use of the JPA {@link PersistenceUnit} and + * {@link PersistenceContext} annotations for injection of {@link EntityManagerFactory} and * {@link EntityManager} instances, respectively, into beans */ @Bean @@ -100,20 +91,17 @@ public PersistenceAnnotationBeanPostProcessor persistenceAnnotationProcessor() { } /** - * @return a Spring {@link BeanPostProcessor} that enables Spring's data/JPA - * exception translation for any beans marked with Spring's - * @Repository annotation + * @return a Spring {@link BeanPostProcessor} that enables Spring's data/JPA exception translation for any beans + * marked with Spring's @Repository annotation */ @Bean public PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor() { /* - * FIXME This doesn't actually seem to be working, for some very - * frustrating, unknown reason. My best guess is that it has something - * to do with whatever's actually closing my transactions not being - * involved. Note that even marking my JAX-RS resources (the ones with - * - * @Transactional annotations) with @Repository doesn't seem to resolve - * the problem. + * FIXME This doesn't actually seem to be working, for some very frustrating, unknown reason. My best guess is + * that it has something to do with whatever's actually closing my transactions not being involved. Note that + * even marking my JAX-RS resources (the ones with + * + * @Transactional annotations) with @Repository doesn't seem to resolve the problem. */ return new PersistenceExceptionTranslationPostProcessor(); } diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/package-info.java index 62639b37..5e695304 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/jpa/package-info.java @@ -3,4 +3,4 @@ * This is the base package for code specific to JPA/Hibernate. *

*/ -package com.justdavis.karl.rpstourney.service.app.jpa; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.app.jpa; diff --git a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/package-info.java b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/package-info.java index 626db5f7..c12014f5 100644 --- a/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/package-info.java +++ b/rps-tourney-service-app/src/main/java/com/justdavis/karl/rpstourney/service/app/package-info.java @@ -1,8 +1,7 @@ /** *

* Contains the "entry point" for the game's webservice API, - * {@link com.justdavis.karl.rpstourney.service.app.GameServiceApplicationInitializer} - * , and associated classes. + * {@link com.justdavis.karl.rpstourney.service.app.GameServiceApplicationInitializer} , and associated classes. *

*/ -package com.justdavis.karl.rpstourney.service.app; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.app; diff --git a/rps-tourney-service-app/src/main/resources/liquibase-change-log.xml b/rps-tourney-service-app/src/main/resources/liquibase-change-log.xml index f716baca..c9dfdbcf 100644 --- a/rps-tourney-service-app/src/main/resources/liquibase-change-log.xml +++ b/rps-tourney-service-app/src/main/resources/liquibase-change-log.xml @@ -15,17 +15,15 @@ - + - + @@ -36,8 +34,8 @@ - + @@ -49,8 +47,7 @@ - + @@ -58,8 +55,7 @@ - + @@ -78,8 +74,7 @@ - + @@ -102,30 +97,27 @@ - + - + - + - + - + @@ -143,13 +135,12 @@ - - - + + + @@ -164,29 +155,23 @@ - + - + - + 7:90bcfccbd78b4aa501e0d2cbe5d8db8b - + - + @@ -197,7 +182,8 @@ INSERT INTO "LoginIdentities" ("id", "accountId", "createdTimestamp") - SELECT "id", "accountId", '2015-01-19 12:00:00 + SELECT "id", "accountId", + '2015-01-19 12:00:00 America/New_York' FROM "GuestLoginIdentities"; @@ -210,8 +196,8 @@ DELETE FROM "GameLoginIdentities"; + referencedTableName="LoginIdentities" baseColumnNames="id" baseTableName="GameLoginIdentities" + referencedColumnNames="id" /> @@ -226,8 +212,7 @@ - + @@ -242,29 +227,24 @@ + foreignKeyName="AuditAccountLoginMergesToAuditAccountMerges" referencedTableName="AuditAccountMerges" /> - - + - - + @@ -294,51 +274,41 @@ - + - + baseTableName="AccountRoles" baseColumnNames="accountId" referencedTableName="Accounts" referencedColumnNames="id" /> + - - - - + baseTableName="GuestLoginIdentities" baseColumnNames="id" referencedTableName="LoginIdentities" + referencedColumnNames="id" /> + + + + + baseTableName="LoginIdentities" baseColumnNames="accountId" referencedTableName="Accounts" referencedColumnNames="id" /> - + - + baseTableName="AuditAccountGameMerges" baseColumnNames="${fkColumnName.Game.id}" referencedTableName="Games" + referencedColumnNames="id" /> @@ -362,7 +332,7 @@ - + diff --git a/rps-tourney-service-app/src/main/resources/logback.xml b/rps-tourney-service-app/src/main/resources/logback.xml index 9418186e..6b93137f 100644 --- a/rps-tourney-service-app/src/main/resources/logback.xml +++ b/rps-tourney-service-app/src/main/resources/logback.xml @@ -2,10 +2,8 @@ - - + + ${rps.service.logs.path:-./logs}/${project.artifactId}.log @@ -18,23 +16,17 @@ - - + + - - - + + + - \ No newline at end of file + diff --git a/rps-tourney-service-app/src/main/webapp/WEB-INF/web.xml b/rps-tourney-service-app/src/main/webapp/WEB-INF/web.xml index 0d4824a9..03db0588 100644 --- a/rps-tourney-service-app/src/main/webapp/WEB-INF/web.xml +++ b/rps-tourney-service-app/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,7 @@ - + diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/MockUriInfo.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/MockUriInfo.java index e84c3071..35c617e8 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/MockUriInfo.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/MockUriInfo.java @@ -9,8 +9,7 @@ import javax.ws.rs.core.UriInfo; /** - * A mock implementation of {@link UriInfo} for use in tests. Any methods needed - * in a given test should be overridden. + * A mock implementation of {@link UriInfo} for use in tests. Any methods needed in a given test should be overridden. */ public class MockUriInfo implements UriInfo { /** diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/NotFoundErrorsIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/NotFoundErrorsIT.java index e92611c9..29fdfff7 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/NotFoundErrorsIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/NotFoundErrorsIT.java @@ -19,9 +19,8 @@ import com.justdavis.karl.misc.jetty.EmbeddedServer; /** - * Integration tests to verify that - * HTTP 404 errors are - * handled properly. + * Integration tests to verify that HTTP 404 errors are handled + * properly. */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { SpringBindingsForWebServiceITs.class }) @@ -32,11 +31,9 @@ public final class NotFoundErrorsIT { private EmbeddedServer server; /** - * Ensures that an HTTP 404 is returned as expected when requesting an - * invalid URL. This is a regression test case for - * Issue - * #108: Web service throws 500 errors at AuthenticationFilter:137 if a 404 - * is encountered. + * Ensures that an HTTP 404 is returned as expected when requesting an invalid URL. This is a regression test case + * for Issue #108: Web service throws 500 errors at + * AuthenticationFilter:137 if a 404 is encountered. */ @Test public void return404ForBadUrls() { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaoITs.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaoITs.java index beb5efca..437b17e0 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaoITs.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForDaoITs.java @@ -13,9 +13,8 @@ import com.justdavis.karl.misc.datasources.provisioners.XmlProvisioningTargetsProvider; /** - * The Spring {@link Configuration} for the Spring bindings to use in - * {@link SpringProfile#INTEGRATION_TESTS} (and also the - * {@link SpringProfile#INTEGRATION_TESTS_WITH_JETTY}). + * The Spring {@link Configuration} for the Spring bindings to use in {@link SpringProfile#INTEGRATION_TESTS} (and also + * the {@link SpringProfile#INTEGRATION_TESTS_WITH_JETTY}). */ @Configuration @Import(SpringBindingsForDaos.class) @@ -23,16 +22,14 @@ public class SpringBindingsForDaoITs { /** * @param provisionersManager - * the injected {@link DataSourceConnectorsManager} for the - * application + * the injected {@link DataSourceConnectorsManager} for the application * @return the {@link IProvisioningTargetsProvider} for the application */ @Bean IProvisioningTargetsProvider targetsProvider(DataSourceProvisionersManager provisionersManager) { /* - * The src/test/resources/datasource-provisioning-targets.xml file - * contains the location of the database servers that we can provision - * databases onto as part of our tests. + * The src/test/resources/datasource-provisioning-targets.xml file contains the location of the database servers + * that we can provision databases onto as part of our tests. */ URL availableTargetsUrl = Thread.currentThread().getContextClassLoader() .getResource("datasource-provisioning-targets.xml"); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServiceITs.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServiceITs.java index 2dadcb5e..d6ee1f5e 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServiceITs.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/SpringBindingsForWebServiceITs.java @@ -16,15 +16,13 @@ /** *

- * This Spring {@link Configuration} should be used for integration tests that - * require the web service to actually be running and responding to requests. It - * adds a bean that will start a Jetty instance along with the Spring + * This Spring {@link Configuration} should be used for integration tests that require the web service to actually be + * running and responding to requests. It adds a bean that will start a Jetty instance along with the Spring * {@link ApplicationContext}, and stop it when the context is stopped. *

*

- * It also {@link Import}s the following additional {@link Configuration}s: - * {@link AppConfigBindingsForITs} and {@link SpringBindingsForWebServices} - * (which itself imports others). + * It also {@link Import}s the following additional {@link Configuration}s: {@link AppConfigBindingsForITs} and + * {@link SpringBindingsForWebServices} (which itself imports others). *

*/ @Configuration @@ -33,8 +31,7 @@ public class SpringBindingsForWebServiceITs { /** * @param dsConnectorsManager - * the injected {@link DataSourceConnectorsManager} for the - * application + * the injected {@link DataSourceConnectorsManager} for the application * @return the {@link IConfigLoader} implementation for the application */ @Bean @@ -44,11 +41,9 @@ IConfigLoader configLoader(DataSourceConnectorsManager dsConnectorsManager) { /** * @param springContext - * the Spring {@link ApplicationContext} that this bean is being - * created in/for - * @return an {@link EmbeddedServer} bean that will start up a Jetty - * container along with the Spring {@link ApplicationContext}, and - * will stop it when the {@link ApplicationContext} is destroyed + * the Spring {@link ApplicationContext} that this bean is being created in/for + * @return an {@link EmbeddedServer} bean that will start up a Jetty container along with the Spring + * {@link ApplicationContext}, and will stop it when the {@link ApplicationContext} is destroyed */ @Bean(initMethod = "startServer", destroyMethod = "stopServer") public EmbeddedServer embeddedServer(ApplicationContext springContext) { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/WebClientHelper.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/WebClientHelper.java index 3f6da48b..5996f1e5 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/WebClientHelper.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/WebClientHelper.java @@ -17,22 +17,19 @@ */ public final class WebClientHelper { /* - * These methods may or may not be being used at the moment, but they have - * all been used at one point or another while trying things out and/or - * debugging issues, and they took forever to write. Deleting them would - * probably not be a great idea. + * These methods may or may not be being used at the moment, but they have all been used at one point or another + * while trying things out and/or debugging issues, and they took forever to write. Deleting them would probably not + * be a great idea. */ /** - * Enables/disables the {@link WebClient}'s session maintenance, which will - * persist cookies and other state between web client calls. Defaults to - * false. - * + * Enables/disables the {@link WebClient}'s session maintenance, which will persist cookies and other state between + * web client calls. Defaults to false. + * * @param client * the {@link WebClient} to modify * @param maintainSession - * true to enable session maintenance, - * false to disable it + * true to enable session maintenance, false to disable it */ public static void enableSessionMaintenance(WebClient client, boolean maintainSession) { WebClient.getConfig(client).getRequestContext().put(org.apache.cxf.message.Message.MAINTAIN_SESSION, @@ -40,15 +37,13 @@ public static void enableSessionMaintenance(WebClient client, boolean maintainSe } /** - * Enables/disables the {@link WebClient}'s "permissive SSL trust" mode, - * which will accept any/all server SSL certificates, regardless of their - * validity. Defaults to false. - * + * Enables/disables the {@link WebClient}'s "permissive SSL trust" mode, which will accept any/all server SSL + * certificates, regardless of their validity. Defaults to false. + * * @param client * the {@link WebClient} to modify * @param permissiveSslTrustMode - * true to enable "permissive SSL trust", - * false to disable it + * true to enable "permissive SSL trust", false to disable it */ public static void enablePermissiveSslTrustMode(WebClient client, boolean permissiveSslTrustMode) { // Grab the WebClient's config. @@ -74,7 +69,7 @@ public static void enablePermissiveSslTrustMode(WebClient client, boolean permis /** * Copies the {@link Cookie}s from one {@link WebClient} to another. - * + * * @param sourceClient * the {@link WebClient} to copy from * @param targetClient @@ -91,9 +86,8 @@ public static void copyCookies(WebClient sourceClient, WebClient targetClient) { * Do not use this class in production! *

*

- * This {@link X509TrustManager} implementation can be used by clients, and - * will accept all server certificates, regardless of their actual - * validity. + * This {@link X509TrustManager} implementation can be used by clients, and will accept all server + * certificates, regardless of their actual validity. *

*/ private static final class PermissiveX509TrustManager implements X509TrustManager { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImplIT.java index 68736bb5..21132d2e 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsDaoImplIT.java @@ -54,10 +54,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class AccountsDaoImplIT { /** - * @return the test run parameters to pass to - * {@link #AccountsDaoImplIT(IProvisioningRequest)}, where each - * top-level element in the returned {@link Collection} represents a - * test run + * @return the test run parameters to pass to {@link #AccountsDaoImplIT(IProvisioningRequest)}, where each top-level + * element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -77,28 +75,25 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link AccountsDaoImplIT} instance. The test runner will - * generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link AccountsDaoImplIT} instance. The test runner will generate the parameters to pass to this + * from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public AccountsDaoImplIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); @@ -325,10 +320,9 @@ public void selectOrCreateAuthToken() { } /** - * Tests {@link AccountsDaoImpl} to ensure that - * {@link AuthToken#getCreatedTimestamp()} is persisted as a legitimate SQL - * type (and not just a binary or character field). - * + * Tests {@link AccountsDaoImpl} to ensure that {@link AuthToken#getCreatedTimestamp()} is persisted as a legitimate + * SQL type (and not just a binary or character field). + * * @throws SQLException * (shouldn't happen) */ @@ -361,10 +355,8 @@ public void authTokenCreationTimestampSqlType() throws SQLException { /** * @param resourcePath - * the path of the classpath resource file to unmarshall the - * {@link Account} from - * @return an {@link Account} instance, as unmarshalled from the specified - * resource file + * the path of the classpath resource file to unmarshall the {@link Account} from + * @return an {@link Account} instance, as unmarshalled from the specified resource file */ private static Account loadAccount(String resourcePath) { try { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplIT.java index 5df6f88a..e4463d7e 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplIT.java @@ -65,24 +65,21 @@ public void wipeSchema() { } /** - * Ensures that {@link AccountsResourceImpl#validateAuth()} returns - * {@link Status#UNAUTHORIZED} as expected when called without - * authentication. + * Ensures that {@link AccountsResourceImpl#validateAuth()} returns {@link Status#UNAUTHORIZED} as expected when + * called without authentication. */ @Test public void validateGuestLoginDenied() { /* - * Just a note: the AccountsResourceImpl will never even be run if - * everything is working correctly. Instead, the AuthorizationFilter - * will handle this. + * Just a note: the AccountsResourceImpl will never even be run if everything is working correctly. Instead, the + * AuthorizationFilter will handle this. */ ClientConfig clientConfig = new ClientConfig(server.getServerBaseAddress()); CookieStore cookieStore = new CookieStore(); /* - * Attempt to validate the login, which should fail with an HTTP 401 - * Unauthorized error. + * Attempt to validate the login, which should fail with an HTTP 401 Unauthorized error. */ AccountsClient accountsClient = new AccountsClient(clientConfig, cookieStore); expectedException.expect(HttpClientException.class); @@ -91,9 +88,8 @@ public void validateGuestLoginDenied() { } /** - * Ensures that {@link AccountsResourceImpl#validateAuth()} works as - * expected when used with an {@link Account} created via - * {@link GuestAuthResourceImpl#loginAsGuest()}. + * Ensures that {@link AccountsResourceImpl#validateAuth()} works as expected when used with an {@link Account} + * created via {@link GuestAuthResourceImpl#loginAsGuest()}. */ @Test public void createAndValidateGuestLogin() { @@ -118,8 +114,8 @@ public void createAndValidateGuestLogin() { } /** - * Ensures that {@link AccountsResourceImpl#updateAccount(Account)} works as - * expected to modify an already-existing {@link Account}. + * Ensures that {@link AccountsResourceImpl#updateAccount(Account)} works as expected to modify an already-existing + * {@link Account}. */ @Test public void updateAccount() { @@ -148,9 +144,8 @@ public void updateAccount() { Assert.assertEquals(originalAuthToken.getToken(), copyOfAuthToken.getToken()); /* - * Pull the Account again and verify that the changes are still there. - * (Basically making sure that the TX was committed, which I had screwed - * up at one point.) + * Pull the Account again and verify that the changes are still there. (Basically making sure that the TX was + * committed, which I had screwed up at one point.) */ Account copyOfAccount = accountsClient.getAccount(); Assert.assertEquals(createdAccount.getId(), copyOfAccount.getId()); @@ -158,9 +153,7 @@ public void updateAccount() { } /** - * Ensures that the bean validation on - * {@link AccountsResourceImpl#updateAccount(Account)} is working as - * expected. + * Ensures that the bean validation on {@link AccountsResourceImpl#updateAccount(Account)} is working as expected. */ @Test public void updateAccountValidation() { @@ -173,8 +166,7 @@ public void updateAccountValidation() { Account createdAccount = guestAuthClient.loginAsGuest(); /* - * Set the Account.name to something invalid and try to apply that. This - * should go boom with an HTTP 400. + * Set the Account.name to something invalid and try to apply that. This should go boom with an HTTP 400. */ createdAccount.setName(""); BadRequestException error = null; @@ -188,9 +180,8 @@ public void updateAccountValidation() { } /** - * Ensures that {@link AccountsResourceImpl#selectOrCreateAuthToken()} works - * as expected when used with an {@link Account} created via - * {@link GuestAuthResourceImpl#loginAsGuest()}. + * Ensures that {@link AccountsResourceImpl#selectOrCreateAuthToken()} works as expected when used with an + * {@link Account} created via {@link GuestAuthResourceImpl#loginAsGuest()}. */ @Test public void selectOrCreateAuthToken() { @@ -210,8 +201,7 @@ public void selectOrCreateAuthToken() { } /** - * Ensures that {@link AccountsResourceImpl#mergeAccount(Account)} works as - * expected. + * Ensures that {@link AccountsResourceImpl#mergeAccount(Account)} works as expected. */ @Test public void mergeAccount() { @@ -236,8 +226,7 @@ public void mergeAccount() { Account targetAccount = targetGuestAuthClient.loginAsGuest(); /* - * Merge the source Account and associated objects to the target - * Account. + * Merge the source Account and associated objects to the target Account. */ targetAccountsClient.mergeAccount(targetAccount.getId(), sourceAuthToken.getToken()); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplTest.java index 168abef2..f353dfe5 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AccountsResourceImplTest.java @@ -15,8 +15,7 @@ */ public final class AccountsResourceImplTest { /** - * Ensures that {@link AccountsResourceImpl#validateAuth()} works as - * expected. + * Ensures that {@link AccountsResourceImpl#validateAuth()} works as expected. */ @Test public void validateAuth() { @@ -37,8 +36,7 @@ public void validateAuth() { } /** - * Ensures that {@link AccountsResourceImpl#selectOrCreateAuthToken()} works - * as expected. + * Ensures that {@link AccountsResourceImpl#selectOrCreateAuthToken()} works as expected. */ @Test public void selectOrCreateAuthToken() throws AddressException { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializerIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializerIT.java index acc7008f..4ca0202e 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializerIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AdminAccountInitializerIT.java @@ -52,11 +52,9 @@ public void wipeSchema() { } /** - * Ensures that - * {@link AdminAccountInitializer#contextInitialized(javax.servlet.ServletContextEvent)} - * is being fired at application startup, and creating the default admin - * account, as expected. - * + * Ensures that {@link AdminAccountInitializer#contextInitialized(javax.servlet.ServletContextEvent)} is being fired + * at application startup, and creating the default admin account, as expected. + * * @throws AddressException * (won't happen; address is hardcoded) */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthenticationFilterTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthenticationFilterTest.java index bfb6470d..19662919 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthenticationFilterTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthenticationFilterTest.java @@ -37,10 +37,9 @@ */ public class AuthenticationFilterTest { /** - * Ensures that {@link AuthenticationFilter} sets the - * {@link SecurityContext} and {@link AccountSecurityContext} as expected - * when an authentication token is provided. - * + * Ensures that {@link AuthenticationFilter} sets the {@link SecurityContext} and {@link AccountSecurityContext} as + * expected when an authentication token is provided. + * * @throws IOException * (not expected to be thrown) */ @@ -71,10 +70,9 @@ public void filterRequestForAuth() throws IOException { } /** - * Ensures that {@link AuthenticationFilter} sets the - * {@link SecurityContext} and {@link AccountSecurityContext} as expected - * when no authentication token is provided. - * + * Ensures that {@link AuthenticationFilter} sets the {@link SecurityContext} and {@link AccountSecurityContext} as + * expected when no authentication token is provided. + * * @throws IOException * (not expected to be thrown) */ @@ -98,9 +96,9 @@ public void filterRequestForNoAuth() throws IOException { } /** - * Ensures that {@link AuthenticationFilter} updates the auth token cookie - * in the response when an {@link Account} is authenticated for the request. - * + * Ensures that {@link AuthenticationFilter} updates the auth token cookie in the response when an {@link Account} + * is authenticated for the request. + * * @throws IOException * (not expected to be thrown) */ @@ -134,9 +132,9 @@ public void filterResponseForAuth() throws IOException { } /** - * Ensures that {@link AuthenticationFilter} updates the auth token cookie - * in the response when no {@link Account} is authenticated for the request. - * + * Ensures that {@link AuthenticationFilter} updates the auth token cookie in the response when no {@link Account} + * is authenticated for the request. + * * @throws IOException * (not expected to be thrown) */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilterTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilterTest.java index af9818bf..f1904eee 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilterTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/AuthorizationFilterTest.java @@ -23,13 +23,12 @@ import com.justdavis.karl.rpstourney.service.app.auth.AuthorizationFilter.AuthorizationFilterFeature; /** - * Unit tests for {@link AuthorizationFilter} and - * {@link AuthorizationFilterFeature}. + * Unit tests for {@link AuthorizationFilter} and {@link AuthorizationFilterFeature}. */ public class AuthorizationFilterTest { /** - * Tests {@link AuthorizationFilterFeature} against a resource with the - * {@link RolesAllowed} annotation just on its class. + * Tests {@link AuthorizationFilterFeature} against a resource with the {@link RolesAllowed} annotation just on its + * class. */ @Test public void configureForRoles() { @@ -47,8 +46,8 @@ public void configureForRoles() { } /** - * Tests {@link AuthorizationFilterFeature} against a resource with the - * {@link RolesAllowed} annotation on both its class and method. + * Tests {@link AuthorizationFilterFeature} against a resource with the {@link RolesAllowed} annotation on both its + * class and method. */ @Test public void configureForOverriddenRoles() { @@ -66,8 +65,7 @@ public void configureForOverriddenRoles() { } /** - * Tests {@link AuthorizationFilterFeature} against a resource with the - * {@link PermitAll} annotation on its method. + * Tests {@link AuthorizationFilterFeature} against a resource with the {@link PermitAll} annotation on its method. */ @Test public void configureForPermitAll() { @@ -83,8 +81,7 @@ public void configureForPermitAll() { } /** - * Tests {@link AuthorizationFilterFeature} against a resource with the - * {@link DenyAll} annotation on its method. + * Tests {@link AuthorizationFilterFeature} against a resource with the {@link DenyAll} annotation on its method. */ @Test public void configureForDenyAll() { @@ -102,9 +99,8 @@ public void configureForDenyAll() { } /** - * Tests {@link AuthorizationFilter} to see if its denies requests, when - * expected. - * + * Tests {@link AuthorizationFilter} to see if its denies requests, when expected. + * * @throws IOException * (not expected to be thrown) */ @@ -124,9 +120,8 @@ public void filterToDeny() throws IOException { } /** - * Tests {@link AuthorizationFilter} to see if its allows requests, when - * expected. - * + * Tests {@link AuthorizationFilter} to see if its allows requests, when expected. + * * @throws IOException * (not expected to be thrown) */ @@ -181,12 +176,12 @@ private static final class MockResourceInfo implements ResourceInfo { /** * Constructs a new {@link MockResourceInfo} implementation. - * + * * @param resourceClass * the value to use for {@link #getResourceClass()} * @param resourceMethodName - * the name of the {@link Method} in the specified - * {@link Class} to use for {@link #getResourceMethod()} + * the name of the {@link Method} in the specified {@link Class} to use for + * {@link #getResourceMethod()} */ public MockResourceInfo(Class resourceClass, String resourceMethodName) { this.resourceClass = resourceClass; @@ -233,8 +228,7 @@ public Configuration getConfiguration() { } /** - * @see javax.ws.rs.core.Configurable#property(java.lang.String, - * java.lang.Object) + * @see javax.ws.rs.core.Configurable#property(java.lang.String, java.lang.Object) */ @Override public FeatureContext property(String name, Object value) { @@ -258,8 +252,7 @@ public FeatureContext register(Class componentClass, int priority) { } /** - * @see javax.ws.rs.core.Configurable#register(java.lang.Class, - * java.lang.Class[]) + * @see javax.ws.rs.core.Configurable#register(java.lang.Class, java.lang.Class[]) */ @Override public FeatureContext register(Class componentClass, Class... contracts) { @@ -267,8 +260,7 @@ public FeatureContext register(Class componentClass, Class... contracts) { } /** - * @see javax.ws.rs.core.Configurable#register(java.lang.Class, - * java.util.Map) + * @see javax.ws.rs.core.Configurable#register(java.lang.Class, java.util.Map) */ @Override public FeatureContext register(Class componentClass, Map, Integer> contracts) { @@ -293,8 +285,7 @@ public FeatureContext register(Object component, int priority) { } /** - * @see javax.ws.rs.core.Configurable#register(java.lang.Object, - * java.lang.Class[]) + * @see javax.ws.rs.core.Configurable#register(java.lang.Object, java.lang.Class[]) */ @Override public FeatureContext register(Object component, Class... contracts) { @@ -302,8 +293,7 @@ public FeatureContext register(Object component, Class... contracts) { } /** - * @see javax.ws.rs.core.Configurable#register(java.lang.Object, - * java.util.Map) + * @see javax.ws.rs.core.Configurable#register(java.lang.Object, java.util.Map) */ @Override public FeatureContext register(Object component, Map, Integer> contracts) { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockAccountsDao.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockAccountsDao.java index 4d9d9be0..267bcd5d 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockAccountsDao.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockAccountsDao.java @@ -9,8 +9,7 @@ import com.justdavis.karl.rpstourney.service.api.auth.AuthToken; /** - * A mock {@link IAccountsDao} implementation for use in tests. Stores - * {@link Account} instances in-memory. + * A mock {@link IAccountsDao} implementation for use in tests. Stores {@link Account} instances in-memory. */ public final class MockAccountsDao implements IAccountsDao { public final List accounts = new ArrayList<>(); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockContainerRequestContext.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockContainerRequestContext.java index 637b47a0..24aa612a 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockContainerRequestContext.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/MockContainerRequestContext.java @@ -46,8 +46,7 @@ public Collection getPropertyNames() { } /** - * @see javax.ws.rs.container.ContainerRequestContext#setProperty(java.lang.String, - * java.lang.Object) + * @see javax.ws.rs.container.ContainerRequestContext#setProperty(java.lang.String, java.lang.Object) */ @Override public void setProperty(String name, Object object) { @@ -87,8 +86,7 @@ public void setRequestUri(URI requestUri) throws IllegalStateException { } /** - * @see javax.ws.rs.container.ContainerRequestContext#setRequestUri(java.net.URI, - * java.net.URI) + * @see javax.ws.rs.container.ContainerRequestContext#setRequestUri(java.net.URI, java.net.URI) */ @Override public void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException { @@ -240,10 +238,10 @@ public void abortWith(Response response) { } /** - * @return the {@link Response} passed to {@link #abortWith(Response)}, or - * null if that hasn't been called at all + * @return the {@link Response} passed to {@link #abortWith(Response)}, or null if that hasn't been + * called at all */ Response getAbortResponse() { return abortResponse; } -} \ No newline at end of file +} diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplIT.java index 5008968b..d21495b2 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplIT.java @@ -56,9 +56,8 @@ public void wipeSchema() { } /** - * Ensures that {@link GameAuthResourceImpl} creates new - * {@link GameLoginIdentity}s as expected. - * + * Ensures that {@link GameAuthResourceImpl} creates new {@link GameLoginIdentity}s as expected. + * * @throws AddressException * (should not occur if test is successful) */ @@ -88,10 +87,9 @@ public void createAndValidateLogin() throws AddressException { } /** - * Ensures that {@link GameAuthResourceImpl} creates new - * {@link GameLoginIdentity}s as expected when they're being added to an - * existing account. - * + * Ensures that {@link GameAuthResourceImpl} creates new {@link GameLoginIdentity}s as expected when they're being + * added to an existing account. + * * @throws AddressException * (should not occur if test is successful) */ @@ -114,10 +112,8 @@ public void createLoginForExistingAccount() throws AddressException { } /** - * Ensures that - * {@link GameAuthResourceImpl#loginWithGameAccount(InternetAddress, String)} - * works as expected. - * + * Ensures that {@link GameAuthResourceImpl#loginWithGameAccount(InternetAddress, String)} works as expected. + * * @throws AddressException * (should not occur if test is successful) */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplTest.java index 2c13ba98..1d3eca7c 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameAuthResourceImplTest.java @@ -21,9 +21,8 @@ */ public final class GameAuthResourceImplTest { /** - * Ensures that {@link GameAuthResourceImpl} creates new - * {@link GameLoginIdentity}s as expected. - * + * Ensures that {@link GameAuthResourceImpl} creates new {@link GameLoginIdentity}s as expected. + * * @throws AddressException * (should not occur if test is successful) */ @@ -51,10 +50,9 @@ public void createLogin() throws AddressException { } /** - * Ensures that - * {@link GameAuthResourceImpl#createGameLogin(InternetAddress, String)} - * behaves as expected when the user/client already has an active login. - * + * Ensures that {@link GameAuthResourceImpl#createGameLogin(InternetAddress, String)} behaves as expected when the + * user/client already has an active login. + * * @throws AddressException * (should not occur if test is successful) */ @@ -90,10 +88,9 @@ public void createLoginWithAuthToken() throws AddressException { } /** - * Ensures that - * {@link GameAuthResourceImpl#loginWithGameAccount(InternetAddress, String)} - * behaves as expected when the user/client is not already logged in. - * + * Ensures that {@link GameAuthResourceImpl#loginWithGameAccount(InternetAddress, String)} behaves as expected when + * the user/client is not already logged in. + * * @throws AddressException * (should not occur if test is successful) */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImplIT.java index f8e13d3d..d6f3f185 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/GameLoginIdentitiesDaoImplIT.java @@ -36,10 +36,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class GameLoginIdentitiesDaoImplIT { /** - * @return the test run parameters to pass to - * {@link #GameLoginIdentitiesDaoImplIT(IProvisioningRequest)}, - * where each top-level element in the returned {@link Collection} - * represents a test run + * @return the test run parameters to pass to {@link #GameLoginIdentitiesDaoImplIT(IProvisioningRequest)}, where + * each top-level element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -59,28 +57,25 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link GameLoginIdentitiesDaoImplIT} instance. The test - * runner will generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link GameLoginIdentitiesDaoImplIT} instance. The test runner will generate the parameters to + * pass to this from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public GameLoginIdentitiesDaoImplIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); @@ -88,7 +83,7 @@ public GameLoginIdentitiesDaoImplIT(IProvisioningRequest provisioningRequest) th /** * Tests {@link GameLoginIdentitiesDaoImpl#save(GameLoginIdentity)}. - * + * * @throws AddressException * (shouldn't happen) */ @@ -134,7 +129,7 @@ public void save() throws AddressException { /** * Tests {@link GameLoginIdentitiesDaoImpl#find(InternetAddress)}. - * + * * @throws AddressException * (shouldn't happen) */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/MockGameLoginIdentitiesDao.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/MockGameLoginIdentitiesDao.java index b6ea0bb5..ba55cdba 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/MockGameLoginIdentitiesDao.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/game/MockGameLoginIdentitiesDao.java @@ -11,8 +11,8 @@ import com.justdavis.karl.rpstourney.service.app.auth.guest.IGuestLoginIndentitiesDao; /** - * A mock {@link IGuestLoginIndentitiesDao} implementation for use in tests. - * Stores {@link GuestLoginIdentity} instances in-memory. + * A mock {@link IGuestLoginIndentitiesDao} implementation for use in tests. Stores {@link GuestLoginIdentity} instances + * in-memory. */ public final class MockGameLoginIdentitiesDao implements IGameLoginIndentitiesDao { public final List logins = new ArrayList<>(); @@ -20,7 +20,7 @@ public final class MockGameLoginIdentitiesDao implements IGameLoginIndentitiesDa /** * Constructs a new {@link MockGameLoginIdentitiesDao} instance. - * + * * @param accountsDao * the {@link MockAccountsDao} instance that's also being used */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplIT.java index fc7d3435..097e4e27 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplIT.java @@ -35,8 +35,7 @@ public final class GuestAuthResourceImplIT { private IGuestLoginIndentitiesDao loginsDao; /** - * Ensures that {@link GuestAuthResourceImpl} creates new - * {@link GuestLoginIdentity}s as expected. + * Ensures that {@link GuestAuthResourceImpl} creates new {@link GuestLoginIdentity}s as expected. */ @Test public void createLogin() { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplTest.java index b18ef9ba..59a792de 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestAuthResourceImplTest.java @@ -22,8 +22,7 @@ public final class GuestAuthResourceImplTest { public ExpectedException expectedException = ExpectedException.none(); /** - * Ensures that {@link GuestAuthResourceImpl} creates new - * {@link GuestLoginIdentity}s as expected. + * Ensures that {@link GuestAuthResourceImpl} creates new {@link GuestLoginIdentity}s as expected. */ @Test public void createLogin() { @@ -49,8 +48,8 @@ public void createLogin() { } /** - * Ensures that {@link GuestAuthResourceImpl#loginAsGuest()} behaves as - * expected when the user/client already has an active login. + * Ensures that {@link GuestAuthResourceImpl#loginAsGuest()} behaves as expected when the user/client already has an + * active login. */ @Test public void existingLogin() { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImplIT.java index 9ddaf132..7b53c6ed 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/GuestLoginIdentitiesDaoImplIT.java @@ -35,10 +35,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class GuestLoginIdentitiesDaoImplIT { /** - * @return the test run parameters to pass to - * {@link #AccountsDaoImplIT(IProvisioningRequest)}, where each - * top-level element in the returned {@link Collection} represents a - * test run + * @return the test run parameters to pass to {@link #AccountsDaoImplIT(IProvisioningRequest)}, where each top-level + * element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -58,28 +56,25 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link AccountsDaoImplIT} instance. The test runner will - * generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link AccountsDaoImplIT} instance. The test runner will generate the parameters to pass to this + * from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public GuestLoginIdentitiesDaoImplIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/MockGuestLoginIdentitiesDao.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/MockGuestLoginIdentitiesDao.java index d80d7881..63b4857a 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/MockGuestLoginIdentitiesDao.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/auth/guest/MockGuestLoginIdentitiesDao.java @@ -7,8 +7,8 @@ import com.justdavis.karl.rpstourney.service.app.auth.MockAccountsDao; /** - * A mock {@link IGuestLoginIndentitiesDao} implementation for use in tests. - * Stores {@link GuestLoginIdentity} instances in-memory. + * A mock {@link IGuestLoginIndentitiesDao} implementation for use in tests. Stores {@link GuestLoginIdentity} instances + * in-memory. */ public final class MockGuestLoginIdentitiesDao implements IGuestLoginIndentitiesDao { public final List logins = new ArrayList<>(); @@ -16,7 +16,7 @@ public final class MockGuestLoginIdentitiesDao implements IGuestLoginIndentities /** * Constructs a new {@link MockGuestLoginIdentitiesDao} instance. - * + * * @param accountsDao * the {@link MockAccountsDao} instance that's also being used */ diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/MockConfigLoader.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/MockConfigLoader.java index b25092d1..c515e8f7 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/MockConfigLoader.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/MockConfigLoader.java @@ -9,24 +9,22 @@ import com.justdavis.karl.misc.datasources.provisioners.hsql.HsqlProvisioningTarget; /** - * An {@link IConfigLoader} that is intended for use with the application's - * integration tests. + * An {@link IConfigLoader} that is intended for use with the application's integration tests. */ public final class MockConfigLoader implements IConfigLoader { private final ServiceConfig config; /** * Constructs a new {@link MockConfigLoader} instance. - * + * * @param dsConnectorsManager * the application's {@link DataSourceConnectorsManager} */ @Inject public MockConfigLoader(DataSourceConnectorsManager dsConnectorsManager) { /* - * Once ServiceConfig has more to it than just a set of DB coords, I'd - * recommend loading the rest of the config from an XML file using a - * separate (customized) XmlConfigLoader instance. + * Once ServiceConfig has more to it than just a set of DB coords, I'd recommend loading the rest of the config + * from an XML file using a separate (customized) XmlConfigLoader instance. */ HsqlProvisioningRequest hsqlProvisioningRequest = HsqlProvisioningRequest diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigTest.java index d3bebdca..7db0dd37 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/ServiceConfigTest.java @@ -27,7 +27,7 @@ public final class ServiceConfigTest { /** * Ensures that {@link ServiceConfig} instances can be marshalled. - * + * * @throws JAXBException * (shouldn't be thrown if things are working) * @throws XPathExpressionException @@ -65,7 +65,7 @@ public void jaxbMarshalling() throws JAXBException, XPathExpressionException { /** * Ensures that {@link ServiceConfig} instances can be unmarshalled. - * + * * @throws JAXBException * (shouldn't be thrown if things are working) * @throws XPathExpressionException diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoaderTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoaderTest.java index c4f1023f..88f4a53b 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoaderTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/config/XmlConfigLoaderTest.java @@ -25,17 +25,16 @@ public final class XmlConfigLoaderTest { public TemporaryFolder tempFolder = new TemporaryFolder(); /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files - * from the default path. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files from the default path. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void loadFromDefaultPath() throws IOException { /* - * Sanity check: We're going to create a config file in the working - * directory, so lets make sure that there isn't one there already. + * Sanity check: We're going to create a config file in the working directory, so lets make sure that there + * isn't one there already. */ Path defaultConfigPath = FileSystems.getDefault().getPath(XmlConfigLoader.CONFIG_DEFAULT); if (Files.exists(defaultConfigPath)) @@ -61,17 +60,16 @@ public void loadFromDefaultPath() throws IOException { } /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files - * from an override path value. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files from an override path value. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void loadFromOverridePath() throws IOException { /* - * Sanity check: We're going to set the config file system property, so - * let's make sure it doesn't already have a value. + * Sanity check: We're going to set the config file system property, so let's make sure it doesn't already have + * a value. */ if (System.getProperties().containsKey(XmlConfigLoader.CONFIG_PROP)) throw new IllegalStateException(); @@ -100,17 +98,16 @@ public void loadFromOverridePath() throws IOException { } /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly caches loaded - * files. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly caches loaded files. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void caching() throws IOException { /* - * Sanity check: We're going to create a config file in the working - * directory, so lets make sure that there isn't one there already. + * Sanity check: We're going to create a config file in the working directory, so lets make sure that there + * isn't one there already. */ Path defaultConfigPath = FileSystems.getDefault().getPath(XmlConfigLoader.CONFIG_DEFAULT); if (Files.exists(defaultConfigPath)) diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelperTest.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelperTest.java index 414932ea..10fde054 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelperTest.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/AiGameplayHelperTest.java @@ -14,8 +14,7 @@ */ public final class AiGameplayHelperTest { /** - * Verifies that {@link AiGameplayHelper} works as expected when only one of - * the players in a {@link Game} is AI. + * Verifies that {@link AiGameplayHelper} works as expected when only one of the players in a {@link Game} is AI. */ @Test public void singleAiPlayer() { @@ -24,8 +23,7 @@ public void singleAiPlayer() { game.setPlayer2(new Player(BuiltInAi.ONE_SIDED_DIE_ROCK)); /* - * Walk through a game, using the AiGameplayHelper, and verifying it - * does what it's supposed to. + * Walk through a game, using the AiGameplayHelper, and verifying it does what it's supposed to. */ game.submitThrow(0, game.getPlayer1(), Throw.ROCK); aiHelper.advanceGameForAiPlayers(game); @@ -39,8 +37,7 @@ public void singleAiPlayer() { } /** - * Verifies that {@link AiGameplayHelper} works as expected when both of the - * players in a {@link Game} are AI. + * Verifies that {@link AiGameplayHelper} works as expected when both of the players in a {@link Game} are AI. */ @Test public void twoAiPlayers() { @@ -49,9 +46,8 @@ public void twoAiPlayers() { game.setPlayer2(new Player(BuiltInAi.ONE_SIDED_DIE_PAPER)); /* - * Start the AiGameplayHelper on the game, which should cause it to - * advance all the way through until player 2 wins. Verify that went as - * expected. + * Start the AiGameplayHelper on the game, which should cause it to advance all the way through until player 2 + * wins. Verify that went as expected. */ aiHelper.advanceGameForAiPlayers(game); Assert.assertEquals(2, game.getRounds().size()); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImplIT.java index 8186444b..d247c590 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GameResourceImplIT.java @@ -80,13 +80,11 @@ public void wipeSchema() { /** *

- * Ensures that {@link GameResourceImpl#getGamesForPlayer()} works correctly - * when the requesting client has an {@link Account}, but no associated - * {@link Player}. + * Ensures that {@link GameResourceImpl#getGamesForPlayer()} works correctly when the requesting client has an + * {@link Account}, but no associated {@link Player}. *

*

- * This is a regression test case for an issue encountered during - * development. + * This is a regression test case for an issue encountered during development. *

*/ @Test @@ -104,8 +102,8 @@ public void getGamesForPlayerWithNewAccount() { } /** - * Ensures that the client and server {@link IGameResource#createGame()} and - * {@link IGameResource#getGame(String)} implementations work correctly. + * Ensures that the client and server {@link IGameResource#createGame()} and {@link IGameResource#getGame(String)} + * implementations work correctly. */ @Test public void createAndGet() { @@ -133,9 +131,9 @@ public void createAndGet() { } /** - * Ensures that the client and server {@link IGameResource} implementations - * work correctly for a simple 1-round game. - * + * Ensures that the client and server {@link IGameResource} implementations work correctly for a simple 1-round + * game. + * * @throws AddressException * (won't be thrown; address is correct and static) */ @@ -176,9 +174,9 @@ public void playSimpleGame() throws AddressException { } /** - * Ensures that the client and server {@link IGameResource} implementations - * work correctly for a simple game with a human and an AI player. - * + * Ensures that the client and server {@link IGameResource} implementations work correctly for a simple game with a + * human and an AI player. + * * @throws AddressException * (won't be thrown; address is correct and static) */ @@ -215,10 +213,9 @@ public void playGameWithAi() throws AddressException { } /** - * Ensures that {@link GameResourceImpl#inviteOpponent(String, long)} - * correctly handles security: only player 1 should be able to invite - * opponents into their game. - * + * Ensures that {@link GameResourceImpl#inviteOpponent(String, long)} correctly handles security: only player 1 + * should be able to invite opponents into their game. + * * @throws AddressException * (won't be thrown; address is correct and static) */ @@ -257,10 +254,9 @@ public void inviteOpponentSecurity() throws AddressException { } /** - * Ensures that {@link GameResourceImpl} doesn't reveal moves made in the - * current round, except to the player that made them. If this were to - * happen, it would allow players to cheat, as they would be able to see - * their opponent's move before making their own. + * Ensures that {@link GameResourceImpl} doesn't reveal moves made in the current round, except to the player that + * made them. If this were to happen, it would allow players to cheat, as they would be able to see their opponent's + * move before making their own. */ @Test public void opponentsMoveNotRevealed() throws AddressException { @@ -300,10 +296,9 @@ public void opponentsMoveNotRevealed() throws AddressException { } /** - * Ensures that the server - * {@link IGameResource#setMaxRounds(String, int, int)} implementation works - * correctly in the face of concurrent calls. - * + * Ensures that the server {@link IGameResource#setMaxRounds(String, int, int)} implementation works correctly in + * the face of concurrent calls. + * * @throws ExecutionException * (should never happen, as we never cancel tasks) * @throws InterruptedException @@ -312,10 +307,8 @@ public void opponentsMoveNotRevealed() throws AddressException { @Test public void setMaxRoundsConcurrency() throws InterruptedException, ExecutionException { /* - * Note to self: On 2014-04-27, I saw this test fail one of its - * assertions but was unable to reproduce (can't recall which - * assertion). I'd guess there's still an intermittent concurrency bug - * lurking. + * Note to self: On 2014-04-27, I saw this test fail one of its assertions but was unable to reproduce (can't + * recall which assertion). I'd guess there's still an intermittent concurrency bug lurking. */ ClientConfig clientConfig = new ClientConfig(server.getServerBaseAddress()); @@ -335,13 +328,10 @@ public void setMaxRoundsConcurrency() throws InterruptedException, ExecutionExce gameClientForPlayer2.joinGame(game.getId()); /* - * What we need to ensure can't happen is this: two or more simultaneous - * requests that both succeed. Because of the guard "oldMaxRounds" - * parameter required, only one concurrent call to this method should - * ever be told it succeeded. The others should all fail because they - * pass in an out-of-date "oldMaxRounds" value. To test this, we'll run - * pairs of these requests concurrently and ensure that only one ever - * succeeds. + * What we need to ensure can't happen is this: two or more simultaneous requests that both succeed. Because of + * the guard "oldMaxRounds" parameter required, only one concurrent call to this method should ever be told it + * succeeded. The others should all fail because they pass in an out-of-date "oldMaxRounds" value. To test this, + * we'll run pairs of these requests concurrently and ensure that only one ever succeeds. */ // Request 'A' will always try to set the rounds from 3 to 5. @@ -352,14 +342,12 @@ public GameView call() throws Exception { GameView gameAfterModification = gameClientForPlayer1.setMaxRounds(game.getId(), 3, 5); /* - * We'll use a non-null result to signal that the request - * succeeded. + * We'll use a non-null result to signal that the request succeeded. */ return gameAfterModification; } catch (GameConflictException t) { /* - * We'll use a null result to signal that the request - * failed. + * We'll use a null result to signal that the request failed. */ return null; } @@ -374,14 +362,12 @@ public GameView call() throws Exception { GameView gameAfterModification = gameClientForPlayer2.setMaxRounds(game.getId(), 3, 7); /* - * We'll use a non-null result to signal that the request - * succeeded. + * We'll use a non-null result to signal that the request succeeded. */ return gameAfterModification; } catch (GameConflictException t) { /* - * We'll use a null result to signal that the request - * failed. + * We'll use a null result to signal that the request failed. */ return null; } @@ -417,17 +403,15 @@ public GameView call() throws Exception { } /** - * Ensures that the server - * {@link IGameResource#submitThrow(String, int, Throw)} implementation - * works correctly in the face of concurrent calls. - * + * Ensures that the server {@link IGameResource#submitThrow(String, int, Throw)} implementation works correctly in + * the face of concurrent calls. + * * @throws ExecutionException * (should never happen, as we never cancel tasks) * @throws InterruptedException * (should never happen, as we never cancel tasks) * @throws AddressException - * (should never happen, as we only use static, valid addresses - * here) + * (should never happen, as we only use static, valid addresses here) */ @Test public void submitThrowConcurrency() throws InterruptedException, ExecutionException, AddressException { @@ -450,11 +434,9 @@ public void submitThrowConcurrency() throws InterruptedException, ExecutionExcep gameClientForPlayer2.setMaxRounds(gameId, game.getMaxRounds(), 999999); /* - * What we want to ensure here is that the following scenario works - * correctly: three concurrent calls from three separate clients. The - * first player is submitting two separate throws at once. The second - * player is also submitting its throw. We want to ensure that, for the - * first player, only one of the two calls succeeds. + * What we want to ensure here is that the following scenario works correctly: three concurrent calls from three + * separate clients. The first player is submitting two separate throws at once. The second player is also + * submitting its throw. We want to ensure that, for the first player, only one of the two calls succeeds. */ CookieStore cookiesForPlayer1b = new CookieStore(); @@ -473,14 +455,12 @@ public GameView call() throws Exception { Throw.ROCK); /* - * We'll use a non-null result to signal that the request - * succeeded. + * We'll use a non-null result to signal that the request succeeded. */ return gameAfterModification; } catch (Throwable t) { /* - * We'll use a null result to signal that the request - * failed. + * We'll use a null result to signal that the request failed. */ return null; } @@ -496,14 +476,12 @@ public GameView call() throws Exception { Throw.PAPER); /* - * We'll use a non-null result to signal that the request - * succeeded. + * We'll use a non-null result to signal that the request succeeded. */ return gameAfterModification; } catch (Throwable t) { /* - * We'll use a null result to signal that the request - * failed. + * We'll use a null result to signal that the request failed. */ return null; } @@ -519,14 +497,12 @@ public GameView call() throws Exception { Throw.SCISSORS); /* - * We'll use a non-null result to signal that the request - * succeeded. + * We'll use a non-null result to signal that the request succeeded. */ return gameAfterModification; } catch (Throwable t) { /* - * We'll use a null result to signal that the request - * failed. + * We'll use a null result to signal that the request failed. */ return null; } @@ -554,9 +530,8 @@ public GameView call() throws Exception { GameView gameThusFar = gameClientForPlayer2.prepareRound(gameId); /* - * Sanity check: ensure that the round's result is correct. (While - * developing this test, intermittent failures were seen where - * player 2's throw wasn't actually showing up.) + * Sanity check: ensure that the round's result is correct. (While developing this test, intermittent + * failures were seen where player 2's throw wasn't actually showing up.) */ Assert.assertEquals("Game state is off: " + gameThusFar, i + 2, gameThusFar.getRounds().size()); @@ -568,8 +543,7 @@ public GameView call() throws Exception { } /** - * Ensures that the client and server - * {@link IGameResource#deleteGame(String)} implementations work correctly. + * Ensures that the client and server {@link IGameResource#deleteGame(String)} implementations work correctly. */ @Test public void delete() { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImplIT.java index 28b20eeb..6c519988 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/GamesDaoImplIT.java @@ -39,10 +39,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class GamesDaoImplIT { /** - * @return the test run parameters to pass to - * {@link #GamesDaoImplIT(IProvisioningRequest)}, where each - * top-level element in the returned {@link Collection} represents a - * test run + * @return the test run parameters to pass to {@link #GamesDaoImplIT(IProvisioningRequest)}, where each top-level + * element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -62,28 +60,25 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link GamesDaoImplIT} instance. The test runner will - * generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link GamesDaoImplIT} instance. The test runner will generate the parameters to pass to this + * from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public GamesDaoImplIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); @@ -181,8 +176,7 @@ public void saveUpdatedGame() { } /** - * Tests {@link GamesDaoImpl#save(Game)} with a {@link Game} that has some - * {@link GameRound}s. + * Tests {@link GamesDaoImpl#save(Game)} with a {@link Game} that has some {@link GameRound}s. */ @Test public void saveWithRounds() { @@ -353,8 +347,8 @@ public void deleteGameAndRounds() { Assert.assertEquals(0, gamesDao.getGames().size()); /* - * Verify that the GameRounds were also deleted. Have to fall back - * to JPA here, as they're not directly exposed by a DAO. + * Verify that the GameRounds were also deleted. Have to fall back to JPA here, as they're not directly + * exposed by a DAO. */ CriteriaBuilder criteriaBuilder = entityManager.getEntityManagerFactory().getCriteriaBuilder(); CriteriaQuery criteria = criteriaBuilder.createQuery(GameRound.class); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImplIT.java index b6db015a..6d46f3f2 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersDaoImplIT.java @@ -34,10 +34,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class PlayersDaoImplIT { /** - * @return the test run parameters to pass to - * {@link #PlayersDaoImplIT(IProvisioningRequest)}, where each - * top-level element in the returned {@link Collection} represents a - * test run + * @return the test run parameters to pass to {@link #PlayersDaoImplIT(IProvisioningRequest)}, where each top-level + * element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -57,28 +55,25 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link PlayersDaoImplIT} instance. The test runner will - * generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link PlayersDaoImplIT} instance. The test runner will generate the parameters to pass to this + * from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public PlayersDaoImplIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); @@ -115,9 +110,8 @@ public void findPlayerForAccount() { } /* - * Pull the persisted Account out of the new Player and call - * findPlayerForAccount(...) again. This time, it should return the - * already-created Player instance. + * Pull the persisted Account out of the new Player and call findPlayerForAccount(...) again. This time, it + * should return the already-created Player instance. */ Account savedAccount = newPlayer.getHumanAccount(); Assert.assertNotNull(savedAccount); @@ -156,8 +150,7 @@ public void findPlayerForBuiltInAi() { playersDao.setEntityManager(entityManager); /* - * Call findPlayerForBuiltInAi(...) with BuiltInAis that don't - * already have Player instances. + * Call findPlayerForBuiltInAi(...) with BuiltInAis that don't already have Player instances. */ Set returnedPlayers = null; EntityTransaction tx = entityManager.getTransaction(); @@ -191,8 +184,7 @@ public void findPlayerForBuiltInAi() { } /* - * Call findPlayerForBuiltInAi(...) again for the BuiltInAis. This - * time, it should have results. + * Call findPlayerForBuiltInAi(...) again for the BuiltInAis. This time, it should have results. */ returnedPlayers = null; tx = entityManager.getTransaction(); @@ -227,8 +219,8 @@ public void findOrCreatePlayerForAccount() { playersDao.setEntityManager(entityManager); /* - * Call findOrCreatePlayerForAccount(...) with an Account that - * doesn't already have a Player instance for it. + * Call findOrCreatePlayerForAccount(...) with an Account that doesn't already have a Player instance for + * it. */ Account account = new Account(); Player newPlayer = null; @@ -243,9 +235,8 @@ public void findOrCreatePlayerForAccount() { } /* - * Pull the persisted Account out of the new Player and call - * findOrCreatePlayerForAccount(...) again. This time, it should - * return the already-created Player instance. + * Pull the persisted Account out of the new Player and call findOrCreatePlayerForAccount(...) again. This + * time, it should return the already-created Player instance. */ Account savedAccount = newPlayer.getHumanAccount(); Assert.assertNotNull(savedAccount); diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImplIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImplIT.java index 06d45cee..160c926b 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImplIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/game/PlayersResourceImplIT.java @@ -62,8 +62,7 @@ public void wipeSchema() { } /** - * Ensures that {@link PlayersResourceImpl#findOrCreatePlayer()} works - * correctly. + * Ensures that {@link PlayersResourceImpl#findOrCreatePlayer()} works correctly. */ @Test public void findOrCreatePlayer() { @@ -87,9 +86,7 @@ public void findOrCreatePlayer() { } /** - * Ensures that - * {@link PlayersResourceImpl#getPlayersForBuiltInAis(java.util.List)} works - * correctly. + * Ensures that {@link PlayersResourceImpl#getPlayersForBuiltInAis(java.util.List)} works correctly. */ @Test public void getPlayersForBuiltInAis() { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DaoTestHelper.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DaoTestHelper.java index 97c6e25b..fe2d4c94 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DaoTestHelper.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DaoTestHelper.java @@ -21,9 +21,8 @@ /** *

- * Leverages both the Spring and JUnit test infrastructure to provision data - * source repositories and JPA {@link EntityManagerFactory}s for DAO test cases - * to use, and properly cleans things up after each test case. + * Leverages both the Spring and JUnit test infrastructure to provision data source repositories and JPA + * {@link EntityManagerFactory}s for DAO test cases to use, and properly cleans things up after each test case. *

*

* It's hacky, and fairly ugly, but it works. @@ -40,10 +39,10 @@ public final class DaoTestHelper extends ExternalResource implements TestExecuti /** * Constructs a new {@link DaoTestHelper} instance. - * + * * @param provisioningRequest - * the {@link IProvisioningRequest} that will be processed before - * each test case, and then cleaned up after each test case + * the {@link IProvisioningRequest} that will be processed before each test case, and then cleaned up + * after each test case */ public DaoTestHelper(IProvisioningRequest provisioningRequest) { this.provisioningRequest = provisioningRequest; @@ -55,8 +54,7 @@ public DaoTestHelper(IProvisioningRequest provisioningRequest) { @Override public void beforeTestClass(TestContext testContext) throws Exception { /* - * Due to the way this TestExecutionListener is created and registered, - * this will never be called. + * Due to the way this TestExecutionListener is created and registered, this will never be called. */ } @@ -66,10 +64,8 @@ public void beforeTestClass(TestContext testContext) throws Exception { @Override public void prepareTestInstance(TestContext testContext) throws Exception { /* - * Snag the Spring ApplicationContext here. This is hacky, but due to - * the way we're creating and initializing this Spring - * TestExecutionListener, this is the only event from that interface - * that will be fired. + * Snag the Spring ApplicationContext here. This is hacky, but due to the way we're creating and initializing + * this Spring TestExecutionListener, this is the only event from that interface that will be fired. */ this.springAppContext = testContext.getApplicationContext(); } @@ -80,8 +76,7 @@ public void prepareTestInstance(TestContext testContext) throws Exception { @Override public void beforeTestMethod(TestContext testContext) throws Exception { /* - * Due to the way this TestExecutionListener is created and registered, - * this will never be called. + * Due to the way this TestExecutionListener is created and registered, this will never be called. */ } @@ -108,11 +103,9 @@ protected void before() throws Throwable { jpaCoords); } catch (Throwable t) { /* - * If anything in the try block blows up, the after() method won't - * run, and the data source repository won't be deleted, which will - * cause all of the next test cases to fail. So, if we catch any - * exceptions here, we delete the DB, and then wrap-re-throw the - * error. + * If anything in the try block blows up, the after() method won't run, and the data source repository won't + * be deleted, which will cause all of the next test cases to fail. So, if we catch any exceptions here, we + * delete the DB, and then wrap-re-throw the error. */ deleteProvisionedDataSourceRepository(); @@ -126,8 +119,8 @@ protected void before() throws Throwable { @Override protected void after() { /* - * Close the EMF that was used by the test. This is needed, because - * apparently the EMF is also keeping a connection to the database open. + * Close the EMF that was used by the test. This is needed, because apparently the EMF is also keeping a + * connection to the database open. */ if (this.entityManagerFactory != null) this.entityManagerFactory.close(); @@ -137,8 +130,7 @@ protected void after() { } /** - * Deletes the data source repository that was provisioned and is tracked in - * {@link #provisioningResult} (if any). + * Deletes the data source repository that was provisioned and is tracked in {@link #provisioningResult} (if any). */ private void deleteProvisionedDataSourceRepository() { if (this.provisionersManager == null || this.provisioningResult == null) @@ -148,11 +140,9 @@ private void deleteProvisionedDataSourceRepository() { this.provisionersManager.delete(provisioningResult); } catch (Throwable t) { /* - * The data source repository delete will often fail if something in - * the test has leaked a connection, as most DB servers will refuse - * to delete a DB with active connections. We don't want the - * "unable to delete" exception to obscure any test failures, - * though, so we'll just log the exception and let this method + * The data source repository delete will often fail if something in the test has leaked a connection, as + * most DB servers will refuse to delete a DB with active connections. We don't want the "unable to delete" + * exception to obscure any test failures, though, so we'll just log the exception and let this method * return normally. */ LOGGER.warn("Unable to delete data source repository.", t); @@ -165,8 +155,7 @@ private void deleteProvisionedDataSourceRepository() { @Override public void afterTestMethod(TestContext testContext) throws Exception { /* - * Due to the way this TestExecutionListener is created and registered, - * this will never be called. + * Due to the way this TestExecutionListener is created and registered, this will never be called. */ } @@ -176,22 +165,19 @@ public void afterTestMethod(TestContext testContext) throws Exception { @Override public void afterTestClass(TestContext testContext) throws Exception { /* - * Due to the way this TestExecutionListener is created and registered, - * this will never be called. + * Due to the way this TestExecutionListener is created and registered, this will never be called. */ } /** - * @return the Spring {@link ApplicationContext} being used for the currect - * test case + * @return the Spring {@link ApplicationContext} being used for the currect test case */ public ApplicationContext getSpringAppContext() { return springAppContext; } /** - * @return the {@link ProvisioningResult} that identifies the DB schema - * being used for the current test run + * @return the {@link ProvisioningResult} that identifies the DB schema being used for the current test run */ public ProvisioningResult getProvisioningResult() { return provisioningResult; diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaPrinter.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaPrinter.java index f344f21f..4b629763 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaPrinter.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaPrinter.java @@ -15,9 +15,8 @@ import com.justdavis.karl.rpstourney.service.app.config.ServiceConfig; /** - * This utility class just prints out the Hibernate/JPA schema to the console. - * Will use the syntax for whatever database is configured for the application's - * integration tests via {@link SpringBindingsForWebServiceITs}. + * This utility class just prints out the Hibernate/JPA schema to the console. Will use the syntax for whatever database + * is configured for the application's integration tests via {@link SpringBindingsForWebServiceITs}. */ final class DatabaseSchemaPrinter { public static void main(String[] args) throws ClassNotFoundException { diff --git a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaUpgradeIT.java b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaUpgradeIT.java index a20d7d19..6afc1893 100644 --- a/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaUpgradeIT.java +++ b/rps-tourney-service-app/src/test/java/com/justdavis/karl/rpstourney/service/app/jpa/DatabaseSchemaUpgradeIT.java @@ -27,10 +27,8 @@ @ActiveProfiles(SpringProfile.INTEGRATION_TESTS) public final class DatabaseSchemaUpgradeIT { /** - * @return the test run parameters to pass to - * {@link #GamesDaoImplIT(IProvisioningRequest)}, where each - * top-level element in the returned {@link Collection} represents a - * test run + * @return the test run parameters to pass to {@link #GamesDaoImplIT(IProvisioningRequest)}, where each top-level + * element in the returned {@link Collection} represents a test run */ @Parameterized.Parameters(name = "{index}: IProvisioningRequest={0}") public static Collection createTestParameters() { @@ -50,37 +48,33 @@ public static Collection createTestParameters() { public DaoTestHelper daoTestHelper; /** - * Constructs a new {@link GamesDaoImplIT} instance. The test runner will - * generate the parameters to pass to this from the - * {@link #createTestParameters()} method. - * + * Constructs a new {@link GamesDaoImplIT} instance. The test runner will generate the parameters to pass to this + * from the {@link #createTestParameters()} method. + * * @param provisioningRequest * @throws Exception - * An {@link Exception} might be thrown by the Spring context - * initialization. + * An {@link Exception} might be thrown by the Spring context initialization. */ public DatabaseSchemaUpgradeIT(IProvisioningRequest provisioningRequest) throws Exception { this.daoTestHelper = new DaoTestHelper(provisioningRequest); /* - * Initialize Spring. We're using this mechanism, rather than the {@link - * SpringJUnit4ClassRunner}, as this test is already using a different - * runner: {@link Parameterized}. + * Initialize Spring. We're using this mechanism, rather than the {@link SpringJUnit4ClassRunner}, as this test + * is already using a different runner: {@link Parameterized}. */ TestContextManager testContextManager = new TestContextManager(getClass()); /* - * Register the DaoTestHelper with the Spring test context, so it can - * snag the ApplicationContext from it. (This is a hack.) + * Register the DaoTestHelper with the Spring test context, so it can snag the ApplicationContext from it. (This + * is a hack.) */ testContextManager.registerTestExecutionListeners(daoTestHelper); testContextManager.prepareTestInstance(this); } /** - * Tests {@link IDataSourceSchemaManager} when run against a schema that's - * already correct. Basically, just verifies that the Liquibase checksum - * handling is correct. + * Tests {@link IDataSourceSchemaManager} when run against a schema that's already correct. Basically, just verifies + * that the Liquibase checksum handling is correct. */ @Test public void updateSchema() { @@ -88,8 +82,7 @@ public void updateSchema() { .getBean(IDataSourceSchemaManager.class); /* - * The DaoTestHelper has already run this once, so just run it a second - * time. + * The DaoTestHelper has already run this once, so just run it a second time. */ schemaManager.createOrUpgradeSchema(daoTestHelper.getProvisioningResult().getCoords()); } diff --git a/rps-tourney-service-app/src/test/resources/datasource-provisioning-targets.xml b/rps-tourney-service-app/src/test/resources/datasource-provisioning-targets.xml index 1d13611b..2db007e6 100644 --- a/rps-tourney-service-app/src/test/resources/datasource-provisioning-targets.xml +++ b/rps-tourney-service-app/src/test/resources/datasource-provisioning-targets.xml @@ -1,9 +1,7 @@ - - + + diff --git a/rps-tourney-service-app/src/test/resources/logback-test.xml b/rps-tourney-service-app/src/test/resources/logback-test.xml index 87ddc0ed..9361767b 100644 --- a/rps-tourney-service-app/src/test/resources/logback-test.xml +++ b/rps-tourney-service-app/src/test/resources/logback-test.xml @@ -11,11 +11,8 @@ - - + + @@ -23,28 +20,22 @@ - - - + + + - - - - + + + + - \ No newline at end of file + diff --git a/rps-tourney-service-client/pom.xml b/rps-tourney-service-client/pom.xml index fcdeb045..8d2071b1 100644 --- a/rps-tourney-service-client/pom.xml +++ b/rps-tourney-service-client/pom.xml @@ -12,12 +12,13 @@ jar rps-tourney-service-client - - The client-side implementation to the web service layer of the - "Rock-Paper-Scissors Tourney" game. - + The client-side implementation to the web service layer of the + "Rock-Paper-Scissors Tourney" game. + + ${project.basedir}/../dev @@ -33,7 +34,7 @@ - org.apache.cxf cxf-rt-rs-client @@ -50,11 +51,9 @@ - - + - - + diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/CookieStore.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/CookieStore.java index c316026d..1d8a5cf2 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/CookieStore.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/CookieStore.java @@ -16,25 +16,21 @@ /** *

- * Stores the cookies returned from calls to the web service and helps apply - * those cookies to future outbound requests. + * Stores the cookies returned from calls to the web service and helps apply those cookies to future outbound requests. *

*

- * The lifecycle for this component must be managed carefully: it should not be - * shared between different users. For example, if used in a server-side web - * application, care should be taken to ensure that a separate instance is used - * for each user session. Otherwise, users might end up accessing other users - * accounts. + * The lifecycle for this component must be managed carefully: it should not be shared between different users. For + * example, if used in a server-side web application, care should be taken to ensure that a separate instance is used + * for each user session. Otherwise, users might end up accessing other users accounts. *

*

- * This class implements the {@link Externalizable} interface (which extends - * {@link Serializable}) so that it may be saved in user's sessions. + * This class implements the {@link Externalizable} interface (which extends {@link Serializable}) so that it may be + * saved in user's sessions. *

*/ public class CookieStore implements Externalizable { /** - * A guard value to catch errors when reading in unsupported serialized - * data. + * A guard value to catch errors when reading in unsupported serialized data. */ private static final int SERIALIZATION_VERSION = 1; @@ -48,20 +44,18 @@ public CookieStore() { } /** - * Stores the specified cookies, so that they can be applied to future - * requests (via {@link #applyCookies(Builder)}). - * + * Stores the specified cookies, so that they can be applied to future requests (via + * {@link #applyCookies(Builder)}). + * * @param cookies - * the {@link Map} of cookies to store, using the - * {@link NewCookie#getName()} values as the keys + * the {@link Map} of cookies to store, using the {@link NewCookie#getName()} values as the keys */ public void remember(Map cookies) { for (String cookieName : cookies.keySet()) { NewCookie cookie = cookies.get(cookieName); /* - * Empty-valued cookies are used by servers as a - * "please remove this cookie" message. + * Empty-valued cookies are used by servers as a "please remove this cookie" message. */ if (cookie.getValue() != null && !cookie.getValue().isEmpty()) remember(cookie); @@ -71,9 +65,8 @@ public void remember(Map cookies) { } /** - * Stores the specified cookie, so that it can be applied to future requests - * (via {@link #applyCookies(Builder)}). - * + * Stores the specified cookie, so that it can be applied to future requests (via {@link #applyCookies(Builder)}). + * * @param cookie * the {@link NewCookie} to store */ @@ -84,20 +77,18 @@ public void remember(NewCookie cookie) { /** * @param cookieName * the {@link Cookie#getName()} of the {@link Cookie} to return - * @return the matching {@link Cookie}, or null if no such - * {@link Cookie} is found + * @return the matching {@link Cookie}, or null if no such {@link Cookie} is found */ public Cookie get(String cookieName) { return this.cookies.get(cookieName); } /** - * Applies the stored cookies to the specified request {@link Builder}, so - * that they will be sent along with any requests made by it. - * + * Applies the stored cookies to the specified request {@link Builder}, so that they will be sent along with any + * requests made by it. + * * @param requestBuilder - * the request {@link Builder} to apply the stored cookies (if - * any) to + * the request {@link Builder} to apply the stored cookies (if any) to */ public void applyCookies(Builder requestBuilder) { // TODO Respect max age & expiry. @@ -108,10 +99,9 @@ public void applyCookies(Builder requestBuilder) { /** * Removes any cookies with the specified name from this {@link CookieStore} - * + * * @param cookieName - * the {@link Cookie#getName()} value for the cookies to be - * removed + * the {@link Cookie#getName()} value for the cookies to be removed */ public void forget(String cookieName) { this.cookies.remove(cookieName); @@ -132,19 +122,17 @@ public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(SERIALIZATION_VERSION); /* - * We can't directly serialize NewCookie instances, because they're not - * Serializable. Additionally, it seems as if NewCookie.toString() and - * NewCookie.valueOf(...) omit all of the extra fields added by - * NewCookie. Instead, we have to serialize each NewCookie manually. + * We can't directly serialize NewCookie instances, because they're not Serializable. Additionally, it seems as + * if NewCookie.toString() and NewCookie.valueOf(...) omit all of the extra fields added by NewCookie. Instead, + * we have to serialize each NewCookie manually. */ Collection cookiesCollection = cookies.values(); out.writeInt(cookiesCollection.size()); for (NewCookie cookie : cookiesCollection) { /* - * Here's the list of fields from NewCookie's constructor that - * includes every field: [String name, String value, String path, - * String domain, int version, String comment, int maxAge, Date - * expiry, boolean secure, boolean httpOnly]. + * Here's the list of fields from NewCookie's constructor that includes every field: [String name, String + * value, String path, String domain, int version, String comment, int maxAge, Date expiry, boolean secure, + * boolean httpOnly]. */ out.writeObject(cookie.getName()); out.writeObject(cookie.getValue()); @@ -165,8 +153,8 @@ public void writeExternal(ObjectOutput out) throws IOException { @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { /* - * First, read in the version field and verify it's correct, so we don't - * attempt to read in an unsupported version of this class' data. + * First, read in the version field and verify it's correct, so we don't attempt to read in an unsupported + * version of this class' data. */ int serializationVersion = in.readInt(); if (serializationVersion != SERIALIZATION_VERSION) @@ -174,16 +162,14 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept serializationVersion, SERIALIZATION_VERSION)); /* - * Read in the list of directly-serialized NewCookies. Populate this - * CookieStore with each. + * Read in the list of directly-serialized NewCookies. Populate this CookieStore with each. */ int numCookies = in.readInt(); for (int i = 0; i < numCookies; i++) { /* - * Here's the list of fields from NewCookie's constructor that - * includes every field: [String name, String value, String path, - * String domain, int version, String comment, int maxAge, Date - * expiry, boolean secure, boolean httpOnly]. + * Here's the list of fields from NewCookie's constructor that includes every field: [String name, String + * value, String path, String domain, int version, String comment, int maxAge, Date expiry, boolean secure, + * boolean httpOnly]. */ String name = (String) in.readObject(); String value = (String) in.readObject(); diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/HttpClientException.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/HttpClientException.java index f16b69ce..2f06849e 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/HttpClientException.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/HttpClientException.java @@ -12,10 +12,9 @@ public final class HttpClientException extends RuntimeException { /** * Constructs a new {@link HttpClientException}. - * + * * @param status - * the unexpected HTTP {@link StatusType} response that was - * received + * the unexpected HTTP {@link StatusType} response that was received */ public HttpClientException(StatusType status) { super(buildMessage(status)); @@ -29,10 +28,9 @@ private static String buildMessage(StatusType status) { /** * Constructs a new {@link HttpClientException}. - * + * * @param cause - * the unexpected {@link HttpClientException} being wrapped and - * rethrown + * the unexpected {@link HttpClientException} being wrapped and rethrown */ public HttpClientException(HttpClientException cause) { super(buildMessage(cause.getStatus()), cause); @@ -40,8 +38,8 @@ public HttpClientException(HttpClientException cause) { } /** - * @return the unexpected HTTP {@link StatusType} response that was - * received, and caused this {@link HttpClientException} + * @return the unexpected HTTP {@link StatusType} response that was received, and caused this + * {@link HttpClientException} */ public StatusType getStatus() { return status; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/ServiceStatusClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/ServiceStatusClient.java index 9faac483..01026a2d 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/ServiceStatusClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/ServiceStatusClient.java @@ -14,15 +14,14 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IServiceStatusResource} - * web service. + * A client-side implementation/binding for the {@link IServiceStatusResource} web service. */ public class ServiceStatusClient implements IServiceStatusResource { private final ClientConfig config; /** * Constructs a new {@link ServiceStatusClient} instance. - * + * * @param config * the {@link ClientConfig} to use */ diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/AccountsClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/AccountsClient.java index 34633f2c..7fb17613 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/AccountsClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/AccountsClient.java @@ -24,8 +24,7 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IAccountsResource} web - * service. + * A client-side implementation/binding for the {@link IAccountsResource} web service. */ public class AccountsClient implements IAccountsResource { private final ClientConfig config; @@ -33,7 +32,7 @@ public class AccountsClient implements IAccountsResource { /** * Constructs a new {@link AccountsClient} instance. - * + * * @param config * the {@link ClientConfig} to use * @param cookieStore @@ -130,8 +129,7 @@ public AuthToken selectOrCreateAuthToken() { } /** - * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, - * java.util.UUID) + * @see com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource#mergeAccount(long, java.util.UUID) */ @Override public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) { @@ -154,15 +152,14 @@ else if (Status.Family.familyOf(response.getStatus()) != Status.Family.SUCCESSFU } /** - * The default {@link IAccountsClientFactory} implementation, which produces - * {@link AccountsClient} instances. + * The default {@link IAccountsClientFactory} implementation, which produces {@link AccountsClient} instances. */ public static final class DefaultAccountsClientFactory implements IAccountsClientFactory { private final ClientConfig config; /** * Constructs a new {@link DefaultAccountsClientFactory} instance. - * + * * @param config * the {@link ClientConfig} to use */ @@ -176,10 +173,8 @@ public DefaultAccountsClientFactory(ClientConfig config) { @Override public IAccountsResource createAccountsClient(String authTokenValueForAccount) { /* - * Create a new (separate) CookieStore for the new client instance - * to use. Note that this CookieStore will not be shared with other - * clients, and will thus not receive any updates/modifications - * applied to them. + * Create a new (separate) CookieStore for the new client instance to use. Note that this CookieStore will + * not be shared with other clients, and will thus not receive any updates/modifications applied to them. */ CookieStore cookieStore = new CookieStore(); NewCookie authTokenCookie = AuthTokenCookieHelper.createAuthTokenCookie(authTokenValueForAccount, diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/IAccountsClientFactory.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/IAccountsClientFactory.java index d6ab3a31..b7f63c4e 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/IAccountsClientFactory.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/IAccountsClientFactory.java @@ -6,27 +6,22 @@ /** *

- * Implementations of this interface act as factories for one-off/custom - * {@link IAccountsResource} instances. In general, this interface should only - * be used directly when there's a need for an {@link IAccountsResource} - * instance with custom credentials. The rest of the time, there will generally - * be a DI-provided {@link IAccountsResource} client available for use that is a - * better choice. + * Implementations of this interface act as factories for one-off/custom {@link IAccountsResource} instances. In + * general, this interface should only be used directly when there's a need for an {@link IAccountsResource} instance + * with custom credentials. The rest of the time, there will generally be a DI-provided {@link IAccountsResource} client + * available for use that is a better choice. *

*

- * This abstraction is needed, as some services will need the ability to create - * new {@link IAccountsResource} clients, using the credentials from - * {@link Account}s that are not currently logged in. + * This abstraction is needed, as some services will need the ability to create new {@link IAccountsResource} clients, + * using the credentials from {@link Account}s that are not currently logged in. *

*/ public interface IAccountsClientFactory { /** * @param authTokenForAccount - * a valid {@link AuthToken#getToken()} (stringified) value for - * the {@link Account} that the new {@link IAccountsResource} - * client should be logged in as - * @return a new {@link IAccountsResource} client instance, which will - * authenticate as the specified {@link Account} + * a valid {@link AuthToken#getToken()} (stringified) value for the {@link Account} that the new + * {@link IAccountsResource} client should be logged in as + * @return a new {@link IAccountsResource} client instance, which will authenticate as the specified {@link Account} */ IAccountsResource createAccountsClient(String authTokenValueForAccount); } diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/GameAuthClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/GameAuthClient.java index 0e598450..369f49cb 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/GameAuthClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/GameAuthClient.java @@ -18,8 +18,7 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IGameAuthResource} web - * service. + * A client-side implementation/binding for the {@link IGameAuthResource} web service. */ public final class GameAuthClient implements IGameAuthResource { private final ClientConfig config; @@ -27,7 +26,7 @@ public final class GameAuthClient implements IGameAuthResource { /** * Constructs a new {@link GameAuthClient} instance. - * + * * @param config * the {@link ClientConfig} to use * @param cookieStore diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/package-info.java index 2d716bb3..a969c279 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/game/package-info.java @@ -1,6 +1,5 @@ /** * Contains the client-side implementation of the - * {@link com.justdavis.karl.rpstourney.service.api.auth.game.IGameAuthResource} - * service. + * {@link com.justdavis.karl.rpstourney.service.api.auth.game.IGameAuthResource} service. */ -package com.justdavis.karl.rpstourney.service.client.auth.game; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client.auth.game; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/GuestAuthClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/GuestAuthClient.java index a39ab9dc..015aa447 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/GuestAuthClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/GuestAuthClient.java @@ -16,8 +16,7 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IGuestAuthResource} web - * service. + * A client-side implementation/binding for the {@link IGuestAuthResource} web service. */ public final class GuestAuthClient implements IGuestAuthResource { private final ClientConfig config; @@ -25,7 +24,7 @@ public final class GuestAuthClient implements IGuestAuthResource { /** * Constructs a new {@link GuestAuthClient} instance. - * + * * @param config * the {@link ClientConfig} to use * @param cookieStore diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/package-info.java index 1cdaf735..0a83df91 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/guest/package-info.java @@ -1,6 +1,5 @@ /** * Contains the client-side implementation of the - * {@link com.justdavis.karl.rpstourney.service.api.auth.guest.IGuestAuthResource} - * service. + * {@link com.justdavis.karl.rpstourney.service.api.auth.guest.IGuestAuthResource} service. */ -package com.justdavis.karl.rpstourney.service.client.auth.guest; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client.auth.guest; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/package-info.java index df4ef26f..b379abf0 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/auth/package-info.java @@ -1,6 +1,5 @@ /** * Contains the client-side implementation of the - * {@link com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource} - * service. + * {@link com.justdavis.karl.rpstourney.service.api.auth.IAccountsResource} service. */ -package com.justdavis.karl.rpstourney.service.client.auth; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client.auth; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfig.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfig.java index 6e6529a1..ce4b0b9e 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfig.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfig.java @@ -8,15 +8,14 @@ import com.justdavis.karl.rpstourney.service.client.auth.game.GameAuthClient; /** - * Models the configuration needed by the various web service client - * implementations, e.g. {@link GameAuthClient}. + * Models the configuration needed by the various web service client implementations, e.g. {@link GameAuthClient}. */ public final class ClientConfig { private final URI serviceRoot; /** * Constructs a new {@link ClientConfig} instance. - * + * * @param serviceRoot * the value to use for {@link #getServiceRoot()} */ @@ -26,7 +25,7 @@ public ClientConfig(URI serviceRoot) { /** * Constructs a new {@link ClientConfig} instance. - * + * * @param serviceRoot * the value to use for {@link #getServiceRoot()} */ diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/package-info.java index 96fa67c6..f5810441 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/config/package-info.java @@ -1,4 +1,4 @@ /** * Contains classes related to configuration of the web service clients. */ -package com.justdavis.karl.rpstourney.service.client.config; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client.config; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/GameClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/GameClient.java index 10e8303d..c1875c19 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/GameClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/GameClient.java @@ -23,8 +23,7 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IGameResource} web - * service. + * A client-side implementation/binding for the {@link IGameResource} web service. */ public final class GameClient implements IGameResource { private final ClientConfig config; @@ -32,7 +31,7 @@ public final class GameClient implements IGameResource { /** * Constructs a new {@link GameClient} instance. - * + * * @param config * the {@link ClientConfig} to use * @param cookieStore @@ -112,8 +111,7 @@ else if (Status.Family.familyOf(response.getStatus()) != Status.Family.SUCCESSFU } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, - * int, int) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#setMaxRounds(java.lang.String, int, int) */ @Override public GameView setMaxRounds(String gameId, int oldMaxRoundsValue, int newMaxRoundsValue) { @@ -141,8 +139,7 @@ else if (Status.Family.familyOf(response.getStatus()) != Status.Family.SUCCESSFU } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, - * long) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#inviteOpponent(java.lang.String, long) */ @Override public void inviteOpponent(String gameId, long playerId) throws NotFoundException, GameConflictException { @@ -216,8 +213,8 @@ else if (Status.Family.familyOf(response.getStatus()) != Status.Family.SUCCESSFU } /** - * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, - * int, com.justdavis.karl.rpstourney.service.api.game.Throw) + * @see com.justdavis.karl.rpstourney.service.api.game.IGameResource#submitThrow(java.lang.String, int, + * com.justdavis.karl.rpstourney.service.api.game.Throw) */ @Override public GameView submitThrow(String gameId, int roundIndex, Throw throwToPlay) { diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/PlayersClient.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/PlayersClient.java index 182a8835..96464643 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/PlayersClient.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/PlayersClient.java @@ -21,8 +21,7 @@ import com.justdavis.karl.rpstourney.service.client.config.ClientConfig; /** - * A client-side implementation/binding for the {@link IPlayersResource} web - * service. + * A client-side implementation/binding for the {@link IPlayersResource} web service. */ public final class PlayersClient implements IPlayersResource { private final ClientConfig config; @@ -30,7 +29,7 @@ public final class PlayersClient implements IPlayersResource { /** * Constructs a new {@link PlayersClient} instance. - * + * * @param config * the {@link ClientConfig} to use * @param cookieStore diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/package-info.java index 1b7c2430..7984a8e8 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/game/package-info.java @@ -1,5 +1,4 @@ /** - * Contains the client service implementation of - * {@link com.justdavis.karl.rpstourney.service.api.game.IGameResource}. + * Contains the client service implementation of {@link com.justdavis.karl.rpstourney.service.api.game.IGameResource}. */ -package com.justdavis.karl.rpstourney.service.client.game; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client.game; diff --git a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/package-info.java b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/package-info.java index f8bcf6fb..87e549af 100644 --- a/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/package-info.java +++ b/rps-tourney-service-client/src/main/java/com/justdavis/karl/rpstourney/service/client/package-info.java @@ -1,5 +1,5 @@ /** - * The base package for the rps-tourney-service-client project. - * Contains classes shared by the rest of the project. + * The base package for the rps-tourney-service-client project. Contains classes shared by the rest of the + * project. */ -package com.justdavis.karl.rpstourney.service.client; \ No newline at end of file +package com.justdavis.karl.rpstourney.service.client; diff --git a/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/CookieStoreTest.java b/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/CookieStoreTest.java index eb8181db..a0522947 100644 --- a/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/CookieStoreTest.java +++ b/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/CookieStoreTest.java @@ -64,8 +64,7 @@ public void rememberAndApply() { } /** - * Tests {@link CookieStore#remember(NewCookie)} and - * {@link CookieStore#get(String)}. + * Tests {@link CookieStore#remember(NewCookie)} and {@link CookieStore#get(String)}. */ @Test public void rememberAndGet() { @@ -116,9 +115,8 @@ public void clear() { } /** - * Verifies that {@link CookieStore}s can be properly serialized and - * deserialized. - * + * Verifies that {@link CookieStore}s can be properly serialized and deserialized. + * * @throws IOException * Might be thrown if serialization or deserialization fails. * @throws ClassNotFoundException @@ -191,8 +189,7 @@ public Response put(Entity entity) { } /** - * @see javax.ws.rs.client.SyncInvoker#put(javax.ws.rs.client.Entity, - * java.lang.Class) + * @see javax.ws.rs.client.SyncInvoker#put(javax.ws.rs.client.Entity, java.lang.Class) */ @Override public T put(Entity entity, Class responseType) { @@ -200,8 +197,7 @@ public T put(Entity entity, Class responseType) { } /** - * @see javax.ws.rs.client.SyncInvoker#put(javax.ws.rs.client.Entity, - * javax.ws.rs.core.GenericType) + * @see javax.ws.rs.client.SyncInvoker#put(javax.ws.rs.client.Entity, javax.ws.rs.core.GenericType) */ @Override public T put(Entity entity, GenericType responseType) { @@ -217,8 +213,7 @@ public Response post(Entity entity) { } /** - * @see javax.ws.rs.client.SyncInvoker#post(javax.ws.rs.client.Entity, - * java.lang.Class) + * @see javax.ws.rs.client.SyncInvoker#post(javax.ws.rs.client.Entity, java.lang.Class) */ @Override public T post(Entity entity, Class responseType) { @@ -226,8 +221,7 @@ public T post(Entity entity, Class responseType) { } /** - * @see javax.ws.rs.client.SyncInvoker#post(javax.ws.rs.client.Entity, - * javax.ws.rs.core.GenericType) + * @see javax.ws.rs.client.SyncInvoker#post(javax.ws.rs.client.Entity, javax.ws.rs.core.GenericType) */ @Override public T post(Entity entity, GenericType responseType) { @@ -323,8 +317,7 @@ public Response method(String name) { } /** - * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, - * java.lang.Class) + * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, java.lang.Class) */ @Override public T method(String name, Class responseType) { @@ -332,8 +325,7 @@ public T method(String name, Class responseType) { } /** - * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, - * javax.ws.rs.core.GenericType) + * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, javax.ws.rs.core.GenericType) */ @Override public T method(String name, GenericType responseType) { @@ -341,8 +333,7 @@ public T method(String name, GenericType responseType) { } /** - * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, - * javax.ws.rs.client.Entity) + * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, javax.ws.rs.client.Entity) */ @Override public Response method(String name, Entity entity) { @@ -350,8 +341,7 @@ public Response method(String name, Entity entity) { } /** - * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, - * javax.ws.rs.client.Entity, java.lang.Class) + * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, javax.ws.rs.client.Entity, java.lang.Class) */ @Override public T method(String name, Entity entity, Class responseType) { @@ -359,8 +349,8 @@ public T method(String name, Entity entity, Class responseType) { } /** - * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, - * javax.ws.rs.client.Entity, javax.ws.rs.core.GenericType) + * @see javax.ws.rs.client.SyncInvoker#method(java.lang.String, javax.ws.rs.client.Entity, + * javax.ws.rs.core.GenericType) */ @Override public T method(String name, Entity entity, GenericType responseType) { @@ -376,8 +366,7 @@ public Invocation build(String method) { } /** - * @see javax.ws.rs.client.Invocation.Builder#build(java.lang.String, - * javax.ws.rs.client.Entity) + * @see javax.ws.rs.client.Invocation.Builder#build(java.lang.String, javax.ws.rs.client.Entity) */ @Override public Invocation build(String method, Entity entity) { @@ -474,8 +463,7 @@ public Builder cookie(Cookie cookie) { } /** - * @see javax.ws.rs.client.Invocation.Builder#cookie(java.lang.String, - * java.lang.String) + * @see javax.ws.rs.client.Invocation.Builder#cookie(java.lang.String, java.lang.String) */ @Override public Builder cookie(String name, String value) { @@ -492,8 +480,7 @@ public Builder cacheControl(CacheControl cacheControl) { } /** - * @see javax.ws.rs.client.Invocation.Builder#header(java.lang.String, - * java.lang.Object) + * @see javax.ws.rs.client.Invocation.Builder#header(java.lang.String, java.lang.Object) */ @Override public Builder header(String name, Object value) { @@ -509,8 +496,7 @@ public Builder headers(MultivaluedMap headers) { } /** - * @see javax.ws.rs.client.Invocation.Builder#property(java.lang.String, - * java.lang.Object) + * @see javax.ws.rs.client.Invocation.Builder#property(java.lang.String, java.lang.Object) */ @Override public Builder property(String name, Object value) { diff --git a/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfigTest.java b/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfigTest.java index 0379a32f..8e932578 100644 --- a/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfigTest.java +++ b/rps-tourney-service-client/src/test/java/com/justdavis/karl/rpstourney/service/client/config/ClientConfigTest.java @@ -12,7 +12,7 @@ public final class ClientConfigTest { /** * Tests {@link ClientConfig#getServiceRoot()}. - * + * * @throws URISyntaxException * (won't happen)) */ diff --git a/rps-tourney-webapp/pom.xml b/rps-tourney-webapp/pom.xml index af9f4466..8b60328b 100644 --- a/rps-tourney-webapp/pom.xml +++ b/rps-tourney-webapp/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 @@ -13,29 +12,29 @@ war rps-tourney-webapp - - A web application for playing the "Rock-Paper-Scissors Tourney" game. - Uses rps-tourney-service-app to handle all gameplay (and a bunch of - other functions.) - + A web application for playing the "Rock-Paper-Scissors Tourney" game. + Uses rps-tourney-service-app to handle all gameplay (and a bunch of + other functions.) - + ${project.basedir}/../dev + + 5.0.1.RELEASE - - - src/main/webapp/WEB-INF/resources/js/vendor/* - + src/main/webapp/WEB-INF/resources/js/vendor/* - org.springframework spring-framework-bom @@ -58,7 +57,7 @@ - javax.servlet javax.servlet-api @@ -66,8 +65,8 @@ provided - org.eclipse.jetty.orbit javax.servlet.jsp @@ -75,8 +74,8 @@ provided - org.eclipse.jetty jetty-jsp @@ -84,21 +83,21 @@ provided - org.springframework spring-webmvc - commons-logging - commons-logging - org.slf4j jcl-over-slf4j @@ -128,7 +127,7 @@ ${spring.security.version} - javax.annotation jsr250-api @@ -143,7 +142,7 @@ - org.ocpsoft.prettytime prettytime @@ -151,16 +150,16 @@ - ch.qos.logback logback-classic - - org.slf4j jul-to-slf4j @@ -178,7 +177,7 @@ spring-test - com.justdavis.karl.rpstourney rps-tourney-service-app @@ -187,14 +186,14 @@ test - org.hsqldb hsqldb test - org.seleniumhq.selenium selenium-java @@ -224,9 +223,9 @@ - - ${project.build.directory}/generated-war-resources/ WEB-INF/resources @@ -239,19 +238,19 @@ - ro.isdc.wro4j wro4j-maven-plugin 1.8.0 ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory - - ${basedir}/src/main/webapp,${project.build.directory}/generated-war-resources/ false @@ -266,7 +265,7 @@ 1.17.2 - org.mockito mockito-core @@ -275,8 +274,8 @@ - org.codehaus.cargo cargo-maven2-plugin @@ -284,9 +283,9 @@ jetty9x - org.eclipse.jetty jetty-distribution @@ -301,7 +300,7 @@ - org.hsqldb hsqldb @@ -327,8 +326,8 @@ - com.justdavis.karl.rpstourney rps-tourney-webapp @@ -348,10 +347,10 @@ jacoco-maven-plugin - default-prepare-agent @@ -359,10 +358,10 @@ - default-prepare-agent-integration @@ -382,10 +381,10 @@ than including it in our sources, we instead download and unpack it as part of every build. --> fetch-bootstrap - generate-resources wget + generate-resources https://github.com/twbs/bootstrap/archive/v3.2.0.zip true @@ -401,10 +400,10 @@ comprehensive: it provides a symbol font and CSS classes to make it easier to use. --> fetch-fontawesome - generate-resources wget + generate-resources https://fontawesome.com/v4/assets/font-awesome-4.7.0.zip @@ -418,48 +417,48 @@ - ro.isdc.wro4j wro4j-maven-plugin - compile run + compile - org.codehaus.cargo cargo-maven2-plugin start-container - pre-integration-test start + pre-integration-test stop-container - post-integration-test stop + post-integration-test - org.apache.maven.plugins maven-failsafe-plugin @@ -477,7 +476,7 @@ - m2e @@ -488,7 +487,7 @@ - org.eclipse.m2e diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/ConfigLoaderBindingForProduction.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/ConfigLoaderBindingForProduction.java index 8ff4784c..dcf9bcae 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/ConfigLoaderBindingForProduction.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/ConfigLoaderBindingForProduction.java @@ -8,8 +8,8 @@ import com.justdavis.karl.rpstourney.webapp.config.XmlConfigLoader; /** - * The Spring {@link Configuration} for the {@link IConfigLoader} to use in - * {@link SpringProfile#PRODUCTION} and {@link SpringProfile#DEVELOPMENT}. + * The Spring {@link Configuration} for the {@link IConfigLoader} to use in {@link SpringProfile#PRODUCTION} and + * {@link SpringProfile#DEVELOPMENT}. */ @Configuration @Profile(value = { SpringProfile.PRODUCTION, SpringProfile.DEVELOPMENT }) diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameClientBindings.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameClientBindings.java index 21724007..f73e4d46 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameClientBindings.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameClientBindings.java @@ -41,22 +41,18 @@ public ClientConfig serviceClientConfig(AppConfig appConfig) { } /** - * @return the {@link CookieStore} for the application to use, which will be - * session-scoped via a proxy to ensure that each client gets their - * own instance + * @return the {@link CookieStore} for the application to use, which will be session-scoped via a proxy to ensure + * that each client gets their own instance */ @Bean @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) public CookieStore cookieStore() { /* - * The CookieStore will be used to store the authentication - * tokens/cookies used by the web service clients (and possibly other - * stuff, later). Keeping the CookieStore, and those auth cookies, - * around in the sessions prevents us from having to recreate it on each - * request. (As an alternative, if this turns out to be a bad idea, the - * auth cookies could be rebuilt from the Authentication instances or - * Account principals in them that Spring Security is already saving in - * the session.) + * The CookieStore will be used to store the authentication tokens/cookies used by the web service clients (and + * possibly other stuff, later). Keeping the CookieStore, and those auth cookies, around in the sessions + * prevents us from having to recreate it on each request. (As an alternative, if this turns out to be a bad + * idea, the auth cookies could be rebuilt from the Authentication instances or Account principals in them that + * Spring Security is already saving in the session.) */ CookieStore cookieStore = new CookieStore(); @@ -66,8 +62,7 @@ public CookieStore cookieStore() { /** * @param config * the {@link ClientConfig} being used - * @return the {@link IServiceStatusResource} client for the application to - * use + * @return the {@link IServiceStatusResource} client for the application to use */ @Bean public IServiceStatusResource statusClient(ClientConfig config) { @@ -79,8 +74,7 @@ public IServiceStatusResource statusClient(ClientConfig config) { * @param config * the {@link ClientConfig} being used * @param cookieStore - * the {@link CookieStore} being used (likely session scoped and - * proxied) + * the {@link CookieStore} being used (likely session scoped and proxied) * @return the {@link IAccountsResource} client for the application to use */ @Bean @@ -92,8 +86,7 @@ public IAccountsResource accountsClient(ClientConfig config, CookieStore cookieS /** * @param config * the {@link ClientConfig} being used - * @return the {@link IAccountsClientFactory} client for the application to - * use + * @return the {@link IAccountsClientFactory} client for the application to use */ @Bean public IAccountsClientFactory accountsClientFactory(ClientConfig config) { @@ -105,8 +98,7 @@ public IAccountsClientFactory accountsClientFactory(ClientConfig config) { * @param config * the {@link ClientConfig} being used * @param cookieStore - * the {@link CookieStore} being used (likely session scoped and - * proxied) + * the {@link CookieStore} being used (likely session scoped and proxied) * @return the {@link IGuestAuthResource} client for the application to use */ @Bean @@ -119,8 +111,7 @@ public IGuestAuthResource guestAuthClient(ClientConfig config, CookieStore cooki * @param config * the {@link ClientConfig} being used * @param cookieStore - * the {@link CookieStore} being used (likely session scoped and - * proxied) + * the {@link CookieStore} being used (likely session scoped and proxied) * @return the {@link IGameAuthResource} client for the application to use */ @Bean @@ -133,8 +124,7 @@ public IGameAuthResource gameAuthClient(ClientConfig config, CookieStore cookieS * @param config * the {@link ClientConfig} being used * @param cookieStore - * the {@link CookieStore} being used (likely session scoped and - * proxied) + * the {@link CookieStore} being used (likely session scoped and proxied) * @return the {@link IGameResource} client for the application to use */ @Bean @@ -147,8 +137,7 @@ public IGameResource gameClient(ClientConfig config, CookieStore cookieStore) { * @param config * the {@link ClientConfig} being used * @param cookieStore - * the {@link CookieStore} being used (likely session scoped and - * proxied) + * the {@link CookieStore} being used (likely session scoped and proxied) * @return the {@link IPlayersResource} client for the application to use */ @Bean diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameWebApplicationInitializer.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameWebApplicationInitializer.java index 84371561..c1d5b793 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameWebApplicationInitializer.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/GameWebApplicationInitializer.java @@ -23,26 +23,24 @@ public final class GameWebApplicationInitializer implements WebApplicationInitia private static final Logger LOGGER = LoggerFactory.getLogger(GameWebApplicationInitializer.class); /* - * A bunch of Spring documentation mentions that it's important that the - * filters from {@link SecurityWebApplicationInitializer} be configured - * before anything else, thus the {@link Order} annotation here. + * A bunch of Spring documentation mentions that it's important that the filters from {@link + * SecurityWebApplicationInitializer} be configured before anything else, thus the {@link Order} annotation here. */ /** - * The web application context-wide initialization parameter that specifies - * the Spring parent {@link ApplicationContext} instance that should be used - * (if any). This is mostly intended for use by integration tests. - * + * The web application context-wide initialization parameter that specifies the Spring parent + * {@link ApplicationContext} instance that should be used (if any). This is mostly intended for use by integration + * tests. + * * @see ServletContext#setAttribute(String, Object) */ public static final String SPRING_PARENT_CONTEXT = "spring.context.parent"; /** - * The {@link ServletContext#getAttribute(String)} key that the Spring - * {@link ApplicationContext} will be saved under. This is intended for use - * by certain integration tests that want to allow the container to - * initialize the Spring context on its own. - * + * The {@link ServletContext#getAttribute(String)} key that the Spring {@link ApplicationContext} will be saved + * under. This is intended for use by certain integration tests that want to allow the container to initialize the + * Spring context on its own. + * * @see ServletContext#getAttribute(String) */ public static final String SPRING_CONTEXT_ATTRIBUTE = "spring.context"; @@ -58,13 +56,10 @@ public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext springContext = new AnnotationConfigWebApplicationContext(); /* - * If a parent Spring ApplicationContext is available, we'll use its - * configuration. If one is not available, we'll configure things - * ourselves. It's expected that some integration tests that use Jetty - * as the web application container will provide a parent - * ApplicationContext. (See - * ccom.justdavis.karl.rpstourney.webapp.SpringITConfigWithJetty for - * more details.) + * If a parent Spring ApplicationContext is available, we'll use its configuration. If one is not available, + * we'll configure things ourselves. It's expected that some integration tests that use Jetty as the web + * application container will provide a parent ApplicationContext. (See + * ccom.justdavis.karl.rpstourney.webapp.SpringITConfigWithJetty for more details.) */ ApplicationContext springParentContext = findSpringParentContext(servletContext); if (springParentContext != null) { @@ -87,10 +82,9 @@ public void onStartup(ServletContext servletContext) throws ServletException { new SessionCookieConfigurator().applyConfiguration(servletContext); /* - * Save the Spring context as a ServletContext attribute. It's expected - * that some integration tests will allow Jetty to start "clean" and - * will need to grab the Spring context out from it once it's running. - * See EmbeddedJettySpringContextRule for details. + * Save the Spring context as a ServletContext attribute. It's expected that some integration tests will allow + * Jetty to start "clean" and will need to grab the Spring context out from it once it's running. See + * EmbeddedJettySpringContextRule for details. */ servletContext.setAttribute(SPRING_CONTEXT_ATTRIBUTE, springContext); @@ -98,13 +92,10 @@ public void onStartup(ServletContext servletContext) throws ServletException { // springContext); /* - * Note: Getting the servlet mappings here correct took forever. The - * following discussion proved to be very helpful: - * http://www.jroller.com - * /kenwdelong/entry/spring_default_servlets_and_serving. Please also - * see the EmbeddedServer class, which provides the JSP and default - * servlets required by this application. Other containers that might be - * used, e.g. Tomcat, would also have to provide these somewhere. + * Note: Getting the servlet mappings here correct took forever. The following discussion proved to be very + * helpful: http://www.jroller.com /kenwdelong/entry/spring_default_servlets_and_serving. Please also see the + * EmbeddedServer class, which provides the JSP and default servlets required by this application. Other + * containers that might be used, e.g. Tomcat, would also have to provide these somewhere. */ // Register the Spring MVC DispatcherServlet to handle requests. @@ -117,16 +108,13 @@ public void onStartup(ServletContext servletContext) throws ServletException { } /** - * Allow the web application context's attributes to provide a parent - * {@link ApplicationContext} for Spring. This is intended for use in - * integration tests, where the container (i.e. Jetty) will be created in - * the parent context and the JAX-RS application will be created in its own - * child context. - * + * Allow the web application context's attributes to provide a parent {@link ApplicationContext} for Spring. This is + * intended for use in integration tests, where the container (i.e. Jetty) will be created in the parent context and + * the JAX-RS application will be created in its own child context. + * * @param servletContext * the {@link ServletContext} being configured - * @return the parent {@link ApplicationContext} for Spring, or - * null if none was found + * @return the parent {@link ApplicationContext} for Spring, or null if none was found */ private static ApplicationContext findSpringParentContext(ServletContext servletContext) { ApplicationContext springParentContext = (ApplicationContext) servletContext diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/RequestResponseLoggingInterceptor.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/RequestResponseLoggingInterceptor.java index 196830f0..5bc82270 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/RequestResponseLoggingInterceptor.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/RequestResponseLoggingInterceptor.java @@ -15,19 +15,17 @@ /** *

- * A Spring {@link HandlerInterceptor} that will log request and response - * details (if its logging category is enabled). Please note: + * A Spring {@link HandlerInterceptor} that will log request and response details (if its logging category is enabled). + * Please note: *

*
    *
  • This must be configured via - * {@link WebMvcConfigurer#addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)} - * , or some similar mechanism .
  • - *
  • This will only "catch" requests that are handled by the Spring MVC - * application.
  • - *
  • The logging will almost certainly end up containing sensitive - * information, such as passwords, and thus must never be - * enabled in production. (It's also going to be slow, which is another reason - * to not use it in production.)
  • + * {@link WebMvcConfigurer#addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry)} , or + * some similar mechanism . + *
  • This will only "catch" requests that are handled by the Spring MVC application.
  • + *
  • The logging will almost certainly end up containing sensitive information, such as passwords, and thus + * must never be enabled in production. (It's also going to be slow, which is another reason to not use + * it in production.)
  • *
*/ public final class RequestResponseLoggingInterceptor extends HandlerInterceptorAdapter { @@ -76,24 +74,22 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons requestRepresentation.append('}'); /* - * Note: We don't currently log the body/message content. It's - * tricky to get, and I don't (yet) have a need for it. + * Note: We don't currently log the body/message content. It's tricky to get, and I don't (yet) have a need + * for it. */ LOGGER.trace("Request: {}", requestRepresentation.toString()); } /* - * Returning true indicates that the request should continue to be - * handled. + * Returning true indicates that the request should continue to be handled. */ return true; } /** * @see org.springframework.web.servlet.handler.HandlerInterceptorAdapter#postHandle(javax.servlet.http.HttpServletRequest, - * javax.servlet.http.HttpServletResponse, java.lang.Object, - * org.springframework.web.servlet.ModelAndView) + * javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.web.servlet.ModelAndView) */ @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @@ -128,8 +124,8 @@ public void postHandle(HttpServletRequest request, HttpServletResponse response, responseRepresentation.append('}'); /* - * Note: We don't currently log the body/message content. It's - * tricky to get, and I don't (yet) have a need for it. + * Note: We don't currently log the body/message content. It's tricky to get, and I don't (yet) have a need + * for it. */ LOGGER.trace("Response: {}", responseRepresentation.toString()); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfigurator.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfigurator.java index d56b5a22..bc0651b1 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfigurator.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfigurator.java @@ -15,11 +15,9 @@ import com.justdavis.karl.rpstourney.webapp.util.CookiesUtils; /** - * This class is responsible for configuring the application's - * {@link SessionCookieConfig}. Without this configuration, the - * JSESSIONID cookies produced by this application will have the - * wrong Domain and Path attributes when running - * behind a proxy, which will effectively prevent sessions from working + * This class is responsible for configuring the application's {@link SessionCookieConfig}. Without this configuration, + * the JSESSIONID cookies produced by this application will have the wrong Domain and + * Path attributes when running behind a proxy, which will effectively prevent sessions from working * correctly. */ public final class SessionCookieConfigurator { @@ -39,13 +37,11 @@ public SessionCookieConfigurator() { * Constructs a new {@link SessionCookieConfigurator} instance. *

*

- * Marked as non-public and deprecated: this constructor is only intended - * for use in unit tests. + * Marked as non-public and deprecated: this constructor is only intended for use in unit tests. *

- * + * * @param springConfig - * the Spring {@link Configuration} class to locate the - * {@link IConfigLoader} bean from + * the Spring {@link Configuration} class to locate the {@link IConfigLoader} bean from */ @Deprecated SessionCookieConfigurator(Class springConfig) { @@ -56,15 +52,12 @@ public SessionCookieConfigurator() { } /** - * Properly configure the {@link ServletContext}'s - * {@link SessionCookieConfig}. + * Properly configure the {@link ServletContext}'s {@link SessionCookieConfig}. */ public void applyConfiguration(ServletContext servletContext) { /* - * We log our entry and exit to this method at 'info', so that the log - * makes more sense. The Spring startup involved here will log a bunch - * of stuff at 'info', and would be pretty confusing without some - * "bookmarks". + * We log our entry and exit to this method at 'info', so that the log makes more sense. The Spring startup + * involved here will log a bunch of stuff at 'info', and would be pretty confusing without some "bookmarks". */ LOGGER.info("Adjusting SessionCookieConfig..."); @@ -95,18 +88,15 @@ public void applyConfiguration(ServletContext servletContext) { } /** - * @return a Spring {@link AbstractApplicationContext} that can be used to - * retrieve the application's {@link IConfigLoader} + * @return a Spring {@link AbstractApplicationContext} that can be used to retrieve the application's + * {@link IConfigLoader} */ private AbstractApplicationContext getSpringContext() { /* - * There does not seem to be a point in this web application's lifecycle - * where both the Spring context and ServletContext are available. - * ServletContextListeners are one likely option, but apparently they - * aren't allowed to modify the ServletContext after it's initialized. - * So as an alternative, we create a small "bootstrap" Spring context - * here, which will only be used to load the AppConfig, and is then - * disposed of. + * There does not seem to be a point in this web application's lifecycle where both the Spring context and + * ServletContext are available. ServletContextListeners are one likely option, but apparently they aren't + * allowed to modify the ServletContext after it's initialized. So as an alternative, we create a small + * "bootstrap" Spring context here, which will only be used to load the AppConfig, and is then disposed of. */ AnnotationConfigApplicationContext springContext = new AnnotationConfigApplicationContext(); springContext.getEnvironment().setDefaultProfiles(SpringProfile.PRODUCTION); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringMvcConfig.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringMvcConfig.java index 7f97e7df..3e0a83e1 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringMvcConfig.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringMvcConfig.java @@ -37,8 +37,8 @@ import com.justdavis.karl.rpstourney.webapp.security.SecurityConfig; /** - * The Spring configuration used by {@link GameWebApplicationInitializer}, and - * thus the entire Spring Web MVC application. + * The Spring configuration used by {@link GameWebApplicationInitializer}, and thus the entire Spring Web MVC + * application. */ @Configuration @Import({ SecurityConfig.class, GameClientBindings.class, ConfigLoaderBindingForProduction.class }) @@ -62,11 +62,9 @@ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer conf @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { /* - * Older browsers, like IE8, send less-than-great "Accept" headers. - * We'll assume that any client that cares will request a specific - * content type, and anything requesting "*" is a dumb browser. (See - * https://jira.spring.io/browse/SPR-12481 for details on how this - * doesn't work quite as expected.) + * Older browsers, like IE8, send less-than-great "Accept" headers. We'll assume that any client that cares will + * request a specific content type, and anything requesting "*" is a dumb browser. (See + * https://jira.spring.io/browse/SPR-12481 for details on how this doesn't work quite as expected.) */ configurer.defaultContentType(MediaType.TEXT_HTML); } @@ -77,8 +75,7 @@ public void configureContentNegotiation(ContentNegotiationConfigurer configurer) @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { /* - * Each entry here will also need a corresponding entry in - * SecurityConfig.configure(WebSecurity). + * Each entry here will also need a corresponding entry in SecurityConfig.configure(WebSecurity). */ registry.addResourceHandler("/css/**").addResourceLocations("/WEB-INF/resources/css/"); @@ -86,10 +83,8 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/i18n/**").addResourceLocations("/WEB-INF/i18n/"); /* - * Though all of the sources from Bootstrap and FontAwesome are - * available, only the fonts from them are needed. (All of their LESS - * and JS have been copied by wro4j-maven-plugin into the css and js - * folders.) + * Though all of the sources from Bootstrap and FontAwesome are available, only the fonts from them are needed. + * (All of their LESS and JS have been copied by wro4j-maven-plugin into the css and js folders.) */ registry.addResourceHandler("/bootstrap-3.2.0/fonts/**") .addResourceLocations("/WEB-INF/resources/bootstrap-3.2.0/fonts/"); @@ -115,8 +110,7 @@ public ViewResolver viewResolver() { @Override public void addViewControllers(ViewControllerRegistry registry) { /* - * The login view's controller is provided by the Spring Security - * filters. + * The login view's controller is provided by the Spring Security filters. */ registry.addViewController("/login").setViewName("login"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); @@ -154,9 +148,8 @@ public HandlerInterceptor localeChangeInterceptor() { } /** - * @return the {@link CookieLocaleResolver} that will be used as the - * application's {@link LocaleResolver} (Spring looks this up by - * bean name) + * @return the {@link CookieLocaleResolver} that will be used as the application's {@link LocaleResolver} (Spring + * looks this up by bean name) */ @Bean public LocaleResolver localeResolver() { @@ -171,8 +164,8 @@ public LocaleResolver localeResolver() { @Override public void extendHandlerExceptionResolvers(List resolvers) { /* - * Add a Spring MVC {@link HandlerExceptionResolver} that configures how - * the application will render unhandled/uncaught {@link Exception}s. + * Add a Spring MVC {@link HandlerExceptionResolver} that configures how the application will render + * unhandled/uncaught {@link Exception}s. */ resolvers.add(new UnhandledExceptionResolver()); } @@ -180,8 +173,7 @@ public void extendHandlerExceptionResolvers(List resol /** * @param configLoader * the injected {@link IConfigLoader} for the application - * @return the application's settings, as represented by a {@link AppConfig} - * instance + * @return the application's settings, as represented by a {@link AppConfig} instance */ @Bean AppConfig appConfig(IConfigLoader configLoader) { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringProfile.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringProfile.java index 4449a7b2..70062c30 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringProfile.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/SpringProfile.java @@ -3,29 +3,25 @@ import org.springframework.context.annotation.Profile; /** - * Enumerates the various Spring {@link Profile}s supported in the application's - * Spring configuration. (Not an actual enum, as the values need to be - * referenced within annotations.) + * Enumerates the various Spring {@link Profile}s supported in the application's Spring configuration. (Not an actual + * enum, as the values need to be referenced within annotations.) */ public final class SpringProfile { /** - * The default {@link Profile}. Contains the configuration for use when the - * application is deployed in production. - * + * The default {@link Profile}. Contains the configuration for use when the application is deployed in production. + * * @see GameWebApplicationInitializer#onStartup(javax.servlet.ServletContext) */ public static final String PRODUCTION = "production"; /** - * The default {@link Profile}. Contains the configuration for use when the - * application is running inside Eclipse (generally via - * WebAppJettyLauncher). + * The default {@link Profile}. Contains the configuration for use when the application is running inside Eclipse + * (generally via WebAppJettyLauncher). */ public static final String DEVELOPMENT = "development"; /** - * Contains the configuration for use when the application is running in - * integration tests. + * Contains the configuration for use when the application is running in integration tests. */ public static final String INTEGRATION_TESTS = "integration-tests"; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/XmlNamespace.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/XmlNamespace.java index 987acddb..6ea88cc1 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/XmlNamespace.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/XmlNamespace.java @@ -5,21 +5,17 @@ */ public final class XmlNamespace { /** - * The default XML namespace that should be used by this project's web - * application. + * The default XML namespace that should be used by this project's web application. */ public static final String RPSTOURNEY_APP = "http://justdavis.com/karl/rpstourney/app/schema/v1"; /** - * A convenience-only alias for - * {@link com.justdavis.karl.rpstourney.service.api.XmlNamespace#RPSTOURNEY_API} - * . + * A convenience-only alias for {@link com.justdavis.karl.rpstourney.service.api.XmlNamespace#RPSTOURNEY_API} . */ public static final String RPSTOURNEY_API = com.justdavis.karl.rpstourney.service.api.XmlNamespace.RPSTOURNEY_API; /** - * A convenience-only alias for - * {@link com.justdavis.karl.misc.datasources.XmlNamespace#JE_DATASOURCES}. + * A convenience-only alias for {@link com.justdavis.karl.misc.datasources.XmlNamespace#JE_DATASOURCES}. */ public static final String JE_DATASOURCES = com.justdavis.karl.misc.datasources.XmlNamespace.JE_DATASOURCES; } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/AccountController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/AccountController.java index d1bcf9e9..64115257 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/AccountController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/AccountController.java @@ -30,7 +30,7 @@ public class AccountController { /** * Constructs a new {@link AccountController} instance. - * + * * @param accountsClient * the {@link IAccountsResource} client to use */ @@ -42,14 +42,12 @@ public AccountController(IAccountsResource accountsClient) { /** * @param authenticatedUser * the currently logged in user {@link Principal} - * @return a {@link ModelAndView} that can be used to render some basic - * information about the current user + * @return a {@link ModelAndView} that can be used to render some basic information about the current user */ @RequestMapping(method = RequestMethod.GET) public ModelAndView getPage(Principal authenticatedUser) { /* - * If a client requests this page without having authenticated, we want - * to redirect them to the login page. + * If a client requests this page without having authenticated, we want to redirect them to the login page. */ if (authenticatedUser == null) return new ModelAndView("redirect:/login"); @@ -79,23 +77,20 @@ public ModelAndView getPage(Principal authenticatedUser) { } /** - * Accepts form submissions from account.jsp, allowing users to - * make changes to their {@link Account}. - * + * Accepts form submissions from account.jsp, allowing users to make changes to their {@link Account}. + * * @param gameId * the {@link Game#getId()} of the game being updated * @param inputName * the new value for {@link Account#getName()} * @param authenticatedUser - * the currently logged in user {@link Principal} (whose - * {@link Account#getName()} is to be updated) + * the currently logged in user {@link Principal} (whose {@link Account#getName()} is to be updated) * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/update", method = { RequestMethod.POST }, produces = MediaType.TEXT_HTML_VALUE) public ModelAndView updateAccount(Principal authenticatedUser, String inputName) { /* - * If a client requests this page without having authenticated, we want - * to redirect them to the login page. + * If a client requests this page without having authenticated, we want to redirect them to the login page. */ if (authenticatedUser == null) return new ModelAndView("redirect:/login"); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/RegisterController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/RegisterController.java index 1f215b0e..65509975 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/RegisterController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/RegisterController.java @@ -39,8 +39,8 @@ public class RegisterController { private static final Logger LOGGER = LoggerFactory.getLogger(RegisterController.class); /** - * The {@link RedirectAttributes#getFlashAttributes()} key used to store - * errors/warnings that should be displayed to the user. + * The {@link RedirectAttributes#getFlashAttributes()} key used to store errors/warnings that should be displayed to + * the user. */ private static final String FLASH_ATTRIB_MESSAGE_TYPE = "messageType"; @@ -49,7 +49,7 @@ public class RegisterController { /** * Constructs a new {@link RegisterController} instance. - * + * * @param accountsClient * the {@link IAccountsResource} client to use * @param gameAuthClient @@ -64,8 +64,7 @@ public RegisterController(IAccountsResource accountsClient, IGameAuthResource ga /** * @param authenticatedUser * the currently logged in user {@link Principal} - * @return a {@link ModelAndView} that can be used to render some basic - * information about the current user + * @return a {@link ModelAndView} that can be used to render some basic information about the current user */ @RequestMapping(method = RequestMethod.GET) public ModelAndView getPage(Principal authenticatedUser) { @@ -75,18 +74,16 @@ public ModelAndView getPage(Principal authenticatedUser) { authenticatedAccount = accountsClient.getAccount(); /* - * Does the user's account already have an associated - * (non-anonymous) login? If so, perhaps the best thing to do is - * redirect the user to their account details. + * Does the user's account already have an associated (non-anonymous) login? If so, perhaps the best thing + * to do is redirect the user to their account details. */ if (!authenticatedAccount.isAnonymous()) return new ModelAndView("redirect:/account"); } /* - * Just a note: If authenticatedAccount is not null and we've reached - * this point, it means that the user has a pre-existing anonymous login - * that will need to be merged with any new login that they create. + * Just a note: If authenticatedAccount is not null and we've reached this point, it means that the user has a + * pre-existing anonymous login that will need to be merged with any new login that they create. */ // Build the model for the account.jsp view. @@ -97,23 +94,19 @@ public ModelAndView getPage(Principal authenticatedUser) { } /** - * Accepts form submissions from register.jsp, allowing users - * to create a new {@link GameLoginIdentity} (and, if needed, an - * {@link Account}). - * + * Accepts form submissions from register.jsp, allowing users to create a new {@link GameLoginIdentity} + * (and, if needed, an {@link Account}). + * * @param authenticatedUser - * the currently logged in user {@link Principal} (whose - * {@link Account#getName()} is to be updated) + * the currently logged in user {@link Principal} (whose {@link Account#getName()} is to be updated) * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @param inputEmail * the email address that the user has entered * @param inputPassword1 * the password that the user has entered * @param inputPassword2 - * the password confirmation that the user has entered (hopefully - * matches the other one) + * the password confirmation that the user has entered (hopefully matches the other one) * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(method = { RequestMethod.POST }, produces = MediaType.TEXT_HTML_VALUE) @@ -125,18 +118,15 @@ public ModelAndView registerLogin(Principal authenticatedUser, RedirectAttribute authenticatedAccount = accountsClient.getAccount(); /* - * Does the user's account already have an associated (non-anonymous) - * login? If so, they shouldn't have been able to view the form, much - * less submit it. + * Does the user's account already have an associated (non-anonymous) login? If so, they shouldn't have been + * able to view the form, much less submit it. */ if (authenticatedAccount != null && !authenticatedAccount.isAnonymous()) throw new BadCodeMonkeyException("Unable to create second game login for user."); /* - * TODO This should be using data binding and JSR-303 validation, which - * can collect multiple validation failures at once. See - * http://www.journaldev - * .com/2668/spring-mvc-form-validation-example-using + * TODO This should be using data binding and JSR-303 validation, which can collect multiple validation failures + * at once. See http://www.journaldev .com/2668/spring-mvc-form-validation-example-using * -annotation-and-custom-validator-implementation for an example. */ @@ -146,8 +136,7 @@ public ModelAndView registerLogin(Principal authenticatedUser, RedirectAttribute emailAddress = new InternetAddress(inputEmail, false); } catch (AddressException e) { /* - * The InternetAddress constructor will throw this exception if the - * address fails to parse correctly. + * The InternetAddress constructor will throw this exception if the address fails to parse correctly. */ redirectAttributes.addFlashAttribute(FLASH_ATTRIB_MESSAGE_TYPE, "emailParseFailure"); return new ModelAndView("redirect:/register"); @@ -158,8 +147,7 @@ public ModelAndView registerLogin(Principal authenticatedUser, RedirectAttribute } /* - * Create the new login (and an Account if they didn't already have - * one). + * Create the new login (and an Account if they didn't already have one). */ Account possiblyNewAccount; try { @@ -171,11 +159,9 @@ public ModelAndView registerLogin(Principal authenticatedUser, RedirectAttribute } /* - * Create a Spring Security 'Authentication' token for the login and use - * it to programmatically login the new/updated account. This token will - * end up being saved in the session. The principal saved in the token - * will be passed to anything else that asks for the request's - * security/authorization principal. + * Create a Spring Security 'Authentication' token for the login and use it to programmatically login the + * new/updated account. This token will end up being saved in the session. The principal saved in the token will + * be passed to anything else that asks for the request's security/authorization principal. */ List grantedAuthorities = new LinkedList<>(); for (SecurityRole role : possiblyNewAccount.getRoles()) diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/package-info.java index b7e1fad3..500a2eab 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/account/package-info.java @@ -1,4 +1,4 @@ /** * Contains classes for the application's "My Account", and related, pages. */ -package com.justdavis.karl.rpstourney.webapp.account; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.account; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfig.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfig.java index 9b1acae1..0da6901d 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfig.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfig.java @@ -6,9 +6,9 @@ import javax.xml.bind.annotation.XmlRootElement; /** - * Represents the game web application's configuration data. Please note that - * instances of this class can be marshalled/unmarshalled via JAX-B. - * + * Represents the game web application's configuration data. Please note that instances of this class can be + * marshalled/unmarshalled via JAX-B. + * * @see IConfigLoader */ @XmlRootElement @@ -30,7 +30,7 @@ private AppConfig() { /** * Constructs a new {@link AppConfig} instance. - * + * * @param baseUrl * the value to use for {@link #getBaseUrl()} * @param clientServiceRoot @@ -47,9 +47,8 @@ public AppConfig(URL baseUrl, URL clientServiceRoot) { } /** - * @return the root {@link URL} that this web application is actually being - * served from, which all links generated by the application will - * reference + * @return the root {@link URL} that this web application is actually being served from, which all links generated + * by the application will reference * @see BaseUrlInterceptor */ public URL getBaseUrl() { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigException.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigException.java index 3fe81aea..149f1f6e 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigException.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigException.java @@ -1,15 +1,15 @@ package com.justdavis.karl.rpstourney.webapp.config; /** - * This unchecked {@link RuntimeException} indicates that the application's - * configuration could not be found where expected, parsed, or otherwise loaded. + * This unchecked {@link RuntimeException} indicates that the application's configuration could not be found where + * expected, parsed, or otherwise loaded. */ public final class AppConfigException extends RuntimeException { private static final long serialVersionUID = 5868164294827440254L; /** * Constructs a new {@link AppConfigException}. - * + * * @param message * the value to use for {@link #getMessage()} * @param cause @@ -21,7 +21,7 @@ public AppConfigException(String message, Throwable cause) { /** * Constructs a new {@link AppConfigException}. - * + * * @param message * the value to use for {@link #getMessage()} */ diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/BaseUrlInterceptor.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/BaseUrlInterceptor.java index f19af5e3..84ad376a 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/BaseUrlInterceptor.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/BaseUrlInterceptor.java @@ -8,18 +8,16 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; /** - * This Spring interceptor runs on every request/response and sets the value of - * {@link AppConfig#getBaseUrl()} as a + * This Spring interceptor runs on every request/response and sets the value of {@link AppConfig#getBaseUrl()} as a * {@link HttpServletRequest#getAttribute(String)} entry (using the key - * {@link BaseUrlInterceptor#REQUEST_ATTRIB_BASE_URL}). This allows the JSP - * views to use it to build correct URLs. (This is necessary in the case of a - * proxy deployment when the proxied location has a different context path.) + * {@link BaseUrlInterceptor#REQUEST_ATTRIB_BASE_URL}). This allows the JSP views to use it to build correct URLs. (This + * is necessary in the case of a proxy deployment when the proxied location has a different context path.) */ @Component public class BaseUrlInterceptor extends HandlerInterceptorAdapter { /** - * The {@link HttpServletRequest#setAttribute(String, Object)} key used to - * store the application's {@link AppConfig#getBaseUrl()} value. + * The {@link HttpServletRequest#setAttribute(String, Object)} key used to store the application's + * {@link AppConfig#getBaseUrl()} value. */ public static final String REQUEST_ATTRIB_BASE_URL = "rpstourney.config.baseurl"; @@ -27,7 +25,7 @@ public class BaseUrlInterceptor extends HandlerInterceptorAdapter { /** * Constructs a new {@link BaseUrlInterceptor} instance. - * + * * @param appConfig * the application's {@link AppConfig} */ diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/IConfigLoader.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/IConfigLoader.java index e9559cb7..468cb410 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/IConfigLoader.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/IConfigLoader.java @@ -2,19 +2,17 @@ /** *

- * Implementations of this interface are responsible for loading/providing the - * application with the {@link AppConfig} data object to use. + * Implementations of this interface are responsible for loading/providing the application with the {@link AppConfig} + * data object to use. *

*

- * Implementations of this interface must cache {@link AppConfig} data after it - * has been loaded once. Accordingly, the only way for changes to the - * application's configuration to be applied is to restart the application. + * Implementations of this interface must cache {@link AppConfig} data after it has been loaded once. Accordingly, the + * only way for changes to the application's configuration to be applied is to restart the application. *

*/ public interface IConfigLoader { /** - * @return the just-loaded or previously-loaded-and-now-cached - * {@link AppConfig} data object for the application + * @return the just-loaded or previously-loaded-and-now-cached {@link AppConfig} data object for the application */ AppConfig getConfig(); } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoader.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoader.java index d82c30f1..7c644408 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoader.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoader.java @@ -23,35 +23,31 @@ /** *

- * This {@link IConfigLoader} implementation loads the application's - * configuration from a JAXB-unmarshallable XML file. + * This {@link IConfigLoader} implementation loads the application's configuration from a JAXB-unmarshallable XML file. *

*

- * By default, the application's configuration will be read from a file located - * at {@link #CONFIG_DEFAULT}, which is in the application's (or container's) - * current working directory. This, however, can be overridden by specifying a + * By default, the application's configuration will be read from a file located at {@link #CONFIG_DEFAULT}, which is in + * the application's (or container's) current working directory. This, however, can be overridden by specifying a * different path via the {@link #CONFIG_PROP} Java system property. *

*/ public class XmlConfigLoader implements IConfigLoader { /** - * The default path that the application's configuration will be read from, - * unless overridden via {@link #CONFIG_PROP}. + * The default path that the application's configuration will be read from, unless overridden via + * {@link #CONFIG_PROP}. */ public static final String CONFIG_DEFAULT = "./rps-webapp-config.xml"; /** - * The Java system property that specifies the path that the application's - * configuration will be read from, overriding the default path specified in - * {@link #CONFIG_DEFAULT}. - * + * The Java system property that specifies the path that the application's configuration will be read from, + * overriding the default path specified in {@link #CONFIG_DEFAULT}. + * * @see System#getProperty(String) */ public static final String CONFIG_PROP = "rps.webapp.config.path"; /** - * This static field is used as a cache for the application's - * {@link AppConfig}. + * This static field is used as a cache for the application's {@link AppConfig}. */ private static AppConfig cachedConfig = null; @@ -68,12 +64,10 @@ public XmlConfigLoader() { @Override public synchronized AppConfig getConfig() { /* - * This method is marked as synchronized to prevent different parts of - * the application from ending up with different config instances. If - * this proves to be a bottleneck, we'll want to create a second - * IConfigLoader implementation that takes an already-loaded config - * value, and set the application to just use that implementation - * (pre-loading the config via this implementation at startup). + * This method is marked as synchronized to prevent different parts of the application from ending up with + * different config instances. If this proves to be a bottleneck, we'll want to create a second IConfigLoader + * implementation that takes an already-loaded config value, and set the application to just use that + * implementation (pre-loading the config via this implementation at startup). */ // Do we already have a cached copy available? @@ -108,19 +102,16 @@ public synchronized AppConfig getConfig() { /** *

- * Marshalls the specified {@link AppConfig} instance out to the specified - * {@link File}. + * Marshalls the specified {@link AppConfig} instance out to the specified {@link File}. *

*

- * This method is not intended for use in the application itself, but is - * useful in some integration tests. + * This method is not intended for use in the application itself, but is useful in some integration tests. *

- * + * * @param config * the {@link AppConfig} instance to be marshalled out * @param configFile - * the {@link File} location to write the {@link AppConfig} out - * to + * the {@link File} location to write the {@link AppConfig} out to */ public static void writeConfig(AppConfig config, File configFile) { if (config == null) @@ -145,7 +136,7 @@ public static void writeConfig(AppConfig config, File configFile) { /** * Note: Integration tests may want to override this method. - * + * * @return an {@link InputStream} for the application's configuration file */ protected InputStream retrieveConfigFile() { @@ -165,9 +156,8 @@ protected InputStream retrieveConfigFile() { } /** - * @return an {@link InputStream} for the file available at - * {@link #CONFIG_DEFAULT}, or null if no such file - * exists + * @return an {@link InputStream} for the file available at {@link #CONFIG_DEFAULT}, or null if no such + * file exists */ private static InputStream retrieveConfigFile_default() { try { @@ -184,13 +174,11 @@ private static InputStream retrieveConfigFile_default() { } /** - * @return an {@link InputStream} for the file specified by - * {@link #CONFIG_PROP}, or null if that property - * wasn't set + * @return an {@link InputStream} for the file specified by {@link #CONFIG_PROP}, or null if that + * property wasn't set * @throws AppConfigException - * A {@link CodeGenerationException} will be thrown if the - * {@link #CONFIG_PROP} property has been set to a value that - * does not point to an actual file. + * A {@link CodeGenerationException} will be thrown if the {@link #CONFIG_PROP} property has been set to + * a value that does not point to an actual file. */ private static InputStream retrieveConfigFile_overridden() throws AppConfigException { try { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/ErrorController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/ErrorController.java index ddd88d27..08a995f4 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/ErrorController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/ErrorController.java @@ -18,10 +18,8 @@ public class ErrorController { /** * @param httpRequest - * the {@link HttpServletRequest} that resulted in the error - * being rendered - * @return a {@link ModelAndView} that can be used to render an application - * error + * the {@link HttpServletRequest} that resulted in the error being rendered + * @return a {@link ModelAndView} that can be used to render an application error */ @RequestMapping(method = RequestMethod.GET) public ModelAndView renderErrorPage(HttpServletRequest httpRequest) { @@ -39,9 +37,8 @@ public ModelAndView renderErrorPage(HttpServletRequest httpRequest) { } /** - * Always throws an {@link Exception} when requested. Useful for testing - * purposes -- to verify that the application is handling errors as - * expected. + * Always throws an {@link Exception} when requested. Useful for testing purposes -- to verify that the application + * is handling errors as expected. */ @RequestMapping(value = "go-boom", method = RequestMethod.GET) public void goBoom() { @@ -50,8 +47,7 @@ public void goBoom() { /** * @param httpRequest - * the {@link HttpServletRequest} that resulted in the error - * being rendered + * the {@link HttpServletRequest} that resulted in the error being rendered * @return the {@link HttpStatus#value()} of the error being rendered */ private static int getErrorCode(HttpServletRequest httpRequest) { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/UnhandledExceptionResolver.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/UnhandledExceptionResolver.java index 45b64090..5588867e 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/UnhandledExceptionResolver.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/UnhandledExceptionResolver.java @@ -19,9 +19,8 @@ public final class UnhandledExceptionResolver extends SimpleMappingExceptionReso */ public UnhandledExceptionResolver() { /* - * This isn't set by default, so without it Spring MVC generates an ugly - * page with the full stack trace on it, which is a bad idea. Instead, - * we point it at the error-default.jsp view. + * This isn't set by default, so without it Spring MVC generates an ugly page with the full stack trace on it, + * which is a bad idea. Instead, we point it at the error-default.jsp view. */ setDefaultErrorView("error-default"); setDefaultStatusCode(HttpStatus.INTERNAL_SERVER_ERROR.value()); @@ -34,9 +33,8 @@ public UnhandledExceptionResolver() { @Override protected void logException(Exception ex, HttpServletRequest request) { /* - * Overriding this superclass method accomplishes two things, 1) - * configures Spring MVC to actually log errors (it doesn't by default), - * and 2) lets us customize how those errors are logged. + * Overriding this superclass method accomplishes two things, 1) configures Spring MVC to actually log errors + * (it doesn't by default), and 2) lets us customize how those errors are logged. */ LOGGER.error("Unhandled error encountered for request: '{}'", getFullRequestUrl(request), ex); @@ -45,8 +43,7 @@ protected void logException(Exception ex, HttpServletRequest request) { /** * @param request * the {@link HttpServletRequest} to get the full URL of - * @return the full request URL, including - * {@link HttpServletRequest#getRequestURL()} and + * @return the full request URL, including {@link HttpServletRequest#getRequestURL()} and * {@link HttpServletRequest#getQueryString()} (if any) */ private String getFullRequestUrl(HttpServletRequest request) { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/package-info.java index c8d6394f..30bb3c56 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/error/package-info.java @@ -1,4 +1,4 @@ /** * Contains classes for the application's error pages. */ -package com.justdavis.karl.rpstourney.webapp.error; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.error; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameController.java index 586ab917..3da0fd44 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameController.java @@ -50,9 +50,8 @@ public class GameController { /** *

- * The {@link RedirectAttributes#getFlashAttributes()} key used to store - * error codes when problems are encountered. The following error codes are - * supported: + * The {@link RedirectAttributes#getFlashAttributes()} key used to store error codes when problems are encountered. + * The following error codes are supported: *

*
    *
  • All of the {@link GameConflictException} constant names.
  • @@ -73,7 +72,7 @@ public class GameController { /** * Constructs a new {@link GameController} instance. - * + * * @param gameClient * the {@link IGameResource} client to use * @param accountsClient @@ -94,24 +93,20 @@ public GameController(IGameResource gameClient, IAccountsResource accountsClient /** *

    - * Creates a new persistent {@link Game} and redirects to - * {@link #getGame(String, Principal)} to display it. + * Creates a new persistent {@link Game} and redirects to {@link #getGame(String, Principal)} to display it. *

    *

    - * Note: If the requesting client is not logged in/authenticated when making - * this request, they will be automatically logged in via - * {@link IGuestLoginManager} as a guest. + * Note: If the requesting client is not logged in/authenticated when making this request, they will be + * automatically logged in via {@link IGuestLoginManager} as a guest. *

    - * + * * @param authenticatedUser - * the currently logged in user {@link Principal}, or - * null if no user is logged in + * the currently logged in user {@link Principal}, or null if no user is logged in * @param request * the {@link HttpServletRequest} being processed * @param response * the {@link HttpServletResponse} being generated - * @return a redirect: view name for the {@link Game} that's - * been created + * @return a redirect: view name for the {@link Game} that's been created */ @RequestMapping(value = "/", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) public String createNewGame(Principal authenticatedUser, HttpServletRequest request, HttpServletResponse response) { @@ -134,19 +129,15 @@ public String createNewGame(Principal authenticatedUser, HttpServletRequest requ * the currently logged in user {@link Principal} * @param locale * the {@link Locale} to target for display - * @return a {@link ModelAndView} that can be used to render an existing - * gameplay session + * @return a {@link ModelAndView} that can be used to render an existing gameplay session */ @RequestMapping(value = "/{gameId}", method = RequestMethod.GET) public ModelAndView getGameAsHtml(@PathVariable String gameId, Principal authenticatedUser, Locale locale) { /* - * FIXME Per the suggestion in - * https://jira.spring.io/browse/SPR-12481?focusedCommentId - * =110879&page=com - * .atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel - * #comment-110879, this method's @RequestMapping is not marked as - * "produces = MediaType.TEXT_HTML_VALUE". It does return HTML, though. - * This workaround should be removed if that JIRA issue is resolved. + * FIXME Per the suggestion in https://jira.spring.io/browse/SPR-12481?focusedCommentId =110879&page=com + * .atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel #comment-110879, this method's @RequestMapping + * is not marked as "produces = MediaType.TEXT_HTML_VALUE". It does return HTML, though. This workaround should + * be removed if that JIRA issue is resolved. */ GameView game = loadGame(gameId); @@ -159,8 +150,7 @@ public ModelAndView getGameAsHtml(@PathVariable String gameId, Principal authent /** * @param gameId * the {@link Game#getId()} of the game being requested - * @return a {@link GameView} instance with the current game state for the - * requesting user + * @return a {@link GameView} instance with the current game state for the requesting user */ @RequestMapping(value = "/{gameId}/data", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @@ -171,17 +161,15 @@ public GameView getGameAsJson(@PathVariable String gameId) { /** * The controller for accepting {@link Account#getName()} updates. - * + * * @param gameId * the {@link Game#getId()} of the game being updated * @param inputPlayerName * the new value for {@link Account#getName()} * @param authenticatedUser - * the currently logged in user {@link Principal} (whose - * {@link Account#getName()} is to be updated) + * the currently logged in user {@link Principal} (whose {@link Account#getName()} is to be updated) * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/{gameId}/updateName", method = { @@ -201,9 +189,8 @@ public String updateName(@PathVariable String gameId, String inputPlayerName, Pr account.setName(inputPlayerName); /* - * Try to submit the name update. If the user has specified an invalid - * name (per the web service's bean validation), this will go boom with - * an HTTP 400. + * Try to submit the name update. If the user has specified an invalid name (per the web service's bean + * validation), this will go boom with an HTTP 400. */ try { accountsClient.updateAccount(account); @@ -217,18 +204,15 @@ public String updateName(@PathVariable String gameId, String inputPlayerName, Pr } /** - * The controller facade for - * {@link IGameResource#submitThrow(String, int, Throw)}. - * + * The controller facade for {@link IGameResource#submitThrow(String, int, Throw)}. + * * @param gameId * the {@link Game#getId()} of the game being updated * @param throwToPlay - * the {@link Throw} that the current user/player is submitting - * for the current {@link GameRound} in the specified - * {@link Game} + * the {@link Throw} that the current user/player is submitting for the current {@link GameRound} in the + * specified {@link Game} * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/{gameId}/playThrow", method = { RequestMethod.GET, @@ -245,9 +229,8 @@ public String submitThrow(@PathVariable String gameId, @RequestParam Throw throw } catch (HttpClientException e) { if (e.getStatus().getStatusCode() == Status.CONFLICT.getStatusCode()) { /* - * This is perfectly normal and not a problem: it can happen due - * to one of the clients being slightly out of date before - * making the call. + * This is perfectly normal and not a problem: it can happen due to one of the clients being slightly + * out of date before making the call. */ } else { // For anything other than a CONFLICT, wrap & rethrow. @@ -270,7 +253,7 @@ public String submitThrow(@PathVariable String gameId, @RequestParam Throw throw /** * The controller facade for {@link IGameResource#joinGame(String)}. - * + * * @param gameId * the {@link Game#getId()} of the game being updated * @param request @@ -280,8 +263,7 @@ public String submitThrow(@PathVariable String gameId, @RequestParam Throw throw * @param authenticatedUser * the currently logged in user {@link Principal} * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/{gameId}/join", method = { RequestMethod.GET, @@ -310,22 +292,19 @@ public String joinGame(@PathVariable String gameId, HttpServletRequest request, } /** - * The controller facade for - * {@link IGameResource#inviteOpponent(String, long)}. - * + * The controller facade for {@link IGameResource#inviteOpponent(String, long)}. + * * @param gameId * the {@link Game#getId()} of the game being updated * @param opponentType - * either friend or ai, indicating - * which type of opponent the user has requested + * either friend or ai, indicating which type of opponent the user has + * requested * @param playerId - * the {@link Player#getId()} of the player being invited as the - * user's opponent + * the {@link Player#getId()} of the player being invited as the user's opponent * @param authenticatedUser * the currently logged in user {@link Principal} * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/{gameId}/inviteOpponent", method = { RequestMethod.GET, @@ -336,9 +315,8 @@ public String inviteOpponent(@PathVariable String gameId, @RequestParam String o GameView game = loadGame(gameId); /* - * If they haven't requested an AI opponent, do nothing. (The submit - * button generally wouldn't be visible for them, but if they have - * disabled JS, they might still use it.) + * If they haven't requested an AI opponent, do nothing. (The submit button generally wouldn't be visible for + * them, but if they have disabled JS, they might still use it.) */ if (!"ai".equals(opponentType)) return "redirect:/game/" + gameId; @@ -361,21 +339,18 @@ public String inviteOpponent(@PathVariable String gameId, @RequestParam String o } /** - * The controller facade for - * {@link IGameResource#setMaxRounds(String, int, int)}. - * + * The controller facade for {@link IGameResource#setMaxRounds(String, int, int)}. + * * @param gameId * the {@link Game#getId()} of the game being updated * @param oldMaxRoundsValue - * the current/old value of {@link Game#getMaxRounds()} (used to - * help prevent synchronization issues) + * the current/old value of {@link Game#getMaxRounds()} (used to help prevent synchronization issues) * @param newMaxRoundsValue * the new value for {@link Game#getMaxRounds()} * @param authenticatedUser * the currently logged in user {@link Principal} * @param redirectAttributes - * the Spring MVC {@link RedirectAttributes} that will be used to - * pass flash attributes around + * the Spring MVC {@link RedirectAttributes} that will be used to pass flash attributes around * @return a redirect: view name for the updated {@link Game} */ @RequestMapping(value = "/{gameId}/setMaxRounds", method = { RequestMethod.GET, @@ -406,8 +381,7 @@ public String setMaxRounds(@PathVariable String gameId, @RequestParam int oldMax /** * @param gameId * the {@link Game#getId()} to match against - * @return the specified {@link GameView}, as returned by - * {@link #gameClient} + * @return the specified {@link GameView}, as returned by {@link #gameClient} */ private GameView loadGame(String gameId) { GameView game = null; @@ -436,8 +410,7 @@ private ModelAndView buildGameModelAndView(Locale locale, Principal authenticate modelAndView.addObject("game", game); /* - * Determine Player display order. Always display current user first, if - * they're a Player. + * Determine Player display order. Always display current user first, if they're a Player. */ Player firstPlayer = isUserThisPlayer(authenticatedUser, game.getPlayer2()) ? game.getPlayer2() : game.getPlayer1(); @@ -452,9 +425,8 @@ private ModelAndView buildGameModelAndView(Locale locale, Principal authenticate : game.getRounds().get(game.getRounds().size() - 1).getAdjustedRoundIndex()); /* - * The following model entries are ONLY used for display purposes. They - * are not and should not be used for any sort of real/actual access - * control. + * The following model entries are ONLY used for display purposes. They are not and should not be used for any + * sort of real/actual access control. */ boolean isPlayer1 = isUserThisPlayer(authenticatedUser, game.getPlayer1()); boolean isPlayer2 = isUserThisPlayer(authenticatedUser, game.getPlayer2()); @@ -473,14 +445,12 @@ private ModelAndView buildGameModelAndView(Locale locale, Principal authenticate List aiPlayersList = new ArrayList<>(aiPlayersSet); Collections.sort(aiPlayersList, new Comparator() { /** - * @see java.util.Comparator#compare(java.lang.Object, - * java.lang.Object) + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ @Override public int compare(Player o1, Player o2) { /* - * This is hacky, but it gives the AIs a stable order that - * happens to be from least-->most difficult. + * This is hacky, but it gives the AIs a stable order that happens to be from least-->most difficult. */ Integer ai1Ordinal = o1.getBuiltInAi().ordinal(); Integer ai2Ordinal = o2.getBuiltInAi().ordinal(); @@ -494,21 +464,18 @@ public int compare(Player o1, Player o2) { /** * @param authenticatedUser - * the user/client {@link Principal} that made the request, or - * null if the request was unauthenticated + * the user/client {@link Principal} that made the request, or null if the request was + * unauthenticated * @param player - * the {@link Player} to check against, or null if - * the player hasn't joined the game yet - * @return true if the specified {@link Principal} is the - * specified {@link Player}, false if not + * the {@link Player} to check against, or null if the player hasn't joined the game yet + * @return true if the specified {@link Principal} is the specified {@link Player}, false + * if not */ private static boolean isUserThisPlayer(Principal authenticatedUser, Player player) { /* - * This is a bit tricky. Because we're using Spring Security, we can - * expect that the Principal instances passed to any controller methods - * will be Authentication instances. From that Authentication, we can - * extract the actual/underlying principal. Given this application's - * SecurityConfig, that should always be an Account. + * This is a bit tricky. Because we're using Spring Security, we can expect that the Principal instances passed + * to any controller methods will be Authentication instances. From that Authentication, we can extract the + * actual/underlying principal. Given this application's SecurityConfig, that should always be an Account. */ Object actualPrincipal = null; if (authenticatedUser == null) @@ -522,8 +489,7 @@ else if (authenticatedUser instanceof Authentication) return false; if (player.getHumanAccount() == null) /* - * AI players will not & cannot use the web app; they must use the - * web service or Java API. + * AI players will not & cannot use the web app; they must use the web service or Java API. */ return false; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameExceptionHandler.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameExceptionHandler.java index 2131861b..3b374600 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameExceptionHandler.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameExceptionHandler.java @@ -8,8 +8,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; /** - * This {@link ControllerAdvice} helper maps some specific application - * exceptions to HTTP response codes. + * This {@link ControllerAdvice} helper maps some specific application exceptions to HTTP response codes. */ @ControllerAdvice public final class GameExceptionHandler { diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameNotFoundException.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameNotFoundException.java index bf4b6b9a..92cfb2f1 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameNotFoundException.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/GameNotFoundException.java @@ -6,8 +6,7 @@ import com.justdavis.karl.rpstourney.service.api.game.Game; /** - * This exception can be thrown to indicate that a {@link Game} was requested - * that doesn't actually exist. + * This exception can be thrown to indicate that a {@link Game} was requested that doesn't actually exist. */ @ResponseStatus(value = HttpStatus.NOT_FOUND) public final class GameNotFoundException extends RuntimeException { @@ -15,7 +14,7 @@ public final class GameNotFoundException extends RuntimeException { /** * Constructs a new {@link GameNotFoundException}. - * + * * @param cause * the value to use for {@link #getCause()} */ diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/package-info.java index 2f5f6938..2a4230cb 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/game/package-info.java @@ -1,4 +1,4 @@ /** * TODO */ -package com.justdavis.karl.rpstourney.webapp.game; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.game; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/HomeController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/HomeController.java index b0c76acd..3584a1ca 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/HomeController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/HomeController.java @@ -24,7 +24,7 @@ public class HomeController { /** * Constructs a new {@link HomeController} instance. - * + * * @param gameClient * the {@link IGameResource} client to use */ @@ -34,8 +34,7 @@ public HomeController(IGameResource gameClient) { } /** - * @return a {@link ModelAndView} that can be used to render some basic - * information about the application + * @return a {@link ModelAndView} that can be used to render some basic information about the application */ @RequestMapping(method = RequestMethod.GET) public ModelAndView getHomePage() { @@ -50,8 +49,7 @@ public ModelAndView getHomePage() { } /** - * Sorts {@link GameView} instances based on their - * {@link GameView#getLastThrowTimestamp()} value, latest first. + * Sorts {@link GameView} instances based on their {@link GameView#getLastThrowTimestamp()} value, latest first. */ private static final class GamesSorter implements Comparator { /** diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/package-info.java index 50df6dce..59b77cfb 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/home/package-info.java @@ -1,4 +1,4 @@ /** * Contains classes for the application's home page. */ -package com.justdavis.karl.rpstourney.webapp.home; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.home; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/InfoController.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/InfoController.java index 3d4a426a..89a4c092 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/InfoController.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/InfoController.java @@ -16,8 +16,8 @@ import com.justdavis.karl.rpstourney.webapp.XmlNamespace; /** - * Just a simple {@link Controller} that returns some information about the web - * application. Intended for use mostly just as an "is it up?" canary. + * Just a simple {@link Controller} that returns some information about the web application. Intended for use mostly + * just as an "is it up?" canary. */ @Controller @RequestMapping("/info") @@ -34,15 +34,13 @@ public String ping() { } /** - * @return a {@link ModelAndView} that can be used to render some basic - * information about the application + * @return a {@link ModelAndView} that can be used to render some basic information about the application */ @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE) public ModelAndView getAppInfo() { /* - * While this view could be rendered as marshalled XML, it acts as a - * better "canary" if it uses JSP to produce the XML, instead. So, it - * does. + * While this view could be rendered as marshalled XML, it acts as a better "canary" if it uses JSP to produce + * the XML, instead. So, it does. */ Map modelProps = new HashMap<>(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/package-info.java index c958418c..0e6cb0d5 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/info/package-info.java @@ -1,4 +1,4 @@ /** * Contains Spring MVC controllers for the application's info services. */ -package com.justdavis.karl.rpstourney.webapp.info; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.info; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTag.java index 04c6a509..0dffdb4f 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTag.java @@ -21,14 +21,13 @@ /** *

    - * A JSP tag handler that provides the <rps:accountName /> - * tag, for printing out the {@link Account#getName()} value for the currently - * authenticated user (if any), or "Anonymous" if not (or whatever - * the localized version of that is). + * A JSP tag handler that provides the <rps:accountName /> tag, for printing out the + * {@link Account#getName()} value for the currently authenticated user (if any), or "Anonymous" if not (or + * whatever the localized version of that is). *

    *

    - * Please note that this class and its properties must be correctly listed in - * this project's src/main/webapp/WEB-INF/rps.tld file. + * Please note that this class and its properties must be correctly listed in this project's + * src/main/webapp/WEB-INF/rps.tld file. *

    */ public final class AccountNameTag extends RequestContextAwareTag { @@ -51,8 +50,8 @@ public AccountNameTag() { } /** - * @return the {@link SecurityContext} that should be used, to determine the - * logged in user for the request being processed + * @return the {@link SecurityContext} that should be used, to determine the logged in user for the request being + * processed */ private SecurityContext getSecurityContext() { if (mockSecurityContext != null) @@ -67,8 +66,7 @@ private SecurityContext getSecurityContext() { */ void setMockSecurityContext(SecurityContext securityContext) { /* - * Note: the lack of @Inject here is intentional, as Spring doesn't bind - * or inject SecurityContext instances. + * Note: the lack of @Inject here is intentional, as Spring doesn't bind or inject SecurityContext instances. */ this.mockSecurityContext = securityContext; } @@ -98,8 +96,7 @@ public void setAccountsClient(IAccountsResource accountsClient) { protected int doStartTagInternal() throws Exception { if (!initialized) { /* - * If we haven't already initialized ourselves, inject dependencies - * into this instance now. + * If we haven't already initialized ourselves, inject dependencies into this instance now. */ ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(pageContext.getServletContext()); @@ -126,8 +123,7 @@ public int doEndTag() throws JspException { } /** - * @return the current user's name, or whatever alternative should be - * displayed instead + * @return the current user's name, or whatever alternative should be displayed instead */ private String getAccountDisplayName() throws IOException { // Determine the current authenticated account (if any). @@ -138,11 +134,9 @@ private String getAccountDisplayName() throws IOException { return getAnonDisplayText(); /* - * At this point, we know the user is authenticated. Even though we have - * an Account instance, that instance is old; it was populated when the - * user first authenticated the current session. We need to grab the - * current Account data to determine what the current Account.getName() - * value is. + * At this point, we know the user is authenticated. Even though we have an Account instance, that instance is + * old; it was populated when the user first authenticated the current session. We need to grab the current + * Account data to determine what the current Account.getName() value is. */ // Grab the latest Account. @@ -156,8 +150,8 @@ private String getAccountDisplayName() throws IOException { } /** - * @return the text to display if the user is not authenticated, or if their - * {@link Account#getName()} is null + * @return the text to display if the user is not authenticated, or if their {@link Account#getName()} is + * null */ private String getAnonDisplayText() { Locale locale = pageContext.getELContext().getLocale(); @@ -165,8 +159,7 @@ private String getAnonDisplayText() { } /** - * @return the {@link Account} of the currently-authenticated user, or - * null if the user isn't logged in + * @return the {@link Account} of the currently-authenticated user, or null if the user isn't logged in */ private Account getAuthenticatedAccount() { // Get the Authentication token for the current user (if any). @@ -175,16 +168,14 @@ private Account getAuthenticatedAccount() { return null; /* - * Grab the Principal from the token. All of the tokens used in this app - * should have a principal. + * Grab the Principal from the token. All of the tokens used in this app should have a principal. */ Object principal = auth.getPrincipal(); if (principal == null) throw new BadCodeMonkeyException(); /* - * All of the tokens used in this app should use an Account as - * principal. + * All of the tokens used in this app should use an Account as principal. */ if (principal != null && !(principal instanceof Account)) throw new BadCodeMonkeyException(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTag.java index f7b8ec1f..a7dcc26c 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTag.java @@ -20,13 +20,12 @@ /** *

    - * A JSP tag handler that provides the - * <rps:gameOpponent game="${someGame}" /> tag, for printing - * out a user's opponent in a {@link GameView}. + * A JSP tag handler that provides the <rps:gameOpponent game="${someGame}" /> tag, for printing out + * a user's opponent in a {@link GameView}. *

    *

    - * Please note that this class and its properties must be correctly listed in - * this project's src/main/webapp/WEB-INF/rps.tld file. + * Please note that this class and its properties must be correctly listed in this project's + * src/main/webapp/WEB-INF/rps.tld file. *

    */ public final class GameOpponentTag extends RequestContextAwareTag { @@ -46,8 +45,8 @@ public void setGame(GameView value) { } /** - * @return the {@link SecurityContext} that should be used, to determine the - * logged in user for the request being processed + * @return the {@link SecurityContext} that should be used, to determine the logged in user for the request being + * processed */ private SecurityContext getSecurityContext() { if (mockSecurityContext != null) @@ -62,8 +61,7 @@ private SecurityContext getSecurityContext() { */ void setMockSecurityContext(SecurityContext securityContext) { /* - * Note: the lack of @Inject here is intentional, as Spring doesn't bind - * or inject SecurityContext instances. + * Note: the lack of @Inject here is intentional, as Spring doesn't bind or inject SecurityContext instances. */ this.mockSecurityContext = securityContext; } @@ -84,8 +82,7 @@ public void setMessageSource(MessageSource messageSource) { protected int doStartTagInternal() throws Exception { if (!initialized) { /* - * If we haven't already initialized ourselves, inject dependencies - * into this instance now. + * If we haven't already initialized ourselves, inject dependencies into this instance now. */ ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(pageContext.getServletContext()); @@ -139,8 +136,7 @@ private String generateContent() { } /** - * @return the {@link Account} of the currently-authenticated user, or - * null if the user isn't logged in + * @return the {@link Account} of the currently-authenticated user, or null if the user isn't logged in */ private Account getAuthenticatedAccount() { // Get the Authentication token for the current user (if any). @@ -149,16 +145,14 @@ private Account getAuthenticatedAccount() { return null; /* - * Grab the Principal from the token. All of the tokens used in this app - * should have a principal. + * Grab the Principal from the token. All of the tokens used in this app should have a principal. */ Object principal = auth.getPrincipal(); if (principal == null) throw new BadCodeMonkeyException(); /* - * All of the tokens used in this app should use an Account as - * principal. + * All of the tokens used in this app should use an Account as principal. */ if (principal != null && !(principal instanceof Account)) throw new BadCodeMonkeyException(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTag.java index 5c99a28c..57e3c4d0 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTag.java @@ -21,13 +21,12 @@ /** *

    - * A JSP tag handler that provides the - * <rps:gameTitle game="${someGame}" /> tag, for printing out - * the title/display label to use for {@link GameView}s. + * A JSP tag handler that provides the <rps:gameTitle game="${someGame}" /> tag, for printing out the + * title/display label to use for {@link GameView}s. *

    *

    - * Please note that this class and its properties must be correctly listed in - * this project's src/main/webapp/WEB-INF/rps.tld file. + * Please note that this class and its properties must be correctly listed in this project's + * src/main/webapp/WEB-INF/rps.tld file. *

    */ public final class GameTitleTag extends RequestContextAwareTag { @@ -41,7 +40,7 @@ public final class GameTitleTag extends RequestContextAwareTag { /** * This is passed in as a required tag attribute. - * + * * @param game * the {@link GameView} to be rendered */ @@ -56,18 +55,17 @@ public void setGame(GameView game) { *

    * If this value is set, this tag will not render any page output. *

    - * + * * @param var - * the name of the page variable whose value will be set to this - * {@link GameTitleTag}'s output + * the name of the page variable whose value will be set to this {@link GameTitleTag}'s output */ public void setVar(String variableName) { this.variableName = variableName; } /** - * @return the {@link SecurityContext} that should be used, to determine the - * logged in user for the request being processed + * @return the {@link SecurityContext} that should be used, to determine the logged in user for the request being + * processed */ private SecurityContext getSecurityContext() { if (mockSecurityContext != null) @@ -77,16 +75,14 @@ private SecurityContext getSecurityContext() { } /** - * Warning: This method is only intended for use by unit - * tests. - * + * Warning: This method is only intended for use by unit tests. + * * @param mockSecurityContext * the mock {@link SecurityContext} to use */ void setMockSecurityContext(SecurityContext mockSecurityContext) { /* - * Note: the lack of @Inject here is intentional, as Spring doesn't bind - * or inject SecurityContext instances. + * Note: the lack of @Inject here is intentional, as Spring doesn't bind or inject SecurityContext instances. */ this.mockSecurityContext = mockSecurityContext; } @@ -107,8 +103,7 @@ public void setMessageSource(MessageSource messageSource) { protected int doStartTagInternal() throws Exception { if (!initialized) { /* - * If we haven't already initialized ourselves, inject dependencies - * into this instance now. + * If we haven't already initialized ourselves, inject dependencies into this instance now. */ ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(pageContext.getServletContext()); @@ -144,8 +139,8 @@ public int doEndTag() throws JspException { /** * @param textOnly - * if true, only text will be returned, if - * false, the result will include HTML markup + * if true, only text will be returned, if false, the result will include HTML + * markup * @return the text, tags, etc. to be rendered */ private String generateContent(boolean textOnly) { @@ -179,8 +174,7 @@ private String generateContent(boolean textOnly) { } /** - * @return the {@link Account} of the currently-authenticated user, or - * null if the user isn't logged in + * @return the {@link Account} of the currently-authenticated user, or null if the user isn't logged in */ private Account getAuthenticatedAccount() { // Get the Authentication token for the current user (if any). @@ -189,16 +183,14 @@ private Account getAuthenticatedAccount() { return null; /* - * Grab the Principal from the token. All of the tokens used in this app - * should have a principal. + * Grab the Principal from the token. All of the tokens used in this app should have a principal. */ Object principal = auth.getPrincipal(); if (principal == null) throw new BadCodeMonkeyException(); /* - * All of the tokens used in this app should use an Account as - * principal. + * All of the tokens used in this app should use an Account as principal. */ if (principal != null && !(principal instanceof Account)) throw new BadCodeMonkeyException(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTag.java index 7fb22985..2c04f2aa 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTag.java @@ -23,17 +23,14 @@ /** *

    - * A JSP tag handler that provides the - * <rps:playerName game=${someGame} player="${player}" /> - * tag, for printing out the {@link Player#getName()} value for the specified - * {@link Player}, or a suitable set of "filler" text if that value is - * null. Note that this tag will also render with CSS classes equal - * to {@link PlayerRole#PLAYER_1} and/or {@link PlayerRole#PLAYER_2}, as - * appropriate. + * A JSP tag handler that provides the <rps:playerName game=${someGame} player="${player}" /> tag, + * for printing out the {@link Player#getName()} value for the specified {@link Player}, or a suitable set of "filler" + * text if that value is null. Note that this tag will also render with CSS classes equal to + * {@link PlayerRole#PLAYER_1} and/or {@link PlayerRole#PLAYER_2}, as appropriate. *

    *

    - * Please note that this class and its properties must be correctly listed in - * this project's src/main/webapp/WEB-INF/rps.tld file. + * Please note that this class and its properties must be correctly listed in this project's + * src/main/webapp/WEB-INF/rps.tld file. *

    */ public final class PlayerNameTag extends RequestContextAwareTag { @@ -47,7 +44,7 @@ public final class PlayerNameTag extends RequestContextAwareTag { /** * This is passed in as a required tag attribute. - * + * * @param game * the {@link GameView} to be rendered */ @@ -57,12 +54,10 @@ public void setGame(GameView game) { /** * This is passed in as a required tag attribute. - * + * * @param player - * the {@link Player} to be rendered, which must be one of the - * {@link Player}s in the value passed to - * {@link #setGame(GameView)}, or must instead be - * null, to indicate that the game's + * the {@link Player} to be rendered, which must be one of the {@link Player}s in the value passed to + * {@link #setGame(GameView)}, or must instead be null, to indicate that the game's * {@link PlayerRole#PLAYER_2} has not yet joined */ public void setPlayer(Player player) { @@ -70,8 +65,8 @@ public void setPlayer(Player player) { } /** - * @return the {@link SecurityContext} that should be used, to determine the - * logged in user for the request being processed + * @return the {@link SecurityContext} that should be used, to determine the logged in user for the request being + * processed */ private SecurityContext getSecurityContext() { if (mockSecurityContext != null) @@ -81,16 +76,14 @@ private SecurityContext getSecurityContext() { } /** - * Warning: This method is only intended for use by unit - * tests. - * + * Warning: This method is only intended for use by unit tests. + * * @param mockSecurityContext * the mock {@link SecurityContext} to use */ void setMockSecurityContext(SecurityContext mockSecurityContext) { /* - * Note: the lack of @Inject here is intentional, as Spring doesn't bind - * or inject SecurityContext instances. + * Note: the lack of @Inject here is intentional, as Spring doesn't bind or inject SecurityContext instances. */ this.mockSecurityContext = mockSecurityContext; } @@ -111,8 +104,7 @@ public void setMessageSource(MessageSource messageSource) { protected int doStartTagInternal() throws Exception { if (!initialized) { /* - * If we haven't already initialized ourselves, inject dependencies - * into this instance now. + * If we haven't already initialized ourselves, inject dependencies into this instance now. */ ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(pageContext.getServletContext()); @@ -148,18 +140,16 @@ public int doEndTag() throws JspException { * @param locale * the {@link Locale} being rendered to * @param authenticatedAccount - * the currently-authenticated user {@link Account}, or - * null if no user is authenticated + * the currently-authenticated user {@link Account}, or null if no user is authenticated * @param game * the {@link GameView} to render the {@link Player} for * @param player * the {@link Player} whose name is being rendered * @param textOnly - * if true, only text will be returned, if - * false, the result will include HTML markup - * @return a rendered <span /> tag that wraps the - * specified {@link Player}'s name, and includes CSS classes - * indicating which {@link PlayerRole}s they represent + * if true, only text will be returned, if false, the result will include HTML + * markup + * @return a rendered <span /> tag that wraps the specified {@link Player}'s name, and includes + * CSS classes indicating which {@link PlayerRole}s they represent */ static String generateContent(MessageSource messageSource, Locale locale, Account authenticatedAccount, GameView game, Player player, boolean textOnly) { @@ -209,11 +199,9 @@ else if (player.getBuiltInAi() != null) /** * @param displayName - * the display text for the {@link Player} being rendered by this - * {@link PlayerNameTag} + * the display text for the {@link Player} being rendered by this {@link PlayerNameTag} * @param roles - * the {@link PlayerRole}s represented by the {@link Player} - * being rendered + * the {@link PlayerRole}s represented by the {@link Player} being rendered * @return the generated tag output */ private static String generateTag(String displayName, PlayerRole... roles) { @@ -229,8 +217,7 @@ private static String generateTag(String displayName, PlayerRole... roles) { } /** - * @return the {@link Account} of the currently-authenticated user, or - * null if the user isn't logged in + * @return the {@link Account} of the currently-authenticated user, or null if the user isn't logged in */ private Account getAuthenticatedAccount() { // Get the Authentication token for the current user (if any). @@ -239,16 +226,14 @@ private Account getAuthenticatedAccount() { return null; /* - * Grab the Principal from the token. All of the tokens used in this app - * should have a principal. + * Grab the Principal from the token. All of the tokens used in this app should have a principal. */ Object principal = auth.getPrincipal(); if (principal == null) throw new BadCodeMonkeyException(); /* - * All of the tokens used in this app should use an Account as - * principal. + * All of the tokens used in this app should use an Account as principal. */ if (principal != null && !(principal instanceof Account)) throw new BadCodeMonkeyException(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTag.java index 8fc1bc7f..6ddc840f 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTag.java @@ -24,12 +24,12 @@ /** *

    - * A JSP tag handler that provides the <rps:roundResult /> - * tag, for printing out the winner/result for the specified {@link GameRound}. + * A JSP tag handler that provides the <rps:roundResult /> tag, for printing out the winner/result + * for the specified {@link GameRound}. *

    *

    - * Please note that this class and its properties must be correctly listed in - * this project's src/main/webapp/WEB-INF/rps.tld file. + * Please note that this class and its properties must be correctly listed in this project's + * src/main/webapp/WEB-INF/rps.tld file. *

    */ public final class RoundResultTag extends RequestContextAwareTag { @@ -53,8 +53,8 @@ public RoundResultTag() { } /** - * @return the {@link SecurityContext} that should be used, to determine the - * logged in user for the request being processed + * @return the {@link SecurityContext} that should be used, to determine the logged in user for the request being + * processed */ private SecurityContext getSecurityContext() { if (mockSecurityContext != null) @@ -69,8 +69,7 @@ private SecurityContext getSecurityContext() { */ void setMockSecurityContext(SecurityContext securityContext) { /* - * Note: the lack of @Inject here is intentional, as Spring doesn't bind - * or inject SecurityContext instances. + * Note: the lack of @Inject here is intentional, as Spring doesn't bind or inject SecurityContext instances. */ this.mockSecurityContext = securityContext; } @@ -86,8 +85,7 @@ public void setMessageSource(MessageSource messageSource) { /** * @param game - * the {@link GameView} that the specified {@link GameRound} is - * part of + * the {@link GameView} that the specified {@link GameRound} is part of */ public void setGame(GameView game) { this.game = game; @@ -95,8 +93,7 @@ public void setGame(GameView game) { /** * @param round - * the {@link GameRound} to display the - * {@link GameRound#getResult()} of + * the {@link GameRound} to display the {@link GameRound#getResult()} of */ public void setRound(GameRound round) { this.round = round; @@ -109,8 +106,7 @@ public void setRound(GameRound round) { protected int doStartTagInternal() throws Exception { if (!initialized) { /* - * If we haven't already initialized ourselves, inject dependencies - * into this instance now. + * If we haven't already initialized ourselves, inject dependencies into this instance now. */ ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(pageContext.getServletContext()); @@ -182,8 +178,7 @@ else if (game.isPlayer(authenticatedAccount) && game.getPlayer(authenticatedAcco } /** - * @return the {@link Account} of the currently-authenticated user, or - * null if the user isn't logged in + * @return the {@link Account} of the currently-authenticated user, or null if the user isn't logged in */ private Account getAuthenticatedAccount() { // Get the Authentication token for the current user (if any). @@ -192,16 +187,14 @@ private Account getAuthenticatedAccount() { return null; /* - * Grab the Principal from the token. All of the tokens used in this app - * should have a principal. + * Grab the Principal from the token. All of the tokens used in this app should have a principal. */ Object principal = auth.getPrincipal(); if (principal == null) throw new BadCodeMonkeyException(); /* - * All of the tokens used in this app should use an Account as - * principal. + * All of the tokens used in this app should use an Account as principal. */ if (principal != null && !(principal instanceof Account)) throw new BadCodeMonkeyException(); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTag.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTag.java index 836fd1d6..b26f8197 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTag.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTag.java @@ -13,9 +13,8 @@ import org.ocpsoft.prettytime.PrettyTime; /** - * A JSP tag handler that provides the - * <rps:instant value="${someInstant}" /> tag, for printing - * out formatted {@link Instant}s and other {@link TemporalAccessor}s. + * A JSP tag handler that provides the <rps:instant value="${someInstant}" /> tag, for printing out + * formatted {@link Instant}s and other {@link TemporalAccessor}s. */ public final class TemporalFormatTag extends SimpleTagSupport { private TemporalAccessor value; @@ -53,8 +52,7 @@ public void setFormat(String format) { } /** - * Enumerates the supported {@link DateTimeFormatter}s for - * {@link TemporalFormatTag}. + * Enumerates the supported {@link DateTimeFormatter}s for {@link TemporalFormatTag}. */ private static enum Format { /** @@ -76,10 +74,9 @@ private static enum Format { /** * Constructs a new {@link Format} constant. - * + * * @param formatter - * the {@link DateTimeFormatter} that this {@link Format} - * constant will represent + * the {@link DateTimeFormatter} that this {@link Format} constant will represent */ private Format(TemporalFormatter formatter) { this.formatter = formatter; @@ -87,29 +84,26 @@ private Format(TemporalFormatter formatter) { } /** - * Abstracts the functionality of the various formatters used in - * {@link Format}. + * Abstracts the functionality of the various formatters used in {@link Format}. */ private static interface TemporalFormatter { /** * @param temporalValue * the {@link TemporalAccessor} to be formatted - * @return the formatted-for-humans representation of the specified - * {@link TemporalAccessor} + * @return the formatted-for-humans representation of the specified {@link TemporalAccessor} */ String format(TemporalAccessor temporalValue); } /** - * A {@link TemporalFormatter} implementation for the - * threetenbp library's {@link DateTimeFormatter}. + * A {@link TemporalFormatter} implementation for the threetenbp library's {@link DateTimeFormatter}. */ private static final class ThreeTenFormatter implements TemporalFormatter { private final DateTimeFormatter formatter; /** * Constructs a new {@link ThreeTenFormatter} instance. - * + * * @param formatter * the {@link DateTimeFormatter} to use */ @@ -123,8 +117,8 @@ public ThreeTenFormatter(DateTimeFormatter formatter) { @Override public String format(TemporalAccessor temporalValue) { /* - * If the value to be formatted is an Instant, it can only be - * converted to a date-time in the context of a timezone. + * If the value to be formatted is an Instant, it can only be converted to a date-time in the context of a + * timezone. */ DateTimeFormatter formatterToUse = formatter; if (temporalValue instanceof Instant) @@ -135,8 +129,7 @@ public String format(TemporalAccessor temporalValue) { } /** - * A {@link TemporalFormatter} implementation that uses the - * {@link PrettyTime} library. + * A {@link TemporalFormatter} implementation that uses the {@link PrettyTime} library. */ private static final class PrettyTimeFormatter implements TemporalFormatter { /** diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/package-info.java index 97d68bcb..c32b6d41 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/jsp/package-info.java @@ -1,4 +1,4 @@ /** * Contains utility classes/code related to JSP. */ -package com.justdavis.karl.rpstourney.webapp.jsp; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.jsp; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/package-info.java index 009dac43..6bfbc038 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/package-info.java @@ -1,6 +1,6 @@ /** * Contains the "entry point" for this web application, - * {@link com.justdavis.karl.rpstourney.webapp.GameWebApplicationInitializer}, - * and other classes related to configuring/launching the web application. + * {@link com.justdavis.karl.rpstourney.webapp.GameWebApplicationInitializer}, and other classes related to + * configuring/launching the web application. */ -package com.justdavis.karl.rpstourney.webapp; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/CustomRememberMeServices.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/CustomRememberMeServices.java index e366a6cc..11d0ca7f 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/CustomRememberMeServices.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/CustomRememberMeServices.java @@ -38,37 +38,31 @@ /** *

    - * A custom Spring Security {@link RememberMeServices} implementation. Allows - * for the use of cookie authentication tokens that authenticate requests to a - * user's {@link Account}. + * A custom Spring Security {@link RememberMeServices} implementation. Allows for the use of cookie authentication + * tokens that authenticate requests to a user's {@link Account}. *

    *

    - * This custom implementation is necessary, as - * {@link PersistentTokenBasedRememberMeServices} requires a - * {@link UserDetailsService}, which in turn requires that every account have a - * username. If, at some point, {@link Account}s do all have a unique username, - * this class can be replaced. + * This custom implementation is necessary, as {@link PersistentTokenBasedRememberMeServices} requires a + * {@link UserDetailsService}, which in turn requires that every account have a username. If, at some point, + * {@link Account}s do all have a unique username, this class can be replaced. *

    */ @Component public class CustomRememberMeServices implements RememberMeServices { /** - * The {@link Cookie#getName()} value for the "remember me" cookie used by - * this class. + * The {@link Cookie#getName()} value for the "remember me" cookie used by this class. */ static final String COOKIE_NAME = AuthTokenCookieHelper.COOKIE_NAME_AUTH_TOKEN; /** *

    - * This is the value used to construct - * {@link RememberMeAuthenticationToken#getKeyHash()} for all + * This is the value used to construct {@link RememberMeAuthenticationToken#getKeyHash()} for all * {@link RememberMeAuthenticationToken}s created by the application. *

    *

    - * In the standard {@link RememberMeServices} implementations, this value is - * included in all of the cookies, as some sort of guard against cookie - * spoofing. That, however, seems wholly ineffective as cookies are in no - * way unreadable. Accordingly, we're just using a hardcoded string here. + * In the standard {@link RememberMeServices} implementations, this value is included in all of the cookies, as some + * sort of guard against cookie spoofing. That, however, seems wholly ineffective as cookies are in no way + * unreadable. Accordingly, we're just using a hardcoded string here. *

    */ static final String REMEMBER_ME_TOKEN_KEY = "foobar"; @@ -83,12 +77,11 @@ public class CustomRememberMeServices implements RememberMeServices { /** * Constructs a new {@link CustomRememberMeServices} instance. - * + * * @param appConfig * the {@link AppConfig} for the application * @param serviceClientCookieStore - * the injected {@link CookieStore} for all web service clients - * (session scoped) + * the injected {@link CookieStore} for all web service clients (session scoped) * @param accountsClient * the injected {@link AccountsClient} to use */ @@ -109,9 +102,8 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse LOGGER.trace("Authenticating request..."); /* - * This method will be called during every unauthenticated request, - * giving this class a chance to check for a valid "remember me" login - * token, and authenticate the rest of the request. + * This method will be called during every unauthenticated request, giving this class a chance to check for a + * valid "remember me" login token, and authenticate the rest of the request. */ // Grab the cookie (if any). @@ -130,11 +122,9 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse } /* - * Snag the auth token from this web app cookie, and use it to create a - * cookie in the web service client. This cookie will saved in our - * CookieStore, and used in turn by any web service clients in the same - * session. (This is a bit hokey, but it saves us from needing to create - * our token store in this layer of the application.) + * Snag the auth token from this web app cookie, and use it to create a cookie in the web service client. This + * cookie will saved in our CookieStore, and used in turn by any web service clients in the same session. (This + * is a bit hokey, but it saves us from needing to create our token store in this layer of the application.) */ String requestUrlString = request.getRequestURL().toString(); URI requestUri; @@ -142,8 +132,8 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse requestUri = new URI(requestUrlString); } catch (URISyntaxException e) { /* - * If this ever occurs, it's almost certainly due to an encoding - * issue that needs to be fixed in the above code. + * If this ever occurs, it's almost certainly due to an encoding issue that needs to be fixed in the above + * code. */ throw new BadCodeMonkeyException(e); } @@ -151,8 +141,7 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse serviceClientCookieStore.remember(serviceClientAuthCookie); /* - * Just having a cookie doesn't mean we're actually authenticated. - * Verify that using the web service. + * Just having a cookie doesn't mean we're actually authenticated. Verify that using the web service. */ Account validatedAccount = null; try { @@ -160,8 +149,7 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse } catch (HttpClientException e) { if (e.getStatus().getStatusCode() == Status.UNAUTHORIZED.getStatusCode()) { /* - * Called the web service successfully, but it said the login - * was invalid. + * Called the web service successfully, but it said the login was invalid. */ LOGGER.warn(String.format("Invalid remember me token '%s' on request '%s'.", rememberMeValue, request)); CookiesUtils.cancelCookie(COOKIE_NAME, response); @@ -173,9 +161,8 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse } /* - * Create a Spring Security 'Authentication' token for the login. This - * token will end up being saved in the session. The principal saved in - * the token will be passed to anything else that asks for the request's + * Create a Spring Security 'Authentication' token for the login. This token will end up being saved in the + * session. The principal saved in the token will be passed to anything else that asks for the request's * security/authorization principal. */ List grantedAuthorities = new LinkedList<>(); @@ -195,75 +182,62 @@ public Authentication autoLogin(HttpServletRequest request, HttpServletResponse @Override public void loginFail(HttpServletRequest request, HttpServletResponse response) { /* - * This method's JavaDoc instructs that, whenever a user tries to login - * and supplies invalid credentials, that their auto-login token should - * be cancelled. Given the use case here though, logins that are _only_ - * tracked by the token, we can only cancel authentication tokens when - * the user has another login mechanism to recover access to their - * account. And even then, it's dubious as to whether or not there's any - * value in doing so. For now, we'll just ignore this. + * This method's JavaDoc instructs that, whenever a user tries to login and supplies invalid credentials, that + * their auto-login token should be cancelled. Given the use case here though, logins that are _only_ tracked by + * the token, we can only cancel authentication tokens when the user has another login mechanism to recover + * access to their account. And even then, it's dubious as to whether or not there's any value in doing so. For + * now, we'll just ignore this. */ } /** * @see org.springframework.security.web.authentication.RememberMeServices#loginSuccess(javax.servlet.http.HttpServletRequest, - * javax.servlet.http.HttpServletResponse, - * org.springframework.security.core.Authentication) + * javax.servlet.http.HttpServletResponse, org.springframework.security.core.Authentication) */ @Override public void loginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { /* - * Typical RememberMeServices implementations would check the request - * for a parameter indicating whether or not the user checked the - * "Remember my login" option in the login form. However, this - * application does not have such an option in its login forms. Instead, - * it assumes that the user always wants that option. This is a security - * risk for users using the application on a public computer, but it's - * just a freaking rock paper scissors game. + * Typical RememberMeServices implementations would check the request for a parameter indicating whether or not + * the user checked the "Remember my login" option in the login form. However, this application does not have + * such an option in its login forms. Instead, it assumes that the user always wants that option. This is a + * security risk for users using the application on a public computer, but it's just a freaking rock paper + * scissors game. */ saveRememberMeToken(request, response, successfulAuthentication); } /** - * Saves a "remember me" authentication token in a cookie in the outgoing - * {@link HttpServletResponse}. - * + * Saves a "remember me" authentication token in a cookie in the outgoing {@link HttpServletResponse}. + * * @param request - * an {@link HttpServletRequest} that resulted in a successful - * authentication + * an {@link HttpServletRequest} that resulted in a successful authentication * @param response * the outgoing {@link HttpServletResponse} to save the cookie in * @param successfulAuthentication - * the principal that was successfully authenticated in the - * specified {@link HttpServletRequest} + * the principal that was successfully authenticated in the specified {@link HttpServletRequest} */ private void saveRememberMeToken(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { /* - * This is a bit hokey, but to avoid having to create a separate model - * class, table, etc. to store authentication tokens for this layer of - * the application, we re-use the web service's setup for that here. + * This is a bit hokey, but to avoid having to create a separate model class, table, etc. to store + * authentication tokens for this layer of the application, we re-use the web service's setup for that here. */ /* - * TODO: Should 'successfulAuthentication' be required to still have a - * password in it? Because someone needs to also login to the web - * service client, and if we aren't passed a PW here, that will have to - * be the responsibility of whoever logged in the Account in the first - * place. I'm thinking that it's the responsibility of whoever logged in - * the Account, as that seems out of scope given this method's name. + * TODO: Should 'successfulAuthentication' be required to still have a password in it? Because someone needs to + * also login to the web service client, and if we aren't passed a PW here, that will have to be the + * responsibility of whoever logged in the Account in the first place. I'm thinking that it's the responsibility + * of whoever logged in the Account, as that seems out of scope given this method's name. */ if (successfulAuthentication == null) throw new IllegalArgumentException(); /* - * It's great that we've got a successful Authentication here and all, - * but the object itself isn't too helpful, as Account instances - * returned by the web service never contain AuthToken (for paranoia - * reasons). So, we'll pretty much ignore it and instead snag the - * AuthToken out of the CookieStore. + * It's great that we've got a successful Authentication here and all, but the object itself isn't too helpful, + * as Account instances returned by the web service never contain AuthToken (for paranoia reasons). So, we'll + * pretty much ignore it and instead snag the AuthToken out of the CookieStore. */ javax.ws.rs.core.Cookie serviceClientAuthTokenCookie = serviceClientCookieStore .get(AuthTokenCookieHelper.COOKIE_NAME_AUTH_TOKEN); @@ -282,14 +256,12 @@ private void saveRememberMeToken(HttpServletRequest request, HttpServletResponse * @param appConfig * the {@link AppConfig} for the application * @param request - * the {@link HttpServletRequest} that the {@link Cookie} is - * being created in response to + * the {@link HttpServletRequest} that the {@link Cookie} is being created in response to * @param authTokenCookieValue - * the {@link AuthToken#getToken()} value to be stored in the - * cookie, for the user it will help authenticate - * @return the "remember me" cookie used by this application, which - * basically just contains the same {@link AuthToken} as is used by - * the web service clients + * the {@link AuthToken#getToken()} value to be stored in the cookie, for the user it will help + * authenticate + * @return the "remember me" cookie used by this application, which basically just contains the same + * {@link AuthToken} as is used by the web service clients */ static Cookie createRememberMeCookie(AppConfig appConfig, HttpServletRequest request, String authTokenCookieValue) { Cookie servletResponseAuthTokenCookie = new Cookie(COOKIE_NAME, authTokenCookieValue); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManager.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManager.java index 7b7809bd..a193c2ca 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManager.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManager.java @@ -24,7 +24,7 @@ public class DefaultGuestLoginManager implements IGuestLoginManager { /** * Constructs a new {@link DefaultGuestLoginManager} instance. - * + * * @param securityContextStrategy * the {@link SecurityContextHolderStrategy} for the application * @param guestAuthClient @@ -47,8 +47,8 @@ public DefaultGuestLoginManager(SecurityContextHolderStrategy securityContextStr @Override public void loginClientAsGuest(HttpServletRequest request, HttpServletResponse response) { /* - * This method shouldn't be called if the request/client is already - * authenticated. If it is, whatever called this method screwed up. + * This method shouldn't be called if the request/client is already authenticated. If it is, whatever called + * this method screwed up. */ Authentication existingAuth = securityContextStrategy.getContext().getAuthentication(); if (existingAuth != null) @@ -62,8 +62,7 @@ public void loginClientAsGuest(HttpServletRequest request, HttpServletResponse r securityContextStrategy.getContext().setAuthentication(guestAuth); /* - * Take the login and use it to "turn on" the remember-me feature of - * Spring Security. + * Take the login and use it to "turn on" the remember-me feature of Spring Security. */ rememberMeServices.loginSuccess(request, response, guestAuth); } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProvider.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProvider.java index 93b59c83..9f4d6238 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProvider.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProvider.java @@ -22,8 +22,7 @@ import com.justdavis.karl.rpstourney.service.client.HttpClientException; /** - * A Spring Security {@link AuthProvider} implementation for - * {@link IGameAuthResource} logins. + * A Spring Security {@link AuthProvider} implementation for {@link IGameAuthResource} logins. */ @Component public final class GameLoginAuthenticationProvider implements AuthenticationProvider { @@ -32,7 +31,7 @@ public final class GameLoginAuthenticationProvider implements AuthenticationProv /** * Constructs a new {@link GameLoginAuthenticationProvider} instance. - * + * * @param sessionCookies * the {@link CookieStore} for the current client/session * @param gameAuthClient @@ -58,15 +57,13 @@ public Authentication authenticate(Authentication authentication) throws Authent String password = authentication.getCredentials().toString(); /* - * Call the IGameAuthResource web service to perform the actual - * authentication. + * Call the IGameAuthResource web service to perform the actual authentication. */ Account authenticatedAccount = null; try { /* - * The web service doesn't allow login attempts if the client is - * already authenticated. We must explicitly ensure that the web - * client is logged out, first. + * The web service doesn't allow login attempts if the client is already authenticated. We must explicitly + * ensure that the web client is logged out, first. */ sessionCookies.forget(CustomRememberMeServices.COOKIE_NAME); @@ -75,8 +72,7 @@ public Authentication authenticate(Authentication authentication) throws Authent authenticatedAccount = gameAuthClient.loginWithGameAccount(emailAddress, password); } catch (HttpClientException e) { /* - * These two status codes indicate a legitimate authentication - * failure. + * These two status codes indicate a legitimate authentication failure. */ if (e.getStatus() == Status.FORBIDDEN || e.getStatus() == Status.UNAUTHORIZED) { throw new BadCredentialsException("Authentication failed.", e); @@ -89,15 +85,11 @@ public Authentication authenticate(Authentication authentication) throws Authent } /* - * Note: If we got this far, the web service authentication was - * successful. As part of that authentication, the web service - * set/updated the AuthToken in the response, which the client will have - * automatically applied to its CookieStore. All future web service - * calls from here on out will be as the newly authenticated user. - * HOWEVER: Because we don't have access to the web application's - * cookies here, we can't adjust the web application's 'AuthToken' - * cookie. That has to be handled by the GameLoginSuccessHandler, - * instead. + * Note: If we got this far, the web service authentication was successful. As part of that authentication, the + * web service set/updated the AuthToken in the response, which the client will have automatically applied to + * its CookieStore. All future web service calls from here on out will be as the newly authenticated user. + * HOWEVER: Because we don't have access to the web application's cookies here, we can't adjust the web + * application's 'AuthToken' cookie. That has to be handled by the GameLoginSuccessHandler, instead. */ return new WebServiceAccountAuthentication(authenticatedAccount); diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandler.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandler.java index 4a6dd398..96469389 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandler.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandler.java @@ -24,28 +24,22 @@ /** *

    - * This Spring Security {@link AuthenticationSuccessHandler} should be fired for - * all successful logins via a {@link GameLoginIdentity}. It will handle the - * "bookkeeping"/cookie management necessary as users de-authenticate from one - * {@link Account} and authenticate to a different one (if that's the case for - * the login event being handled). Primarily, it adjusts the value of the - * client's {@link CustomRememberMeServices#COOKIE_NAME} cookie to reference the - * new {@link Account}'s {@link GuestLoginIdentity} (one will be created if it - * doesn't already exist). + * This Spring Security {@link AuthenticationSuccessHandler} should be fired for all successful logins via a + * {@link GameLoginIdentity}. It will handle the "bookkeeping"/cookie management necessary as users de-authenticate from + * one {@link Account} and authenticate to a different one (if that's the case for the login event being handled). + * Primarily, it adjusts the value of the client's {@link CustomRememberMeServices#COOKIE_NAME} cookie to reference the + * new {@link Account}'s {@link GuestLoginIdentity} (one will be created if it doesn't already exist). *

    *

    - * In addition, this {@link AuthenticationSuccessHandler} helps ensure that - * clients do not lose the game history from guest-only accounts. It does so by - * calling the {@link IAccountsResource#mergeFromDifferentAccount(Account)} web - * service method, but only when the {@link Account} that they were previously - * authenticated with was anonymous (i.e. not also associated - * with a {@link GameLoginIdentity}). + * In addition, this {@link AuthenticationSuccessHandler} helps ensure that clients do not lose the game history from + * guest-only accounts. It does so by calling the {@link IAccountsResource#mergeFromDifferentAccount(Account)} web + * service method, but only when the {@link Account} that they were previously authenticated with was anonymous (i.e. + * not also associated with a {@link GameLoginIdentity}). *

    *

    - * Design note: It would be a lot simpler to just include all of this logic in - * the {@link GameLoginAuthenticationProvider} itself. Unfortunately though, - * Spring doesn't give auth providers access to the request or response at all, - * so we can't do that. + * Design note: It would be a lot simpler to just include all of this logic in the + * {@link GameLoginAuthenticationProvider} itself. Unfortunately though, Spring doesn't give auth providers access to + * the request or response at all, so we can't do that. *

    */ @Component @@ -56,16 +50,15 @@ public final class GameLoginSuccessHandler extends SavedRequestAwareAuthenticati /** * Constructs a new {@link GameLoginSuccessHandler} instance. - * + * * @param appConfig * the {@link AppConfig} for the application * @param accountsClientForCurrentAuth - * the {@link IAccountsResource} web service client to use when - * accessing the session's currently logged-in {@link Account} - * (if any) + * the {@link IAccountsResource} web service client to use when accessing the session's currently + * logged-in {@link Account} (if any) * @param accountsClientFactory - * the {@link IAccountsClientFactory} to use when creating - * {@link IAccountsResource} clients with different credentials + * the {@link IAccountsClientFactory} to use when creating {@link IAccountsResource} clients with + * different credentials */ @Inject public GameLoginSuccessHandler(AppConfig appConfig, IAccountsResource accountsClientForCurrentAuth, @@ -77,8 +70,7 @@ public GameLoginSuccessHandler(AppConfig appConfig, IAccountsResource accountsCl /** * @see org.springframework.security.web.authentication.AuthenticationSuccessHandler#onAuthenticationSuccess(javax.servlet.http.HttpServletRequest, - * javax.servlet.http.HttpServletResponse, - * org.springframework.security.core.Authentication) + * javax.servlet.http.HttpServletResponse, org.springframework.security.core.Authentication) */ @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, @@ -93,18 +85,16 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo .createAccountsClient(authTokenValueForPrevLogin); /* - * Was the user previously logged in to an anonymous account? Note: - * At this point in the login process and this method, - * 'accountsClientForCurrentAuth' will still be authenticating as - * the user's previous Account (if any). + * Was the user previously logged in to an anonymous account? Note: At this point in the login process and + * this method, 'accountsClientForCurrentAuth' will still be authenticating as the user's previous Account + * (if any). */ boolean previousLoginWasAnon = accountsClientForPrevLogin.getAccount().isAnonymous(); /* - * If previous Account was anonymous, we will automatically merge - * that Account into the newly-logged-into one. This is done - * because, if it isn't, users would lose all of the history from - * that anonymous Account, and have no way of recovering it. + * If previous Account was anonymous, we will automatically merge that Account into the newly-logged-into + * one. This is done because, if it isn't, users would lose all of the history from that anonymous Account, + * and have no way of recovering it. */ if (previousLoginWasAnon) { AuthToken authTokenForPrevLogin = accountsClientForPrevLogin.selectOrCreateAuthToken(); @@ -115,8 +105,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo } /* - * Set the 'AuthToken' cookie for the account the user is newly - * authenticated to. + * Set the 'AuthToken' cookie for the account the user is newly authenticated to. */ AuthToken authTokenForNewLogin = accountsClientForCurrentAuth.selectOrCreateAuthToken(); Cookie authTokenCookie = CustomRememberMeServices.createRememberMeCookie(appConfig, request, @@ -124,8 +113,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo response.addCookie(authTokenCookie); /* - * Call the superclass' implementation, so it can do all of the good - * stuff that it does, too. + * Call the superclass' implementation, so it can do all of the good stuff that it does, too. */ super.onAuthenticationSuccess(request, response, authentication); } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/IGuestLoginManager.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/IGuestLoginManager.java index 642609f4..981dd363 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/IGuestLoginManager.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/IGuestLoginManager.java @@ -7,23 +7,20 @@ /** *

    - * Implementations of this interface allow the web application to manage logins - * for users/clients via the web service's {@link IGuestAuthResource} facility. + * Implementations of this interface allow the web application to manage logins for users/clients via the web service's + * {@link IGuestAuthResource} facility. *

    */ public interface IGuestLoginManager { /** - * Authenticate the user/client that issued the specified request as a - * guest. Implementations must ensure that the login is set for the rest of - * the request. In addition, implementations should attempt to ensure that - * future requests are also authenticated by setting any authentication - * cookies, etc. in the specified response. - * + * Authenticate the user/client that issued the specified request as a guest. Implementations must ensure that the + * login is set for the rest of the request. In addition, implementations should attempt to ensure that future + * requests are also authenticated by setting any authentication cookies, etc. in the specified response. + * * @param request * the {@link HttpServletRequest} being processed * @param response - * the {@link HttpServletResponse} being generated for the - * request + * the {@link HttpServletResponse} being generated for the request */ void loginClientAsGuest(HttpServletRequest request, HttpServletResponse response); } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityConfig.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityConfig.java index 05b4783b..1c8178ad 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityConfig.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityConfig.java @@ -24,19 +24,17 @@ /** *

    - * This Spring {@link Configuration} handles most of the configuration related - * to Spring Security. + * This Spring {@link Configuration} handles most of the configuration related to + * Spring Security. *

    *

    - * It enables the use of the JSR-250 security annotations on controller methods - * to secure things: {@link DenyAll}, {@link RolesAllowed}, etc. By default, - * everything is unsecured. When required, form-based authentication will be + * It enables the use of the JSR-250 security annotations on controller methods to secure things: {@link DenyAll}, + * {@link RolesAllowed}, etc. By default, everything is unsecured. When required, form-based authentication will be * used. *

    *

    - * The actual authentication and authorization is handled with calls to the - * application's web service. The {@link IGameAuthResource} and - * {@link IGuestAuthResource} mechanisms are supported. + * The actual authentication and authorization is handled with calls to the application's web service. The + * {@link IGameAuthResource} and {@link IGuestAuthResource} mechanisms are supported. *

    */ @Configuration @@ -54,32 +52,28 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { private GameLoginAuthenticationProvider gameLoginAuthProvider; /** - * The {@link AuthenticationSuccessHandler} for {@link IGameAuthResource} - * logins. + * The {@link AuthenticationSuccessHandler} for {@link IGameAuthResource} logins. */ @Inject private GameLoginSuccessHandler gameLoginSuccessHandler; /** - * The {@link RememberMeServices} implementation to be used. (note that - * we're cheating a bit here: we both define and use this bean in the same - * class). + * The {@link RememberMeServices} implementation to be used. (note that we're cheating a bit here: we both define + * and use this bean in the same class). */ @Inject private RememberMeServices rememberMeServices; /** - * Takes the application's {@link AuthenticationManagerBuilder} bean and - * configures it to use the correct authentication mechanisms. + * Takes the application's {@link AuthenticationManagerBuilder} bean and configures it to use the correct + * authentication mechanisms. */ @Inject public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { /* - * Note: I'm not really sure why this method is used, rather than just - * overriding the superclass' configure(AuthenticationManagerBuilder - * auth) method, but doing it this way works (and the other way - * doesn't). The Spring Security maintainer, Rob Winch, has a GitHub - * pull request doing things this way: + * Note: I'm not really sure why this method is used, rather than just overriding the superclass' + * configure(AuthenticationManagerBuilder auth) method, but doing it this way works (and the other way doesn't). + * The Spring Security maintainer, Rob Winch, has a GitHub pull request doing things this way: * https://github.com/jhipster/jhipster-sample-app/pull/2. */ @@ -105,21 +99,17 @@ public void configure(WebSecurity web) throws Exception { @Override protected void configure(HttpSecurity http) throws Exception { /* - * This is fairly unusual for a Spring Security config (note the lack of - * a '.authorizeRequests()' call), but meets this application's need - * quite well. All or almost all of the application's authorization is - * done programmatically, and the MVC Controllers are all responsible - * for redirecting to '/login' as necessary. + * This is fairly unusual for a Spring Security config (note the lack of a '.authorizeRequests()' call), but + * meets this application's need quite well. All or almost all of the application's authorization is done + * programmatically, and the MVC Controllers are all responsible for redirecting to '/login' as necessary. */ /* - * Spring Security's "remember me" services are used as a form of - * automatic anonymous-ish login. If users, for example, start a game, - * they will be logged in automatically with a new anonymous account - * that gets created for them. If the user at some point decides they - * want a normal username+password account (perhaps to play the same - * games across multiple devices), the anonymous accounts can be - * "merged" into the new username+password accounts. + * Spring Security's "remember me" services are used as a form of automatic anonymous-ish login. If users, for + * example, start a game, they will be logged in automatically with a new anonymous account that gets created + * for them. If the user at some point decides they want a normal username+password account (perhaps to play the + * same games across multiple devices), the anonymous accounts can be "merged" into the new username+password + * accounts. */ gameLoginSuccessHandler.setDefaultTargetUrl("/account"); http.formLogin().loginPage("/login").successHandler(gameLoginSuccessHandler).and().logout().and().httpBasic() @@ -128,14 +118,12 @@ protected void configure(HttpSecurity http) throws Exception { } /** - * @return the {@link SecurityContextHolderStrategy} that the application is - * using + * @return the {@link SecurityContextHolderStrategy} that the application is using */ @Bean public SecurityContextHolderStrategy securityContextHolderStrategy() { /* - * Just exposing this strategy as a bean; Spring Security has a non-bean - * mechanism for configuring it. + * Just exposing this strategy as a bean; Spring Security has a non-bean mechanism for configuring it. */ return SecurityContextHolder.getContextHolderStrategy(); } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityWebApplicationInitializer.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityWebApplicationInitializer.java index 2db331fd..0ff27685 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityWebApplicationInitializer.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/SecurityWebApplicationInitializer.java @@ -6,29 +6,25 @@ /** *

    - * The subclass of {@link AbstractSecurityWebApplicationInitializer} will be - * automagically discovered by Spring and will cause Spring's Security filters - * and such to be registered with the Servlet 3.0 web application. + * The subclass of {@link AbstractSecurityWebApplicationInitializer} will be automagically discovered by Spring and will + * cause Spring's Security filters and such to be registered with the Servlet 3.0 web application. *

    */ @Order(1) public final class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer implements WebApplicationInitializer { /* - * A bunch of Spring documentation mentions that it's important that these - * filters be configured before anything else, thus the {@link Order} - * annotation here. + * A bunch of Spring documentation mentions that it's important that these filters be configured before anything + * else, thus the {@link Order} annotation here. */ /* - * Note: For some reason, it seems that this class must explicitly implement - * WebApplicationInitializer in order to be picked up by Spring, even though - * the superclass already implements that interface. + * Note: For some reason, it seems that this class must explicitly implement WebApplicationInitializer in order to + * be picked up by Spring, even though the superclass already implements that interface. */ /* - * Don't need to do anything else. This class will be picked up off of the - * classpath and the superclass will handle registering the Spring Security - * filters appropriately. + * Don't need to do anything else. This class will be picked up off of the classpath and the superclass will handle + * registering the Spring Security filters appropriately. */ } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/WebServiceAccountAuthentication.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/WebServiceAccountAuthentication.java index 151cfd39..0c400e27 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/WebServiceAccountAuthentication.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/WebServiceAccountAuthentication.java @@ -13,8 +13,7 @@ import com.justdavis.karl.rpstourney.service.api.auth.SecurityRole; /** - * An {@link Authentication} implementation that can be used with the web - * service's {@link Account} class. + * An {@link Authentication} implementation that can be used with the web service's {@link Account} class. */ public final class WebServiceAccountAuthentication extends AbstractAuthenticationToken { private static final long serialVersionUID = 5599413980514620207L; @@ -23,11 +22,10 @@ public final class WebServiceAccountAuthentication extends AbstractAuthenticatio /** * Constructs a new {@link WebServiceAccountAuthentication} instance. - * + * * @param authenticatedAccount - * the already-authenticated guest {@link Account} that this new - * {@link WebServiceAccountAuthentication} instance will - * represent + * the already-authenticated guest {@link Account} that this new {@link WebServiceAccountAuthentication} + * instance will represent */ public WebServiceAccountAuthentication(Account authenticatedAccount) { super(buildAuthoritiesList(authenticatedAccount)); @@ -38,11 +36,10 @@ public WebServiceAccountAuthentication(Account authenticatedAccount) { /** * @param authenticatedAccount - * the already-authenticated guest {@link Account} that this new - * {@link WebServiceAccountAuthentication} instance will - * represent - * @return a {@link List} of {@link GrantedAuthority}s built from the - * specified {@link Account}'s {@link Account#getRoles()} + * the already-authenticated guest {@link Account} that this new {@link WebServiceAccountAuthentication} + * instance will represent + * @return a {@link List} of {@link GrantedAuthority}s built from the specified {@link Account}'s + * {@link Account#getRoles()} */ private static Collection buildAuthoritiesList(Account authenticatedAccount) { if (authenticatedAccount == null) @@ -68,10 +65,9 @@ public Object getPrincipal() { @Override public Object getCredentials() { /* - * We could maybe also collect an ILoginIdentity in this class' - * constructor and return that here. However, there isn't really any - * need for that now (many other Authentication implementations just - * return null here), so we don't bother. + * We could maybe also collect an ILoginIdentity in this class' constructor and return that here. However, there + * isn't really any need for that now (many other Authentication implementations just return null here), so we + * don't bother. */ return null; } diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/package-info.java index 0ab5cb47..24d93806 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/security/package-info.java @@ -1,4 +1,4 @@ /** * TODO */ -package com.justdavis.karl.rpstourney.webapp.security; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.security; diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtils.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtils.java index f0fc8bdd..9819306f 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtils.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtils.java @@ -19,22 +19,19 @@ public final class CookiesUtils { private static final Logger LOGGER = LoggerFactory.getLogger(CookiesUtils.class); /** - * A regex for validating the Domain property of cookies: it - * must start with a '.' and contain a second one somewhere - * else. + * A regex for validating the Domain property of cookies: it must start with a '.' and + * contain a second one somewhere else. */ private static final Pattern VALID_COOKIE_DOMAIN = Pattern.compile(".*\\..*"); /** - * A regex that will match against IP-only values. (Note: This will allow - * components greater than 255, so isn't 100% effective, but it's good - * enough for our purposes here.) + * A regex that will match against IP-only values. (Note: This will allow components greater than 255, so isn't 100% + * effective, but it's good enough for our purposes here.) */ private static final Pattern LIKELY_IP_ADDRESS = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); /** - * Private constructor; instances of this class aren't needed, as all - * methods are static. + * Private constructor; instances of this class aren't needed, as all methods are static. */ private CookiesUtils() { } @@ -43,10 +40,8 @@ private CookiesUtils() { * @param cookieName * the name of the {@link Cookie} to extract * @param request - * the {@link HttpServletRequest} to extract the specified - * {@link Cookie} from - * @return the specified {@link Cookie} in the specified - * {@link HttpServletRequest}, or null if no such + * the {@link HttpServletRequest} to extract the specified {@link Cookie} from + * @return the specified {@link Cookie} in the specified {@link HttpServletRequest}, or null if no such * {@link Cookie} is present */ public static Cookie extractCookie(String cookieName, HttpServletRequest request) { @@ -62,9 +57,9 @@ public static Cookie extractCookie(String cookieName, HttpServletRequest request } /** - * Cancels a cookie for the client that made the request, by including a new - * expired version of the cookie in the response. - * + * Cancels a cookie for the client that made the request, by including a new expired version of the cookie in the + * response. + * * @param response * the {@link HttpServletResponse} to cancel the cookie in */ @@ -77,11 +72,10 @@ public static void cancelCookie(String cookieName, HttpServletResponse response) } /** - * Configures the {@link Cookie#setHttpOnly(boolean)}, - * {@link Cookie#setDomain(String)}, {@link Cookie#setPath(String)}, and - * {@link Cookie#setSecure(boolean)} properties for the specified + * Configures the {@link Cookie#setHttpOnly(boolean)}, {@link Cookie#setDomain(String)}, + * {@link Cookie#setPath(String)}, and {@link Cookie#setSecure(boolean)} properties for the specified * {@link Cookie}, based on the specified {@link AppConfig}. - * + * * @param cookie * the {@link Cookie} to be configured * @param appConfig @@ -99,10 +93,8 @@ public static void applyCookieSecurityProperties(Cookie cookie, AppConfig appCon cookie.setPath(path); /* - * This application will store user's authentication status in session - * cookies and will also store AuthTokens themselves in cookies (which - * are just s private as a username and password). It MUST be hosted - * securely. + * This application will store user's authentication status in session cookies and will also store AuthTokens + * themselves in cookies (which are just s private as a username and password). It MUST be hosted securely. */ boolean isHttps = "https".equals(baseUrl.getProtocol()); if (isHttps) @@ -113,23 +105,19 @@ public static void applyCookieSecurityProperties(Cookie cookie, AppConfig appCon /** * @param applicationUrl - * a {@link URL} that the application to build a cookie for is - * being hosted at (does not have to be the base/root {@link URL} - * ) - * @return the cookie Domain property to use for application - * being hosted at the specified {@link URL}, or null - * if no Domain property is allowed (per the specs) for - * that {@link URL} + * a {@link URL} that the application to build a cookie for is being hosted at (does not have to be the + * base/root {@link URL} ) + * @return the cookie Domain property to use for application being hosted at the specified {@link URL}, + * or null if no Domain property is allowed (per the specs) for that {@link URL} */ private static String computeCookieDomainProperty(URL applicationUrl) { String domain = applicationUrl.getHost(); /* - * Per http://code.google.com/p/chromium/issues/detail?id=56211 and - * http://curl.haxx.se/rfc/cookie_spec.html, the Domain property must - * never refer to top-level domains. Chrome, in particular, gets very - * upset about this and ignores the cookies entirely. So, if we're about - * to try and do that: stop. Leave the property unassigned, instead. + * Per http://code.google.com/p/chromium/issues/detail?id=56211 and http://curl.haxx.se/rfc/cookie_spec.html, + * the Domain property must never refer to top-level domains. Chrome, in particular, gets very upset about this + * and ignores the cookies entirely. So, if we're about to try and do that: stop. Leave the property unassigned, + * instead. */ boolean isLikelyAnIpAddress = LIKELY_IP_ADDRESS.matcher(domain).matches(); if (!isLikelyAnIpAddress && !VALID_COOKIE_DOMAIN.matcher(domain).matches()) diff --git a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/package-info.java b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/package-info.java index 2166f9b6..6d5a5108 100644 --- a/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/package-info.java +++ b/rps-tourney-webapp/src/main/java/com/justdavis/karl/rpstourney/webapp/util/package-info.java @@ -1,4 +1,4 @@ /** * Contains general-purpose utilities used by the rest of the project. */ -package com.justdavis.karl.rpstourney.webapp.util; \ No newline at end of file +package com.justdavis.karl.rpstourney.webapp.util; diff --git a/rps-tourney-webapp/src/main/resources/logback.xml b/rps-tourney-webapp/src/main/resources/logback.xml index 23c4fc14..560a7f00 100644 --- a/rps-tourney-webapp/src/main/resources/logback.xml +++ b/rps-tourney-webapp/src/main/resources/logback.xml @@ -2,10 +2,8 @@ - - + + ${rps.webapp.logs.path:-./logs}/${project.artifactId}.log @@ -22,4 +20,4 @@ - \ No newline at end of file + diff --git a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/game.js b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/game.js index bb95eaf8..ed678329 100644 --- a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/game.js +++ b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/game.js @@ -1,65 +1,65 @@ /* * Hide the player name form when the page loads. */ -$(document).ready(function() { - $("form.player-name").hide(); +$(document).ready(function () { + $("form.player-name").hide(); }); /* * Swap out the player name label for the editor, when it's clicked. */ -$(document).on("click", "p.player-name-current", function() { - $(this).hide(); +$(document).on("click", "p.player-name-current", function () { + $(this).hide(); - $("form.player-name").show(); - $("form.player-name > input").focus().select(); + $("form.player-name").show(); + $("form.player-name > input").focus().select(); }); /* * Watch for and record clicks on this button, to handle blurs of its form * correctly. */ -$(document).on("mousedown", "form.player-name button", function(event) { - $(this).data("mouseDown", true); +$(document).on("mousedown", "form.player-name button", function (event) { + $(this).data("mouseDown", true); }); -$(document).on("mouseup", "form.player-name button", function(event) { - $(this).data("mouseDown", false); +$(document).on("mouseup", "form.player-name button", function (event) { + $(this).data("mouseDown", false); }); /* * Hide the form when it loses focus, unless it's being submitted. */ -$(document).on("blur", "form.player-name", function(event) { - // Ignore the blur if it was caused by a submit. The submission will cause a - // reload that hides it anyways. - if ($("form.player-name button").data("mouseDown") == true) - return false; - - $(this).hide(); - $("p.player-name-current").show(); +$(document).on("blur", "form.player-name", function (event) { + // Ignore the blur if it was caused by a submit. The submission will cause a + // reload that hides it anyways. + if ($("form.player-name button").data("mouseDown") == true) + return false; + + $(this).hide(); + $("p.player-name-current").show(); }); /* * Whenever the user selects one of the "invite opponent" form's two radio * buttons, show/hide the panels in that form appropriately. */ -$("input[name='opponentType']").on("change", function() { - var opponentTypeValue = $("input[name='opponentType']:checked").val(); - if (opponentTypeValue == "friend") { - $("#opponent-type-friend-panel").show(); - $("#opponent-type-ai-panel").hide(); - } else if (opponentTypeValue == "ai") { - $("#opponent-type-friend-panel").hide(); - $("#opponent-type-ai-panel").show(); - } +$("input[name='opponentType']").on("change", function () { + var opponentTypeValue = $("input[name='opponentType']:checked").val(); + if (opponentTypeValue == "friend") { + $("#opponent-type-friend-panel").show(); + $("#opponent-type-ai-panel").hide(); + } else if (opponentTypeValue == "ai") { + $("#opponent-type-friend-panel").hide(); + $("#opponent-type-ai-panel").show(); + } }); /* * Prepare the "invite opponent" form when the page loads. */ -$(document).ready(function() { - $("#opponent-type-friend").prop("checked", true); - $("input[name='opponentType']").change(); +$(document).ready(function () { + $("#opponent-type-friend").prop("checked", true); + $("input[name='opponentType']").change(); }); /* @@ -67,38 +67,38 @@ $(document).ready(function() { * round in the specified game. */ function computeRoundResultElement(gameData, round) { - /* - * Note: This HTML is slightly different from the server-side version. The - * server-side version puts the won/lost class in an outer, wrapping - * . The differences don't affect any of the logic or rendering, - * though. - */ - - var resultText = $.i18n.prop('roundResult.none'); - var resultClasses = ""; - if (round.result === 'PLAYER_1_WON') { - resultText = computePlayerNameText(gameData, gameData.player1); - if (isUserThisPlayer(gameData, gameData.player1)) { - resultClasses = "PLAYER_1 won"; - } else if (isUserAPlayer(gameData)) { - resultClasses = "PLAYER_1 lost"; - } else { - resultClasses = "PLAYER_1"; - } - } else if (round.result === 'PLAYER_2_WON') { - resultText = computePlayerNameText(gameData, gameData.player2); - if (isUserThisPlayer(gameData, gameData.player2)) { - resultClasses = "PLAYER_2 won"; - } else if (isUserAPlayer(gameData)) { - resultClasses = "PLAYER_2 lost"; - } else { - resultClasses = "PLAYER_2"; - } - } else if (round.result === 'TIED') { - resultText = $.i18n.prop('roundResult.tied'); - } - - return '' + resultText + ''; + /* + * Note: This HTML is slightly different from the server-side version. The + * server-side version puts the won/lost class in an outer, wrapping + * . The differences don't affect any of the logic or rendering, + * though. + */ + + var resultText = $.i18n.prop('roundResult.none'); + var resultClasses = ""; + if (round.result === 'PLAYER_1_WON') { + resultText = computePlayerNameText(gameData, gameData.player1); + if (isUserThisPlayer(gameData, gameData.player1)) { + resultClasses = "PLAYER_1 won"; + } else if (isUserAPlayer(gameData)) { + resultClasses = "PLAYER_1 lost"; + } else { + resultClasses = "PLAYER_1"; + } + } else if (round.result === 'PLAYER_2_WON') { + resultText = computePlayerNameText(gameData, gameData.player2); + if (isUserThisPlayer(gameData, gameData.player2)) { + resultClasses = "PLAYER_2 won"; + } else if (isUserAPlayer(gameData)) { + resultClasses = "PLAYER_2 lost"; + } else { + resultClasses = "PLAYER_2"; + } + } else if (round.result === 'TIED') { + resultText = $.i18n.prop('roundResult.tied'); + } + + return '' + resultText + ''; } /* @@ -106,26 +106,26 @@ function computeRoundResultElement(gameData, round) { * in the specified game. */ function computePlayerNameText(gameData, player) { - var playerLabel = $.i18n.prop('playerName.notJoined'); - if (player != null) { - // Compute the display name. - if (player.name !== null) { - playerLabel = player.name; - } else if (player.builtInAi != null) { - playerLabel = $.i18n.prop('players.ai.name.' - + player.builtInAi.displayNameKey); - } else { - playerLabel = $.i18n.prop('playerName.anon'); - } - - // Add the " (You)" suffix, if needed. - if (isUserThisPlayer(gameData, player)) { - playerLabel = playerLabel - + $.i18n.prop('playerName.current.suffix') - } - } - - return playerLabel; + var playerLabel = $.i18n.prop('playerName.notJoined'); + if (player != null) { + // Compute the display name. + if (player.name !== null) { + playerLabel = player.name; + } else if (player.builtInAi != null) { + playerLabel = $.i18n.prop('players.ai.name.' + + player.builtInAi.displayNameKey); + } else { + playerLabel = $.i18n.prop('playerName.anon'); + } + + // Add the " (You)" suffix, if needed. + if (isUserThisPlayer(gameData, player)) { + playerLabel = playerLabel + + $.i18n.prop('playerName.current.suffix') + } + } + + return playerLabel; } /* @@ -133,24 +133,24 @@ function computePlayerNameText(gameData, player) { * created for is a player in the game, false if not. */ function isUserAPlayer(gameData) { - if (gameData === null) { - throw "Missing game data."; - } - - // Check to see if the game data has an associated user. - if (gameData.viewPlayer === null) { - return false; - } - - if (gameData.player1 !== null - && isUserThisPlayer(gameData, gameData.player1)) { - return true; - } else if (gameData.player2 !== null - && isUserThisPlayer(gameData, gameData.player2)) { - return true; - } else { - return false; - } + if (gameData === null) { + throw "Missing game data."; + } + + // Check to see if the game data has an associated user. + if (gameData.viewPlayer === null) { + return false; + } + + if (gameData.player1 !== null + && isUserThisPlayer(gameData, gameData.player1)) { + return true; + } else if (gameData.player2 !== null + && isUserThisPlayer(gameData, gameData.player2)) { + return true; + } else { + return false; + } } /* @@ -158,19 +158,19 @@ function isUserAPlayer(gameData) { * created for is the specified player in the game, false if not. */ function isUserThisPlayer(gameData, player) { - if (gameData === null) { - throw "Missing game data."; - } - if (player === null) { - return false; - } - - // Check to see if the game data has an associated user. - if (gameData.viewPlayer === null) { - return false; - } - - return player.humanAccount !== null && player.id === gameData.viewPlayer.id; + if (gameData === null) { + throw "Missing game data."; + } + if (player === null) { + return false; + } + + // Check to see if the game data has an associated user. + if (gameData.viewPlayer === null) { + return false; + } + + return player.humanAccount !== null && player.id === gameData.viewPlayer.id; } /* @@ -179,29 +179,29 @@ function isUserThisPlayer(gameData, player) { * hasn't even completed yet. */ function isUserTheWinner(gameData) { - if (gameData === null) { - throw "Missing game data."; - } - if (gameData.state !== "FINISHED") { - throw "Game not finished."; - } - - // Check to see if the game data has an associated user. - if (gameData.viewPlayer === null) { - return false; - } - - // Sanity check: Make sure the current player is a human. - if (gameData.viewPlayer.humanAccount === null) { - throw "Cyborg detected!"; - } - - // Check to see if the winner was an actual user. - if (gameData.winner.humanAccount === null) { - return false; - } - - return gameData.winner.humanAccount.id === gameData.viewPlayer.humanAccount.id; + if (gameData === null) { + throw "Missing game data."; + } + if (gameData.state !== "FINISHED") { + throw "Game not finished."; + } + + // Check to see if the game data has an associated user. + if (gameData.viewPlayer === null) { + return false; + } + + // Sanity check: Make sure the current player is a human. + if (gameData.viewPlayer.humanAccount === null) { + throw "Cyborg detected!"; + } + + // Check to see if the winner was an actual user. + if (gameData.winner.humanAccount === null) { + return false; + } + + return gameData.winner.humanAccount.id === gameData.viewPlayer.humanAccount.id; } /* @@ -209,190 +209,190 @@ function isUserTheWinner(gameData) { * state. */ function processNewGameState(gameData) { - // Build the URL for the game state, based on the URL for the game page. - gameUrl = window.location.href; - - // Grab player names/labels for use later. - var player1Label = computePlayerNameText(gameData, gameData.player1); - var player2Label = computePlayerNameText(gameData, gameData.player2); - - // Update Player 1's name. - $(".PLAYER_1").text(player1Label); - - if (gameData.state != "WAITING_FOR_PLAYER") { - // Update Player 2's name. - $(".PLAYER_2").text(player2Label); - - // If the user is a player, unhide the throw controls. - if (isUserAPlayer(gameData)) { - $(".player-throws").removeClass("hidden"); - } - - // Remove the "ask someone to join" message and/or the "Join Game" - // controls. - $("#join-message").remove(); - $("#join-controls").remove(); - } - - // Update the max round displays and controls. - $(".max-rounds-value").text(gameData.maxRounds); - if (gameData.state !== "WAITING_FOR_PLAYER" - && gameData.state !== "WAITING_FOR_FIRST_THROW") { - // If game has started, remove the game controls. - $("#game-controls").remove(); - } else { - // If game hasn't started, update the max round controls. - var roundsDecreaseUrl = gameUrl + "/setMaxRounds?oldMaxRoundsValue=" - + gameData.maxRounds + "&newMaxRoundsValue=" - + (gameData.maxRounds - 2); - ; - var roundsIncreaseUrl = gameUrl + "/setMaxRounds?oldMaxRoundsValue=" - + gameData.maxRounds + "&newMaxRoundsValue=" - + (gameData.maxRounds + 2); - $("#max-rounds-down").attr("href", roundsDecreaseUrl); - $("#max-rounds-up").attr("href", roundsIncreaseUrl); - } - - // Update the round history table. - if (gameData.state !== "WAITING_FOR_PLAYER" - && gameData.state !== "WAITING_FOR_FIRST_THROW") { - // Remove the "fake" result row, if it's there. - $("#round-data-fake").remove(); - - // Update/create the rows for each round. - for (index = 0; index < gameData.rounds.length; index++) { - var round = gameData.rounds[index]; - var roundRow = $("#round-data-" + round.roundIndex); - - // Create a new row, if one does not yet exist for the round. - if (roundRow.length === 0) { - $('table#rounds > tbody').append( - ''); - roundRow = $("#round-data-" + round.roundIndex); - } - - // Set/update all of the column values in the row for the round. - roundRow.children("td:nth-child(1)").text( - round.adjustedRoundIndex + 1); - var firstPlayerThrow, secondPlayerThrow; - if (isUserThisPlayer(gameData, gameData.player2)) { - firstPlayerThrow = round.throwForPlayer2; - secondPlayerThrow = round.throwForPlayer1; - } else { - firstPlayerThrow = round.throwForPlayer1; - secondPlayerThrow = round.throwForPlayer2; - } - var throwForFirstPlayerKey = firstPlayerThrow === null ? 'game.roundHistory.' - : 'game.roundHistory.' + firstPlayerThrow; - roundRow.children("td:nth-child(2)").text( - $.i18n.prop(throwForFirstPlayerKey)); - var throwForSecondPlayerKey = secondPlayerThrow === null ? 'game.roundHistory.' - : 'game.roundHistory.' + secondPlayerThrow; - roundRow.children("td:nth-child(3)").text( - $.i18n.prop(throwForSecondPlayerKey)); - roundRow.children("td:nth-child(4)").empty().append( - computeRoundResultElement(gameData, round)); - } - } - - // Determine the order players are displayed in the UI. - var playerFirst, playerSecond; - var player1Element, player2Element; - if (isUserThisPlayer(gameData, gameData.player2)) { - playerFirst = gameData.player2; - playerSecond = gameData.player1; - player1Element = $("#player-second"); - player2Element = $("#player-first"); - } else { - playerFirst = gameData.player1; - playerSecond = gameData.player2; - player1Element = $("#player-first"); - player2Element = $("#player-second"); - } - - // Update the page's title (in the HTML header). - document.title = '' + computePlayerNameText(gameData, playerFirst) + ' ' - + $.i18n.prop('gameTitle.versus') + ' ' - + computePlayerNameText(gameData, playerSecond); - - // Update the scores. - player1Element.find(".player-score-value").text(gameData.scoreForPlayer1); - player2Element.find(".player-score-value").text(gameData.scoreForPlayer2); - - if (gameData.state === "FINISHED") { - // Update the won/lost styling. - if (gameData.scoreForPlayer1 > gameData.scoreForPlayer2) { - player1Element.addClass("won"); - player2Element.addClass("lost"); - } else { - player1Element.addClass("lost"); - player2Element.addClass("won"); - } - - // Hide the throw controls. - $(".player-throws").toggleClass("hidden", true); - - // Create the result row, if it hasn't been already. - if ($("#result-row").length === 0) { - var winnerDisplayName = ""; - var winnerNameClass = ""; - var wonOrLostClass = ""; - - if (gameData.winner.id === gameData.player1.id) { - winnerDisplayName = computePlayerNameText(gameData, - gameData.player1); - winnerNameClass = "PLAYER_1"; - } else { - winnerDisplayName = computePlayerNameText(gameData, - gameData.player2); - winnerNameClass = "PLAYER_2"; - } - - if (isUserAPlayer(gameData) && isUserTheWinner(gameData)) { - wonOrLostClass = "won"; - } else if (isUserAPlayer(gameData)) { - wonOrLostClass = "lost"; - } - - var finalResultCell = '' - + winnerDisplayName + '' - + $.i18n.prop('game.roundHistory.someoneWonSuffix') - + ''; - $('table#rounds > tbody').append( - '' + finalResultCell - + ''); - } - } - - // Update the round counter. - if (gameData.state !== "WAITING_FOR_PLAYER" - && gameData.state !== "WAITING_FOR_FIRST_THROW") { - var currentRound = gameData.rounds[gameData.rounds.length - 1]; - $("#round-counter-current").text(currentRound.adjustedRoundIndex + 1); - } + // Build the URL for the game state, based on the URL for the game page. + gameUrl = window.location.href; + + // Grab player names/labels for use later. + var player1Label = computePlayerNameText(gameData, gameData.player1); + var player2Label = computePlayerNameText(gameData, gameData.player2); + + // Update Player 1's name. + $(".PLAYER_1").text(player1Label); + + if (gameData.state != "WAITING_FOR_PLAYER") { + // Update Player 2's name. + $(".PLAYER_2").text(player2Label); + + // If the user is a player, unhide the throw controls. + if (isUserAPlayer(gameData)) { + $(".player-throws").removeClass("hidden"); + } + + // Remove the "ask someone to join" message and/or the "Join Game" + // controls. + $("#join-message").remove(); + $("#join-controls").remove(); + } + + // Update the max round displays and controls. + $(".max-rounds-value").text(gameData.maxRounds); + if (gameData.state !== "WAITING_FOR_PLAYER" + && gameData.state !== "WAITING_FOR_FIRST_THROW") { + // If game has started, remove the game controls. + $("#game-controls").remove(); + } else { + // If game hasn't started, update the max round controls. + var roundsDecreaseUrl = gameUrl + "/setMaxRounds?oldMaxRoundsValue=" + + gameData.maxRounds + "&newMaxRoundsValue=" + + (gameData.maxRounds - 2); + ; + var roundsIncreaseUrl = gameUrl + "/setMaxRounds?oldMaxRoundsValue=" + + gameData.maxRounds + "&newMaxRoundsValue=" + + (gameData.maxRounds + 2); + $("#max-rounds-down").attr("href", roundsDecreaseUrl); + $("#max-rounds-up").attr("href", roundsIncreaseUrl); + } + + // Update the round history table. + if (gameData.state !== "WAITING_FOR_PLAYER" + && gameData.state !== "WAITING_FOR_FIRST_THROW") { + // Remove the "fake" result row, if it's there. + $("#round-data-fake").remove(); + + // Update/create the rows for each round. + for (index = 0; index < gameData.rounds.length; index++) { + var round = gameData.rounds[index]; + var roundRow = $("#round-data-" + round.roundIndex); + + // Create a new row, if one does not yet exist for the round. + if (roundRow.length === 0) { + $('table#rounds > tbody').append( + ''); + roundRow = $("#round-data-" + round.roundIndex); + } + + // Set/update all of the column values in the row for the round. + roundRow.children("td:nth-child(1)").text( + round.adjustedRoundIndex + 1); + var firstPlayerThrow, secondPlayerThrow; + if (isUserThisPlayer(gameData, gameData.player2)) { + firstPlayerThrow = round.throwForPlayer2; + secondPlayerThrow = round.throwForPlayer1; + } else { + firstPlayerThrow = round.throwForPlayer1; + secondPlayerThrow = round.throwForPlayer2; + } + var throwForFirstPlayerKey = firstPlayerThrow === null ? 'game.roundHistory.' + : 'game.roundHistory.' + firstPlayerThrow; + roundRow.children("td:nth-child(2)").text( + $.i18n.prop(throwForFirstPlayerKey)); + var throwForSecondPlayerKey = secondPlayerThrow === null ? 'game.roundHistory.' + : 'game.roundHistory.' + secondPlayerThrow; + roundRow.children("td:nth-child(3)").text( + $.i18n.prop(throwForSecondPlayerKey)); + roundRow.children("td:nth-child(4)").empty().append( + computeRoundResultElement(gameData, round)); + } + } + + // Determine the order players are displayed in the UI. + var playerFirst, playerSecond; + var player1Element, player2Element; + if (isUserThisPlayer(gameData, gameData.player2)) { + playerFirst = gameData.player2; + playerSecond = gameData.player1; + player1Element = $("#player-second"); + player2Element = $("#player-first"); + } else { + playerFirst = gameData.player1; + playerSecond = gameData.player2; + player1Element = $("#player-first"); + player2Element = $("#player-second"); + } + + // Update the page's title (in the HTML header). + document.title = '' + computePlayerNameText(gameData, playerFirst) + ' ' + + $.i18n.prop('gameTitle.versus') + ' ' + + computePlayerNameText(gameData, playerSecond); + + // Update the scores. + player1Element.find(".player-score-value").text(gameData.scoreForPlayer1); + player2Element.find(".player-score-value").text(gameData.scoreForPlayer2); + + if (gameData.state === "FINISHED") { + // Update the won/lost styling. + if (gameData.scoreForPlayer1 > gameData.scoreForPlayer2) { + player1Element.addClass("won"); + player2Element.addClass("lost"); + } else { + player1Element.addClass("lost"); + player2Element.addClass("won"); + } + + // Hide the throw controls. + $(".player-throws").toggleClass("hidden", true); + + // Create the result row, if it hasn't been already. + if ($("#result-row").length === 0) { + var winnerDisplayName = ""; + var winnerNameClass = ""; + var wonOrLostClass = ""; + + if (gameData.winner.id === gameData.player1.id) { + winnerDisplayName = computePlayerNameText(gameData, + gameData.player1); + winnerNameClass = "PLAYER_1"; + } else { + winnerDisplayName = computePlayerNameText(gameData, + gameData.player2); + winnerNameClass = "PLAYER_2"; + } + + if (isUserAPlayer(gameData) && isUserTheWinner(gameData)) { + wonOrLostClass = "won"; + } else if (isUserAPlayer(gameData)) { + wonOrLostClass = "lost"; + } + + var finalResultCell = '' + + winnerDisplayName + '' + + $.i18n.prop('game.roundHistory.someoneWonSuffix') + + ''; + $('table#rounds > tbody').append( + '' + finalResultCell + + ''); + } + } + + // Update the round counter. + if (gameData.state !== "WAITING_FOR_PLAYER" + && gameData.state !== "WAITING_FOR_FIRST_THROW") { + var currentRound = gameData.rounds[gameData.rounds.length - 1]; + $("#round-counter-current").text(currentRound.adjustedRoundIndex + 1); + } } /* * When called, this function will automatically refresh the game state. */ function refreshGameState() { - // Build the URL for the game state, based on the URL for the game page. - gameUrl = window.location.href; - gameStateUrl = gameUrl + "/data"; - - // Issue an AJAX request for the current game state. - $.getJSON(gameStateUrl, function(gameData) { - console.log("Refresh successful. Next interval: %d.", refreshInterval); - // console.log("Refresh request succeeded: %s", - // JSON.stringify(gameData)); - - // Process the new data. - processNewGameState(gameData); - }).fail(function(jqxhr, textStatus, error) { - console.log("Refresh request failed: %s, %s", textStatus, error); - }); + // Build the URL for the game state, based on the URL for the game page. + gameUrl = window.location.href; + gameStateUrl = gameUrl + "/data"; + + // Issue an AJAX request for the current game state. + $.getJSON(gameStateUrl, function (gameData) { + console.log("Refresh successful. Next interval: %d.", refreshInterval); + // console.log("Refresh request succeeded: %s", + // JSON.stringify(gameData)); + + // Process the new data. + processNewGameState(gameData); + }).fail(function (jqxhr, textStatus, error) { + console.log("Refresh request failed: %s, %s", textStatus, error); + }); } /* @@ -400,8 +400,8 @@ function refreshGameState() { * increases exponentially, up to a maximum of 60 seconds. */ function calculateNextRefreshInterval(lastInterval) { - var maxInterval = 60 * 1000; - return Math.min(maxInterval, (lastInterval * 1.25)); + var maxInterval = 60 * 1000; + return Math.min(maxInterval, (lastInterval * 1.25)); } /* @@ -409,11 +409,11 @@ function calculateNextRefreshInterval(lastInterval) { */ var refreshInterval = 1000; function refreshGameStateAndLoop() { - refreshGameState(); + refreshGameState(); - refreshInterval = calculateNextRefreshInterval(refreshInterval); - setTimeout(refreshGameStateAndLoop, refreshInterval); + refreshInterval = calculateNextRefreshInterval(refreshInterval); + setTimeout(refreshGameStateAndLoop, refreshInterval); } -$(document).ready(function() { - setTimeout(refreshGameStateAndLoop, refreshInterval); +$(document).ready(function () { + setTimeout(refreshGameStateAndLoop, refreshInterval); }); diff --git a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/main.js b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/main.js index 695fde57..d036e96b 100644 --- a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/main.js +++ b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/main.js @@ -1,8 +1,8 @@ // Initialize the jquery.i18n.properties-1.1.js plugin. $.i18n.properties({ - name: 'messages', - language: '', - path: baseUrl + '/i18n/', - mode: 'map', - encoding: 'ISO-8859-1' + name : 'messages', + language : '', + path : baseUrl + '/i18n/', + mode : 'map', + encoding : 'ISO-8859-1' }); diff --git a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/plugins.js b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/plugins.js index 728680b0..69b49119 100644 --- a/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/plugins.js +++ b/rps-tourney-webapp/src/main/webapp/WEB-INF/resources/js/plugins.js @@ -1,13 +1,12 @@ // Avoid `console` errors in browsers that lack a console. -(function() { +(function () { var method; - var noop = function () {}; - var methods = [ - 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', - 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', - 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', - 'timeStamp', 'trace', 'warn' - ]; + var noop = function () { + }; + var methods = [ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', + 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', + 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', + 'time', 'timeEnd', 'timeStamp', 'trace', 'warn' ]; var length = methods.length; var console = (window.console = window.console || {}); diff --git a/rps-tourney-webapp/src/main/webapp/WEB-INF/web.xml b/rps-tourney-webapp/src/main/webapp/WEB-INF/web.xml index e2ec913c..04d8cb0f 100644 --- a/rps-tourney-webapp/src/main/webapp/WEB-INF/web.xml +++ b/rps-tourney-webapp/src/main/webapp/WEB-INF/web.xml @@ -1,11 +1,9 @@ - + @@ -20,9 +18,8 @@ - + /error diff --git a/rps-tourney-webapp/src/main/webapp/WEB-INF/wro.xml b/rps-tourney-webapp/src/main/webapp/WEB-INF/wro.xml index b58408e7..bd1f9b3a 100644 --- a/rps-tourney-webapp/src/main/webapp/WEB-INF/wro.xml +++ b/rps-tourney-webapp/src/main/webapp/WEB-INF/wro.xml @@ -1,20 +1,18 @@ - + - + - + /WEB-INF/resources/js/vendor/jquery.i18n.properties-1.1.js /WEB-INF/resources/js/main.js /WEB-INF/resources/js/plugins.js - + /bootstrap-3.2.0/js/transition.js /bootstrap-3.2.0/js/alert.js /bootstrap-3.2.0/js/button.js diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/account/AuthenticationIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/account/AuthenticationIT.java index 53accdb9..411a1bc9 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/account/AuthenticationIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/account/AuthenticationIT.java @@ -15,8 +15,7 @@ import com.justdavis.karl.rpstourney.webapp.account.RegisterController; /** - * Integration tests for {@link RegisterController}, {@link AccountController}, - * and login.jsp. + * Integration tests for {@link RegisterController}, {@link AccountController}, and login.jsp. */ public final class AuthenticationIT { /** @@ -53,9 +52,8 @@ public void loginFailsForInvalidAccount() { } /** - * Ensures that users who login from an existing anonymous account have - * their game history, etc. merged into the account that they are logging - * into. + * Ensures that users who login from an existing anonymous account have their game history, etc. merged into the + * account that they are logging into. */ @Test public void loginFromAnonymousAccount() { @@ -85,8 +83,7 @@ public void loginFromAnonymousAccount() { Assert.assertEquals(ITUtils.buildWebAppUrl("account"), driverB.getCurrentUrl()); /* - * Verify that the login worked and that the account is now - * associated with both games. + * Verify that the login worked and that the account is now associated with both games. */ driverB.get(ITUtils.buildWebAppUrl("")); Assert.assertEquals(2, driverB.findElements(By.cssSelector("table#player-games tbody tr")).size()); @@ -97,8 +94,7 @@ public void loginFromAnonymousAccount() { } /** - * Ensures that the sign in/account control that's part of the pages' - * template works correctly. + * Ensures that the sign in/account control that's part of the pages' template works correctly. */ @Test public void signInAndAccountControl() { @@ -130,8 +126,7 @@ public void signInAndAccountControl() { driver.findElement(By.cssSelector("form#register button[type=submit]")).click(); /* - * Ensure the Sign In control was replaced with the current account - * control. + * Ensure the Sign In control was replaced with the current account control. */ driver.get(ITUtils.buildWebAppUrl("/")); Assert.assertEquals( diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/EnvironmentIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/EnvironmentIT.java index 1bcfbe05..af967aac 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/EnvironmentIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/EnvironmentIT.java @@ -11,8 +11,8 @@ import com.justdavis.karl.rpstourney.service.client.ServiceStatusClient; /** - * Some basic integration tests that ensure that Jetty and everything else seem - * to be working as expected by the other ITs. + * Some basic integration tests that ensure that Jetty and everything else seem to be working as expected by the other + * ITs. */ public final class EnvironmentIT { /** @@ -27,11 +27,10 @@ public void checkWebService() { /** * Verify that the web application looks to be up & running. - * + * * @throws IOException - * An {@link IOException} will be thrown if an error occurs - * trying to access the web application. Indicates that things - * aren't running correctly. + * An {@link IOException} will be thrown if an error occurs trying to access the web application. + * Indicates that things aren't running correctly. */ @Test public void checkWebApp() throws IOException { diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/ITUtils.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/ITUtils.java index c89fd725..62843dc7 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/ITUtils.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/ITUtils.java @@ -9,36 +9,31 @@ * Contains constants and methods for use by the project's integration tests. *

    *

    - * The code here relies on and interacts with the embedded Jetty instance that - * is used for this project's integration tests. See - * cargo-maven2-plugin in the project's pom.xml for - * details. + * The code here relies on and interacts with the embedded Jetty instance that is used for this project's integration + * tests. See cargo-maven2-plugin in the project's pom.xml for details. *

    */ public final class ITUtils { /** - * The port that Jetty will run on, for the embedded Jetty instance used in - * the project's integration tests. + * The port that Jetty will run on, for the embedded Jetty instance used in the project's integration tests. */ private static final int JETTY_PORT = 9093; /** - * The context path that this project's WAR will be hosted at, for the - * embedded Jetty instance used in this project's integration tests. + * The context path that this project's WAR will be hosted at, for the embedded Jetty instance used in this + * project's integration tests. */ private static final String CONTEXT_WEB_APP = "/rps-tourney-webapp"; /** - * The context path that the rps-tourney-service-app project's - * WAR will be hosted at, for the embedded Jetty instance used in this - * project's integration tests. + * The context path that the rps-tourney-service-app project's WAR will be hosted at, for the embedded + * Jetty instance used in this project's integration tests. */ private static final String CONTEXT_WEB_SERVICE = "/rps-tourney-service-app"; /** * @param pathComponents - * (optional) the path components to add to the URL, e.g. - * "game", "abc", "playThrow" + * (optional) the path components to add to the URL, e.g. "game", "abc", "playThrow" * @return a URL for the specified resource in the web application */ public static String buildWebAppUrl(String... pathComponents) { @@ -55,9 +50,8 @@ public static String buildWebAppUrl(String... pathComponents) { } /** - * @return a {@link ClientConfig} instance that can be used to access the - * rps-tourney-service-app WAR's web services, for the - * embedded Jetty instance used in this project's integration tests + * @return a {@link ClientConfig} instance that can be used to access the rps-tourney-service-app WAR's + * web services, for the embedded Jetty instance used in this project's integration tests */ public static ClientConfig createClientConfig() { UriBuilder serviceRootUri = UriBuilder diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/MessagesTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/MessagesTest.java index bdb3548b..bf843a6c 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/MessagesTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/MessagesTest.java @@ -22,8 +22,7 @@ */ public final class MessagesTest { /** - * Verifies that all of the {@link BuiltInAi#getDisplayNameKey()} messages - * that should exist, do exist. + * Verifies that all of the {@link BuiltInAi#getDisplayNameKey()} messages that should exist, do exist. */ @Test public void aiNames() { diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfiguratorTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfiguratorTest.java index a3be4586..732fe3d1 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfiguratorTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/SessionCookieConfiguratorTest.java @@ -20,10 +20,9 @@ */ public final class SessionCookieConfiguratorTest { /** - * Tests - * {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when - * {@link AppConfig#getBaseUrl()} has a context path. - * + * Tests {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when {@link AppConfig#getBaseUrl()} + * has a context path. + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -43,10 +42,9 @@ public void configureCookiesWithPath() throws Exception { } /** - * Tests - * {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when - * {@link AppConfig#getBaseUrl()} does not have a context path. - * + * Tests {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when {@link AppConfig#getBaseUrl()} + * does not have a context path. + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -66,10 +64,9 @@ public void configureCookiesWithoutPath() throws Exception { } /** - * Tests - * {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when - * {@link AppConfig#getBaseUrl()} has localhost as the domain. - * + * Tests {@link SessionCookieConfigurator#applyConfiguration(ServletContext)} when {@link AppConfig#getBaseUrl()} + * has localhost as the domain. + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -85,15 +82,14 @@ public void configureCookiesForLocalhost() throws Exception { /* * Verify that things were configured, as expected. See the comments for - * CookiesUtils.computeCookieDomainProperty(URL), for an explanation of - * why the domain should be null in this case. + * CookiesUtils.computeCookieDomainProperty(URL), for an explanation of why the domain should be null in this + * case. */ Assert.assertNull(servletContext.getSessionCookieConfig().getDomain()); } /** - * A mock Spring {@link Configuration} for use in - * {@link SessionCookieConfiguratorTest}. + * A mock Spring {@link Configuration} for use in {@link SessionCookieConfiguratorTest}. */ @Configuration static class MockConfigLoaderBindingA { @@ -121,8 +117,7 @@ public AppConfig getConfig() { } /** - * A mock Spring {@link Configuration} for use in - * {@link SessionCookieConfiguratorTest}. + * A mock Spring {@link Configuration} for use in {@link SessionCookieConfiguratorTest}. */ @Configuration static class MockConfigLoaderBindingB { @@ -150,8 +145,7 @@ public AppConfig getConfig() { } /** - * A mock Spring {@link Configuration} for use in - * {@link SessionCookieConfiguratorTest}. + * A mock Spring {@link Configuration} for use in {@link SessionCookieConfiguratorTest}. */ @Configuration static class MockConfigLoaderBindingC { diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/account/RegisterIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/account/RegisterIT.java index b963aad6..f1bc7e9d 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/account/RegisterIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/account/RegisterIT.java @@ -11,13 +11,12 @@ import com.justdavis.karl.rpstourney.webapp.ITUtils; /** - * Integration tests for both {@link RegisterController} and - * register.jsp. + * Integration tests for both {@link RegisterController} and register.jsp. */ public final class RegisterIT { /** - * Ensures that users can register and successfully view their account - * details, when they weren't logged in at all beforehand. + * Ensures that users can register and successfully view their account details, when they weren't logged in at all + * beforehand. */ @Test public void registerWithNoLoginAndViewAccount() { @@ -52,8 +51,8 @@ public void registerWithNoLoginAndViewAccount() { } /** - * Ensures that users can register a login for an existing anonymous - * account, without losing their game history, etc. + * Ensures that users can register a login for an existing anonymous account, without losing their game history, + * etc. */ @Test public void registerWithAnonymousLogin() { diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigTest.java index eafefe00..6e5b8a12 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/AppConfigTest.java @@ -28,7 +28,7 @@ public final class AppConfigTest { /** * Ensures that {@link AppConfig} instances can be marshalled. - * + * * @throws JAXBException * (shouldn't be thrown if things are working) * @throws XPathExpressionException @@ -64,7 +64,7 @@ public void jaxbMarshalling() /** * Ensures that {@link AppConfig} instances can be unmarshalled. - * + * * @throws JAXBException * (shouldn't be thrown if things are working) * @throws XPathExpressionException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/MockConfigLoader.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/MockConfigLoader.java index e39d4d92..2fd137db 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/MockConfigLoader.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/MockConfigLoader.java @@ -8,17 +8,15 @@ import com.justdavis.karl.misc.exceptions.BadCodeMonkeyException; /** - * An {@link IConfigLoader} that is intended for use with the application's - * integration tests. + * An {@link IConfigLoader} that is intended for use with the application's integration tests. */ public final class MockConfigLoader implements IConfigLoader { private final AppConfig config; /** - * Constructs a new {@link MockConfigLoader} instance. This constructor is - * intended for use in unit tests, as they can pass in the appropriate - * parameters manually. - * + * Constructs a new {@link MockConfigLoader} instance. This constructor is intended for use in unit tests, as they + * can pass in the appropriate parameters manually. + * * @param baseUrl * the value to use for {@link AppConfig#getBaseUrl()} * @param clientServiceRoot @@ -35,17 +33,15 @@ public MockConfigLoader(URL baseUrl, URL clientServiceRoot) { @Inject public MockConfigLoader() { /* - * Once AppConfig has more to it than just a couple of fields, I'd - * recommend loading the rest of the config from an XML file using a - * separate (customized) XmlConfigLoader instance. + * Once AppConfig has more to it than just a couple of fields, I'd recommend loading the rest of the config from + * an XML file using a separate (customized) XmlConfigLoader instance. */ this(getBaseUrlForManualTesting(), getServiceUrlForManualTesting()); } /** - * @return the {@link AppConfig#getClientServiceRoot()} that will work when - * things are being tested manually via + * @return the {@link AppConfig#getClientServiceRoot()} that will work when things are being tested manually via * WebAppJettyLauncher */ private static URL getBaseUrlForManualTesting() { @@ -61,10 +57,8 @@ private static URL getBaseUrlForManualTesting() { } /** - * @return the {@link AppConfig#getClientServiceRoot()} that will work when - * things are being tested manually via - * ServiceAppJettyLauncher and - * WebAppJettyLauncher + * @return the {@link AppConfig#getClientServiceRoot()} that will work when things are being tested manually via + * ServiceAppJettyLauncher and WebAppJettyLauncher */ private static URL getServiceUrlForManualTesting() { URL clientServiceRoot; diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoaderTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoaderTest.java index efd50336..4fff507e 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoaderTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/config/XmlConfigLoaderTest.java @@ -21,17 +21,16 @@ public final class XmlConfigLoaderTest { public TemporaryFolder tempFolder = new TemporaryFolder(); /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files - * from the default path. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files from the default path. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void loadFromDefaultPath() throws IOException { /* - * Sanity check: We're going to create a config file in the working - * directory, so lets make sure that there isn't one there already. + * Sanity check: We're going to create a config file in the working directory, so lets make sure that there + * isn't one there already. */ Path defaultConfigPath = FileSystems.getDefault().getPath(XmlConfigLoader.CONFIG_DEFAULT); if (Files.exists(defaultConfigPath)) @@ -58,17 +57,16 @@ public void loadFromDefaultPath() throws IOException { } /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files - * from an override path value. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly loads files from an override path value. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void loadFromOverridePath() throws IOException { /* - * Sanity check: We're going to set the config file system property, so - * let's make sure it doesn't already have a value. + * Sanity check: We're going to set the config file system property, so let's make sure it doesn't already have + * a value. */ if (System.getProperties().containsKey(XmlConfigLoader.CONFIG_PROP)) throw new IllegalStateException(); @@ -98,17 +96,16 @@ public void loadFromOverridePath() throws IOException { } /** - * Ensures that {@link XmlConfigLoader#getConfig()} correctly caches loaded - * files. - * + * Ensures that {@link XmlConfigLoader#getConfig()} correctly caches loaded files. + * * @throws IOException * (would indicate a problem with the test code itself) */ @Test public void caching() throws IOException { /* - * Sanity check: We're going to create a config file in the working - * directory, so lets make sure that there isn't one there already. + * Sanity check: We're going to create a config file in the working directory, so lets make sure that there + * isn't one there already. */ Path defaultConfigPath = FileSystems.getDefault().getPath(XmlConfigLoader.CONFIG_DEFAULT); if (Files.exists(defaultConfigPath)) diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/error/ErrorIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/error/ErrorIT.java index aba813d0..3bbba1bd 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/error/ErrorIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/error/ErrorIT.java @@ -10,8 +10,7 @@ import com.justdavis.karl.rpstourney.webapp.ITUtils; /** - * Integration tests for both {@link ErrorController} and - * error-*.jsp. + * Integration tests for both {@link ErrorController} and error-*.jsp. */ public final class ErrorIT { /** diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameControllerTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameControllerTest.java index 381bb6b5..d3477ea3 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameControllerTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameControllerTest.java @@ -34,7 +34,7 @@ public final class GameControllerTest { * Tests * {@link GameController#createNewGame(java.security.Principal, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)} * . - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -66,10 +66,8 @@ public GameView createGame() { } /** - * Tests - * {@link GameController#getGameAsHtml(String, java.security.Principal, java.util.Locale)} - * . - * + * Tests {@link GameController#getGameAsHtml(String, java.security.Principal, java.util.Locale)} . + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -88,8 +86,8 @@ public void getGame() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(GameController).build(); /* - * Run the mock tests against the controller. We'll check the status and - * then just spot-check a few model attributes. + * Run the mock tests against the controller. We'll check the status and then just spot-check a few model + * attributes. */ mockMvc.perform(MockMvcRequestBuilders.get("/game/" + game.getId())) .andExpect(MockMvcResultMatchers.status().isOk()) @@ -100,7 +98,7 @@ public void getGame() throws Exception { * Tests * {@link GameController#updateName(String, String, Principal, org.springframework.web.servlet.mvc.support.RedirectAttributes)} * . - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -120,8 +118,7 @@ public void updateName() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(gameController).build(); /* - * Run the mock tests against the controller, and verify that nothing - * goes boom. + * Run the mock tests against the controller, and verify that nothing goes boom. */ String gamePath = "/game/" + game.getId(); String updateNamePath = gamePath + "/updateName"; @@ -140,7 +137,7 @@ public void updateName() throws Exception { * Tests * {@link GameController#updateName(String, String, Principal, org.springframework.web.servlet.mvc.support.RedirectAttributes)} * to verify that it handles web service validation errors as expected. - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -160,8 +157,7 @@ public void updateNameValidation() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(gameController).build(); /* - * Run the mock tests against the controller, and verify that it - * generates a user-visible warning, as expected. + * Run the mock tests against the controller, and verify that it generates a user-visible warning, as expected. */ String gamePath = "/game/" + game.getId(); String updateNamePath = gamePath + "/updateName"; @@ -172,11 +168,10 @@ public void updateNameValidation() throws Exception { } /** - * Tests {@link GameController#getGameAsJson(String)}, when called before a - * game has started. This is a regression test case for - * Issue - * #110: Unable to retrieve game JSON before game starts: HTTP 500. - * + * Tests {@link GameController#getGameAsJson(String)}, when called before a game has started. This is a regression + * test case for Issue #110: Unable to retrieve game + * JSON before game starts: HTTP 500. + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -195,23 +190,23 @@ public void getGameJsonBeforeStart() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(GameController).build(); /* - * Run the mock tests against the controller. We'll check the status and - * then just spot-check a few model attributes. + * Run the mock tests against the controller. We'll check the status and then just spot-check a few model + * attributes. */ mockMvc.perform(MockMvcRequestBuilders.get("/game/" + game.getId() + "/data")) .andExpect(MockMvcResultMatchers.status().isOk()); } /** - * A mock {@link IAccountsResource} client implementation for use in - * {@link GameControllerTest#updateName()}, and other tests. + * A mock {@link IAccountsResource} client implementation for use in {@link GameControllerTest#updateName()}, and + * other tests. */ private static final class MockUpdatableAccountsClient extends MockAccountsClient { private Account account; /** * Constructs a new {@link MockUpdatableAccountsClient} instance. - * + * * @param account * the value to use for {@link #getAccount()} */ diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameIT.java index 0f2fa73a..7a2a5653 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/game/GameIT.java @@ -63,9 +63,9 @@ public void createNewGame() { } /** - * Tests {@link GameController} and {@link GameExceptionHandler} to ensure - * that {@link GameNotFoundException}s are converted to 404s. - * + * Tests {@link GameController} and {@link GameExceptionHandler} to ensure that {@link GameNotFoundException}s are + * converted to 404s. + * * @throws IOException * (indicates a test failure) */ @@ -83,8 +83,7 @@ public void gameNotFound404() throws IOException { } /** - * Uses {@link GameController} and {@link GameClient} to ensure that a game - * can be played via the web application. + * Uses {@link GameController} and {@link GameClient} to ensure that a game can be played via the web application. */ @Test public void playShortGame() { @@ -133,8 +132,7 @@ public void playShortGame() { } /** - * Exercises the web application to ensure that game can be played against - * an AI opponent. + * Exercises the web application to ensure that game can be played against an AI opponent. */ @Test public void playGameVsAi() { @@ -169,11 +167,9 @@ public void playGameVsAi() { aiThrowText.equals("Rock") || aiThrowText.equals("Paper") || aiThrowText.equals("Scissors")); /* - * Because the AI for Player 2 will just make random moves, we don't - * really want to try and play to the end of the game-- no point. - * The web service ITs verify that AI games will play all the way to - * the end. We just want to ensure they at least start correctly in - * the web interface. + * Because the AI for Player 2 will just make random moves, we don't really want to try and play to the end + * of the game-- no point. The web service ITs verify that AI games will play all the way to the end. We + * just want to ensure they at least start correctly in the web interface. */ } finally { if (player1Driver != null) @@ -182,8 +178,7 @@ public void playGameVsAi() { } /** - * Uses {@link GameController} and {@link GameClient} to ensure that players - * can change their names. + * Uses {@link GameController} and {@link GameClient} to ensure that players can change their names. */ @Test public void updateName() { @@ -224,8 +219,7 @@ public void updateName() { .invisibilityOf(driver.findElement(By.xpath("//form[contains(@class, 'player-name')]")))); /* - * Player 2 (webapp): Activate the name editor, check the controls' - * state. + * Player 2 (webapp): Activate the name editor, check the controls' state. */ driver.findElement(By.cssSelector("#player-first .player-name")).click(); Assert.assertTrue(driver.findElement(By.xpath("//form[contains(@class, 'player-name')]")).isDisplayed()); @@ -238,9 +232,8 @@ public void updateName() { // Player 2 (webapp): Check Player 2's name. /* - * FIXME Broken due to apparent HtmlUnit bug, where clicking in a - * form causes a spurious onblur event to be fired first. See - * 2018-02-01 email to the htmlunit-user mailing list for details. + * FIXME Broken due to apparent HtmlUnit bug, where clicking in a form causes a spurious onblur event to be + * fired first. See 2018-02-01 email to the htmlunit-user mailing list for details. */ // wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("#player-first.player-name"), // "bar (You)")); @@ -251,8 +244,7 @@ public void updateName() { } /** - * Ensures that the game behaves correctly if the user attempts to set the - * number of rounds to an invalid value. + * Ensures that the game behaves correctly if the user attempts to set the number of rounds to an invalid value. */ @Test public void setMaxRoundsToInvalidValue() { @@ -282,8 +274,7 @@ public void setMaxRoundsToInvalidValue() { } /** - * Ensures that the throw controls are hidden before a game starts and - * displayed once it does. + * Ensures that the throw controls are hidden before a game starts and displayed once it does. */ @Test public void hideThrowsBeforeStart() { @@ -328,8 +319,7 @@ public void hideThrowsBeforeStart() { } /** - * Ensures that the game behaves correctly if the user attempts to submit - * more than one throw for the same round. + * Ensures that the game behaves correctly if the user attempts to submit more than one throw for the same round. */ @Test public void submitThrowTwiceInSameRound() { @@ -371,8 +361,7 @@ public void submitThrowTwiceInSameRound() { } /** - * Verifies that the web application updates the display of in-progress - * games via background AJAX refreshes. + * Verifies that the web application updates the display of in-progress games via background AJAX refreshes. */ @Test public void ajaxRefresh() { @@ -434,8 +423,8 @@ public void ajaxRefresh() { wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(".player-throws"))); } catch (TimeoutException e) { /* - * If one of these are thrown, the page has the wrong state. We need - * to log the page state to help debug the problem. + * If one of these are thrown, the page has the wrong state. We need to log the page state to help debug the + * problem. */ throw new TimeoutException("Test case failed. Current page source:\n" + driver.getPageSource(), e); } finally { @@ -446,12 +435,10 @@ public void ajaxRefresh() { /** *

    - * Ensures that games display the correct round count, with and without - * JavaScript. + * Ensures that games display the correct round count, with and without JavaScript. *

    *

    - * This is a regression test case for - * Issue #53: + * This is a regression test case for Issue #53: * Current round counter is very goofy.. *

    */ @@ -481,8 +468,7 @@ public void currentRoundCounterCorrectness() { player2Driver.get(ITUtils.buildWebAppUrl("game/" + gameId)); /* - * Play through a three-round game, checking the round counts for - * both players at every step. + * Play through a three-round game, checking the round counts for both players at every step. */ player1Wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("round-counter-current"), "1")); Assert.assertEquals("1", getRoundCounterCurrent(player2Driver)); @@ -523,8 +509,7 @@ public void currentRoundCounterCorrectness() { * Ensures that the JavaScript correctly creates the max round controls. *

    *

    - * This is a regression test case for - * Issue #73: + * This is a regression test case for Issue #73: * Webapp 404s when setting max rounds. *

    */ @@ -555,9 +540,8 @@ public void joinGameAndAlterRounds() { player2Driver.findElement(By.id("join-game")).click(); /* - * Player 1: Wait for player 2's status to refresh. All this wait is - * really needed for is to delay adjusting the rounds until at least - * one JS update cycle has completed. + * Player 1: Wait for player 2's status to refresh. All this wait is really needed for is to delay adjusting + * the rounds until at least one JS update cycle has completed. */ player1Wait.until(ExpectedConditions.not(ExpectedConditions .textToBePresentInElementLocated(By.cssSelector("div#player-second .player-name"), "Waiting"))); @@ -588,18 +572,16 @@ public void joinGameAndAlterRounds() { } /** - * Ensures that the web application correctly returns the game state as - * JSON. - * + * Ensures that the web application correctly returns the game state as JSON. + * * @throws IOException - * (will be passed through if it occurs, indicating a test - * error) + * (will be passed through if it occurs, indicating a test error) */ @Test public void jsonGameData() throws IOException { /* - * Use two Selenium players to play through the game a bit, so that the - * game state is "interesting" enough to test. + * Use two Selenium players to play through the game a bit, so that the game state is "interesting" enough to + * test. */ WebDriver player1Driver = null; WebDriver player2Driver = null; @@ -629,8 +611,7 @@ public void jsonGameData() throws IOException { } /* - * Now, pull the game state as JSON data and verify that it looks - * correct. + * Now, pull the game state as JSON data and verify that it looks correct. */ URL gameDataUrl = new URL(ITUtils.buildWebAppUrl("game/" + gameId + "/data")); InputStream gameDataStream = null; @@ -653,11 +634,9 @@ public void jsonGameData() throws IOException { } /** - * A regression test case for - * Issue #78: - * "You Won" / "You Lost" display wrong: a 3 to 1 win reports "You Lost" - * . Verifies that the AJAXy win/loss display is correct when your opponent - * makes the final move and loses. + * A regression test case for Issue #78: "You Won" / + * "You Lost" display wrong: a 3 to 1 win reports "You Lost" . Verifies that the AJAXy win/loss display is + * correct when your opponent makes the final move and loses. */ @Test public void ajaxOpponentLoses() { @@ -697,12 +676,10 @@ public void ajaxOpponentLoses() { /** *

    - * Verifies that the AJAXy round history updates are rendered correctly for - * non-players. + * Verifies that the AJAXy round history updates are rendered correctly for non-players. *

    *

    - * This is also a regression test case for - * Issue #79: + * This is also a regression test case for Issue #79: * Round history table updates goofily: rows out of order. *

    */ @@ -764,8 +741,8 @@ public void ajaxObserver() { .textToBePresentInElementLocated(By.xpath("//table[@id='rounds']/tbody/tr[5]/td[4]"), "player2")); } catch (TimeoutException e) { /* - * If one of these are thrown, the page has the wrong state. We need - * to log the page state to help debug the problem. + * If one of these are thrown, the page has the wrong state. We need to log the page state to help debug the + * problem. */ throw new TimeoutException("Test case failed. Current page source:\n" + observerDriver.getPageSource(), e); } finally { @@ -777,8 +754,8 @@ public void ajaxObserver() { /** * @param driver * the {@link WebDriver} to use - * @return the value of the #round-counter-current element on - * the specified {@link WebDriver}'s current page + * @return the value of the #round-counter-current element on the specified {@link WebDriver}'s current + * page */ private String getRoundCounterCurrent(WebDriver driver) { return driver.findElement(By.id("round-counter-current")).getText(); diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeControllerTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeControllerTest.java index b8ff8230..2ec44452 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeControllerTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeControllerTest.java @@ -26,7 +26,7 @@ public final class HomeControllerTest { /** * Tests the {@link HomeController#getHomePage()} response. - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -42,18 +42,17 @@ public void getHomePage() throws Exception { } /** - * Tests {@link HomeController#getHomePage()} to ensure its model properly - * includes the results of {@link IGameResource#getGamesForPlayer()}. - * + * Tests {@link HomeController#getHomePage()} to ensure its model properly includes the results of + * {@link IGameResource#getGamesForPlayer()}. + * * @throws Exception * (all of the MVC test methods declare this exception) */ @Test public void getGamesForPlayer() throws Exception { /* - * Build the mocks needed for the test. Add an artificial delay between - * creating the two games, to ensure they end up with different - * timestamps. + * Build the mocks needed for the test. Add an artificial delay between creating the two games, to ensure they + * end up with different timestamps. */ Player player1 = new Player(new Account()); Player player2 = new Player(new Account()); @@ -75,8 +74,7 @@ public void getGamesForPlayer() throws Exception { @Override public boolean matches(Object item) { /* - * Note the order of the games here: games updated last should - * now be first in the model's list. + * Note the order of the games here: games updated last should now be first in the model's list. */ return Arrays.asList(gameViewB, gameViewA).equals(item); } diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeIT.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeIT.java index 964d703f..3c262774 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeIT.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/home/HomeIT.java @@ -32,8 +32,7 @@ public void home_unauthenticated() { } /** - * Tests {@link HomeController#getHomePage()} for an authenticated user that - * has at least one game to be displayed. + * Tests {@link HomeController#getHomePage()} for an authenticated user that has at least one game to be displayed. */ @Test public void home_withGame() { @@ -56,13 +55,10 @@ public void home_withGame() { } /** - * Ensures that the home page doesn't throw errors when it displays a game - * at the {@link State#WAITING_FOR_FIRST_THROW} step. This is a regression - * test case for - * Error on - * home page after new game has been joined: - * "No message found under code 'home.games.game.state.WAITING_FOR_FIRST_THROW'..." - * . + * Ensures that the home page doesn't throw errors when it displays a game at the + * {@link State#WAITING_FOR_FIRST_THROW} step. This is a regression test case for + * Error on home page after new game has been joined: + * "No message found under code 'home.games.game.state.WAITING_FOR_FIRST_THROW'..." . */ @Test public void home_withGameBeforeFirstThrow() { diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/info/InfoControllerTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/info/InfoControllerTest.java index 66b6d1d1..0cf00f13 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/info/InfoControllerTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/info/InfoControllerTest.java @@ -13,7 +13,7 @@ public final class InfoControllerTest { /** * Tests the {@link InfoController#ping()} response. - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ @@ -31,7 +31,7 @@ public void ping() throws Exception { /** * Tests the {@link InfoController#getAppInfo()} response. - * + * * @throws Exception * (all of the MVC test methods declare this exception) */ diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTagTest.java index f7a3c76b..6e578553 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/AccountNameTagTest.java @@ -23,7 +23,7 @@ public class AccountNameTagTest { /** * Tests usage of {@link AccountNameTag} when the user is not authenticated. - * + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -53,9 +53,8 @@ public void withUnauthenticatedUser() throws JspException, IOException { } /** - * Tests usage of {@link AccountNameTag} when the user is authenticated but - * has no name. - * + * Tests usage of {@link AccountNameTag} when the user is authenticated but has no name. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -94,9 +93,8 @@ public Account getAccount() { } /** - * Tests usage of {@link AccountNameTag} when the user is authenticated and - * has a name. - * + * Tests usage of {@link AccountNameTag} when the user is authenticated and has a name. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTagTest.java index 7816bf6d..d09b517e 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameOpponentTagTest.java @@ -23,9 +23,8 @@ */ public class GameOpponentTagTest { /** - * Tests usage of {@link GameOpponentTag} when an opponent can be found, and - * that opponent has a name. - * + * Tests usage of {@link GameOpponentTag} when an opponent can be found, and that opponent has a name. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -58,9 +57,8 @@ public void withOpponentThatHasAName() throws JspException, IOException { } /** - * Tests usage of {@link GameOpponentTag} when the opponent hasn't yet - * joined. - * + * Tests usage of {@link GameOpponentTag} when the opponent hasn't yet joined. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -90,9 +88,8 @@ public void withNullOpponent() throws JspException, IOException { } /** - * Tests usage of {@link GameOpponentTag} when the opponent is a - * {@link BuiltInAi}. - * + * Tests usage of {@link GameOpponentTag} when the opponent is a {@link BuiltInAi}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTagTest.java index 263b21b2..ce4692ea 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/GameTitleTagTest.java @@ -22,9 +22,9 @@ */ public class GameTitleTagTest { /** - * Tests usage of {@link GameTitleTag} when {@link GameView#getPlayer1()} is - * the current user and {@link GameView#getPlayer2()} is null. - * + * Tests usage of {@link GameTitleTag} when {@link GameView#getPlayer1()} is the current user and + * {@link GameView#getPlayer2()} is null. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -57,10 +57,9 @@ public void withPlayer1AsUserAndPlayer2AsNull() throws JspException, IOException } /** - * Tests usage of {@link GameTitleTag} when {@link GameView#getPlayer1()} - * exists but has no name and {@link GameView#getPlayer2()} is the current - * user. - * + * Tests usage of {@link GameTitleTag} when {@link GameView#getPlayer1()} exists but has no name and + * {@link GameView#getPlayer2()} is the current user. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -93,9 +92,9 @@ public void withPlayer1AnonAndPlayer2AsUser() throws JspException, IOException { } /** - * Tests usage of {@link GameTitleTag} when both {@link Player}s have a - * display name, and neither are the current user. - * + * Tests usage of {@link GameTitleTag} when both {@link Player}s have a display name, and neither are the current + * user. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -129,9 +128,8 @@ public void withOtherNamedPlayers() throws JspException, IOException { } /** - * Tests usage of {@link GameTitleTag} when it's set to just output to a - * variable. - * + * Tests usage of {@link GameTitleTag} when it's set to just output to a variable. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockJspWriter.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockJspWriter.java index d2eb34f3..492b52a6 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockJspWriter.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockJspWriter.java @@ -226,4 +226,4 @@ public int getRemaining() { public void write(char[] cbuf, int off, int len) throws IOException { output.append(cbuf, off, len); } -} \ No newline at end of file +} diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockPageContext.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockPageContext.java index 946cd06b..96133515 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockPageContext.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/MockPageContext.java @@ -34,7 +34,7 @@ final class MockPageContext extends PageContext { /** * Constructs a new {@link MockPageContext} instance. - * + * * @param jspWriter * the {@link JspWriter} to return for calls to {@link #getOut()} */ @@ -44,12 +44,11 @@ public MockPageContext(JspWriter jspWriter) { /** * Constructs a new {@link MockPageContext} instance. - * + * * @param jspWriter * the {@link JspWriter} to return for calls to {@link #getOut()} * @param servletContext - * the {@link ServletContext} to return for calls to - * {@link #getServletContext()} + * the {@link ServletContext} to return for calls to {@link #getServletContext()} */ public MockPageContext(JspWriter jspWriter, ServletContext servletContext) { this.jspWriter = jspWriter; @@ -58,8 +57,7 @@ public MockPageContext(JspWriter jspWriter, ServletContext servletContext) { } /** - * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, - * java.lang.Object) + * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, java.lang.Object) */ @Override public void setAttribute(String name, Object value) { @@ -67,8 +65,7 @@ public void setAttribute(String name, Object value) { } /** - * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, - * java.lang.Object, int) + * @see javax.servlet.jsp.JspContext#setAttribute(java.lang.String, java.lang.Object, int) */ @Override public void setAttribute(String name, Object value, int scope) { @@ -164,14 +161,13 @@ public ELContext getELContext() { } /** - * @see javax.servlet.jsp.PageContext#initialize(javax.servlet.Servlet, - * javax.servlet.ServletRequest, javax.servlet.ServletResponse, - * java.lang.String, boolean, int, boolean) + * @see javax.servlet.jsp.PageContext#initialize(javax.servlet.Servlet, javax.servlet.ServletRequest, + * javax.servlet.ServletResponse, java.lang.String, boolean, int, boolean) */ @Override public void initialize(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) - throws IOException, IllegalStateException, IllegalArgumentException { + throws IOException, IllegalStateException, IllegalArgumentException { throw new UnsupportedOperationException(); } @@ -280,8 +276,7 @@ public void handlePageException(Throwable t) throws ServletException, IOExceptio } /** - * A mock {@link ELContext} implementation for use with - * {@link MockPageContext}. + * A mock {@link ELContext} implementation for use with {@link MockPageContext}. */ private static final class MockELContext extends ELContext { /** @@ -308,4 +303,4 @@ public VariableMapper getVariableMapper() { throw new UnsupportedOperationException(); } } -} \ No newline at end of file +} diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTagTest.java index 1bcc8c69..991acd5d 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/PlayerNameTagTest.java @@ -24,9 +24,9 @@ */ public class PlayerNameTagTest { /** - * Tests usage of {@link PlayerNameTag} when the {@link Player} has no name, - * is set as {@link GameView#getPlayer1()}, and is the current user. - * + * Tests usage of {@link PlayerNameTag} when the {@link Player} has no name, is set as + * {@link GameView#getPlayer1()}, and is the current user. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -57,10 +57,9 @@ public void withNoNameAsPlayer1AndAsUser() throws JspException, IOException { } /** - * Tests usage of {@link PlayerNameTag} when the {@link Player} has a name - * and is set as both {@link GameView#getPlayer1()} - * {@link GameView#getPlayer2()}. - * + * Tests usage of {@link PlayerNameTag} when the {@link Player} has a name and is set as both + * {@link GameView#getPlayer1()} {@link GameView#getPlayer2()}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -93,9 +92,9 @@ public void withNameAsPlayer1AndPlayer2() throws JspException, IOException { } /** - * Tests usage of {@link PlayerNameTag} when it's set to render out as a - * not-yet-joined {@link GameView#getPlayer2()}. - * + * Tests usage of {@link PlayerNameTag} when it's set to render out as a not-yet-joined + * {@link GameView#getPlayer2()}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -125,9 +124,9 @@ public void withNullPlayer2() throws JspException, IOException { } /** - * Tests usage of {@link PlayerNameTag} when it's set to render out as a - * {@link GameView#getPlayer2()} that is a {@link BuiltInAi}. - * + * Tests usage of {@link PlayerNameTag} when it's set to render out as a {@link GameView#getPlayer2()} that is a + * {@link BuiltInAi}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTagTest.java index 9c0edafb..c68a907a 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/RoundResultTagTest.java @@ -25,9 +25,8 @@ */ public class RoundResultTagTest { /** - * Tests usage of {@link RoundResultTag} when the current user won the - * {@link GameRound}. - * + * Tests usage of {@link RoundResultTag} when the current user won the {@link GameRound}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException @@ -65,9 +64,9 @@ public void withUserAsWinner() throws JspException, IOException { } /** - * Tests usage of {@link RoundResultTag} when the current user is just an - * observer and {@link GameRound#getResult()} is {@link Result#TIED}. - * + * Tests usage of {@link RoundResultTag} when the current user is just an observer and {@link GameRound#getResult()} + * is {@link Result#TIED}. + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTagTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTagTest.java index c190e9f4..d06fa608 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTagTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/jsp/TemporalFormatTagTest.java @@ -14,7 +14,7 @@ public class TemporalFormatTagTest { /** * Tests normal usage of {@link TemporalFormatTag}. - * + * * @throws IOException * (indicates a problem with the test setup) * @throws JspException diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/CustomerRememberMeServicesTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/CustomerRememberMeServicesTest.java index f8cb0b86..7ff9d206 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/CustomerRememberMeServicesTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/CustomerRememberMeServicesTest.java @@ -34,10 +34,9 @@ */ public final class CustomerRememberMeServicesTest { /** - * Tests - * {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} - * on requests with no authentication token. - * + * Tests {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} on requests with no + * authentication token. + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) */ @@ -57,10 +56,9 @@ public void autoLogin_noToken() throws MalformedURLException { } /** - * Tests - * {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} - * on requests with an empty authentication token. - * + * Tests {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} on requests with an + * empty authentication token. + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) */ @@ -81,10 +79,9 @@ public void autoLogin_emptyToken() throws MalformedURLException { } /** - * Tests - * {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} - * on requests with an invalid authentication token. - * + * Tests {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} on requests with an + * invalid authentication token. + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) */ @@ -114,10 +111,9 @@ public Account validateAuth() { } /** - * Tests - * {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} - * on requests with a valid authentication token. - * + * Tests {@link CustomRememberMeServices#autoLogin(HttpServletRequest, HttpServletResponse)} on requests with a + * valid authentication token. + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) */ @@ -149,10 +145,9 @@ public Account validateAuth() { } /** - * Tests that - * {@link CustomRememberMeServices#loginSuccess(HttpServletRequest, HttpServletResponse, Authentication)} + * Tests that {@link CustomRememberMeServices#loginSuccess(HttpServletRequest, HttpServletResponse, Authentication)} * saves an authentication cookie as expected. - * + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) * @throws URISyntaxException @@ -192,7 +187,7 @@ public void loginSuccess() throws MalformedURLException, URISyntaxException { private static class MockAccountsClient extends AccountsClient { /** * Constructs a new {@link MockAccountsClient} instance. - * + * * @param cookieStore * the {@link CookieStore} to use */ diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManagerTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManagerTest.java index 5e7abd11..cae40799 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManagerTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/DefaultGuestLoginManagerTest.java @@ -22,9 +22,8 @@ */ public final class DefaultGuestLoginManagerTest { /** - * Verifies that - * {@link DefaultGuestLoginManager#loginClientAsGuest(HttpServletRequest, HttpServletResponse)} - * works as expected. + * Verifies that {@link DefaultGuestLoginManager#loginClientAsGuest(HttpServletRequest, HttpServletResponse)} works + * as expected. */ @Test public void loginClientAsGuest() { @@ -48,9 +47,8 @@ public void loginClientAsGuest() { } /** - * Verifies that - * {@link DefaultGuestLoginManager#loginClientAsGuest(HttpServletRequest, HttpServletResponse)} - * fails as expected when called for an already-authenticated request. + * Verifies that {@link DefaultGuestLoginManager#loginClientAsGuest(HttpServletRequest, HttpServletResponse)} fails + * as expected when called for an already-authenticated request. */ @Test(expected = BadCodeMonkeyException.class) public void loginClientAsGuest_alreadyAuhenticated() { @@ -72,15 +70,14 @@ public void loginClientAsGuest_alreadyAuhenticated() { } /** - * A mock {@link SecurityContextHolderStrategy} implementation for use in - * tests. + * A mock {@link SecurityContextHolderStrategy} implementation for use in tests. */ private static final class MockSecurityContextHolderStrategy implements SecurityContextHolderStrategy { private final SecurityContext securityContext; /** * Constructs a new {@link MockSecurityContextHolderStrategy} instance. - * + * * @param securityContext * the value to use for {@link #getContext()} */ @@ -129,7 +126,7 @@ private final class MockGuestAuthClient implements IGuestAuthResource { /** * Constructs a new {@link MockGuestAuthClient} instance. - * + * * @param loginResult * the vaue to return for {@link #loginAsGuest()} */ @@ -172,8 +169,7 @@ public void loginFail(HttpServletRequest request, HttpServletResponse response) /** * @see org.springframework.security.web.authentication.RememberMeServices#loginSuccess(javax.servlet.http.HttpServletRequest, - * javax.servlet.http.HttpServletResponse, - * org.springframework.security.core.Authentication) + * javax.servlet.http.HttpServletResponse, org.springframework.security.core.Authentication) */ @Override public void loginSuccess(HttpServletRequest request, HttpServletResponse response, diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProviderTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProviderTest.java index 3f1eb99c..4b08d20f 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProviderTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginAuthenticationProviderTest.java @@ -20,9 +20,8 @@ */ public final class GameLoginAuthenticationProviderTest { /** - * Tests - * {@link GameLoginAuthenticationProvider#authenticate(Authentication)} when - * presented with invalid credentials. + * Tests {@link GameLoginAuthenticationProvider#authenticate(Authentication)} when presented with invalid + * credentials. */ @Test(expected = BadCredentialsException.class) public void authenticate_failedLogin() { @@ -37,9 +36,7 @@ public void authenticate_failedLogin() { } /** - * Tests - * {@link GameLoginAuthenticationProvider#authenticate(Authentication)} when - * presented with valid credentials. + * Tests {@link GameLoginAuthenticationProvider#authenticate(Authentication)} when presented with valid credentials. */ @Test public void authenticate_successfulLogin() { @@ -72,19 +69,18 @@ public void supports() { } /** - * A mock client-side implementation of {@link IGameAuthResource}, for use - * in tests. + * A mock client-side implementation of {@link IGameAuthResource}, for use in tests. */ private static final class MockGameAuthClient implements IGameAuthResource { private final Account accountToLogin; /** * Constructs a new {@link MockGameAuthClient} instance. - * + * * @param accountToLogin * the {@link Account} to return from all calls to - * {@link #loginWithGameAccount(InternetAddress, String)}, or - * null if all logins should fail + * {@link #loginWithGameAccount(InternetAddress, String)}, or null if all logins should + * fail */ public MockGameAuthClient(Account accountToLogin) { this.accountToLogin = accountToLogin; diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandlerTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandlerTest.java index 7a37db13..78e462de 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandlerTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/security/GameLoginSuccessHandlerTest.java @@ -32,9 +32,8 @@ */ public final class GameLoginSuccessHandlerTest { /** - * Tests {@link GameLoginSuccessHandler} as if the login event was for a - * user that was not already authenticated. - * + * Tests {@link GameLoginSuccessHandler} as if the login event was for a user that was not already authenticated. + * * @throws ServletException * (shouldn't happen, but indicates test failure if it does) * @throws IOException @@ -61,9 +60,9 @@ public void handleWithNoPreviousLogin() throws URISyntaxException, IOException, } /** - * Tests {@link GameLoginSuccessHandler} as if the login event was for a - * user that was already authenticated to an Account that was not anonymous. - * + * Tests {@link GameLoginSuccessHandler} as if the login event was for a user that was already authenticated to an + * Account that was not anonymous. + * * @throws ServletException * (shouldn't happen, but indicates test failure if it does) * @throws IOException @@ -104,9 +103,9 @@ public void handleWithPreviousNonAnonLogin() } /** - * Tests {@link GameLoginSuccessHandler} as if the login event was for a - * user that was already authenticated to an Account that was anonymous. - * + * Tests {@link GameLoginSuccessHandler} as if the login event was for a user that was already authenticated to an + * Account that was anonymous. + * * @throws ServletException * (shouldn't happen, but indicates test failure if it does) * @throws IOException @@ -159,8 +158,7 @@ public void handleWithPreviousAnonLogin() } /** - * A mock {@link IAccountsResource} client for use in - * {@link GameLoginSuccessHandlerTest}. + * A mock {@link IAccountsResource} client for use in {@link GameLoginSuccessHandlerTest}. */ private static final class CustomMockAccountsClient extends MockAccountsClient { private final Account account; @@ -169,7 +167,7 @@ private static final class CustomMockAccountsClient extends MockAccountsClient { /** * Constructor. - * + * * @param account * the mock {@link Account} that will be used */ @@ -201,8 +199,7 @@ public AuthToken selectOrCreateAuthToken() { } /** - * @see com.justdavis.karl.rpstourney.service.api.auth.MockAccountsClient#mergeAccount(long, - * java.util.UUID) + * @see com.justdavis.karl.rpstourney.service.api.auth.MockAccountsClient#mergeAccount(long, java.util.UUID) */ @Override public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) { @@ -211,18 +208,16 @@ public void mergeAccount(long targetAccountId, UUID sourceAccountAuthTokenValue) } /** - * @return the targetAccountId value that was passed to - * {@link #mergeAccount(long, UUID)}, or null if it - * has not been called + * @return the targetAccountId value that was passed to {@link #mergeAccount(long, UUID)}, or + * null if it has not been called */ public Long getMergeTargetAccountId() { return mergeTargetAccountId; } /** - * @return the sourceAccountAuthTokenValue value that was - * passed to {@link #mergeAccount(long, UUID)}, or - * null if it has not been called + * @return the sourceAccountAuthTokenValue value that was passed to + * {@link #mergeAccount(long, UUID)}, or null if it has not been called */ public UUID getMergeSourceAccountAuthTokenValue() { return mergeSourceAccountAuthTokenValue; @@ -230,18 +225,16 @@ public UUID getMergeSourceAccountAuthTokenValue() { } /** - * An {@link IAccountsClientFactory} implementation that produces - * {@link CustomMockAccountsClient} instances. + * An {@link IAccountsClientFactory} implementation that produces {@link CustomMockAccountsClient} instances. */ private static final class CustomMockAccountsClientFactory implements IAccountsClientFactory { private final Account account; /** * Constructs a new {@link CustomMockAccountsClientFactory} instance. - * + * * @param account - * the mock {@link Account} that will be used in the - * {@link CustomMockAccountsClient} instances + * the mock {@link Account} that will be used in the {@link CustomMockAccountsClient} instances */ public CustomMockAccountsClientFactory(Account account) { this.account = account; diff --git a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtilsTest.java b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtilsTest.java index 7058f1fc..6e912f7c 100644 --- a/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtilsTest.java +++ b/rps-tourney-webapp/src/test/java/com/justdavis/karl/rpstourney/webapp/util/CookiesUtilsTest.java @@ -50,9 +50,8 @@ public void cancelCookie() { } /** - * Tests - * {@link CookiesUtils#applyCookieSecurityProperties(Cookie, AppConfig)}. - * + * Tests {@link CookiesUtils#applyCookieSecurityProperties(Cookie, AppConfig)}. + * * @throws MalformedURLException * (won't occur, as {@link URL}s are hardcoded) */ diff --git a/rps-tourney-webapp/src/test/resources/logback-cargo.xml b/rps-tourney-webapp/src/test/resources/logback-cargo.xml index 9f5f913c..c5f62e64 100644 --- a/rps-tourney-webapp/src/test/resources/logback-cargo.xml +++ b/rps-tourney-webapp/src/test/resources/logback-cargo.xml @@ -7,34 +7,24 @@ ${project.build.directory}/failsafe-reports/cargo-logback-output.log true true - + %date{ISO8601} [%thread] %-5level %logger{36} - %msg%n
    - - + + - - - + + + - - + +