Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
Signed-off-by: Shivesh Ranjan <[email protected]>
  • Loading branch information
shiveshr committed Sep 3, 2020
2 parents 6c24e12 + eb61c9e commit 8339e8f
Show file tree
Hide file tree
Showing 96 changed files with 4,345 additions and 1,429 deletions.
155 changes: 151 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,117 @@ def getProjectVersion() {
return ver
}

project('serializers') {
project('serializers:shared') {
dependencies {
compile project(':common')
compile project(':client')
compile group: 'io.pravega', name: 'pravega-client', version: pravegaVersion
compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
}

javadoc {
title = "Serializers shared"
dependsOn delombok
source = delombok.outputDir
failOnError = true
exclude "**/impl/**";
options.addBooleanOption("Xdoclint:all,-reference", true)
}
}

project('serializers:avro') {
dependencies {
compile project(':serializers:shared')
compile group: 'org.apache.avro', name: 'avro', version: avroVersion
testCompile project(path:':serializers:shared', configuration:'testRuntime')
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
}

javadoc {
title = "Serializers avro"
dependsOn delombok
source = delombok.outputDir
failOnError = true
exclude "**/impl/**";
options.addBooleanOption("Xdoclint:all,-reference", true)
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}

project('serializers:protobuf') {
dependencies {
compile project(':serializers:shared')
compile group: 'com.google.protobuf', name: 'protobuf-java', version: protobufProtocVersion
compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufUtilVersion
compile group: 'io.pravega', name: 'pravega-client', version: pravegaVersion
compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jsonSchema', version: jacksonVersion
testCompile project(path:':serializers:shared', configuration:'testRuntime')
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
}

javadoc {
title = "Serializers protobuf"
dependsOn delombok
source = delombok.outputDir
failOnError = true
exclude "**/impl/**";
options.addBooleanOption("Xdoclint:all,-reference", true)
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}

project('serializers:json') {
dependencies {
compile project(':serializers:shared')
compile group: 'com.github.everit-org.json-schema', name: 'org.everit.json.schema', version: everitVersion
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jsonSchema', version: jacksonVersion
testCompile project(path:':serializers:shared', configuration:'testRuntime')
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
}

javadoc {
title = "Serializers json"
dependsOn delombok
source = delombok.outputDir
failOnError = true
exclude "**/impl/**";
options.addBooleanOption("Xdoclint:all,-reference", true)
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}

project('serializers') {
dependencies {
compile project(':serializers:avro')
compile project(':serializers:protobuf')
compile project(':serializers:json')
compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
testCompile project(path:':serializers:shared', configuration:'testRuntime')
testCompile files(project(':serializers:avro').sourceSets.test.output)
testCompile files(project(':serializers:protobuf').sourceSets.test.output)
testCompile files(project(':serializers:json').sourceSets.test.output)
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
Expand All @@ -242,6 +342,8 @@ project('serializers') {

jar {
manifest {}
// add zip64=true so that we are able to pack more than 65k files in the jar.
zip64=true

from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
Expand Down Expand Up @@ -317,6 +419,47 @@ project('server') {
}
}

project('test') {
sourceSets {
test.resources.srcDirs += "$rootDir/resources"
test.java.srcDir project(':server').file("src/test/java")
test.java.srcDir project(':serializers').file("src/test/java")
test.java.srcDir project(':serializers:shared').file("src/test/java")
test.java.srcDir project(':serializers:protobuf').file("src/test/java")
test.java.srcDir project(':serializers:json').file("src/test/java")
test.java.srcDir project(':serializers:avro').file("src/test/java")
}
compileTestJava.dependsOn tasks.getByPath(':server:testClasses')
dependencies {
compile project(':common')
compile project(':contract')
compile project(':client')
compile project(':server')
compile project(':serializers')
compile project(':serializers:protobuf')
compile project(':serializers:avro')
compile project(':serializers:json')
compile project(':serializers:shared')
testCompile (group: 'io.pravega', name: 'pravega-standalone', version: pravegaVersion) {
exclude group: 'javax.ws.rs', module: 'jsr311-api'
}
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile files(project(':server').sourceSets.test.output.classesDir)
testCompile group: 'org.glassfish.jersey.test-framework.providers', name: 'jersey-test-framework-provider-grizzly2', version: jerseyVersion
}

javadoc {
title = "Test"
dependsOn delombok
source = delombok.outputDir
failOnError = true
exclude "**/impl/**";
options.addBooleanOption("Xdoclint:all,-reference", true)
}
}

apply plugin: 'distribution'
distributions {
main {
Expand Down Expand Up @@ -393,6 +536,10 @@ task publishAllJars() {
dependsOn ':common:publish'
dependsOn ':contract:publish'
dependsOn ':server:publish'
dependsOn ':serializers:shared:publish'
dependsOn ':serializers:avro:publish'
dependsOn ':serializers:json:publish'
dependsOn ':serializers:protobuf:publish'
dependsOn ':serializers:publish'
}

Expand Down
10 changes: 8 additions & 2 deletions checkstyle/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
<Package name="io.pravega.schemaregistry.contract.generated" />
</Match>
<Match> <!-- generated code -->
<Package name="io.pravega.schemaregistry.test.integrationtest.generated" />
<Package name="io.pravega.schemaregistry.testobjs.generated" />
</Match>
<Match> <!-- generated code -->
<Package name="io.pravega.schemaregistry.testobjs.generated" />
<Package name="io.pravega.schemaregistry.serializer.avro.testobjs.generated" />
</Match>
<Match> <!-- generated code -->
<Package name="io.pravega.schemaregistry.serializer.protobuf.generated" />
</Match>
<Match> <!-- generated code -->
<Package name="io.pravega.schemaregistry.test.integrationtest.generated" />
</Match>
<Match> <!-- does not work well with futures -->
<Bug pattern="NP_NONNULL_PARAM_VIOLATION" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,102 @@ public class SchemaRegistryClientConfig {
* URI for connecting with registry client.
*/
private final URI schemaRegistryUri;
/**
* Flag to indicate if authentication is enabled.
*/
private final boolean authEnabled;
/**
* Authentication method.
*/
private final String authMethod;
/**
* Authentication token.
*/
private final String authToken;
/*
* Path to trust store for TLS server authentication certificate.
*/
private final String trustStore;
/**
* Type of key store used as the trust store - e.g. jks, pkcs11, pkcs12, dks etc. If not specified then either
* certificate (if configured) or default java TLS store as specified in system properties would be used.
*/
private final String trustStoreType;
/**
* Password for the trust store. Defaults to null.
*/
private final String trustStorePassword;
/**
* If the trust store is a certificate file, typically DER or PEM file.
*/
private final String certificate;
/**
* Flag to indicate whether client should perform host name validation in server authentication certificate.
*/
private final boolean validateHostName;

private SchemaRegistryClientConfig(URI schemaRegistryUri, boolean authEnabled, String authMethod, String authToken) {
private SchemaRegistryClientConfig(URI schemaRegistryUri, boolean authEnabled, String authMethod, String authToken,
String trustStore, String trustStoreType, String trustStorePassword,
String certificate, boolean validateHostName) {
this.schemaRegistryUri = schemaRegistryUri;
this.authEnabled = authEnabled;
this.authMethod = authMethod;
this.authToken = authToken;
this.trustStore = trustStore;
this.certificate = certificate;
this.trustStoreType = trustStoreType;
this.trustStorePassword = trustStorePassword;
this.validateHostName = validateHostName;
}

public static final class SchemaRegistryClientConfigBuilder {
private boolean authEnabled = false;
private boolean validateHostName = false;
private String trustStore = null;
private String trustStoreType = null;
private String trustStorePassword = null;
private String certificate = null;

public SchemaRegistryClientConfigBuilder certificate(String certificate) {
this.certificate = certificate;
return this;
}

public SchemaRegistryClientConfigBuilder trustStore(String trustStore, String trustStoreType, String trustStorePassword) {
this.trustStore = trustStore;
return this.trustStoreType(trustStoreType)
.trustStorePassword(trustStorePassword);
}

private SchemaRegistryClientConfigBuilder trustStoreType(String trustStoreType) {
this.trustStoreType = trustStoreType;
return this;
}

private SchemaRegistryClientConfigBuilder trustStorePassword(String trustStorePassword) {
this.trustStorePassword = trustStorePassword;
return this;
}

public SchemaRegistryClientConfigBuilder authentication(String authMethod, String authToken) {
return this.authEnabled()
.authMethod(authMethod)
.authToken(authToken);
}

private SchemaRegistryClientConfigBuilder authEnabled() {
this.authEnabled = true;
return this;
}

private SchemaRegistryClientConfigBuilder authMethod(String authMethod) {
this.authMethod = authMethod;
return this;
}

private SchemaRegistryClientConfigBuilder authToken(String authToken) {
this.authToken = authToken;
return this;
}
}
}
Loading

0 comments on commit 8339e8f

Please sign in to comment.