Search in sources :

Example 26 with Secret

use of com.sequenceiq.cloudbreak.service.secret.domain.Secret in project cloudbreak by hortonworks.

the class SecretAspectsTest method testproceedDeleteAllEntity.

@Test
public void testproceedDeleteAllEntity() {
    DummyEntity dummyEntity = new DummyEntity(new Secret(null, "path"));
    when(proceedingJoinPoint.getArgs()).thenReturn(new Object[] { List.of(dummyEntity) });
    underTest.proceedOnRepositoryDeleteAll(proceedingJoinPoint);
    verify(secretService, times(1)).delete(eq("path"));
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) Test(org.junit.Test)

Example 27 with Secret

use of com.sequenceiq.cloudbreak.service.secret.domain.Secret in project cloudbreak by hortonworks.

the class SecretAspectsTest method testproceedSaveEntityNotTenantAwareResource.

@Test
public void testproceedSaveEntityNotTenantAwareResource() throws Exception {
    DummyEntity dummyEntity = new DummyEntity(new Secret(""));
    when(proceedingJoinPoint.getArgs()).thenReturn(new Object[] { dummyEntity });
    thrown.expect(CloudbreakServiceException.class);
    thrown.expectCause(any(IllegalArgumentException.class));
    underTest.proceedOnRepositorySave(proceedingJoinPoint);
    verifySecretManagementIgnoredDuringSave(null);
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) Test(org.junit.Test)

Example 28 with Secret

use of com.sequenceiq.cloudbreak.service.secret.domain.Secret in project cloudbreak by hortonworks.

the class SecretAspectsTest method testThrowCloudbreakServiceExceptionWhenEntityIsNotAccountIdAwareResource.

@Test
public void testThrowCloudbreakServiceExceptionWhenEntityIsNotAccountIdAwareResource() throws Exception {
    DummyEntity dummyEntity = new DummyEntity(new Secret("secret"));
    when(proceedingJoinPoint.getArgs()).thenReturn(new Object[] { dummyEntity });
    assertThrows(CloudbreakServiceException.class, () -> underTest.proceedOnRepositorySave(proceedingJoinPoint));
    verifySecretManagementIgnoredDuringSave(dummyEntity.secret);
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) Test(org.junit.Test)

Example 29 with Secret

use of com.sequenceiq.cloudbreak.service.secret.domain.Secret in project cloudbreak by hortonworks.

the class SecretAspectsTest method testproceedSaveEntity.

@Test
public void testproceedSaveEntity() throws Exception {
    DummyTenantAwareResourceEntity dummyEntity = new DummyTenantAwareResourceEntity(new Secret("raw"));
    when(proceedingJoinPoint.getArgs()).thenReturn(new Object[] { dummyEntity });
    when(tenant.getName()).thenReturn("tenant");
    underTest.proceedOnRepositorySave(proceedingJoinPoint);
    verify(secretService, times(1)).put(anyString(), eq("raw"));
    assertThat(dummyEntity.secret, IsInstanceOf.instanceOf(SecretProxy.class));
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) SecretProxy(com.sequenceiq.cloudbreak.service.secret.domain.SecretProxy) Test(org.junit.Test)

Example 30 with Secret

use of com.sequenceiq.cloudbreak.service.secret.domain.Secret in project cloudbreak by hortonworks.

the class SecretAspectsTest method testproceedDeleteEntity.

@Test
public void testproceedDeleteEntity() {
    DummyEntity dummyEntity = new DummyEntity(new Secret(null, "path"));
    when(proceedingJoinPoint.getArgs()).thenReturn(new Object[] { dummyEntity });
    underTest.proceedOnRepositoryDelete(proceedingJoinPoint);
    verify(secretService, times(1)).delete(eq("path"));
}
Also used : Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) Test(org.junit.Test)

Aggregations

Secret (com.sequenceiq.cloudbreak.service.secret.domain.Secret)37 Test (org.junit.Test)11 Field (java.lang.reflect.Field)8 Test (org.junit.jupiter.api.Test)8 Stack (com.sequenceiq.freeipa.entity.Stack)7 SecretProxy (com.sequenceiq.cloudbreak.service.secret.domain.SecretProxy)5 SecretOperationException (com.sequenceiq.cloudbreak.service.secret.SecretOperationException)4 SecretResponse (com.sequenceiq.cloudbreak.service.secret.model.SecretResponse)4 VaultSecret (com.sequenceiq.cloudbreak.service.secret.vault.VaultSecret)4 HostKeytabRequest (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.HostKeytabRequest)4 HostKeytabResponse (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.HostKeytabResponse)4 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)4 Host (com.sequenceiq.freeipa.client.model.Host)4 KeytabCache (com.sequenceiq.freeipa.entity.KeytabCache)4 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)3 DetailedStackStatus (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.DetailedStackStatus)3 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)3 InstanceStatus (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus)3 RoleRequest (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.RoleRequest)3 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)3