Search in sources :

Example 1 with ApacheHttpClient

use of com.github.nagyesta.lowkeyvault.http.ApacheHttpClient in project lowkey-vault by nagyesta.

the class LowkeyVaultContainerVanillaTest method testContainerShouldStartUpWhenCalledWithoutVaultNames.

@Test
void testContainerShouldStartUpWhenCalledWithoutVaultNames() {
    // given
    final LowkeyVaultContainer underTest = new LowkeyVaultContainer(DockerImageName.parse(getCurrentLowkeyVaultImageName()).asCompatibleSubstituteFor(LowkeyVaultContainer.DEFAULT_IMAGE_NAME)).withImagePullPolicy(PullPolicy.defaultPolicy());
    // when
    underTest.start();
    // then
    final String endpoint = underTest.getDefaultVaultBaseUrl();
    final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getDefaultVaultAuthority(), underTest.getEndpointAuthority());
    final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
    verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
Also used : AuthorityOverrideFunction(com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction) ApacheHttpClient(com.github.nagyesta.lowkeyvault.http.ApacheHttpClient) BasicAuthenticationCredential(com.azure.core.credential.BasicAuthenticationCredential) TokenCredential(com.azure.core.credential.TokenCredential) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with ApacheHttpClient

use of com.github.nagyesta.lowkeyvault.http.ApacheHttpClient in project lowkey-vault by nagyesta.

the class LowkeyVaultContainerJupiterTest method testContainerShouldStartUpWhenCalledWithValidNames.

@Test
void testContainerShouldStartUpWhenCalledWithValidNames() {
    // given + when test container is created
    // then
    final String endpoint = underTest.getVaultBaseUrl(VAULT_NAME);
    final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getVaultAuthority(VAULT_NAME), underTest.getEndpointAuthority());
    final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
    verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
Also used : AuthorityOverrideFunction(com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction) ApacheHttpClient(com.github.nagyesta.lowkeyvault.http.ApacheHttpClient) BasicAuthenticationCredential(com.azure.core.credential.BasicAuthenticationCredential) TokenCredential(com.azure.core.credential.TokenCredential) Test(org.junit.jupiter.api.Test)

Example 3 with ApacheHttpClient

use of com.github.nagyesta.lowkeyvault.http.ApacheHttpClient in project lowkey-vault by nagyesta.

the class LowkeyVaultContainerVanillaTest method testContainerShouldStartUpWhenCalledWithValidNames.

@Test
void testContainerShouldStartUpWhenCalledWithValidNames() {
    // given
    final LowkeyVaultContainer underTest = new LowkeyVaultContainer(DockerImageName.parse(getCurrentLowkeyVaultImageName()).asCompatibleSubstituteFor(LowkeyVaultContainer.DEFAULT_IMAGE_NAME), Collections.singleton(VAULT_NAME)).withImagePullPolicy(PullPolicy.defaultPolicy());
    // when
    underTest.start();
    // then
    final String endpoint = underTest.getVaultBaseUrl(VAULT_NAME);
    final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getVaultAuthority(VAULT_NAME), underTest.getEndpointAuthority());
    final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
    verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
Also used : AuthorityOverrideFunction(com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction) ApacheHttpClient(com.github.nagyesta.lowkeyvault.http.ApacheHttpClient) BasicAuthenticationCredential(com.azure.core.credential.BasicAuthenticationCredential) TokenCredential(com.azure.core.credential.TokenCredential) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

BasicAuthenticationCredential (com.azure.core.credential.BasicAuthenticationCredential)3 TokenCredential (com.azure.core.credential.TokenCredential)3 ApacheHttpClient (com.github.nagyesta.lowkeyvault.http.ApacheHttpClient)3 AuthorityOverrideFunction (com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2