diff --git a/.env b/.env index bbb7c1655..40afbfcbb 100644 --- a/.env +++ b/.env @@ -1,8 +1,8 @@ VERSION=3.1 -TOMCAT_DOCKER_VERSION=8-jre8-openjdk -DB_VERSION=10.6.11 -MONGODB_VERSION=4.1.13 +TOMCAT_DOCKER_VERSION=8.5-jre11 +DB_VERSION=10.6 +MONGODB_VERSION=4.4 IMAGE_TOMCAT=owasp/security-shepherd IMAGE_MARIADB=owasp/security-shepherd_mariadb @@ -36,6 +36,6 @@ HTTPS_PORT=443 DOCKER_NETWORK_NAME=securityshepherd_default -TEST_MYSQL_HOST=127.0.0.1 -TEST_MYSQL_PORT=3306 -TEST_MYSQL_PASSWORD=password +TEST_MARIADB_HOST=127.0.0.1 +TEST_MARIADB_PORT=3306 +TEST_MARIADB_PASSWORD=password diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 559c499e1..98e0bca65 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,11 +20,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v3.6.0 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '8' + java-version: '11' - name: Build Maven with Docker Profile and Generate SBOM run: mvn clean install -Pdocker -DskipTests -B -DexcludeTestProject=true cyclonedx:makeBom - name: Upload WAR File @@ -80,14 +80,14 @@ jobs: uses: actions/checkout@v2 - name: Log in to Docker Hub - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4.1.1 + uses: docker/metadata-action@v4 with: images: owasp/security-shepherd @@ -107,7 +107,7 @@ jobs: env-file: .env - name: Build and push Tomcat - uses: docker/build-push-action@v3.2.0 + uses: docker/build-push-action@v3 with: context: . push: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08bc43eba..a873aa079 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: lint-java: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.2.0 - uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a #v3.6.0 with: args: "--set-exit-if-changed" @@ -35,11 +35,12 @@ jobs: name: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - uses: actions/checkout@v3.2.0 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: - java-version: 1.8 + distribution: 'zulu' + java-version: '11' - name: Build Maven with Docker Profile run: mvn clean install -Pdocker -DskipTests -B - name: Docker Compose Build @@ -49,57 +50,75 @@ jobs: needs: [lint-java, build] runs-on: ubuntu-latest services: - mysql: - image: mysql:5.7 + mariadb: + image: mariadb:10.6 env: - MYSQL_ROOT_PASSWORD: password - MYSQL_DATABASE: core + MARIADB_ROOT_PASSWORD: password + MARIADB_DATABASE: core ports: - '8888:3306' options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - uses: actions/checkout@v3.2.0 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: - java-version: 1.8 - - name: Start MYSQL Server + distribution: 'zulu' + java-version: '11' + - name: Start MariaDB Server run: sudo /etc/init.d/mysql start - - name: Modify MySQL Connection Variables + - name: Modify MyMariaDBSQL Connection Variables run: | sed -i "s/'@'localhost'/'@'%'/g" ${GITHUB_WORKSPACE}/src/main/resources/database/moduleSchemas.sql - sed -i 's/TEST_MYSQL_PORT=3306/TEST_MYSQL_PORT=8888/g' ${GITHUB_WORKSPACE}/.env + sed -i 's/TEST_MARIADB_PORT=3306/TEST_MARIADB_PORT=8888/g' ${GITHUB_WORKSPACE}/.env - name: Run Unit Tests run: mvn test -B -e -X + - name: Upload unit test reports + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: failsafe-reports + path: | + target/surefire-reports/*.txt + target/surefire-reports/*.xml integration-tests: needs: [lint-java, build] runs-on: ubuntu-latest services: - mysql: - image: mysql:5.7 + mariadb: + image: mariadb:10.6 env: - MYSQL_ROOT_PASSWORD: password - MYSQL_DATABASE: core + MARIADB_ROOT_PASSWORD: password + MARIADB_DATABASE: core ports: - '8888:3306' options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - uses: actions/checkout@v3.2.0 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: - java-version: 1.8 - - name: Start MYSQL Server + distribution: 'zulu' + java-version: '11' + - name: Start MARIADB Server run: sudo /etc/init.d/mysql start - - name: Modify MySQL Connection Variables + - name: Modify MARIADB Connection Variables run: | sed -i "s/'@'localhost'/'@'%'/g" ${GITHUB_WORKSPACE}/src/main/resources/database/moduleSchemas.sql - sed -i 's/TEST_MYSQL_PORT=3306/TEST_MYSQL_PORT=8888/g' ${GITHUB_WORKSPACE}/.env - - name: Prepare Intergration Tests + sed -i 's/TEST_MARIADB_PORT=3306/TEST_MARIADB_PORT=8888/g' ${GITHUB_WORKSPACE}/.env + - name: Prepare Integration Tests run: | sudo apt-get -y install libargon2-0 mvn -Pdocker validate - name: Run Intergration Tests run: | mvn verify -DskipUTs=true -DmongoDocker -B + - name: Upload integration test reports + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: failsafe-reports + path: | + target/failsafe-reports/*.txt + target/failsafe-reports/*.xml diff --git a/docker/mongo/Dockerfile b/docker/mongo/Dockerfile index f642e67f6..155d5c07d 100644 --- a/docker/mongo/Dockerfile +++ b/docker/mongo/Dockerfile @@ -26,17 +26,15 @@ RUN { \ FROM mongo:${MONGODB_VERSION} COPY --from=builder /workdir/moduleSchemas.js /docker-entrypoint-initdb.d/ - -ENV RUN_USER mongodb -ENV RUN_GROUP mongodb - COPY --from=builder /workdir/mongod.conf /etc/mongod.conf -RUN chown -R ${RUN_USER}:${RUN_GROUP} "/etc/mongod.conf" -RUN chown -R ${RUN_USER}:${RUN_GROUP} "/docker-entrypoint-initdb.d" +ENV RUN_USER mongodb -USER ${RUN_USER} +USER root RUN sed -i 's/\/\/REMOVE/ /g' /docker-entrypoint-initdb.d/moduleSchemas.js +RUN chown -R ${RUN_USER}:${RUN_USER} /etc/mongod.conf +RUN chown -R ${RUN_USER}:${RUN_USER} /docker-entrypoint-initdb.d/moduleSchemas.js +USER ${RUN_USER} ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/pom.xml b/pom.xml index d9052ee3e..c86051dca 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ org.mariadb.jdbc mariadb-java-client - 3.0.6 + 3.1.0 @@ -120,7 +120,7 @@ org.springframework spring-web - 5.3.23 + 6.0.2 test @@ -136,7 +136,7 @@ org.springframework spring-core - 5.3.22 + 6.0.2 test @@ -166,7 +166,7 @@ org.junit.jupiter junit-jupiter-api - 5.9.0 + 5.9.1 test @@ -197,7 +197,7 @@ org.mockito mockito-core - 4.8.0 + 4.9.0 @@ -345,19 +345,22 @@ - mongo:${MONGODB_VERSION} + mongo_shepherd:${MONGODB_VERSION} ${project.basedir}/docker/mongo/Dockerfile + + + 27017:27017 - - - waiting for connections on port 27017 - - + + + + + @@ -442,7 +445,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + 2.6 ${skipUTs} @@ -453,12 +456,18 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.22.2 + 2.6 + true ${skipTests} ${skipITs} + + + + + - **/*Test* + **/test/*Test* diff --git a/src/test/java/dbProcs/GetterTest.java b/src/test/java/dbProcs/GetterTest.java index 280a6444d..1d5404ea5 100644 --- a/src/test/java/dbProcs/GetterTest.java +++ b/src/test/java/dbProcs/GetterTest.java @@ -30,9 +30,9 @@ public class GetterTest { private static final Logger log = LogManager.getLogger(GetterTest.class); - private static String lang = new String("en_GB"); - private static Locale locale = new Locale(lang); - private static String applicationRoot = new String(); + private static final String lang = "en_GB"; + private static final Locale locale = new Locale(lang); + private static final String applicationRoot = ""; private static final int totalNumberOfModulesInShepherd = 58; /** Creates DB or Restores DB to Factory Defaults before running tests */ @@ -51,10 +51,9 @@ public static void resetDatabase() throws IOException, SQLException { * * @param className Name of the class you wish to search / create * @return The Identifier of the class owning the name submitted - * @throws SQLException */ public static String findCreateClassId(String className) throws SQLException { - String classId = new String(); + String classId = ""; ResultSet rs = Getter.getClassInfo(applicationRoot); while (rs.next()) { if (rs.getString(2).compareTo(className) == 0) { @@ -81,11 +80,10 @@ public static String findCreateClassId(String className) throws SQLException { * * @param className Name of the class you wish to search / create * @return The Identifier of the class owning the name submitted - * @throws SQLException */ public static String findCreateClassId(String className, String applicationRoot) throws SQLException { - String classId = new String(); + String classId = ""; ResultSet rs = Getter.getClassInfo(applicationRoot); while (rs.next()) { if (rs.getString(2).compareTo(className) == 0) { @@ -114,13 +112,12 @@ public static String findCreateClassId(String className, String applicationRoot) * @param userName The user name of the admin you want to create or sign in as * @param password The password of the admin you want to create or sign in as * @return Boolean value depicting if the user exists and can be authenticated - * @throws SQLException */ public static boolean verifyTestAdmin(String applicationRoot, String userName, String password) throws SQLException { boolean result = false; - String user[] = Getter.authUser(applicationRoot, userName, userName); + String[] user = Getter.authUser(applicationRoot, userName, userName); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); Setter.userCreate( @@ -146,7 +143,6 @@ public static boolean verifyTestAdmin(String applicationRoot, String userName, S * @param userName The user name of the user you want to create or sign in as * @param password The password of the user you want to create or sign in as * @return Boolean value depicting if the user exists and can be authenticated - * @throws SQLException */ public static boolean verifyTestUser(String applicationRoot, String userName, String password) throws SQLException { @@ -185,13 +181,13 @@ public static boolean verifyTestUser( throws SQLException { boolean result = false; - String className = new String(); + String className; className = Getter.getClassInfo(applicationRoot, theClass)[0]; if (className.isEmpty()) { TestProperties.failAndPrint("Could not find class info for class " + theClass); } - String user[] = Getter.authUser(applicationRoot, userName, userName); + String[] user = Getter.authUser(applicationRoot, userName, userName); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); Setter.userCreate( @@ -229,7 +225,7 @@ public void testAuthUserCorrectUpperCaseCredentials() { String password = new String("goodPassword"); try { - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -239,7 +235,6 @@ public void testAuthUserCorrectUpperCaseCredentials() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { fail("Could not Authenticate as " + userName); } @@ -256,7 +251,7 @@ public void testAuthUserCorrectLongUsername() { String password = new String("goodPassword"); try { - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -266,7 +261,6 @@ public void testAuthUserCorrectLongUsername() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { fail("Could not Authenticate as " + userName); } @@ -282,7 +276,7 @@ public void testAuthUserBadLongUsername() { String userName = new String("badUsernameWithAnIncrediblyLongLengthWhicIsTooMuch"); String password = new String("goodPassword"); - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -301,7 +295,6 @@ public void testAuthUserBadLongUsername() { } else { log.debug("PASS: Could not create bad username " + userName); - return; } } @@ -312,7 +305,7 @@ public void testAuthUserCorrectNonLatinUsername() { String password = new String("goodPassword"); log.debug("Attempting to authenticate as " + userName); - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -329,7 +322,6 @@ public void testAuthUserCorrectNonLatinUsername() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { log.debug("FAIL: Successfully signed in as " + userName); fail("Could not Authenticate as " + userName); @@ -344,7 +336,7 @@ public void testAuthUserCorrectEmojiUsername() { String password = new String("goodEmojiPassword"); log.debug("Attempting to authenticate as " + userName); - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -361,7 +353,6 @@ public void testAuthUserCorrectEmojiUsername() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { log.debug("FAIL: Successfully signed in as " + userName); fail("Could not Authenticate as " + userName); @@ -375,7 +366,7 @@ public void testAuthUserCorrectNonLatinPassword() { String password = new String("אذاसтьᚩᚾåäö123ÅÄÖǎ𝓫𝚌Ⴛḗ𝑓ᶃ"); try { - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -385,7 +376,6 @@ public void testAuthUserCorrectNonLatinPassword() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { fail("Could not Authenticate as " + userName); } @@ -405,7 +395,7 @@ public void testAuthUserCorrectCredentialsLongPassword() { "goodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgoodPasswordgood"); try { - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -415,7 +405,6 @@ public void testAuthUserCorrectCredentialsLongPassword() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { fail("Could not Authenticate as " + userName); } @@ -431,7 +420,7 @@ public void testAuthUserCorrectLowerCaseCredentials() { String password = new String("goodPassword"); try { - String user[] = Getter.authUser(applicationRoot, userName, password); + String[] user = Getter.authUser(applicationRoot, userName, password); if (user == null || user[0].isEmpty()) { log.debug("User not found in DB. Adding user to DB and Retesting before giving up"); @@ -441,7 +430,6 @@ public void testAuthUserCorrectLowerCaseCredentials() { } if (user != null && !user[0].isEmpty()) { log.debug("PASS: Successfully signed in as " + userName); - return; } else { fail("Could not Authenticate as " + userName); } diff --git a/src/test/java/dbProcs/MongoDatabaseTest.java b/src/test/java/dbProcs/MongoDatabaseTest.java index ab991f4dc..fbf9c4a6f 100644 --- a/src/test/java/dbProcs/MongoDatabaseTest.java +++ b/src/test/java/dbProcs/MongoDatabaseTest.java @@ -35,7 +35,8 @@ public static void initAll() throws IOException { @Test @DisplayName("Should Return Type MongoCredentials") - public void getMongoChallengeCredentials_ShouldReturnTypeMongoCredentials() throws IOException { + public void testGetMongoChallengeCredentials_ShouldReturnTypeMongoCredentials() + throws IOException { assertThat( MongoDatabase.getMongoChallengeCredentials(null, TEST_PATH), instanceOf(MongoCredential.class)); @@ -43,7 +44,8 @@ public void getMongoChallengeCredentials_ShouldReturnTypeMongoCredentials() thro @Test @DisplayName("Should read properties file for mongo challenge credentials") - public void getMongoChallengeCredentials_ShouldReadPropertiesFileForCreds() throws IOException { + public void testGetMongoChallengeCredentials_ShouldReadPropertiesFileForCreds() + throws IOException { MongoCredential creds = MongoDatabase.getMongoChallengeCredentials(null, TEST_PATH); String username = creds.getUserName(); @@ -57,19 +59,19 @@ public void getMongoChallengeCredentials_ShouldReadPropertiesFileForCreds() thro @Test @DisplayName("Should Return Type String") - public void getMongoChallengeCollName_ShouldReturnTypeString() { + public void testGetMongoChallengeCollName_ShouldReturnTypeString() { assertThat(MongoDatabase.getMongoChallengeCollName(null, TEST_PATH), instanceOf(String.class)); } @Test @DisplayName("Should read properties file with connection details to challenge") - public void getMongoChallengeCollName_ReadPropertiesFile() { + public void testGetMongoChallengeCollName_ReadPropertiesFile() { MongoDatabase.getMongoChallengeCollName(null, TEST_PATH); } @Test @DisplayName("Should return a MongoClient instance") - public void getMongoDbConnection_ShouldReturnTypeMongoClient() { + public void testGetMongoDbConnection_ShouldReturnTypeMongoClient() { MongoCredential credential = MongoCredential.createScramSha1Credential("test", "test", "test".toCharArray()); assertThat(MongoDatabase.getMongoDbConnection(null), instanceOf(MongoClient.class)); @@ -78,13 +80,13 @@ public void getMongoDbConnection_ShouldReturnTypeMongoClient() { @Test @DisplayName("Must return type (Mongo) DB") - public void getMongoDatabase_ShouldReturnTypeDB() { + public void testGetMongoDatabase_ShouldReturnTypeDB() { assertThat(MongoDatabase.getMongoDatabase(mongoClient), instanceOf(DB.class)); } @Test @DisplayName("Read properties file for db name") - public void getMongoDatabase_ReadDbName() { + public void testGetMongoDatabase_ReadDbName() { DB db = MongoDatabase.getMongoDatabase(mongoClient); assertEquals("test_shepherdGames", db.getName()); } diff --git a/src/test/java/testUtils/TestCountdownHandler.java b/src/test/java/testUtils/TestCountdownHandler.java index 6be8cb0fa..3b92e718e 100644 --- a/src/test/java/testUtils/TestCountdownHandler.java +++ b/src/test/java/testUtils/TestCountdownHandler.java @@ -30,7 +30,7 @@ public static void resetDatabase() throws IOException, SQLException { } @Test - public void countdownHandler_SetCorrectStartTime() { + public void testCountdownHandler_SetCorrectStartTime() { LocalDateTime testTime = LocalDateTime.now(); CountdownHandler.setStartTime(testTime); @@ -51,7 +51,7 @@ public void countdownHandler_SetCorrectStartTime() { } @Test - public void countdownHandler_SetCorrectLockTime() { + public void testCountdownHandler_SetCorrectLockTime() { LocalDateTime testTime = LocalDateTime.now(); CountdownHandler.setLockTime(testTime); @@ -72,7 +72,7 @@ public void countdownHandler_SetCorrectLockTime() { } @Test - public void countdownHandler_SetCorrectEndTime() { + public void testCountdownHandler_SetCorrectEndTime() { LocalDateTime testTime = LocalDateTime.now(); CountdownHandler.setEndTime(testTime); @@ -93,7 +93,7 @@ public void countdownHandler_SetCorrectEndTime() { } @Test - public void countdownHandler_compareStartTime() { + public void testCountdownHandler_compareStartTime() { LocalDateTime testTime = LocalDateTime.now().minusMinutes(5); @@ -119,7 +119,7 @@ public void countdownHandler_compareStartTime() { } @Test - public void countdownHandler_compareLockTime() { + public void testCountdownHandler_compareLockTime() { LocalDateTime testTime = LocalDateTime.now().minusMinutes(5); @@ -144,7 +144,7 @@ public void countdownHandler_compareLockTime() { } @Test - public void countdownHandler_compareEndTime() { + public void testCountdownHandler_compareEndTime() { LocalDateTime testTime = LocalDateTime.now().minusMinutes(5); @@ -169,7 +169,7 @@ public void countdownHandler_compareEndTime() { } @Test - public void countdownHandler_TestIsOpen() throws InvalidCountdownStateException { + public void testCountdownHandler_TestIsOpen() throws InvalidCountdownStateException { LocalDateTime longPastTime = LocalDateTime.now().minusMinutes(10); LocalDateTime shortPastTime = LocalDateTime.now().minusMinutes(5); @@ -218,7 +218,7 @@ public void countdownHandler_TestIsOpen() throws InvalidCountdownStateException } @Test - public void countdownHandler_TestIsOpenStartAfterEndInvalid() { + public void testCountdownHandler_TestIsOpenStartAfterEndInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -229,7 +229,7 @@ public void countdownHandler_TestIsOpenStartAfterEndInvalid() { } @Test - public void countdownHandler_TestIsOpenStartAfterLockInvalid() { + public void testCountdownHandler_TestIsOpenStartAfterLockInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -240,7 +240,7 @@ public void countdownHandler_TestIsOpenStartAfterLockInvalid() { } @Test - public void countdownHandler_TestIsOpenLockAfterEndInvalid() { + public void testCountdownHandler_TestIsOpenLockAfterEndInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -251,7 +251,7 @@ public void countdownHandler_TestIsOpenLockAfterEndInvalid() { } @Test - public void countdownHandler_TestIsRunning() throws InvalidCountdownStateException { + public void testCountdownHandler_TestIsRunning() throws InvalidCountdownStateException { LocalDateTime longPastTime = LocalDateTime.now().minusMinutes(10); LocalDateTime shortPastTime = LocalDateTime.now().minusMinutes(5); @@ -296,7 +296,7 @@ public void countdownHandler_TestIsRunning() throws InvalidCountdownStateExcepti } @Test - public void countdownHandler_TestIsRunningStartAfterEndInvalid() { + public void testCountdownHandler_TestIsRunningStartAfterEndInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -307,7 +307,7 @@ public void countdownHandler_TestIsRunningStartAfterEndInvalid() { } @Test - public void countdownHandler_TestIsRunningStartAfterLockInvalid() { + public void testCountdownHandler_TestIsRunningStartAfterLockInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -318,7 +318,7 @@ public void countdownHandler_TestIsRunningStartAfterLockInvalid() { } @Test - public void countdownHandler_TestIsRunningLockAfterEndInvalid() { + public void testCountdownHandler_TestIsRunningLockAfterEndInvalid() { LocalDateTime testTime = LocalDateTime.parse("1980-01-01T12:00:00"); @@ -329,7 +329,7 @@ public void countdownHandler_TestIsRunningLockAfterEndInvalid() { } @Test - public void countdownHandler_TestIsRunningEqualTimes() throws InvalidCountdownStateException { + public void testCountdownHandler_TestIsRunningEqualTimes() throws InvalidCountdownStateException { // These equal-time edge cases should work even though they don't make much // sense... @@ -358,7 +358,7 @@ public void countdownHandler_TestIsRunningEqualTimes() throws InvalidCountdownSt } @Test - public void countdownHandler_TestIsOpenEqualTimes() throws InvalidCountdownStateException { + public void testCountdownHandler_TestIsOpenEqualTimes() throws InvalidCountdownStateException { // These equal-time edge cases should work even though they don't make much // sense... diff --git a/src/test/java/testUtils/TestProperties.java b/src/test/java/testUtils/TestProperties.java index 7942afa41..b58cb983b 100644 --- a/src/test/java/testUtils/TestProperties.java +++ b/src/test/java/testUtils/TestProperties.java @@ -23,6 +23,7 @@ import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletConfig; @@ -38,6 +39,7 @@ public static void failAndPrint(String message) { fail(message); } + @Test public static void executeSql(Logger log) throws IOException, SQLException { File file = @@ -421,11 +423,11 @@ public static void createMysqlResource( public static void createMysqlResource() throws IOException { Dotenv dotenv = Dotenv.load(); createMysqlResource( - dotenv.get("TEST_MYSQL_HOST"), - Integer.parseInt(dotenv.get("TEST_MYSQL_PORT")), + dotenv.get("TEST_MARIADB_HOST"), + Integer.parseInt(dotenv.get("TEST_MARIADB_PORT")), "core", "root", - dotenv.get("TEST_MYSQL_PASSWORD")); + dotenv.get("TEST_MARIADB_PASSWORD")); } /** diff --git a/src/test/java/testUtils/TestXmlDocumentBuilder.java b/src/test/java/testUtils/TestXmlDocumentBuilder.java index 95406a39c..a4750175b 100644 --- a/src/test/java/testUtils/TestXmlDocumentBuilder.java +++ b/src/test/java/testUtils/TestXmlDocumentBuilder.java @@ -23,7 +23,7 @@ public static void initAll() { @Test @DisplayName("Should Return Type DocumentBuilder") - public void xmlDocBuilder_ShouldReturnTypeDocumentBuilder() { + public void testXmlDocBuilder_ShouldReturnTypeDocumentBuilder() { DocumentBuilder db = XmlDocumentBuilder.xmlDocBuilder(true, true, true, true, true, true); assertThat(db, instanceOf(DocumentBuilder.class)); assertNotNull(db);