@Test public void testGetNull() { when(vaultVersionedKeyValueOperations.get(anyString())).thenReturn(null); Assert.assertNull(underTest.get(gson.toJson(secret))); }
@Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); }
VaultKvV2Engine extends AbstractVaultEngine<VaultKvV2Engine> { @Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); } }
VaultKvV2Engine extends AbstractVaultEngine<VaultKvV2Engine> { @Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); } VaultKvV2Engine(VaultTemplate template); }
VaultKvV2Engine extends AbstractVaultEngine<VaultKvV2Engine> { @Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); } VaultKvV2Engine(VaultTemplate template); @Override String put(String path, String value); @Override boolean isExists(String secret); @Override @Cacheable(cacheNames = "vaultCache") String get(@NotNull String secret); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void delete(String secret); @Override SecretResponse convertToExternal(String secret); List<String> listEntries(String path); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void cleanup(String path); }
VaultKvV2Engine extends AbstractVaultEngine<VaultKvV2Engine> { @Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); } VaultKvV2Engine(VaultTemplate template); @Override String put(String path, String value); @Override boolean isExists(String secret); @Override @Cacheable(cacheNames = "vaultCache") String get(@NotNull String secret); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void delete(String secret); @Override SecretResponse convertToExternal(String secret); List<String> listEntries(String path); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void cleanup(String path);  }