-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CORDA-1301: Test that quasar-core is added to runtime and cordaRuntim…
…e. (#46)
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
quasar-utils/src/test/groovy/net/corda/plugins/QuasarPluginTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |