Skip to content

Commit

Permalink
feat: Autoconfigure noopSchemaCacheKey Impl for non-eni-api mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisingenhaag committed Feb 22, 2024
1 parent 2281397 commit bc1fda4
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ sonarqubeVersion=4.4.1.3373
logstashLogbackEncoderVersion=7.3
fabric8Version=5.12.4
hazelcastVersion=4.2.8
everitJsonVersion=1.14.4

# internal
jsonFilterVersion=1.0.1

version=0.0.0-DEVELOPMENT
version=0.0.0-SNAPSHOT
11 changes: 11 additions & 0 deletions horizon-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ plugins {

group 'de.telekom.eni'

ext {
isReleaseVersion = !version.endsWith("SNAPSHOT")
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -43,6 +47,11 @@ dependencies {
// ENI
api "de.telekom:json-filter:${jsonFilterVersion}"

api ("com.github.erosb:everit-json-schema:${everitJsonVersion}") {
// fixes logging in test scope
exclude group: 'commons-logging'
}

implementation 'org.springframework.boot:spring-boot'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand Down Expand Up @@ -143,6 +152,8 @@ test {
}

signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }

def signingKey = new String(Base64.decoder.decode(System.getenv('PUBLISH_GPG_PRIVATE_KEY') ?: ""))
def signingPassword = System.getenv('PUBLISH_GPG_PASSPHRASE')
useInMemoryPgpKeys(signingKey, signingPassword)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package de.telekom.eni.pandora.horizon.cache.schema;

import org.apache.commons.lang3.tuple.Pair;
import org.everit.json.schema.Schema;

public interface SchemaCacheService {
Pair<Boolean, Schema> getSchemaForEventType(String environment, String eventType, String hub, String team);

void pollSchemas();
}
6 changes: 6 additions & 0 deletions horizon-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ plugins {

group 'de.telekom.eni'

ext {
isReleaseVersion = !version.endsWith("SNAPSHOT")
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -111,6 +115,8 @@ jacocoTestReport {
}

signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }

def signingKey = new String(Base64.decoder.decode(System.getenv('PUBLISH_GPG_PRIVATE_KEY') ?: ""))
def signingPassword = System.getenv('PUBLISH_GPG_PASSPHRASE')
useInMemoryPgpKeys(signingKey, signingPassword)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.telekom.eni.pandora.horizon.autoconfigure.cache;

import de.telekom.eni.pandora.horizon.cache.schema.SchemaCacheService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.everit.json.schema.Schema;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Configuration for the SchemaCacheService
* This AutoConfiguration is not enabled by default, as it might not be relevant for all applications.
* If it´s enabled it only provides a default noop impl bean if not other implementation of SchemaCacheService is provided.
*
*/
@Configuration
@Slf4j
public class SchemaCacheAutoConfiguration {

@Bean
@ConditionalOnMissingBean({SchemaCacheService.class})
public SchemaCacheService schemaCacheService() {
return new SchemaCacheService() {
@Override
public Pair<Boolean, Schema> getSchemaForEventType(String environment, String eventType, String hub, String team) {
log.debug("SchemaCacheService is not implemented, returning null");
return null;
}

@Override
public void pollSchemas() {
log.debug("SchemaCacheService is not implemented");
}
};
}

}
5 changes: 5 additions & 0 deletions horizon-spring-boot-starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ plugins {

group 'de.telekom.eni'

ext {
isReleaseVersion = !version.endsWith("SNAPSHOT")
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -103,6 +107,7 @@ jacocoTestReport {
}

signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
def signingKey = new String(Base64.decoder.decode(System.getenv('PUBLISH_GPG_PRIVATE_KEY') ?: ""))
def signingPassword = System.getenv('PUBLISH_GPG_PASSPHRASE')
useInMemoryPgpKeys(signingKey, signingPassword)
Expand Down

0 comments on commit bc1fda4

Please sign in to comment.