Skip to content

Commit

Permalink
feat: switching to oracle-free module
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Dec 4, 2023
1 parent 04bd51d commit ddd4a44
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
9 changes: 2 additions & 7 deletions jpa/multitenancy/multidatasource-multitenancy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.6</version>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.multitenancy</groupId>
Expand Down Expand Up @@ -103,11 +103,6 @@
<artifactId>spring-boot-testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand All @@ -120,7 +115,7 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<artifactId>oracle-free</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import static com.example.multitenancy.utils.AppConstants.PROFILE_TEST;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

import com.example.multitenancy.config.multitenant.TenantIdentifierResolver;
import com.example.multitenancy.primary.repositories.PrimaryCustomerRepository;
import com.example.multitenancy.secondary.repositories.SecondaryCustomerRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
Expand All @@ -18,4 +21,9 @@ public abstract class AbstractIntegrationTest extends DBContainerInitializer {
@Autowired protected MockMvc mockMvc;

@Autowired protected ObjectMapper objectMapper;

@Autowired protected PrimaryCustomerRepository primaryCustomerRepository;
@Autowired protected SecondaryCustomerRepository secondaryCustomerRepository;

@Autowired protected TenantIdentifierResolver tenantIdentifierResolver;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.oracle.OracleContainer;
import org.testcontainers.utility.DockerImageName;

@Testcontainers(disabledWithoutDocker = true, parallel = true)
public class DBContainerInitializer {

@Container
private static final PostgreSQLContainer<?> POSTGRE_SQL_CONTAINER =
new PostgreSQLContainer<>("postgres:16.1-alpine");
new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.1-alpine"));

@Container
private static final OracleContainer ORACLE_CONTAINER =
new OracleContainer(
DockerImageName.parse("gvenzl/oracle-xe").withTag("slim-faststart"));
DockerImageName.parse("gvenzl/oracle-free")
.withTag("23-slim-faststart"))
.withReuse(true);

@DynamicPropertySource
static void addsDynamicProperties(DynamicPropertyRegistry propertyRegistry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,15 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.example.multitenancy.common.AbstractIntegrationTest;
import com.example.multitenancy.config.multitenant.TenantIdentifierResolver;
import com.example.multitenancy.primary.entities.PrimaryCustomer;
import com.example.multitenancy.primary.repositories.PrimaryCustomerRepository;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;

class PrimaryCustomerControllerIT extends AbstractIntegrationTest {

@Autowired private PrimaryCustomerRepository primaryCustomerRepository;
@Autowired private TenantIdentifierResolver tenantIdentifierResolver;

private List<PrimaryCustomer> primaryCustomerList = null;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import com.example.multitenancy.common.AbstractIntegrationTest;
import com.example.multitenancy.config.multitenant.TenantIdentifierResolver;
import com.example.multitenancy.secondary.entities.SecondaryCustomer;
import com.example.multitenancy.secondary.repositories.SecondaryCustomerRepository;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;

class SecondaryCustomerControllerIT extends AbstractIntegrationTest {

@Autowired private SecondaryCustomerRepository secondaryCustomerRepository;
@Autowired private TenantIdentifierResolver tenantIdentifierResolver;

private List<SecondaryCustomer> secondaryCustomerList = null;

@BeforeEach
Expand Down

0 comments on commit ddd4a44

Please sign in to comment.