@@ -2,19 +2,13 @@ package org.lfdecentralizedtrust.splice.integration.tests
22
33import com .daml .ledger .javaapi .data .TransactionTree
44import org .lfdecentralizedtrust .splice .config .ConfigTransforms
5- import org .lfdecentralizedtrust .splice .config .ConfigTransforms .{
6- ConfigurableApp ,
7- updateAutomationConfig ,
8- }
5+ import org .lfdecentralizedtrust .splice .config .ConfigTransforms .{ConfigurableApp , updateAutomationConfig }
96import org .lfdecentralizedtrust .splice .console .ScanAppBackendReference
107import org .lfdecentralizedtrust .splice .environment .ledger .api .TransactionTreeUpdate
118import org .lfdecentralizedtrust .splice .http .v0 .definitions
129import org .lfdecentralizedtrust .splice .http .v0 .definitions .DamlValueEncoding .members .CompactJson
1310import org .lfdecentralizedtrust .splice .integration .EnvironmentDefinition
14- import org .lfdecentralizedtrust .splice .integration .tests .SpliceTests .{
15- IntegrationTest ,
16- SpliceTestConsoleEnvironment ,
17- }
11+ import org .lfdecentralizedtrust .splice .integration .tests .SpliceTests .{IntegrationTest , SpliceTestConsoleEnvironment }
1812import org .lfdecentralizedtrust .splice .scan .admin .http .ProtobufJsonScanHttpEncodings
1913import org .lfdecentralizedtrust .splice .scan .automation .ScanHistoryBackfillingTrigger
2014import org .lfdecentralizedtrust .splice .store .{PageLimit , TreeUpdateWithMigrationId }
@@ -27,12 +21,14 @@ import scala.math.BigDecimal.javaBigDecimal2bigDecimal
2721import com .digitalasset .canton .{HasActorSystem , HasExecutionContext }
2822import org .lfdecentralizedtrust .splice .automation .TxLogBackfillingTrigger
2923import org .lfdecentralizedtrust .splice .http .v0 .definitions .TransactionHistoryRequest .SortOrder
24+ import org .lfdecentralizedtrust .splice .http .v0 .definitions .UpdateHistoryItemV2
3025import org .lfdecentralizedtrust .splice .scan .store .TxLogEntry
3126import org .lfdecentralizedtrust .splice .store .MultiDomainAcsStore .TxLogBackfillingState
3227import org .lfdecentralizedtrust .splice .store .UpdateHistory .BackfillingState
3328import org .scalactic .source .Position
3429
3530import scala .annotation .nowarn
31+ import scala .collection .immutable .SortedMap
3632import scala .jdk .CollectionConverters .*
3733import scala .jdk .OptionConverters .*
3834
@@ -377,6 +373,24 @@ class ScanHistoryBackfillingIntegrationTest
377373 }
378374
379375 clue(" Compare scan histories with each other using the v1 HTTP endpoint" ) {
376+ // The v1 endpoint is deprecated, but we still have users using it
377+ @ nowarn(" cat=deprecation" )
378+ val sv1HttpUpdates =
379+ sv1ScanBackend.getUpdateHistoryV1(1000 , None , encoding = CompactJson )
380+
381+ @ nowarn(" cat=deprecation" )
382+ val sv2HttpUpdates =
383+ sv2ScanBackend.getUpdateHistoryV1(1000 , None , encoding = CompactJson )
384+
385+ // Compare common prefix, as there might be concurrent activity
386+ val commonLength = sv1HttpUpdates.length min sv2HttpUpdates.length
387+ commonLength should be > 10
388+ val sv1Items = sv1HttpUpdates.take(commonLength)
389+ val sv2Items = sv2HttpUpdates.take(commonLength)
390+ sv1Items should contain theSameElementsInOrderAs sv2Items
391+ }
392+
393+ clue(" Compare scan histories with each other using the v2 HTTP endpoint" ) {
380394 val sv1HttpUpdates =
381395 readUpdateHistoryFromScan(sv1ScanBackend)
382396 val sv2HttpUpdates =
@@ -387,6 +401,19 @@ class ScanHistoryBackfillingIntegrationTest
387401 commonLength should be > 10
388402 val sv1Items = sv1HttpUpdates.take(commonLength)
389403 val sv2Items = sv2HttpUpdates.take(commonLength)
404+ def collectEventsById (items : Seq [UpdateHistoryItemV2 ]) = items.collect {
405+ case definitions.UpdateHistoryItemV2 .members.UpdateHistoryTransactionV2 (http) =>
406+ http.eventsById
407+ }
408+ val eventsByIdSv1 = collectEventsById(sv1Items)
409+ val eventsByIdSv2 = collectEventsById(sv2Items)
410+
411+ def assertOrderedEventsById (eventsByIdSeq : Seq [SortedMap [String , definitions.TreeEvent ]]) =
412+ forAll(eventsByIdSeq) { eventsById =>
413+ eventsById.keys.toSeq should contain theSameElementsInOrderAs SortedMap .from(eventsById).keys.toSeq
414+ }
415+ assertOrderedEventsById(eventsByIdSv1)
416+ assertOrderedEventsById(eventsByIdSv2)
390417 sv1Items should contain theSameElementsInOrderAs sv2Items
391418 }
392419
0 commit comments