Skip to content

Unable to disable in-memory token selection if flow tests #180

@adelrustum

Description

@adelrustum

Corda 4.3 OpenSource
Tokens SDK 1.1

Currently in-memory selection is enabled by default, and to disable it you need to add tokens-selection-1.1.conf under cordapps/config with the following:

stateSelection.inMemory.enabled=false
// You need to supply the below values even when disabling, 
// otherwise you'll get a warning.
stateSelection.inMemory.indexingStrategies: ["EXTERNAL_ID"]
stateSelection.inMemory.cacheSize=1024

The above worked fine for me when running nodes locally, but I wasn't able to achieve the same for flow tests.

  • Create config:
Map<String, String> selectionConfig = new LinkedHashMap<>();
selectionConfig.put("stateSelection.inMemory.enabled","false");
selectionConfig.put("stateSelection.inMemory.indexingStrategies", "[\"EXTERNAL_ID\"]");
selectionConfig.put("stateSelection.inMemory.cacheSize", "1024");
  • Supply config to cordapp:
TestCordapp.findCordapp("com.r3.corda.lib.tokens.selection").withConfig(selectionConfig)

When I run my test in debug mode, I noticed that InMemorySelectionConfig is not able to identify my keys even though they're there. Notice how exists() returns false even though the object config has that value:

Config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions