Skip to content

Commit

Permalink
Fixes asciidoctor#405. Adds integration tests to asciidoctorj-distrib…
Browse files Browse the repository at this point in the history
…ution.
  • Loading branch information
robertpanzer committed Nov 20, 2015
1 parent f87e9cb commit 527ab90
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
3 changes: 3 additions & 0 deletions asciidoctorj-distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ dependencies {
compile project(':asciidoctorj')
compile project(':asciidoctorj-epub3')
compile project(':asciidoctorj-pdf')
compile project(':asciidoctorj-diagram')

testCompile project(':asciidoctorj-arquillian-extension')
}

// we're creating a dist, not a jar, silly Gradle
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.asciidoctor.diagram

import org.asciidoctor.Asciidoctor
import org.asciidoctor.OptionsBuilder
import org.jboss.arquillian.spock.ArquillianSputnik
import org.jboss.arquillian.test.api.ArquillianResource
import org.junit.runner.RunWith
import spock.lang.Specification

@RunWith(ArquillianSputnik)
class WhenDitaaDiagramIsRendered extends Specification {

@ArquillianResource
private Asciidoctor asciidoctor

def 'should render ditaa diagram'() throws Exception {

given:

String imageFileName = UUID.randomUUID()

String document = """= Document Title
Hello World
[ditaa,${imageFileName}]
....
+---+
| A |
+---+
....
"""

asciidoctor.requireLibrary('asciidoctor-diagram')

when:
String result = asciidoctor.convert(document, OptionsBuilder.options().toFile(false).attributes(['imagesoutdir': 'build']))

then:
result.contains("""src="${imageFileName}.png""")
new File("build/${imageFileName}.png").exists()
new File("build/${imageFileName}.png.cache").exists()
}
}
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ext {
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.35'
jrubyVersion = '9.0.3.0'
jrubyVersion = '9.0.4.0'
jsoupVersion = '1.8.1'
junitVersion = '4.12'
nettyVersion = '4.0.33.Final'
Expand Down Expand Up @@ -97,7 +97,7 @@ subprojects {
}

// apply Java and JRuby stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
subprojects {

plugins.withType(JavaPlugin) {

Expand All @@ -111,7 +111,7 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
task.targetCompatibility = project.targetCompatibility
}
}

dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
Expand All @@ -134,8 +134,7 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
else {
} else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}

Expand All @@ -156,6 +155,9 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {

task sourcesJar(type: Jar, dependsOn: classes, group: 'Release') {
description 'Assembles a jar archive containing the main source code.'
Expand Down

0 comments on commit 527ab90

Please sign in to comment.