removing tests

This commit is contained in:
Dario Ghunney Ware 2025-01-06 16:19:42 +00:00
parent 0e4aac4897
commit 428b4238e3
6 changed files with 7 additions and 114 deletions

View File

@ -322,7 +322,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-oauth2-client:$springBootVersion" implementation "org.springframework.boot:spring-boot-starter-oauth2-client:$springBootVersion"
implementation "org.springframework.session:spring-session-core:$springBootVersion" implementation "org.springframework.session:spring-session-core:$springBootVersion"
implementation "org.springframework:spring-jdbc" implementation "org.springframework:spring-jdbc:6.2.1"
implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5' implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5'
// Don't upgrade h2database // Don't upgrade h2database

View File

@ -27,8 +27,8 @@ services:
UMASK: "022" UMASK: "022"
SYSTEM_DEFAULTLOCALE: en-US SYSTEM_DEFAULTLOCALE: en-US
UI_APPNAME: Stirling-PDF UI_APPNAME: Stirling-PDF
UI_HOMEDESCRIPTION: Demo site for Stirling-PDF Latest-fat with Security UI_HOMEDESCRIPTION: Demo site for Stirling-PDF Latest-fat with Security and PostgreSQL
UI_APPNAMENAVBAR: Stirling-PDF Latest-fat UI_APPNAMENAVBAR: Stirling-PDF Latest-fat-PostgreSQL
SYSTEM_MAXFILESIZE: "100" SYSTEM_MAXFILESIZE: "100"
METRICS_ENABLED: "true" METRICS_ENABLED: "true"
SYSTEM_GOOGLEVISIBILITY: "true" SYSTEM_GOOGLEVISIBILITY: "true"

View File

@ -11,8 +11,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;

View File

@ -16,6 +16,10 @@ import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import stirling.software.SPDF.model.ApplicationProperties; import stirling.software.SPDF.model.ApplicationProperties;
import static java.nio.file.Files.createDirectories;
import static java.nio.file.Files.createFile;
import static java.nio.file.Files.delete;
import static java.nio.file.Files.exists;
@ExtendWith(MockitoExtension.class) @ExtendWith(MockitoExtension.class)
public class SPDFApplicationTest { public class SPDFApplicationTest {

View File

@ -1,51 +0,0 @@
package stirling.software.SPDF.config.security.database;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import stirling.software.SPDF.model.ApplicationProperties;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class DatabaseServiceTest {
public static final String TEST_FILE = "test.txt";
private final String BACKUP_PATH = "configs/db/backup/";
@Mock
private ApplicationProperties applicationProperties;
@Mock
private DataSource dataSource;
@InjectMocks
private DatabaseService databaseService;
@Test
void testHasBackups() throws IOException {
Path backupDir = Paths.get(BACKUP_PATH);
Files.createDirectories(backupDir);
Path testFile = Paths.get(BACKUP_PATH + TEST_FILE);
ApplicationProperties.System system = mock(ApplicationProperties.System.class);
ApplicationProperties.Datasource datasource = mock(ApplicationProperties.Datasource.class);
Files.createFile(testFile);
when(applicationProperties.getSystem()).thenReturn(system);
when(system.getDatasource()).thenReturn(datasource);
when(datasource.isEnableCustomDatabase()).thenReturn(false);
assertTrue(databaseService.hasBackup());
Files.deleteIfExists(testFile);
}
}

View File

@ -1,58 +0,0 @@
package stirling.software.SPDF.integrationtests;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import stirling.software.SPDF.SPDFApplication;
import static java.nio.file.Files.createDirectories;
import static java.nio.file.Files.createFile;
import static java.nio.file.Files.delete;
import static java.nio.file.Files.exists;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest
public class SPDFApplicationIntegrationTest {
@Test
public void testMainApplicationStartup() throws IOException, InterruptedException {
// Setup mock environment for the main method
Path configPath = Path.of("test/configs");
Path settingsPath = Paths.get("test/configs/settings.yml");
Path customSettingsPath = Paths.get("test/configs/custom_settings.yml");
Path staticPath = Path.of("test/customFiles/static/");
Path templatesPath = Path.of("test/customFiles/templates/");
// Ensure the files do not exist for the test
if (exists(settingsPath)) {
delete(settingsPath);
}
if (exists(customSettingsPath)) {
delete(customSettingsPath);
}
if (exists(staticPath)) {
delete(staticPath);
}
if (exists(templatesPath)) {
delete(templatesPath);
}
// Ensure the directories are created for testing
createDirectories(configPath);
createDirectories(staticPath);
createDirectories(templatesPath);
createFile(settingsPath);
createFile(customSettingsPath);
// Run the main method
SPDFApplication.main(new String[] {"-Dspring.profiles.active=default"});
// Verify that the directories were created
assertTrue(exists(settingsPath));
assertTrue(exists(customSettingsPath));
assertTrue(exists(staticPath));
assertTrue(exists(templatesPath));
}
}