Skip to content

Commit

Permalink
migrated to Junit5 native Gradle support, upgrade to Flink 1.5, Hive 2.1
Browse files Browse the repository at this point in the history
(older are still working)
  • Loading branch information
jornfranke committed Jul 12, 2018
1 parent 1c57676 commit c732fae
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 192 deletions.
67 changes: 14 additions & 53 deletions examples/mapreduce-excelinput/build.gradle
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'jacoco'
apply plugin: 'org.junit.platform.gradle.plugin'

mainClassName = "org.zuinnote.hadoop.office.example.driver.Excel2CSVDriver"
compileJava.options.encoding = 'UTF-8'
Expand Down Expand Up @@ -55,24 +54,6 @@ eclipse {
javadoc.classpath += configurations.provided


// Integrate JaCoCo for jUnit5
project.afterEvaluate {
def junitPlatformTestTask = project.tasks.getByName('junitPlatformTest')

// configure jacoco to analyze the junitPlatformTest task
jacoco {
applyTo junitPlatformTestTask
}

// create junit platform jacoco task
project.task(type: JacocoReport, "junitPlatformJacocoReport",
{
sourceDirectories = files("./src/main")
classDirectories = files("$buildDir/classes/main")
executionData junitPlatformTestTask
})
}


sourceSets {
main.compileClasspath += configurations.provided
Expand All @@ -96,11 +77,11 @@ dependencies {
// hadoopoffice library
compile("com.github.zuinnote:hadoopoffice-fileformat:1.1.1")

testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.1.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'

testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testIntegrationRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testIntegrationRuntime group: 'org.junit.platform', name: 'junit-platform-console', version: '1.1.1'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
testIntegrationRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
testIntegrationRuntime group: 'org.junit.platform', name: 'junit-platform-console', version: '1.2.0'
testIntegrationCompile group: 'org.apache.hadoop', name: 'hadoop-minicluster', version: '2.7.0'
}

Expand All @@ -115,39 +96,19 @@ uploadArchives {
}
}

task testUnit(type: JavaExec, dependsOn: jar) {
group 'Verification'
description 'Runs the unit tests.'

classpath = sourceSets.test.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath

main 'org.junit.platform.console.ConsoleLauncher'
args = ['--scan-classpath', sourceSets.testIntegration.output.classesDirs.asPath,
'--reports-dir', "${buildDir}/test-results/testIntegration"
]
test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}

task testIntegration(type: JavaExec, dependsOn: jar) {
group 'Verification'
description 'Runs the integration tests.'

task testIntegration(type: Test) {
testClassesDirs = sourceSets.testIntegration.output.classesDirs
classpath = sourceSets.testIntegration.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath

main 'org.junit.platform.console.ConsoleLauncher'
args = ['--scan-classpath', sourceSets.testIntegration.output.classesDirs.asPath,
'--reports-dir', "${buildDir}/test-results/integration-test"
]
useJUnitPlatform()
}


1
2

check.dependsOn testIntegration
testIntegration.mustRunAfter testUnit

afterEvaluate {
jacoco {
applyTo testUnit
applyTo testIntegration
}
}
testIntegration.mustRunAfter test
58 changes: 12 additions & 46 deletions examples/mapreduce-exceloutput/build.gradle
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'jacoco'
apply plugin: 'org.junit.platform.gradle.plugin'

mainClassName = "org.zuinnote.hadoop.office.example.driver.CSV2ExcelDriver"
compileJava.options.encoding = 'UTF-8'
Expand Down Expand Up @@ -55,24 +54,6 @@ eclipse {
javadoc.classpath += configurations.provided


// Integrate JaCoCo for jUnit5
project.afterEvaluate {
def junitPlatformTestTask = project.tasks.getByName('junitPlatformTest')

// configure jacoco to analyze the junitPlatformTest task
jacoco {
applyTo junitPlatformTestTask
}

// create junit platform jacoco task
project.task(type: JacocoReport, "junitPlatformJacocoReport",
{
sourceDirectories = files("./src/main")
classDirectories = files("$buildDir/classes/main")
executionData junitPlatformTestTask
})
}


sourceSets {
main.compileClasspath += configurations.provided
Expand All @@ -96,11 +77,11 @@ dependencies {
// hadoopoffice library
compile("com.github.zuinnote:hadoopoffice-fileformat:1.1.1")

testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.1.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'

testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testIntegrationRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testIntegrationRuntime group: 'org.junit.platform', name: 'junit-platform-console', version: '1.1.1'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
testIntegrationRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
testIntegrationRuntime group: 'org.junit.platform', name: 'junit-platform-console', version: '1.2.0'
testIntegrationCompile group: 'org.apache.hadoop', name: 'hadoop-minicluster', version: '2.7.0'
}

Expand All @@ -115,35 +96,20 @@ uploadArchives {
}
}

task testUnit(type: JavaExec, dependsOn: jar) {
group 'Verification'
description 'Runs the unit tests.'

classpath = sourceSets.test.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath

main 'org.junit.platform.console.ConsoleLauncher'
args = ['--scan-classpath', sourceSets.testIntegration.output.classesDirs.asPath,
'--reports-dir', "${buildDir}/test-results/testIntegration"
]
test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}

task testIntegration(type: JavaExec, dependsOn: jar) {
group 'Verification'
description 'Runs the integration tests.'

task testIntegration(type: Test) {
testClassesDirs = sourceSets.testIntegration.output.classesDirs
classpath = sourceSets.testIntegration.runtimeClasspath
systemProperties['jar.path'] = jar.archivePath

main 'org.junit.platform.console.ConsoleLauncher'
args = ['--scan-classpath', sourceSets.testIntegration.output.classesDirs.asPath,
'--reports-dir', "${buildDir}/test-results/integration-test"
]
useJUnitPlatform()
}


check.dependsOn testIntegration
testIntegration.mustRunAfter testUnit
testIntegration.mustRunAfter test

afterEvaluate {
jacoco {
Expand Down
37 changes: 11 additions & 26 deletions fileformat/build.gradle
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'jacoco'
apply plugin: 'org.junit.platform.gradle.plugin'


sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

group = "com.github.zuinnote"
archivesBaseName = "hadoopoffice-fileformat"
version = "1.1.1"
version = "1.2.0"

jar {
manifest {
Expand All @@ -32,23 +32,6 @@ jacocoTestReport {
}
}

// Integrate JaCoCo for jUnit5
project.afterEvaluate {
def junitPlatformTestTask = project.tasks.getByName('junitPlatformTest')

// configure jacoco to analyze the junitPlatformTest task
jacoco {
applyTo junitPlatformTestTask
}

// create junit platform jacoco task
project.task(type: JacocoReport, "junitPlatformJacocoReport",
{
sourceDirectories = files("./src/main")
classDirectories = files("$buildDir/classes/main")
executionData junitPlatformTestTask
})
}

configurations {
provided
Expand Down Expand Up @@ -87,14 +70,15 @@ artifacts {

test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.github.zuinnote'
artifactId 'hadoopoffice-fileformat'
version '1.1.1'
version '1.2.0'
from components.java
}
}
Expand All @@ -107,16 +91,17 @@ dependencies {
compile("org.apache.poi:poi:3.17")
compile("org.apache.poi:poi-ooxml:3.17")
// for signing and verification of signatures
provided("org.bouncycastle:bcprov-ext-jdk15on:1.58")
provided("org.bouncycastle:bcpkix-jdk15on:1.58")
provided("org.bouncycastle:bcprov-ext-jdk15on:1.59")
provided("org.bouncycastle:bcpkix-jdk15on:1.59")
provided("org.apache.santuario:xmlsec:2.1.0")
// hadoop libraries
provided("org.apache.hadoop:hadoop-common:2.7.0")
provided("org.apache.hadoop:hadoop-mapreduce-client-common:2.7.0")
// log4j2
provided("org.apache.logging.log4j:log4j-api:2.8.1")
provided("org.apache.logging.log4j:log4j-api:2.11.0")
// test
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.1.1'

testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'

testRuntime group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.2.0'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
}
34 changes: 8 additions & 26 deletions flinkds/build.gradle
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'jacoco'
apply plugin: 'org.junit.platform.gradle.plugin'


sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

group = "com.github.zuinnote"
archivesBaseName = "hadoopoffice-flinkds"
version = "1.1.1"
version = "1.2.0"


jar {
Expand Down Expand Up @@ -38,25 +38,6 @@ jacocoTestReport {
}


// Integrate JaCoCo for jUnit5
project.afterEvaluate {
def junitPlatformTestTask = project.tasks.getByName('junitPlatformTest')

// configure jacoco to analyze the junitPlatformTest task
jacoco {
applyTo junitPlatformTestTask
}

// create junit platform jacoco task
project.task(type: JacocoReport, "junitPlatformJacocoReport",
{
sourceDirectories = files("./src/main")
classDirectories = files("$buildDir/classes/main")
executionData junitPlatformTestTask
})
}


configurations {
provided
integrationTestCompile.extendsFrom testCompile
Expand Down Expand Up @@ -90,20 +71,20 @@ dependencies {
// hadoopoffice library
compile("com.github.zuinnote:hadoopoffice-fileformat:1.1.1")
// flink api
provided("org.apache.flink:flink-java:1.3.2")
provided("org.apache.flink:flink-java:1.5.0")
// log4j2
provided("org.apache.logging.log4j:log4j-api:2.4.1")
provided("org.apache.logging.log4j:log4j-api:2.11.0")
// testing
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.1.1'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
}

publishing {
publications {
maven(MavenPublication) {
groupId 'com.github.zuinnote'
artifactId 'hadoopoffice-flinkds'
version '1.1.1'
version '1.2.0'

from components.java
}
Expand All @@ -115,6 +96,7 @@ publishing {

test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}

javadoc.classpath += configurations.provided
Expand Down

0 comments on commit c732fae

Please sign in to comment.