Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Feb 21, 2024
1 parent c028228 commit 904f56f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions sonatype/src/test/kotlin/com/bakdata/gradle/SonatypePluginIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ internal class SonatypePluginIT {
}

val projectName = testProjectDir.fileName.toString()
val expectedUploades = listOf(".jar", ".pom", "-javadoc.jar", "-sources.jar")
val expectedUploads = listOf(".jar", ".pom", "-javadoc.jar", "-sources.jar", ".module")
.map { classifier -> "$projectName/$TEST_VERSION/$projectName-$TEST_VERSION$classifier" }
.flatMap { baseFile -> listOf(baseFile, "$baseFile.asc") }
.plus("$projectName/maven-metadata.xml")
.flatMap { file -> listOf(file, "$file.md5", "$file.sha1") }
assertThat(getUploadedFilesInGroup(wiremock)).containsExactlyInAnyOrderElementsOf(expectedUploades)
.flatMap { file -> listOf(file, "$file.md5", "$file.sha1", "$file.sha256", "$file.sha512") }
assertThat(getUploadedFilesInGroup(wiremock)).containsExactlyInAnyOrderElementsOf(expectedUploads)
}

private fun getUploadedFilesInGroup(wiremock: WireMockServer): List<String> {
Expand All @@ -123,7 +123,13 @@ internal class SonatypePluginIT {
.willReturn(okJson("""{"data": [{"id": $PROFILE_ID, "name": "${TEST_GROUP}"}]}""")))
wiremock.stubFor(post(urlMatching("/staging/profiles/$PROFILE_ID/start"))
.willReturn(okJson("""{"data": {"stagedRepositoryId": $STAGING_ID}}""")))
wiremock.stubFor(any(urlMatching("/staging/deploy.*"))
wiremock.stubFor(get(urlMatching("/staging/deployByRepositoryId/$STAGING_ID/.*/maven-metadata.xml"))
.willReturn(okXml("""
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
</metadata>
""".trimIndent())))
wiremock.stubFor(put(urlMatching("/staging/deploy.*"))
.willReturn(ok()))
wiremock.stubFor(get(urlMatching("/staging/profile_repositories/$PROFILE_ID"))
.willReturn(okJson("""{"data": [{"type": "open", "repositoryId": "$REPO_ID"}]}""")))
Expand All @@ -140,7 +146,6 @@ internal class SonatypePluginIT {
.willReturn(okJson("""{"type": "released", "transitioning": false}""")))
}

@Disabled("java.io.EOFException: input contained no data") //FIXME
@Test
fun testMultiModuleProject(@TempDir testProjectDir: Path, @Wiremock wiremock: WireMockServer) {
Files.writeString(testProjectDir.resolve("build.gradle.kts"), """
Expand Down Expand Up @@ -201,12 +206,12 @@ internal class SonatypePluginIT {
.haveExactly(1, taskWithPathAndOutcome(":closeAndReleaseRepository", TaskOutcome.SUCCESS))
}

val expectedUploades = listOf(".jar", ".pom", "-javadoc.jar", "-sources.jar")
val expectedUploads = listOf(".jar", ".pom", "-javadoc.jar", "-sources.jar", ".module")
.flatMap { classifier -> children.map { child -> "$child/$TEST_VERSION/$child-$TEST_VERSION$classifier" } }
.flatMap { baseFile -> listOf(baseFile, "$baseFile.asc") }
.plus(children.map { child -> "$child/maven-metadata.xml" })
.flatMap { file -> listOf(file, "$file.md5", "$file.sha1") }
assertThat(getUploadedFilesInGroup(wiremock)).containsExactlyInAnyOrderElementsOf(expectedUploades)
.flatMap { file -> listOf(file, "$file.md5", "$file.sha1", "$file.sha256", "$file.sha512") }
assertThat(getUploadedFilesInGroup(wiremock)).containsExactlyInAnyOrderElementsOf(expectedUploads)
}

companion object {
Expand Down

0 comments on commit 904f56f

Please sign in to comment.