Skip to content

Commit

Permalink
SAMZA-1015 Add support for streams, Lambdas and other JDK 8 like feat…
Browse files Browse the repository at this point in the history
…ures in checkstyle
  • Loading branch information
jagadish-northguard committed Sep 30, 2016
1 parent 36bcbac commit 19ef7cd
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 49 deletions.
50 changes: 29 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
}

apply from: file("gradle/dependency-versions.gradle")
Expand All @@ -38,6 +38,7 @@ apply from: file("gradle/release.gradle")
apply from: file("gradle/rat.gradle")
apply from: file('gradle/customize.gradle')


rat {
excludes = [
'*.patch',
Expand Down Expand Up @@ -125,6 +126,7 @@ project(':samza-api') {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}
}

Expand All @@ -135,6 +137,7 @@ project(":samza-core_$scalaVersion") {
// Force scala joint compilation
sourceSets.main.scala.srcDir "src/main/java"
sourceSets.test.scala.srcDir "src/test/java"

sourceSets.main.java.srcDirs = []

jar {
Expand All @@ -158,6 +161,7 @@ project(":samza-core_$scalaVersion") {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}
}

Expand Down Expand Up @@ -190,6 +194,7 @@ project(":samza-autoscaling_$scalaVersion") {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}
}

Expand Down Expand Up @@ -269,6 +274,7 @@ project(':samza-log4j') {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}
}

Expand Down Expand Up @@ -412,6 +418,7 @@ project(":samza-kv_$scalaVersion") {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}
}

Expand Down Expand Up @@ -446,27 +453,27 @@ project(":samza-kv-rocksdb_$scalaVersion") {
}

project(":samza-hdfs_$scalaVersion") {
apply plugin: 'scala'

dependencies {
compile project(':samza-api')
compile project(":samza-core_$scalaVersion")
compile project(":samza-kafka_$scalaVersion")
compile "org.scala-lang:scala-library:$scalaLibVersion"
compile("org.apache.hadoop:hadoop-hdfs:$yarnVersion") {
exclude module: 'slf4j-log4j12'
exclude module: 'servlet-api'
}
compile("org.apache.hadoop:hadoop-common:$yarnVersion") {
exclude module: 'slf4j-log4j12'
exclude module: 'servlet-api'
exclude module: 'zookeeper'
}

testCompile "junit:junit:$junitVersion"
testCompile "org.scalatest:scalatest_$scalaVersion:$scalaTestVersion"
testCompile "org.apache.hadoop:hadoop-minicluster:$yarnVersion"
apply plugin: 'scala'

dependencies {
compile project(':samza-api')
compile project(":samza-core_$scalaVersion")
compile project(":samza-kafka_$scalaVersion")
compile "org.scala-lang:scala-library:$scalaLibVersion"
compile("org.apache.hadoop:hadoop-hdfs:$yarnVersion") {
exclude module: 'slf4j-log4j12'
exclude module: 'servlet-api'
}
compile("org.apache.hadoop:hadoop-common:$yarnVersion") {
exclude module: 'slf4j-log4j12'
exclude module: 'servlet-api'
exclude module: 'zookeeper'
}

testCompile "junit:junit:$junitVersion"
testCompile "org.scalatest:scalatest_$scalaVersion:$scalaTestVersion"
testCompile "org.apache.hadoop:hadoop-minicluster:$yarnVersion"
}
}

project(":samza-rest") {
Expand Down Expand Up @@ -569,6 +576,7 @@ project(":samza-test_$scalaVersion") {

checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
toolVersion = "$checkstyleVersion"
}

tasks.create(name: "releaseTestJobs", dependsOn: configurations.archives.artifacts, type: Tar) {
Expand Down
3 changes: 2 additions & 1 deletion checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@
<property name="basicOffset" value="2"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="2"/>
<property name="lineWrappingIndentation" value="2"/>
</module>
<module name="MethodParamPad"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
</module>
</module>
</module>
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ gradleVersion=2.0
org.gradle.jvmargs="-XX:MaxPermSize=512m"

systemProp.file.encoding=utf-8
checkstyleVersion=5.9
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ public void tearDown() {
localityManager.writeContainerToHostMapping(0, "localhost", "jmx:localhost:8080", "jmx:tunnel:localhost:9090");
Map<Integer, Map<String, String>> localMap = localityManager.readContainerLocality();
Map<Integer, Map<String, String>> expectedMap =
new HashMap<Integer, Map<String, String>>() {
{
this.put(new Integer(0),
new HashMap<String, String>() {
{
this.put(SetContainerHostMapping.HOST_KEY, "localhost");
this.put(SetContainerHostMapping.JMX_URL_KEY, "jmx:localhost:8080");
this.put(SetContainerHostMapping.JMX_TUNNELING_URL_KEY, "jmx:tunnel:localhost:9090");
}
});
}
};
new HashMap<Integer, Map<String, String>>() {
{
this.put(new Integer(0),
new HashMap<String, String>() {
{
this.put(SetContainerHostMapping.HOST_KEY, "localhost");
this.put(SetContainerHostMapping.JMX_URL_KEY, "jmx:localhost:8080");
this.put(SetContainerHostMapping.JMX_TUNNELING_URL_KEY, "jmx:tunnel:localhost:9090");
}
});
}
};
assertEquals(expectedMap, localMap);

localityManager.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public void tearDown() {
assertTrue(consumer.isStarted());

Map<String, Integer> expectedMap =
new HashMap<String, Integer>() {
{
this.put("Task0", new Integer(0));
this.put("Task1", new Integer(1));
this.put("Task2", new Integer(2));
this.put("Task3", new Integer(0));
this.put("Task4", new Integer(1));
}
};
new HashMap<String, Integer>() {
{
this.put("Task0", new Integer(0));
this.put("Task1", new Integer(1));
this.put("Task2", new Integer(2));
this.put("Task3", new Integer(0));
this.put("Task4", new Integer(1));
}
};

for (Map.Entry<String, Integer> entry : expectedMap.entrySet()) {
taskAssignmentManager.writeTaskContainerMapping(entry.getKey(), entry.getValue());
Expand Down Expand Up @@ -110,12 +110,12 @@ public void tearDown() {
assertTrue(consumer.isStarted());

Map<String, Integer> expectedMap =
new HashMap<String, Integer>() {
{
this.put("Task0", new Integer(0));
this.put("Task1", new Integer(1));
}
};
new HashMap<String, Integer>() {
{
this.put("Task0", new Integer(0));
this.put("Task1", new Integer(1));
}
};

for (Map.Entry<String, Integer> entry : expectedMap.entrySet()) {
taskAssignmentManager.writeTaskContainerMapping(entry.getKey(), entry.getValue());
Expand Down

0 comments on commit 19ef7cd

Please sign in to comment.