Add database configuration via command-line arguments
A new configuration setup now allows specifying a path for database properties via command-line arguments during application startup. This update also changes the call signature for `DatabaseConnection.initialize()` method to accept a path argument. Similarly, methods in `PropertiesLoader`, `PropertiesWriter`, and `MailSettings` classes were also updated to use the specified path when working with properties files. The `TestForm` class's tests were updated accordingly to handle these changes.
This commit is contained in:
parent
2f1d24598b
commit
49af4a3067
|
|
@ -4,14 +4,15 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Mark fields as final in VerificationData and ContactFormData The 'code', 'eMail' fields in the VerificationData class and 'username', 'email', 'question' fields in the ContactFormData class are now marked as 'final'. At the same time, some unused imports from ContactController, ContactFormData, FormQuery, and VerifyController have been removed for code cleanliness.">
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Update Form HTML output and disable validation auto-configuration The form-to-HTML output process has been switched from a `<div>` approach to using a `StringBuilder` with a table structure in `ContactFormData.java`. Also, the spring validation auto-configuration has been disabled by adding `exclude = ValidationAutoConfiguration.class` in the `@SpringBootApplication` annotation of `Main.java`. Some changes in `.idea/workspace.xml` and `VerifyController.java` were made as well.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/beans/WebConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/beans/WebConfig.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/contact/ContactFormData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/contact/ContactFormData.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/database/Database.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/database/Database.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/FormQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/FormQuery.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/VerifyController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/VerifyController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/database/DatabaseConnection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/database/DatabaseConnection.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/mail/MailSettings.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/mail/MailSettings.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/properties/PropertiesLoader.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/properties/PropertiesLoader.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/properties/PropertiesWriter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/properties/PropertiesWriter.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/TestForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/TestForm.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -28,6 +29,8 @@
|
|||
<list>
|
||||
<option value="Jsp File" />
|
||||
<option value="Class" />
|
||||
<option value="package-info" />
|
||||
<option value="package.json" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
|
@ -62,43 +65,68 @@
|
|||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Gradle.Build forms.executor": "Run",
|
||||
"Gradle.TestForm.testFunctions.executor": "Debug",
|
||||
"Gradle.TestForm.testRetrieveForm.executor": "Run",
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"Spring Boot.Main.executor": "Run",
|
||||
"Tomcat Server.Tomcat 10.1.17.executor": "Run",
|
||||
"git-widget-placeholder": "master",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.0",
|
||||
"project.structure.side.proportion": "0.0",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Gradle.Build forms.executor": "Run",
|
||||
"Gradle.TestForm.executor": "Run",
|
||||
"Gradle.TestForm.testFunctions.executor": "Debug",
|
||||
"Gradle.TestForm.testRetrieveForm.executor": "Run",
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"Spring Boot.Main.executor": "Run",
|
||||
"Tomcat Server.Tomcat 10.1.17.executor": "Run",
|
||||
"git-widget-placeholder": "master",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.0",
|
||||
"project.structure.side.proportion": "0.0",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"mysql",
|
||||
"mariadb"
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"mysql",
|
||||
"mariadb"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager" selected="Spring Boot.Main">
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="Gradle.TestForm">
|
||||
<configuration name="TestForm" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":test" />
|
||||
<option value="--tests" />
|
||||
<option value=""TestForm"" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>true</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="TestForm.testFunctions" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
|
|
@ -194,6 +222,7 @@
|
|||
</method>
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Gradle.TestForm" />
|
||||
<item itemvalue="Gradle.TestForm.testFunctions" />
|
||||
<item itemvalue="Gradle.TestForm.testRetrieveForm" />
|
||||
<item itemvalue="Spring Boot.Main" />
|
||||
|
|
@ -201,6 +230,7 @@
|
|||
</list>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Gradle.TestForm" />
|
||||
<item itemvalue="Gradle.TestForm.testRetrieveForm" />
|
||||
<item itemvalue="Gradle.TestForm.testFunctions" />
|
||||
</list>
|
||||
|
|
@ -239,7 +269,7 @@
|
|||
<workItem from="1707656217023" duration="2305000" />
|
||||
<workItem from="1708153393312" duration="669000" />
|
||||
<workItem from="1708154142819" duration="609000" />
|
||||
<workItem from="1714315469459" duration="3062000" />
|
||||
<workItem from="1714315469459" duration="8118000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Initial commit for site for forms">
|
||||
<option name="closed" value="true" />
|
||||
|
|
@ -273,7 +303,15 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1705227608210</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="5" />
|
||||
<task id="LOCAL-00005" summary="Update Form HTML output and disable validation auto-configuration The form-to-HTML output process has been switched from a `<div>` approach to using a `StringBuilder` with a table structure in `ContactFormData.java`. Also, the spring validation auto-configuration has been disabled by adding `exclude = ValidationAutoConfiguration.class` in the `@SpringBootApplication` annotation of `Main.java`. Some changes in `.idea/workspace.xml` and `VerifyController.java` were made as well.">
|
||||
<option name="closed" value="true" />
|
||||
<created>1714319923708</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714319923708</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="6" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
@ -296,6 +334,7 @@
|
|||
<MESSAGE value="Add TestForm class and set up related unit tests The changes add a new TestForm class to implement unit tests for form handling in the application. The included tests verify the storing, retrieving, and verification of forms from a database, as well as form object creation and confirmation of form data. This is a step towards improving the code's reliability and making it easier to catch potential bugs or issues." />
|
||||
<MESSAGE value="Remove unnecessary Gson imports in ContactFormData The Gson and GsonBuilder imports in the ContactFormData class were unused and have been removed. This cleanup simplifies the code and reduces unnecessary dependencies. " />
|
||||
<MESSAGE value="Mark fields as final in VerificationData and ContactFormData The 'code', 'eMail' fields in the VerificationData class and 'username', 'email', 'question' fields in the ContactFormData class are now marked as 'final'. At the same time, some unused imports from ContactController, ContactFormData, FormQuery, and VerifyController have been removed for code cleanliness." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Mark fields as final in VerificationData and ContactFormData The 'code', 'eMail' fields in the VerificationData class and 'username', 'email', 'question' fields in the ContactFormData class are now marked as 'final'. At the same time, some unused imports from ContactController, ContactFormData, FormQuery, and VerifyController have been removed for code cleanliness." />
|
||||
<MESSAGE value="Update Form HTML output and disable validation auto-configuration The form-to-HTML output process has been switched from a `<div>` approach to using a `StringBuilder` with a table structure in `ContactFormData.java`. Also, the spring validation auto-configuration has been disabled by adding `exclude = ValidationAutoConfiguration.class` in the `@SpringBootApplication` annotation of `Main.java`. Some changes in `.idea/workspace.xml` and `VerifyController.java` were made as well." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Update Form HTML output and disable validation auto-configuration The form-to-HTML output process has been switched from a `<div>` approach to using a `StringBuilder` with a table structure in `ContactFormData.java`. Also, the spring validation auto-configuration has been disabled by adding `exclude = ValidationAutoConfiguration.class` in the `@SpringBootApplication` annotation of `Main.java`. Some changes in `.idea/workspace.xml` and `VerifyController.java` were made as well." />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -10,9 +10,15 @@ import java.sql.SQLException;
|
|||
@SpringBootApplication(exclude = ValidationAutoConfiguration.class)
|
||||
public class Main {
|
||||
|
||||
private static String path;
|
||||
|
||||
public static void main(String[] args) throws SQLException {
|
||||
path = args[0];
|
||||
SpringApplication.run(Main.class, args);
|
||||
DatabaseConnection.initialize();
|
||||
DatabaseConnection.initialize(args[0]);
|
||||
}
|
||||
|
||||
public static String getConfigPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.alttd.forms.properties.PropertiesWriter;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
|
@ -26,6 +27,13 @@ public class DatabaseConnection {
|
|||
Database.createTables();
|
||||
}
|
||||
|
||||
public DatabaseConnection(String path) throws SQLException {
|
||||
instance = this;
|
||||
loadProperties(path);
|
||||
instance.openConnection();
|
||||
Database.createTables();
|
||||
}
|
||||
|
||||
public static Connection getConnection() {
|
||||
try {
|
||||
instance.openConnection();
|
||||
|
|
@ -36,15 +44,21 @@ public class DatabaseConnection {
|
|||
return instance.connection;
|
||||
}
|
||||
|
||||
public static void initialize(String path) throws SQLException {
|
||||
if (instance != null)
|
||||
return;
|
||||
instance = new DatabaseConnection(path);
|
||||
}
|
||||
|
||||
public static void initialize() throws SQLException {
|
||||
if (instance != null)
|
||||
return;
|
||||
instance = new DatabaseConnection();
|
||||
}
|
||||
|
||||
private void loadProperties() {
|
||||
private void loadProperties(String path) {
|
||||
String fileName = "database.properties";
|
||||
Optional<Properties> optionalProperties = PropertiesLoader.loadProperties(fileName);
|
||||
Optional<Properties> optionalProperties = PropertiesLoader.loadProperties(path, fileName);
|
||||
if (optionalProperties.isPresent()) {
|
||||
properties = optionalProperties.get();
|
||||
return;
|
||||
|
|
@ -58,7 +72,11 @@ public class DatabaseConnection {
|
|||
properties.setProperty("user", "root");
|
||||
properties.setProperty("password", "root");
|
||||
properties.setProperty("parameters", "autoReconnect=true&useSSL=false");
|
||||
PropertiesWriter.writeProperties(properties, fileName);
|
||||
PropertiesWriter.writeProperties(properties, path, fileName);
|
||||
}
|
||||
|
||||
private void loadProperties() {
|
||||
loadProperties("");
|
||||
}
|
||||
|
||||
public void openConnection() throws SQLException {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.alttd.forms.mail;
|
||||
|
||||
import com.alttd.forms.Main;
|
||||
import com.alttd.forms.properties.PropertiesLoader;
|
||||
import com.alttd.forms.properties.PropertiesWriter;
|
||||
|
||||
|
|
@ -20,8 +21,9 @@ public class MailSettings {
|
|||
if (mailProperties != null)
|
||||
return mailProperties;
|
||||
|
||||
String path = Main.getConfigPath();
|
||||
String fileName = "mail_settings.properties";
|
||||
Optional<Properties> properties = PropertiesLoader.loadProperties(fileName);
|
||||
Optional<Properties> properties = PropertiesLoader.loadProperties(path, fileName);
|
||||
if (properties.isPresent()) {
|
||||
mailProperties = properties.get();
|
||||
return mailProperties;
|
||||
|
|
@ -33,7 +35,7 @@ public class MailSettings {
|
|||
mailProperties.put("mail.smtp.auth", "true");
|
||||
mailProperties.put("mail.smtp.socketFactory.port", "465");
|
||||
mailProperties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
PropertiesWriter.writeProperties(mailProperties, fileName);
|
||||
PropertiesWriter.writeProperties(mailProperties, path, fileName);
|
||||
return mailProperties;
|
||||
}
|
||||
|
||||
|
|
@ -59,8 +61,10 @@ public class MailSettings {
|
|||
return createPasswordAuthentication(accountDetails);
|
||||
}
|
||||
|
||||
String path = Main.getConfigPath();
|
||||
|
||||
String fileName = "mail_account.properties";
|
||||
Optional<Properties> properties = PropertiesLoader.loadProperties(fileName);
|
||||
Optional<Properties> properties = PropertiesLoader.loadProperties(path, fileName);
|
||||
if (properties.isPresent()) {
|
||||
accountDetails = properties.get();
|
||||
return createPasswordAuthentication(accountDetails);
|
||||
|
|
@ -70,7 +74,7 @@ public class MailSettings {
|
|||
accountDetails.put("username", "test@test.test");
|
||||
accountDetails.put("password", "testpassword");
|
||||
|
||||
PropertiesWriter.writeProperties(accountDetails, fileName);
|
||||
PropertiesWriter.writeProperties(accountDetails, path, fileName);
|
||||
return createPasswordAuthentication(accountDetails);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
@ -13,15 +15,21 @@ public class PropertiesLoader {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);
|
||||
|
||||
public static Optional<Properties> loadProperties(String fileName) {
|
||||
public static Optional<Properties> loadProperties(String path, String fileName) {
|
||||
Properties prop = new Properties();
|
||||
Optional<File> currentJarPath = JarPath.getCurrentJarDir();
|
||||
if (currentJarPath.isEmpty()) {
|
||||
logger.error("Unable to find jar path to load properties (" + fileName + ")");
|
||||
return Optional.empty();
|
||||
File file;
|
||||
if (path.isEmpty()) {
|
||||
Optional<File> currentJarPath = JarPath.getCurrentJarDir();
|
||||
if (currentJarPath.isEmpty()) {
|
||||
logger.error("Unable to find jar path to load properties (" + fileName + ")");
|
||||
return Optional.empty();
|
||||
}
|
||||
file = new File(currentJarPath.get(), fileName);
|
||||
} else {
|
||||
file = Path.of(URI.create("file://" + path + File.separator + fileName)).toFile();
|
||||
}
|
||||
|
||||
File file = new File(currentJarPath.get(), fileName);
|
||||
|
||||
if (!file.exists()) {
|
||||
logger.warn("Tried to load properties file that doesnt exists (" + fileName + ")");
|
||||
return Optional.empty();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
@ -13,13 +15,19 @@ public class PropertiesWriter {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PropertiesWriter.class);
|
||||
|
||||
public static void writeProperties(Properties prop, String fileName) {
|
||||
Optional<File> currentJarPath = JarPath.getCurrentJarDir();
|
||||
if (currentJarPath.isEmpty()) {
|
||||
logger.error("Failed to get current jar directory");
|
||||
return;
|
||||
public static void writeProperties(Properties prop, String path, String fileName) {
|
||||
File file;
|
||||
if (path.isEmpty()) {
|
||||
Optional<File> currentJarPath = JarPath.getCurrentJarDir();
|
||||
if (currentJarPath.isEmpty()) {
|
||||
logger.error("Unable to find jar path to write properties (" + fileName + ")");
|
||||
return;
|
||||
}
|
||||
file = new File(currentJarPath.get(), fileName);
|
||||
} else {
|
||||
file = Path.of(URI.create("file://" + path + File.separator + fileName)).toFile();
|
||||
}
|
||||
File file = new File(currentJarPath.get(), fileName);
|
||||
|
||||
if (file.exists()) {
|
||||
logger.error("File already exists (" + fileName + ")");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
logging.level.com.alttd.forms=warn
|
||||
logging.level.com.alttd.forms=warn
|
||||
server.port=8002
|
||||
|
|
@ -15,7 +15,7 @@ public class TestForm {
|
|||
|
||||
@BeforeAll
|
||||
public static void testInsert() {
|
||||
Assertions.assertDoesNotThrow(DatabaseConnection::initialize);
|
||||
Assertions.assertDoesNotThrow(() -> DatabaseConnection.initialize());
|
||||
StoreFormQuery storeFormQuery = new StoreFormQuery();
|
||||
ContactFormData contactFormData = new ContactFormData("akastijn", "akastijn@alttd.com", "This is a test question.");
|
||||
storeFormQuery.storeFormForVerificationCode("akastijn@alttd.com", contactFormData).
|
||||
|
|
@ -28,7 +28,7 @@ public class TestForm {
|
|||
|
||||
@Test
|
||||
public void testRetrieveForm() {
|
||||
Assertions.assertDoesNotThrow(DatabaseConnection::initialize);
|
||||
Assertions.assertDoesNotThrow(() -> DatabaseConnection.initialize());
|
||||
new FormQuery().getFormForCode(String.valueOf(code), "akastijn@alttd.com").thenAccept(result -> {
|
||||
Assertions.assertTrue(result.failReason().isEmpty());
|
||||
Optional<Form> optionalForm = result.form();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user