Skip to content

Commit

Permalink
Issue 71: Integration test and Samples (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: Shivesh Ranjan <[email protected]>
  • Loading branch information
shiveshr authored Aug 20, 2020
1 parent 6284faf commit 7597736
Show file tree
Hide file tree
Showing 13 changed files with 1,849 additions and 3 deletions.
41 changes: 41 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -419,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
5 changes: 4 additions & 1 deletion checkstyle/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<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.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" />
</Match>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ private boolean checkCompatibility(SchemaInfo schema, GroupProperties groupPrope
CompatibilityChecker checker = CompatibilityCheckerFactory.getCompatibilityChecker(schema.getSerializationFormat());

// Verify that the type matches the type in schemas it will be validated against.
if (!schemasWithVersion.stream().allMatch(x -> x.getSchemaInfo().getType().equals(schema.getType()))) {
if (!groupProperties.isAllowMultipleTypes() && !schemasWithVersion.stream().allMatch(x -> x.getSchemaInfo().getType().equals(schema.getType()))) {
return false;
}
switch (groupProperties.getCompatibility().getType()) {
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ include 'client',
'serializers:protobuf',
'serializers:json',
'serializers:avro',
'serializers'
'serializers',
'test'
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.pravega.schemaregistry.integrationtest;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Address {
private String streetAddress;
private String city;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.pravega.schemaregistry.integrationtest;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DerivedUser1 extends User {
@Getter
private String user1;

public DerivedUser1(String name, Address address, int age, String user1) {
super(name, address, age);
this.user1 = user1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.pravega.schemaregistry.integrationtest;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DerivedUser2 extends User {
@Getter
private String user2;

public DerivedUser2(String name, Address address, int age, String user2) {
super(name, address, age);
this.user2 = user2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.pravega.schemaregistry.integrationtest;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
@Getter
private String name;
@Getter
private Address address;
@Getter
private int age;

}
Loading

0 comments on commit 7597736

Please sign in to comment.