Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@
<version>1.12.772</version>
</dependency>

<!-- H2 Database for testing -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jwt.expiration=${JWT_EXPIRATION:86400000}
# ============================================
# Riot API Configuration
# ============================================
riot.api.key=${RIOT_API_KEY:RGAPI-7863c35a-a05f-4d60-a638-32376f1189ac}
riot.api.key=${RIOT_API_KEY:REPLACE_WITH_YOUR_RIOT_API_KEY}

# ============================================
# Google AI Configuration (Gemini)
# ============================================
google.ai.api.key=${GOOGLE_AI_API_KEY:AIzaSyAambK9U6ps0QX41--9G3tC-xKN2Xk6Wiw}
google.ai.api.key=${GOOGLE_AI_API_KEY:REPLACE_WITH_YOUR_GOOGLE_AI_API_KEY}

# ============================================
# Actuator Configuration
Expand Down
Binary file removed backend/src/main/resources/keystore.jks
Binary file not shown.
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/TfgApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

@ActiveProfiles("test")
@SpringBootTest
class TfgApplicationTests {

Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/e2e/AdminE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;

import java.time.Duration;
Expand All @@ -26,6 +27,7 @@
/**
* End-to-end tests for the admin interface and API endpoints.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {
"jwt.secret=mySecretKeyForTesting123456789012345678901234567890"
Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/e2e/DashboardE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;

import java.time.Duration;
Expand All @@ -26,6 +27,7 @@
/**
* End-to-end tests for the dashboard interface and API endpoints.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {
"jwt.secret=mySecretKeyForTesting123456789012345678901234567890"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;

import java.time.Duration;
Expand All @@ -26,6 +27,7 @@
/**
* End-to-end tests for the home navigation and main page.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {
"jwt.secret=mySecretKeyForTesting123456789012345678901234567890"
Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/e2e/LoginE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;

import java.time.Duration;
Expand All @@ -26,6 +27,7 @@
/**
* End-to-end tests for the login interface and API endpoints.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {
"jwt.secret=mySecretKeyForTesting123456789012345678901234567890"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
Expand All @@ -25,6 +26,7 @@
* Integration tests for AdminController
* Tests admin-specific operations with real database interactions
*/
@ActiveProfiles("test")
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
Expand Down Expand Up @@ -40,6 +41,7 @@
* Strategy: Use real database with @Transactional, mock only external API
* (RiotService)
*/
@ActiveProfiles("test")
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
Expand All @@ -27,6 +28,7 @@
* Integration tests for FileController
* Tests file upload, download, and delete operations
*/
@ActiveProfiles("test")
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -20,6 +21,7 @@
/**
* Integration tests for RiotService and related repositories.
*/
@ActiveProfiles("test")
@SpringBootTest
@Transactional
class RiotServiceIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
Expand All @@ -34,6 +35,7 @@
* Strategic Integration Tests for SummonerController
*
*/
@ActiveProfiles("test")
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
Expand All @@ -25,6 +26,7 @@
* Integration tests for UserController
* Tests real database interactions and full request/response cycles
*/
@ActiveProfiles("test")
@SpringBootTest
@AutoConfigureMockMvc
@Transactional
Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/system/AdminSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;

import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;

/**
* Comprehensive system tests for admin functionalities, including user management and access control.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class AdminSystemTest {

Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/java/com/tfg/tfg/system/AuthSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;

import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;

/**
* Comprehensive system tests for authentication and session management.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class AuthSystemTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;

import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;

/**
* Testing system for dashboard functionalities, including recent summoner activity and match history display.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class DashboardSystemTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.security.crypto.password.PasswordEncoder;
Expand All @@ -23,6 +24,7 @@
/**
* Testing system for search functionalities, including summoner search and match history retrieval.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SearchSystemTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;

import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;

/**
* Comprehensive system tests for user account functionalities, including profile management and summoner linking.
*/
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class UserAccountSystemTest {

Expand Down
26 changes: 26 additions & 0 deletions backend/src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ============================================
# SPIRITBLADE - Test Configuration
# ============================================

# SSL Configuration for Tests
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-password=spiritblade
server.ssl.key-password=spiritblade
server.ssl.key-alias=spiritblade

# JWT Configuration for Tests
jwt.secret=mySecretKeyForTesting123456789012345678901234567890

# Database Configuration for Tests (H2 in-memory)
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=Oracle
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create-drop

# Riot API Configuration for Tests (Mocked)
riot.api.key=RGAPI-MOCK-KEY-FOR-TESTING

# Google AI Configuration for Tests (Mocked)
google.ai.api.key=GEMINI-MOCK-KEY-FOR-TESTING
Binary file added backend/src/test/resources/keystore.jks
Binary file not shown.
1 change: 1 addition & 0 deletions iac/terraform/adb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ resource "oci_database_autonomous_database" "main" {

lifecycle {
prevent_destroy = true
ignore_changes = all
}
}

Expand Down
67 changes: 0 additions & 67 deletions iac/terraform/conv.py

This file was deleted.

4 changes: 2 additions & 2 deletions iac/terraform/images.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ data "oci_containerengine_node_pool_option" "oke_options" {

# Buscar imágenes OKE que soporten ARM64 y K8s v1.31.1
locals {
# Filtrar imágenes OKE compatibles con ARM y v1.31.1
# Filtrar imágenes OKE compatibles con ARM y la versión del cluster
oke_arm_images = [
for source in data.oci_containerengine_node_pool_option.oke_options.sources :
source if can(regex("Oracle-Linux.*aarch64.*OKE-1\\.31\\.1", source.source_name))
source if can(regex(format("Oracle-Linux.*aarch64.*OKE-%s", replace(oci_containerengine_cluster.k8s_cluster.kubernetes_version, "v", "")), source.source_name))
]

# Seleccionar la imagen más reciente
Expand Down
Loading
Loading