Merge pull request #8148 from alimate/BAEL-3269

BAEL-3269: Fix the Integrations Tests in spring-vault
This commit is contained in:
Eric Martin 2019-11-06 06:58:08 -06:00 committed by GitHub
commit 50ef45d24f
1 changed files with 13 additions and 18 deletions

View File

@ -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