aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/maven/src/integrationTest
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2020-07-17 16:36:09 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-07-17 16:36:09 +0200
commit6996b1135f61c7d2cb60b0652c6a2691dda31990 (patch)
treed568096c25e31c28d14d518a63458b5a7526b896 /integration-tests/maven/src/integrationTest
parentde56cab76f556e5b4af0b8c8cb08d8b482b86d0a (diff)
parent1c3530dcbb50c347f80bef694829dbefe89eca77 (diff)
downloaddokka-6996b1135f61c7d2cb60b0652c6a2691dda31990.tar.gz
dokka-6996b1135f61c7d2cb60b0652c6a2691dda31990.tar.bz2
dokka-6996b1135f61c7d2cb60b0652c6a2691dda31990.zip
Merge branch 'dev-0.11.0'
Diffstat (limited to 'integration-tests/maven/src/integrationTest')
-rw-r--r--integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt132
1 files changed, 132 insertions, 0 deletions
diff --git a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt
new file mode 100644
index 00000000..86cc2f41
--- /dev/null
+++ b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt
@@ -0,0 +1,132 @@
+package org.jetbrains.dokka.it.maven
+
+import org.jetbrains.dokka.it.AbstractIntegrationTest
+import org.jetbrains.dokka.it.awaitProcessResult
+import org.jetbrains.dokka.it.ProcessResult
+import java.io.File
+import kotlin.test.BeforeTest
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+class MavenIntegrationTest : AbstractIntegrationTest() {
+
+ private val currentDokkaVersion: String = checkNotNull(System.getenv("DOKKA_VERSION"))
+
+ private val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH")))
+
+ @BeforeTest
+ fun prepareProjectFiles() {
+ val templateProjectDir = File("projects", "it-maven")
+ templateProjectDir.copyRecursively(projectDir)
+ val pomXml = File(projectDir, "pom.xml")
+ assertTrue(pomXml.isFile)
+ pomXml.apply {
+ writeText(readText().replace("\$dokka_version", currentDokkaVersion))
+ }
+ }
+
+ @Test
+ fun `dokka dokka`() {
+ val result = ProcessBuilder().directory(projectDir)
+ .command(mavenBinaryFile.absolutePath, "dokka:dokka", "-U", "-e").start().awaitProcessResult()
+
+ diagnosticAsserts(result)
+
+ val dokkaOutputDir = File(projectDir, "output")
+ assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
+
+ val imagesDir = File(dokkaOutputDir, "images")
+ assertTrue(imagesDir.isDirectory, "Missing images directory")
+
+ val scriptsDir = File(dokkaOutputDir, "scripts")
+ assertTrue(scriptsDir.isDirectory, "Missing scripts directory")
+
+ val stylesDir = File(dokkaOutputDir, "styles")
+ assertTrue(stylesDir.isDirectory, "Missing styles directory")
+
+ val navigationHtml = File(dokkaOutputDir, "navigation.html")
+ assertTrue(navigationHtml.isFile, "Missing navigation.html")
+
+ projectDir.allHtmlFiles().forEach { file ->
+ assertContainsNoErrorClass(file)
+ assertNoUnresolvedLInks(file)
+ }
+ }
+
+ @Test
+ fun `dokka javadoc`() {
+ val result = ProcessBuilder().directory(projectDir)
+ .command(mavenBinaryFile.absolutePath, "dokka:javadoc", "-U", "-e").start().awaitProcessResult()
+
+ diagnosticAsserts(result)
+
+ val dokkaOutputDir = File(projectDir, "output")
+ assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
+
+ val scriptsDir = File(dokkaOutputDir, "jquery")
+ assertTrue(scriptsDir.isDirectory, "Missing jquery directory")
+
+ val stylesDir = File(dokkaOutputDir, "resources")
+ assertTrue(stylesDir.isDirectory, "Missing resources directory")
+
+ projectDir.allHtmlFiles().forEach { file ->
+ assertContainsNoErrorClass(file)
+ assertNoUnresolvedLInks(file)
+ }
+ }
+
+ @Test
+ fun `dokka javadocJar`() {
+ val result = ProcessBuilder().directory(projectDir)
+ .command(mavenBinaryFile.absolutePath, "dokka:javadocJar", "-U", "-e").start().awaitProcessResult()
+
+ diagnosticAsserts(result)
+
+ val dokkaOutputDir = File(projectDir, "output")
+ assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
+
+ val scriptsDir = File(dokkaOutputDir, "jquery")
+ assertTrue(scriptsDir.isDirectory, "Missing jquery directory")
+
+ val stylesDir = File(dokkaOutputDir, "resources")
+ assertTrue(stylesDir.isDirectory, "Missing resources directory")
+
+ val dokkaTargetDir = File(projectDir, "target")
+ assertTrue(dokkaOutputDir.isDirectory, "Missing dokka target directory")
+
+ val jarFile = File(dokkaTargetDir, "it-maven-1.0-SNAPSHOT-javadoc.jar")
+ assertTrue(jarFile.isFile, "Missing dokka jar file")
+
+ projectDir.allHtmlFiles().forEach { file ->
+ assertContainsNoErrorClass(file)
+ assertNoUnresolvedLInks(file)
+ }
+ }
+
+ private fun diagnosticAsserts(result: ProcessResult) {
+ assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)")
+
+ val extensionLoadedRegex = Regex("""Extension: org\.jetbrains\.dokka\.base\.DokkaBase""")
+ val amountOfExtensionsLoaded = extensionLoadedRegex.findAll(result.output).count()
+
+ assertTrue(
+ amountOfExtensionsLoaded > 10,
+ "Expected more than 10 extensions being present (found $amountOfExtensionsLoaded)"
+ )
+
+ val undocumentedReportRegex = Regex("""Undocumented:""")
+ val amountOfUndocumentedReports = undocumentedReportRegex.findAll(result.output).count()
+ assertTrue(
+ amountOfUndocumentedReports > 0,
+ "Expected at least one report of undocumented code (found $amountOfUndocumentedReports)"
+ )
+
+ val undocumentedJavaReportRegex = Regex("""Undocumented: it\.basic\.java""")
+ val amountOfUndocumentedJavaReports = undocumentedJavaReportRegex.findAll(result.output).count()
+ assertTrue(
+ amountOfUndocumentedJavaReports > 0,
+ "Expected at least one report of undocumented java code (found $amountOfUndocumentedJavaReports)"
+ )
+ }
+}