mirror of
https://github.com/corda/corda.git
synced 2025-06-19 15:43:52 +00:00
CORDA-3009 - Migrate identity service to use to string short (#5217)
* migrate PersistentIdentityService to use key.toShortString() update definition of PublicKeyToExternalId mapping to allow fast lookup by externalId/publicKey * fix misspelled table name * add test of migration script * add design document for proposal to move IdentityService to using the correct PK.toStringShort() method for hashing a publickey * add enterprise testing considerations to design * address review comments * fix compilation errors * modify PublicKeyToOwningIdentityCache to use toStringShort() as it's lookup key * address syzmon's code review comments
This commit is contained in:
@ -58,8 +58,8 @@ class DBRunnerExtension : Extension, BeforeAllCallback, AfterAllCallback, Before
|
||||
val rootContext = context?.root ?: return null
|
||||
|
||||
val testClass = context.testClass.orElse(null) ?: return null
|
||||
val annotation = testClass.requiredDb ?:
|
||||
throw IllegalStateException("Test run with DBRunnerExtension is not annotated with @RequiresDb")
|
||||
val annotation = testClass.requiredDb
|
||||
?: throw IllegalStateException("Test run with DBRunnerExtension is not annotated with @RequiresDb")
|
||||
val groupName = annotation.group
|
||||
val defaultContextClassName = annotation.defaultContextClassName
|
||||
|
||||
@ -84,13 +84,14 @@ class DBRunnerExtension : Extension, BeforeAllCallback, AfterAllCallback, Before
|
||||
private fun <T : Any> AnnotatedElement.findAnnotations(annotationClass: Class<T>): Sequence<T> = declaredAnnotations.asSequence()
|
||||
.filterNot { it.isInternal }
|
||||
.flatMap { annotation ->
|
||||
if (annotationClass.isAssignableFrom(annotation::class.java))sequenceOf(annotationClass.cast(annotation))
|
||||
if (annotationClass.isAssignableFrom(annotation::class.java)) sequenceOf(annotationClass.cast(annotation))
|
||||
else annotation.annotationClass.java.findAnnotations(annotationClass)
|
||||
}
|
||||
|
||||
private val Annotation.isInternal: Boolean get() = annotationClass.java.name.run {
|
||||
startsWith("java.lang") ||
|
||||
startsWith("org.junit") ||
|
||||
startsWith("kotlin")
|
||||
}
|
||||
private val Annotation.isInternal: Boolean
|
||||
get() = annotationClass.java.name.run {
|
||||
startsWith("java.lang") ||
|
||||
startsWith("org.junit") ||
|
||||
startsWith("kotlin")
|
||||
}
|
||||
}
|
@ -16,5 +16,4 @@ class NoOpTestDatabaseContext : TestDatabaseContext {
|
||||
override fun afterTest(teardownSql: List<String>) {}
|
||||
|
||||
override fun close() {}
|
||||
|
||||
}
|
@ -23,7 +23,7 @@ interface TestDatabaseContext : ExtensionContext.Store.CloseableResource {
|
||||
get() = _usingRemoteDatabase.get() ?: false
|
||||
set(value) = _usingRemoteDatabase.set(value)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called once when the context is first instantiated, i.e. at the start of the test run, before any tests at all have been executed.
|
||||
*
|
||||
|
@ -3,7 +3,6 @@ package net.corda.testing.internal.db
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
class AssertingTestDatabaseContext : TestDatabaseContext {
|
||||
|
||||
@ -57,5 +56,4 @@ class AssertingTestDatabaseContext : TestDatabaseContext {
|
||||
throw IllegalStateException("Assertion failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -15,7 +15,5 @@ class GroupAMoreTests {
|
||||
@SpecialSql1
|
||||
@SpecialSql2
|
||||
fun moreSpecialSqlRequired() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -14,13 +14,10 @@ class GroupATests {
|
||||
|
||||
@Test
|
||||
fun noSpecialSqlRequired() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SpecialSql1
|
||||
fun someSpecialSqlRequired() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -13,13 +13,10 @@ class GroupBTests {
|
||||
|
||||
@Test
|
||||
fun noSpecialSqlRequired() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SpecialSql1
|
||||
fun someSpecialSqlRequired() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,8 @@
|
||||
<Appenders>
|
||||
<Console name="Console-Appender" target="SYSTEM_OUT">
|
||||
<PatternLayout>
|
||||
<ScriptPatternSelector defaultPattern="%highlight{[%level{length=5}] %date{HH:mm:ss,SSS} [%t] %c{2}.%method - %msg%n}{INFO=white,WARN=red,FATAL=bright red}">
|
||||
<ScriptPatternSelector
|
||||
defaultPattern="%highlight{[%level{length=5}] %date{HH:mm:ss,SSS} [%t] %c{2}.%method - %msg%n}{INFO=white,WARN=red,FATAL=bright red}">
|
||||
<Script name="MDCSelector" language="javascript"><![CDATA[
|
||||
result = null;
|
||||
if (!logEvent.getContextData().size() == 0) {
|
||||
@ -24,7 +25,8 @@
|
||||
result;
|
||||
]]>
|
||||
</Script>
|
||||
<PatternMatch key="WithMDC" pattern="%highlight{[%level{length=5}] %date{HH:mm:ss,SSS} [%t] %c{2}.%method - %msg %X%n}{INFO=white,WARN=red,FATAL=bright red}"/>
|
||||
<PatternMatch key="WithMDC"
|
||||
pattern="%highlight{[%level{length=5}] %date{HH:mm:ss,SSS} [%t] %c{2}.%method - %msg %X%n}{INFO=white,WARN=red,FATAL=bright red}"/>
|
||||
</ScriptPatternSelector>
|
||||
</PatternLayout>
|
||||
<ThresholdFilter level="trace"/>
|
||||
@ -32,14 +34,14 @@
|
||||
|
||||
<!-- Required for printBasicInfo -->
|
||||
<Console name="Console-Appender-Println" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%msg%n" />
|
||||
<PatternLayout pattern="%msg%n"/>
|
||||
</Console>
|
||||
|
||||
<!-- Will generate up to 100 log files for a given day. During every rollover it will delete
|
||||
those that are older than 60 days, but keep the most recent 10 GB -->
|
||||
<RollingRandomAccessFile name="RollingFile-Appender"
|
||||
fileName="${log-path}/${log-name}.log"
|
||||
filePattern="${archive}/${log-name}.%date{yyyy-MM-dd}-%i.log.gz">
|
||||
fileName="${log-path}/${log-name}.log"
|
||||
filePattern="${archive}/${log-name}.%date{yyyy-MM-dd}-%i.log.gz">
|
||||
|
||||
<PatternLayout pattern="[%-5level] %date{ISO8601}{UTC}Z [%t] %c{2}.%method - %msg %X%n"/>
|
||||
|
||||
@ -83,7 +85,7 @@
|
||||
</Root>
|
||||
<Logger name="net.corda" level="${defaultLogLevel}" additivity="false">
|
||||
<AppenderRef ref="Console-ErrorCode-Appender"/>
|
||||
<AppenderRef ref="RollingFile-ErrorCode-Appender" />
|
||||
<AppenderRef ref="RollingFile-ErrorCode-Appender"/>
|
||||
</Logger>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
Reference in New Issue
Block a user