Search in sources :

Example 6 with SDBMetadata

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

the class AdminActionsControllerTest method testOverrideOwner.

@Test
public void testOverrideOwner() {
    SDBMetadata sdbMetadata = Mockito.mock(SDBMetadata.class);
    Authentication authentication = Mockito.mock(Authentication.class);
    Mockito.when(sdbMetadata.getName()).thenReturn("name");
    Mockito.when(sdbMetadata.getOwner()).thenReturn("owner");
    Mockito.when(authentication.getName()).thenReturn("name");
    adminActionsController.overrideSdbOwner(sdbMetadata, authentication);
    Mockito.verify(safeDepositBoxService).overrideOwner("name", "owner", "name");
}
Also used : SDBMetadata(com.nike.cerberus.domain.SDBMetadata) Authentication(org.springframework.security.core.Authentication) Test(org.junit.Test)

Example 7 with SDBMetadata

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

the class SdbMetadataControllerTest method testRestoreSdbIncludingDataInRequest.

@Test
public void testRestoreSdbIncludingDataInRequest() {
    SDBMetadata sdbMetadata = Mockito.mock(SDBMetadata.class);
    Authentication authentication = Mockito.mock(Authentication.class);
    Mockito.when(authentication.getName()).thenReturn("name");
    Mockito.when(sdbMetadata.getPath()).thenReturn("path");
    Mockito.when(safeDepositBoxService.getSafeDepositBoxIdByPath("path")).thenReturn(Optional.of("id"));
    sdbMetadataController.restoreSdbIncludingDataInRequest(sdbMetadata, authentication);
    Mockito.verify(safeDepositBoxService).deleteSafeDepositBox("id");
    Mockito.verify(metadataService).restoreMetadata(sdbMetadata, "name");
}
Also used : SDBMetadata(com.nike.cerberus.domain.SDBMetadata) Authentication(org.springframework.security.core.Authentication) Test(org.junit.Test)

Aggregations

SDBMetadata (com.nike.cerberus.domain.SDBMetadata)7 Test (org.junit.Test)7 Authentication (org.springframework.security.core.Authentication)3 IamPrincipalPermission (com.nike.cerberus.domain.IamPrincipalPermission)2 SDBMetadataResult (com.nike.cerberus.domain.SDBMetadataResult)2 SafeDepositBoxV2 (com.nike.cerberus.domain.SafeDepositBoxV2)2 UserGroupPermission (com.nike.cerberus.domain.UserGroupPermission)2 HashSet (java.util.HashSet)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Role (com.nike.cerberus.domain.Role)1 InputStream (java.io.InputStream)1 OffsetDateTime (java.time.OffsetDateTime)1 HashMap (java.util.HashMap)1