Search in sources :

Example 1 with AuthKmsKeyMetadataResult

use of com.nike.cerberus.domain.AuthKmsKeyMetadataResult in project cerberus by Nike-Inc.

the class AdminActionsControllerTest method testGetAuthKmsKeyMetadataWhenKmsServiceReturnsEmptyMetadata.

@Test
public void testGetAuthKmsKeyMetadataWhenKmsServiceReturnsEmptyMetadata() {
    AuthKmsKeyMetadataResult authKmsKeyMetadata = adminActionsController.getAuthKmsKeyMetadata();
    Assert.assertNotNull(authKmsKeyMetadata);
    Assert.assertEquals(0, authKmsKeyMetadata.getAuthenticationKmsKeyMetadata().size());
}
Also used : AuthKmsKeyMetadataResult(com.nike.cerberus.domain.AuthKmsKeyMetadataResult) Test(org.junit.Test)

Example 2 with AuthKmsKeyMetadataResult

use of com.nike.cerberus.domain.AuthKmsKeyMetadataResult in project cerberus by Nike-Inc.

the class AdminActionsControllerTest method testGetAuthKmsKeyMetadataWhenKmsServiceReturnsListWithAuthenticationKmsData.

@Test
public void testGetAuthKmsKeyMetadataWhenKmsServiceReturnsListWithAuthenticationKmsData() {
    AuthKmsKeyMetadata authKmsKeyMetadata = new AuthKmsKeyMetadata();
    List<AuthKmsKeyMetadata> authKmsKeyMetadataList = new ArrayList<>();
    authKmsKeyMetadataList.add(authKmsKeyMetadata);
    Mockito.when(kmsService.getAuthenticationKmsMetadata()).thenReturn(authKmsKeyMetadataList);
    AuthKmsKeyMetadataResult authKmsKeyMetadataResult = adminActionsController.getAuthKmsKeyMetadata();
    Assert.assertNotNull(authKmsKeyMetadataResult);
    Assert.assertSame(authKmsKeyMetadataList, authKmsKeyMetadataResult.getAuthenticationKmsKeyMetadata());
    Assert.assertSame(authKmsKeyMetadata, authKmsKeyMetadataResult.getAuthenticationKmsKeyMetadata().get(0));
}
Also used : AuthKmsKeyMetadata(com.nike.cerberus.domain.AuthKmsKeyMetadata) AuthKmsKeyMetadataResult(com.nike.cerberus.domain.AuthKmsKeyMetadataResult) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with AuthKmsKeyMetadataResult

use of com.nike.cerberus.domain.AuthKmsKeyMetadataResult in project cerberus by Nike-Inc.

the class AdminActionsControllerTest method testGetAuthKmsKeyMetadataWhenKmsServiceReturnsNull.

@Test
public void testGetAuthKmsKeyMetadataWhenKmsServiceReturnsNull() {
    Mockito.when(kmsService.getAuthenticationKmsMetadata()).thenReturn(null);
    AuthKmsKeyMetadataResult authKmsKeyMetadata = adminActionsController.getAuthKmsKeyMetadata();
    Assert.assertNotNull(authKmsKeyMetadata);
    Assert.assertNull(authKmsKeyMetadata.getAuthenticationKmsKeyMetadata());
}
Also used : AuthKmsKeyMetadataResult(com.nike.cerberus.domain.AuthKmsKeyMetadataResult) Test(org.junit.Test)

Aggregations

AuthKmsKeyMetadataResult (com.nike.cerberus.domain.AuthKmsKeyMetadataResult)3 Test (org.junit.Test)3 AuthKmsKeyMetadata (com.nike.cerberus.domain.AuthKmsKeyMetadata)1 ArrayList (java.util.ArrayList)1