forked from woggioni/rbcs
Add optional OpenTelemetry Netty server instrumentation
- Update lys.version to 2026.04.14 - Add optional compileOnly dependency on opentelemetry-netty-4.1 in rbcs-server - Add runtime guard to only activate instrumentation when OTel classes are on classpath - Insert OTel combined handler after HttpServerCodec in the Netty pipeline - Add requires-static JPMS directives for optional module support - Add enableTelemetry config attribute to rbcs:server with default false - Update Configuration DTO, XSD schema, Parser, Serializer, and all tests
This commit is contained in:
17
rbcs-common/bin/test/net/woggioni/rbcs/common/CidrTest.kt
Normal file
17
rbcs-common/bin/test/net/woggioni/rbcs/common/CidrTest.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
package net.woggioni.rbcs.common
|
||||
|
||||
import java.net.InetAddress
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class CidrTest {
|
||||
class CidrTest {
|
||||
@Test
|
||||
fun test() {
|
||||
val cidr = Cidr.from("2a02:4780:12:368b::1/128")
|
||||
Assertions.assertTrue {
|
||||
cidr.contains(InetAddress.ofLiteral("2a02:4780:12:368b::1"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package net.woggioni.rbcs.common
|
||||
|
||||
import java.security.Provider
|
||||
import java.security.Security
|
||||
import java.util.Base64
|
||||
import net.woggioni.rbcs.common.PasswordSecurity.decodePasswordHash
|
||||
import net.woggioni.rbcs.common.PasswordSecurity.hashPassword
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.EnumSource
|
||||
|
||||
|
||||
class PasswordHashingTest {
|
||||
|
||||
@EnumSource(PasswordSecurity.Algorithm::class)
|
||||
@ParameterizedTest
|
||||
fun test(algo: PasswordSecurity.Algorithm) {
|
||||
val password = "password"
|
||||
val encoded = hashPassword(password, algorithm = algo)
|
||||
val (_, salt) = decodePasswordHash(encoded, algo)
|
||||
Assertions.assertEquals(encoded,
|
||||
hashPassword(password, salt = salt.let(Base64.getEncoder()::encodeToString), algorithm = algo)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun listAvailableAlgorithms() {
|
||||
Security.getProviders().asSequence()
|
||||
.flatMap { provider: Provider -> provider.services.asSequence() }
|
||||
.filter { service: Provider.Service -> "SecretKeyFactory" == service.type }
|
||||
.map(Provider.Service::getAlgorithm)
|
||||
.forEach {
|
||||
println(it)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user