-
Notifications
You must be signed in to change notification settings - Fork 224
V1 2 feature branch #137
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
Closed
emailtomanishkr
wants to merge
3
commits into
BetterCloud:v1_2_feature_branch
from
emailtomanishkr:v1_2_feature_branch
Closed
V1 2 feature branch #137
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/test-integration/java/com/bettercloud/vault/api/LogicalV2Tests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.bettercloud.vault.api; | ||
|
|
||
| import com.bettercloud.vault.Vault; | ||
| import com.bettercloud.vault.VaultConfig; | ||
| import com.bettercloud.vault.VaultException; | ||
| import org.junit.Assert; | ||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
|
|
||
| import java.util.HashMap; | ||
|
|
||
| /** | ||
| * Integration test to run on KV Secrets Engine - Version 2 | ||
| * This test expects the vault is running with url http://localhost:8200 and enabled a token as "00000000-0000-0000-0000-000000000000" with read and write privilege. | ||
| */ | ||
| public class LogicalV2Tests { | ||
| private static final String address = "http://localhost:8200"; | ||
| private static final String token = "00000000-0000-0000-0000-000000000000"; | ||
| private static final boolean isVerifySsl = false; | ||
| private static Vault vault; | ||
|
|
||
| @BeforeClass | ||
| public static void setUp() throws VaultException { | ||
| VaultConfig vaultConfig = new VaultConfig().address(address) | ||
| .token(token).sslVerify(isVerifySsl).build(); | ||
| vault = new Vault(vaultConfig); | ||
| } | ||
|
|
||
| @Test | ||
| public void testReadAndWrite() throws VaultException { | ||
| final String path = "secret/place"; | ||
| final String key = "city"; | ||
| final String value_1 = "Bangalore"; | ||
| final String value_2 = "Denver"; | ||
| vault.logical().write(path, new HashMap<String, String>() {{ | ||
| put(key, value_1); | ||
| }}); | ||
| Assert.assertEquals(value_1, vault.logical().read(path).getData().get(key)); | ||
| Assert.assertEquals(value_1, vault.logical().read(path, 1).getData().get(key)); | ||
| vault.logical().write(path, new HashMap<String, String>() {{ | ||
| put(key, value_2); | ||
| }}); | ||
| Assert.assertEquals(value_2, vault.logical().read(path, 2).getData().get(key)); | ||
| Assert.assertEquals(value_1, vault.logical().read(path, 1).getData().get(key)); | ||
| Assert.assertEquals(value_2, vault.logical().read(path).getData().get(key)); | ||
| vault.logical().delete(path); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.