Skip to content

Commit

Permalink
#921: remove (unused) SchemaMultiTenantConnectionProvider(s) for h2/p…
Browse files Browse the repository at this point in the history
…gsql

(SchemaMultiTenantConnectionProvider is no longer abstract)
  • Loading branch information
clean-coder committed Jul 10, 2024
1 parent 8020fa5 commit 6a507ce
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

import static ch.puzzle.okr.multitenancy.TenantContext.DEFAULT_TENANT_ID;

public class AbstractSchemaMultiTenantConnectionProvider extends AbstractMultiTenantConnectionProvider<String> {
public class SchemaMultiTenantConnectionProvider extends AbstractMultiTenantConnectionProvider<String> {

private static final Logger logger = LoggerFactory.getLogger(AbstractSchemaMultiTenantConnectionProvider.class);
private static final Logger logger = LoggerFactory.getLogger(SchemaMultiTenantConnectionProvider.class);

final Map<String, ConnectionProvider> connectionProviderMap;

public AbstractSchemaMultiTenantConnectionProvider() {
public SchemaMultiTenantConnectionProvider() {
this.connectionProviderMap = new HashMap<>();
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@ [email protected],[email protected]
okr.tenants.acme.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8544/realms/pitc/protocol/openid-connect/certs
okr.tenants.acme.security.oauth2.frontend.issuer-url=http://localhost:8544/realms/pitc
okr.tenants.acme.security.oauth2.frontend.client-id=acme_okr_staging

spring.jpa.properties.hibernate.multi_tenant_connection_provider=ch.puzzle.okr.multitenancy.SchemaMultiTenantConnectionProviderH2
2 changes: 1 addition & 1 deletion backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ okr.jwt.claim.email=email

spring.jpa.properties.hibernate.multiTenancy=SCHEMA
spring.jpa.properties.hibernate.tenant_identifier_resolver=ch.puzzle.okr.multitenancy.CurrentTenantIdentifierResolverImpl
spring.jpa.properties.hibernate.multi_tenant_connection_provider=ch.puzzle.okr.multitenancy.SchemaMultiTenantConnectionProviderPGSQL
spring.jpa.properties.hibernate.multi_tenant_connection_provider=ch.puzzle.okr.multitenancy.SchemaMultiTenantConnectionProvider

okr.clientcustomization.favicon=assets/favicon.png
okr.clientcustomization.logo=assets/images/okr-logo.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SchemaMultiTenantConnectionProviderInternalsTest {

private static final String TENANT_ID = "pitc";

private static class ConfigurableConnectionProviderMock extends AbstractSchemaMultiTenantConnectionProvider {
private static class ConfigurableConnectionProviderMock extends SchemaMultiTenantConnectionProvider {

@Override
protected Properties getHibernateProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -27,8 +26,7 @@ public class SchemaMultiTenantConnectionProviderTest {
void getConnectionShouldSetSchemaWithOkrPrefix() throws SQLException {
// arrange
when(connection.createStatement()).thenReturn(statement);
AbstractSchemaMultiTenantConnectionProvider provider = new AbstractSchemaMultiTenantConnectionProvider() {
};
SchemaMultiTenantConnectionProvider provider = new SchemaMultiTenantConnectionProvider();

// act
provider.getConnection(TENANT_ID, connection);
Expand All @@ -42,8 +40,7 @@ void getConnectionShouldSetSchemaWithOkrPrefix() throws SQLException {
void getConnectionShouldSetSchemaWithoutOkrPrefixIfTenantIdIsDefaultTenantId() throws SQLException {
// arrange
when(connection.createStatement()).thenReturn(statement);
AbstractSchemaMultiTenantConnectionProvider provider = new AbstractSchemaMultiTenantConnectionProvider() {
};
SchemaMultiTenantConnectionProvider provider = new SchemaMultiTenantConnectionProvider();

// act
provider.getConnection(TenantContext.DEFAULT_TENANT_ID, connection);
Expand Down

0 comments on commit 6a507ce

Please sign in to comment.