From a00011b9844f9b5cc51c6f6617eec08af20ca281 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Wed, 6 Nov 2019 11:07:12 +0330 Subject: [PATCH] Fixed the Vault Issue --- .../springvault/VaultIntegrationTest.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java b/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java index 75c700ee26..9f4b5d82a4 100644 --- a/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java +++ b/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java @@ -1,36 +1,28 @@ package org.baeldung.springvault; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.core.annotation.Order; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; -import org.springframework.vault.core.VaultTemplate; -import org.springframework.vault.support.VaultResponse; +import java.net.URISyntaxException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * These tests are requiring the {@code vault} command to be installed and available in the executing + * platform. So, if you intend to run them in your environment, the please install the vault and then + * run the ignored tests. + */ @RunWith(SpringRunner.class) @SpringBootTest(classes = CredentialsService.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ContextConfiguration(classes = VaultTestConfiguration.class, loader = AnnotationConfigContextLoader.class) @@ -47,6 +39,7 @@ public class VaultIntegrationTest { * @throws URISyntaxException */ @Test + @Ignore public void givenCredentials_whenSecureCredentials_thenCredentialsSecured() throws URISyntaxException { try { // Given @@ -63,9 +56,11 @@ public class VaultIntegrationTest { /** * Test to access credentials + * * @throws URISyntaxException */ @Test + @Ignore public void whenAccessCredentials_thenCredentialsRetrieved() throws URISyntaxException { // Given