use of com.walmartlabs.concord.plugins.hashivault.v2.HashiVaultTask in project concord-plugins by walmartlabs.
the class HashiVaultTaskV1Test method getTask.
private HashiVaultTask getTask(boolean setDefaults) {
ctx = new MockContext(new HashMap<>());
HashiVaultTask t = new HashiVaultTask(secretService);
injectVariable(t, "execution", ctx);
ctx.setVariable("txId", "643cd26e-6d64-11eb-81f9-0800273425d4");
if (setDefaults) {
Map<String, Object> defaults = new HashMap<>(2);
defaults.put("apiToken", getApiToken());
defaults.put("baseUrl", getBaseUrl());
ctx.setVariable("hashivaultParams", defaults);
injectVariable(t, "hashivaultParams", defaults);
}
return t;
}
use of com.walmartlabs.concord.plugins.hashivault.v2.HashiVaultTask in project concord-plugins by walmartlabs.
the class HashiVaultTaskV2Test method testWriteKvPublicMethodV2.
@Test
public void testWriteKvPublicMethodV2() {
String path = "secret/newSecretTaskPublicMethodV2";
Map<String, Object> kvPairs = new HashMap<>();
kvPairs.put("key1", "value1");
kvPairs.put("key2", "value2");
HashiVaultTask task = getTask(true);
task.writeKV(path, kvPairs);
// -- now get the values back
// resets context
task = getTask(true);
Map<String, Object> data = task.readKV(path);
assertEquals("value1", MapUtils.getString(data, "key1"));
assertEquals("value2", MapUtils.getString(data, "key2"));
}
Aggregations