switch Replace the AUDIT_MODE == WRAP dispatch in zeroecho.core.CryptoAlgorithms#create(...) with an exhaustive Java 21 pattern switch over the sealed CryptoContext hierarchy. This removes the repeated instanceof chain, keeps unchecked casts localized in a single internal helper, and closes the missing audit-wrap gap for AgreementContext. Add focused JUnit 5 coverage for audited proxy wrapping using Mockito-based tests for representative context interfaces and wrapper lifecycle delegation. Closes #20 Time-Spent: 45m
72 lines
2.3 KiB
Groovy
72 lines
2.3 KiB
Groovy
plugins {
|
|
id 'buildlogic.java-library-conventions'
|
|
id 'com.palantir.git-version'
|
|
}
|
|
|
|
group='org.egothor'
|
|
|
|
configurations {
|
|
mockitoAgent
|
|
}
|
|
|
|
dependencies {
|
|
api 'org.bouncycastle:bcpkix-jdk18on'
|
|
implementation 'org.egothor:conflux'
|
|
|
|
testImplementation "org.mockito:mockito-core:5.23.0"
|
|
testImplementation "org.mockito:mockito-inline:5.2.0"
|
|
|
|
mockitoAgent("org.mockito:mockito-core:5.23.0") {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
|
|
def generatedDir = layout.buildDirectory.dir("generated/docs").get().asFile
|
|
def staticOverview = file("src/main/javadoc/overview.html")
|
|
def overviewCss = file("src/main/javadoc/css/overview.css")
|
|
|
|
tasks.register('generateCryptoTable', JavaExec) {
|
|
group = 'documentation'
|
|
description = 'Generates the Crypto Catalog table fragment'
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
mainClass = 'zeroecho.core.util.GenerateCryptoCatalogTable'
|
|
args file("$generatedDir/crypto-catalog-table.html").absolutePath
|
|
dependsOn classes
|
|
}
|
|
|
|
tasks.register('composeOverview') {
|
|
group = 'documentation'
|
|
description = 'Produces a final overview.html by injecting the generated table into the static template'
|
|
inputs.file(staticOverview)
|
|
inputs.file("$generatedDir/crypto-catalog-table.html")
|
|
outputs.file("$generatedDir/overview.composed.html")
|
|
dependsOn tasks.named('generateCryptoTable')
|
|
doLast {
|
|
def template = staticOverview.getText('UTF-8')
|
|
def table = file("$generatedDir/crypto-catalog-table.html").getText('UTF-8')
|
|
def marker = "<!-- CRYPTO_CATALOG_TABLE -->"
|
|
if (!template.contains(marker)) {
|
|
throw new GradleException("Marker not found in ${staticOverview}: ${marker}")
|
|
}
|
|
def composed = template.replace(marker, table)
|
|
file("$generatedDir/overview.composed.html").setText(composed, 'UTF-8')
|
|
}
|
|
}
|
|
|
|
javadoc {
|
|
dependsOn tasks.named('composeOverview')
|
|
options.overview = file("$generatedDir/overview.composed.html")
|
|
options.encoding = 'UTF-8'
|
|
// options.stylesheetFile = overviewCss
|
|
options.addStringOption("-add-stylesheet", overviewCss.absolutePath)
|
|
|
|
options.links("https://www.egothor.org/javadoc/conflux")
|
|
// options.overview = file("src/main/javadoc/overview.html")
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
jvmArgs("-javaagent:${configurations.mockitoAgent.singleFile}")
|
|
}
|