Skip to content

Commit

Permalink
CORDA-1301: Test that quasar-core is added to runtime and cordaRuntim…
Browse files Browse the repository at this point in the history
…e. (#46)
  • Loading branch information
chrisr3 authored Apr 5, 2018
1 parent a1b6464 commit fc2197e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions quasar-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ gradlePlugin {

dependencies {
compile project(':cordapp')
testCompile "junit:junit:$junit_version"
testCompile "org.assertj:assertj-core:$assertj_version"
}

publish {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package net.corda.plugins

import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder

import static org.assertj.core.api.Assertions.*
import static org.gradle.testkit.runner.TaskOutcome.*
import static org.junit.Assert.*

class QuasarPluginTest {
private static final String TEST_GRADLE_USER_HOME = System.getProperty("test.gradle.user.home", ".")

@Rule
public final TemporaryFolder testProjectDir = new TemporaryFolder()

@Test
void checkIsRuntime() {
def quasarVersion = "0.7.9"

def buildFile = testProjectDir.newFile("build.gradle")
buildFile.text = """
buildscript {
ext {
quasar_group = 'co.paralleluniverse'
quasar_version = '$quasarVersion'
}
}
plugins {
id 'java'
id 'net.corda.plugins.quasar-utils' apply false
}
description 'Show quasar-core added to runtime configurations'
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: 'net.corda.plugins.quasar-utils'
jar {
enabled = false
}
configurations.runtime.forEach {
println "runtime: \${it.name}"
}
configurations.cordaRuntime.forEach {
println "cordaRuntime: \${it.name}"
}
"""
def result = GradleRunner.create()
.withProjectDir(testProjectDir.getRoot())
.withArguments("--info", "build", "-g", TEST_GRADLE_USER_HOME)
.withPluginClasspath()
.build()
println result.output

def output = result.output.readLines()
assertThat(output).containsOnlyOnce(
"runtime: quasar-core-$quasarVersion-jdk8.jar".toString(),
"cordaRuntime: quasar-core-$quasarVersion-jdk8.jar".toString()
)

def build = result.task(":build")
assertNotNull(build)
assertEquals(UP_TO_DATE, build.outcome)
}
}

0 comments on commit fc2197e

Please sign in to comment.