From 5171e1c5cfcef8b157f6c4fd8a9f3a73738d50a6 Mon Sep 17 00:00:00 2001 From: Dries Samyn Date: Mon, 2 Oct 2023 18:37:32 +0100 Subject: [PATCH] Fix json deserialiser & add test --- .../statemanager/impl/tests/StateManagerIntegrationTest.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libs/state-manager/state-manager-db-impl/src/integrationTest/kotlin/net/corda/libs/statemanager/impl/tests/StateManagerIntegrationTest.kt b/libs/state-manager/state-manager-db-impl/src/integrationTest/kotlin/net/corda/libs/statemanager/impl/tests/StateManagerIntegrationTest.kt index 048386e618e..1f6ec9eaacb 100644 --- a/libs/state-manager/state-manager-db-impl/src/integrationTest/kotlin/net/corda/libs/statemanager/impl/tests/StateManagerIntegrationTest.kt +++ b/libs/state-manager/state-manager-db-impl/src/integrationTest/kotlin/net/corda/libs/statemanager/impl/tests/StateManagerIntegrationTest.kt @@ -1,6 +1,5 @@ package net.corda.libs.statemanager.impl.tests -import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper import net.corda.db.admin.impl.ClassloaderChangeLog import net.corda.db.admin.impl.LiquibaseSchemaMigratorImpl @@ -14,6 +13,7 @@ import net.corda.libs.statemanager.api.State import net.corda.libs.statemanager.api.StateManager import net.corda.libs.statemanager.api.metadata import net.corda.libs.statemanager.impl.StateManagerImpl +import net.corda.libs.statemanager.impl.convertToMetadata import net.corda.libs.statemanager.impl.model.v1.StateEntity import net.corda.libs.statemanager.impl.model.v1.StateManagerEntities import net.corda.libs.statemanager.impl.repository.impl.KEY_PARAMETER_NAME @@ -76,9 +76,6 @@ class StateManagerIntegrationTest { private val stateManager: StateManager = StateManagerImpl(StateRepositoryImpl(queryProvider), entityManagerFactoryFactory) - private fun ObjectMapper.toMetadata(metadata: String) = - this.readValue(metadata, object : TypeReference() {}) - private fun cleanStates() = entityManagerFactoryFactory.createEntityManager().transaction { it.createNativeQuery("DELETE FROM state s WHERE s.key LIKE '%$testUniqueId%'").executeUpdate() it.flush() @@ -129,7 +126,7 @@ class StateManagerIntegrationTest { it.assertThat(loadedEntity.modifiedTime).isNotNull it.assertThat(loadedEntity.version).isEqualTo(version(i, key)) it.assertThat(loadedEntity.value).isEqualTo((stateContent(i, key).toByteArray())) - it.assertThat(objectMapper.toMetadata(loadedEntity.metadata)) + it.assertThat(objectMapper.convertToMetadata(loadedEntity.metadata)) .containsExactlyInAnyOrderEntriesOf(metadataContent(i, key)) } }