From 55d4aed4c661fabce9ebf6685c3257e5e83db349 Mon Sep 17 00:00:00 2001 From: Dario Ghunney Ware Date: Mon, 6 Jan 2025 18:38:35 +0000 Subject: [PATCH] enabling test --- build.gradle | 2 +- .../software/SPDF/SPDFApplication.java | 2 - .../database/DatabaseServiceTest.java | 53 ------------------- .../SPDFApplicationIntegrationTest.java | 1 - 4 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 src/test/java/stirling/software/SPDF/config/security/database/DatabaseServiceTest.java diff --git a/build.gradle b/build.gradle index 189c5aea765..fc8b7c702e1 100644 --- a/build.gradle +++ b/build.gradle @@ -322,7 +322,7 @@ dependencies { implementation "org.springframework.boot:spring-boot-starter-oauth2-client:$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' // Don't upgrade h2database diff --git a/src/main/java/stirling/software/SPDF/SPDFApplication.java b/src/main/java/stirling/software/SPDF/SPDFApplication.java index 9ecf6114b41..242a0bff697 100644 --- a/src/main/java/stirling/software/SPDF/SPDFApplication.java +++ b/src/main/java/stirling/software/SPDF/SPDFApplication.java @@ -11,8 +11,6 @@ import java.util.Map; 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.Value; import org.springframework.boot.SpringApplication; diff --git a/src/test/java/stirling/software/SPDF/config/security/database/DatabaseServiceTest.java b/src/test/java/stirling/software/SPDF/config/security/database/DatabaseServiceTest.java deleted file mode 100644 index caa042917e9..00000000000 --- a/src/test/java/stirling/software/SPDF/config/security/database/DatabaseServiceTest.java +++ /dev/null @@ -1,53 +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.Disabled; -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 - @Disabled("Failing on CI/CD") - 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); - } -} \ No newline at end of file diff --git a/src/test/java/stirling/software/SPDF/integrationtests/SPDFApplicationIntegrationTest.java b/src/test/java/stirling/software/SPDF/integrationtests/SPDFApplicationIntegrationTest.java index 62f0a0765a9..199b6dd3025 100644 --- a/src/test/java/stirling/software/SPDF/integrationtests/SPDFApplicationIntegrationTest.java +++ b/src/test/java/stirling/software/SPDF/integrationtests/SPDFApplicationIntegrationTest.java @@ -13,7 +13,6 @@ import static java.nio.file.Files.exists; import static org.junit.jupiter.api.Assertions.assertTrue; -@Disabled @SpringBootTest public class SPDFApplicationIntegrationTest {