diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-16 09:29:25 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-11-13 19:46:36 +0100 |
commit | 1a552c1f64fc15a94c298e50a3dd614f3794c0e3 (patch) | |
tree | 5aab050b712775ef98da5041e673100c75f9ee56 /integration-tests/maven/src/integrationTest/kotlin/org/jetbrains | |
parent | e03aed7331756eaef766c7306bd033c84f7fd815 (diff) | |
download | dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.gz dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.bz2 dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.zip |
Add integration tests for Kotlin projects
Diffstat (limited to 'integration-tests/maven/src/integrationTest/kotlin/org/jetbrains')
-rw-r--r-- | integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt new file mode 100644 index 00000000..4037cc08 --- /dev/null +++ b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt @@ -0,0 +1,59 @@ +package org.jetbrains.dokka.it.maven + +import org.jetbrains.dokka.it.* +import java.io.File +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class BiojavaIntegrationTest : AbstractIntegrationTest(), S3Project { + + private val currentDokkaVersion: String = checkNotNull(System.getenv("DOKKA_VERSION")) + private val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH"))) + override val projectOutputLocation: File by lazy { File(projectDir, "biojava-core/target/dokkaJavadoc") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "biojava/biojava") + templateProjectDir.copyRecursively(projectDir) + val customResourcesDir = File(templateProjectDir, "custom Resources") + if (customResourcesDir.exists() && customResourcesDir.isDirectory) { + customResourcesDir.copyRecursively(File(projectDir, "customResources"), overwrite = true) + } + copyAndApplyGitDiff(File("projects", "biojava/biojava.diff")) + } + + @Test + fun `dokka javadoc`() { + val result = ProcessBuilder().directory(projectDir) + .command(mavenBinaryFile.absolutePath, "dokka:javadoc", "-pl", "biojava-core", "\"-Ddokka_version=$currentDokkaVersion\"", "-U", "-e").start().awaitProcessResult() + + diagnosticAsserts(result) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + val scriptsDir = File(projectOutputLocation, "jquery") + assertTrue(scriptsDir.isDirectory, "Missing jquery directory") + + val stylesDir = File(projectOutputLocation, "resources") + assertTrue(stylesDir.isDirectory, "Missing resources directory") + + 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)" + ) + } +} |