Skip to content

Commit

Permalink
Rename getEntryContent
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jan 5, 2025
1 parent 6692d2d commit e1fbac2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text1 = outputShadowJar.getEntryContent(ENTRY_SERVICES_SHADE)
val text1 = outputShadowJar.getContent(ENTRY_SERVICES_SHADE)
assertThat(text1).isEqualTo(CONTENT_ONE_TWO)

val text2 = outputShadowJar.getEntryContent(ENTRY_SERVICES_FOO)
val text2 = outputShadowJar.getContent(ENTRY_SERVICES_FOO)
assertThat(text2).isEqualTo("one")
}

Expand All @@ -48,7 +48,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(ENTRY_FOO_SHADE)
val text = outputShadowJar.getContent(ENTRY_FOO_SHADE)
assertThat(text).isEqualTo(CONTENT_ONE_TWO)
}

Expand All @@ -67,10 +67,10 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text1 = outputShadowJar.getEntryContent(ENTRY_SERVICES_SHADE)
val text1 = outputShadowJar.getContent(ENTRY_SERVICES_SHADE)
assertThat(text1).isEqualTo(CONTENT_ONE_TWO)

val text2 = outputShadowJar.getEntryContent(ENTRY_SERVICES_FOO)
val text2 = outputShadowJar.getContent(ENTRY_SERVICES_FOO)
assertThat(text2).isEqualTo("one")
}

Expand Down Expand Up @@ -117,7 +117,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text1 = outputShadowJar.getEntryContent("META-INF/services/java.sql.Driver")
val text1 = outputShadowJar.getContent("META-INF/services/java.sql.Driver")
assertThat(text1).isEqualTo(
"""
oracle.jdbc.OracleDriver
Expand All @@ -127,15 +127,15 @@ class ServiceFileTransformerTest : BaseTransformerTest() {
""".trimIndent(),
)

val text2 = outputShadowJar.getEntryContent("META-INF/services/myapache.axis.components.compiler.Compiler")
val text2 = outputShadowJar.getContent("META-INF/services/myapache.axis.components.compiler.Compiler")
assertThat(text2).isEqualTo(
"""
myapache.axis.components.compiler.Javac
org.apache.axis.components.compiler.Jikes
""".trimIndent(),
)

val text3 = outputShadowJar.getEntryContent("META-INF/services/org.apache.commons.logging.LogFactory")
val text3 = outputShadowJar.getContent("META-INF/services/org.apache.commons.logging.LogFactory")
assertThat(text3).isEqualTo(
"""
myapache.commons.logging.impl.LogFactoryImpl
Expand Down Expand Up @@ -163,7 +163,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(ENTRY_FOO_SHADE)
val text = outputShadowJar.getContent(ENTRY_FOO_SHADE)
assertThat(text).isEqualTo(CONTENT_ONE_TWO)
}

Expand Down Expand Up @@ -196,7 +196,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(servicesShadowEntry)
val text = outputShadowJar.getContent(servicesShadowEntry)
assertThat(text).isEqualTo(CONTENT_THREE + "\n" + CONTENT_ONE_TWO)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(ENTRY_TEST_PROPERTIES)
val text = outputShadowJar.getContent(ENTRY_TEST_PROPERTIES)
assertThat(text.trimIndent()).isEqualTo(CONTENT_ONE_TWO)
}

Expand All @@ -57,7 +57,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(ENTRY_TEST_PROPERTIES)
val text = outputShadowJar.getContent(ENTRY_TEST_PROPERTIES)
assertThat(text.trimIndent()).isEqualTo(CONTENT_ONE_TWO)
}

Expand Down Expand Up @@ -150,7 +150,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val text = outputShadowJar.getEntryContent(propertiesXml)
val text = outputShadowJar.getContent(propertiesXml)
assertThat(text.trimIndent()).isEqualTo(
"""
<?xml version="1.0" encoding="UTF-8"?>
Expand Down Expand Up @@ -232,7 +232,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val props = outputShadowJar.getEntryContent(ENTRY_SERVICE_EXTENSION_MODULE).toProperties()
val props = outputShadowJar.getContent(ENTRY_SERVICE_EXTENSION_MODULE).toProperties()
assertThat(props.getProperty("moduleName")).isEqualTo("MergedByShadowJar")
assertThat(props.getProperty("moduleVersion")).isEqualTo("1.0.0")
assertThat(props.getProperty("extensionClasses"))
Expand Down Expand Up @@ -273,7 +273,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val props = outputShadowJar.getEntryContent(ENTRY_GROOVY_EXTENSION_MODULE).toProperties()
val props = outputShadowJar.getContent(ENTRY_GROOVY_EXTENSION_MODULE).toProperties()
assertThat(props.getProperty("moduleName")).isEqualTo("MergedByShadowJar")
assertThat(props.getProperty("moduleVersion")).isEqualTo("1.0.0")
assertThat(props.getProperty("extensionClasses"))
Expand Down Expand Up @@ -318,7 +318,7 @@ class TransformersTest : BaseTransformerTest() {

run(shadowJarTask)

val props = outputShadowJar.getEntryContent(ENTRY_SERVICE_EXTENSION_MODULE).toProperties()
val props = outputShadowJar.getContent(ENTRY_SERVICE_EXTENSION_MODULE).toProperties()
assertThat(props.getProperty("moduleName")).isEqualTo("MergedByShadowJar")
assertThat(props.getProperty("moduleVersion")).isEqualTo("1.0.0")
assertThat(props.getProperty("extensionClasses"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class JarPath(val path: Path) :
path.deleteExisting()
}

fun getEntryContent(entryName: String): String {
fun getContent(entryName: String): String {
val entry = getEntry(entryName) ?: error("Entry not found: $entryName")
return getInputStream(entry).bufferedReader().readText()
}
Expand Down

0 comments on commit e1fbac2

Please sign in to comment.