Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adelrustum opened this issue Feb 13, 2020 · 2 comments
Open

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

adelrustum opened this issue Feb 13, 2020 · 2 comments

Comments

@adelrustum
Copy link

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

@amolpednekar
Copy link

Facing the same issue with flow tests

@hecong-cac
Copy link

hecong-cac commented Nov 13, 2021

should with the following(change enabled to false if you want to disable in-memory token selection ):

        val selectionConfig = mutableMapOf<String, Any>()
        val inMemoryConfig = mutableMapOf<String, Any>()
        inMemoryConfig.put("enabled",true)
        inMemoryConfig.put("indexingStrategies", listOf("EXTERNAL_ID"))
        inMemoryConfig.put("cacheSize",124000)
        val stateSelectionConfig = mutableMapOf<String, Any>()
        stateSelectionConfig.put("inMemory",inMemoryConfig)
        selectionConfig.put("stateSelection",stateSelectionConfig)
                        TestCordapp.findCordapp("com.r3.corda.lib.tokens.workflows").withConfig(selectionConfig)

↑ work to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants