aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/maven
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-09-16 09:29:25 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-11-13 19:46:36 +0100
commit1a552c1f64fc15a94c298e50a3dd614f3794c0e3 (patch)
tree5aab050b712775ef98da5041e673100c75f9ee56 /integration-tests/maven
parente03aed7331756eaef766c7306bd033c84f7fd815 (diff)
downloaddokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.gz
dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.bz2
dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.zip
Add integration tests for Kotlin projects
Diffstat (limited to 'integration-tests/maven')
m---------integration-tests/maven/projects/biojava/biojava0
-rw-r--r--integration-tests/maven/projects/biojava/biojava.diff42
-rw-r--r--integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt59
3 files changed, 101 insertions, 0 deletions
diff --git a/integration-tests/maven/projects/biojava/biojava b/integration-tests/maven/projects/biojava/biojava
new file mode 160000
+Subproject 633021b1cf6c1aafd45df2d94dc2ad6eadad398
diff --git a/integration-tests/maven/projects/biojava/biojava.diff b/integration-tests/maven/projects/biojava/biojava.diff
new file mode 100644
index 00000000..84fbe50f
--- /dev/null
+++ b/integration-tests/maven/projects/biojava/biojava.diff
@@ -0,0 +1,42 @@
+diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml
+index 6cc9c6c9a..ef4f28225 100644
+--- a/biojava-core/pom.xml
++++ b/biojava-core/pom.xml
+@@ -22,9 +22,36 @@
+ </license>
+ </licenses>
+
++ <pluginRepositories>
++ <pluginRepository>
++ <id>kotlin-dev</id>
++ <url>https://dl.bintray.com/kotlin/kotlin-dev</url>
++ </pluginRepository>
++ <pluginRepository>
++ <id>kotlin-eap</id>
++ <url>https://dl.bintray.com/kotlin/kotlin-eap</url>
++ </pluginRepository>
++ <pluginRepository>
++ <id>jcenter</id>
++ <url>https://jcenter.bintray.com/</url>
++ </pluginRepository>
++ </pluginRepositories>
++
+ <build>
+ <plugins>
+-
++ <plugin>
++ <groupId>org.jetbrains.dokka</groupId>
++ <artifactId>dokka-maven-plugin</artifactId>
++ <version>${dokka_version}</version>
++ <executions>
++ <execution>
++ <phase>pre-site</phase>
++ <goals>
++ <goal>javadoc</goal>
++ </goals>
++ </execution>
++ </executions>
++ </plugin>
+ <!-- Excluding demo package is required for avoiding namespace clashes (demo package is in all modules) for signing the jar. See issue #387 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
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)"
+ )
+ }
+}