use of org.cloudfoundry.credhub.data.EncryptedValueDataService in project credhub by cloudfoundry-incubator.
the class EncryptionKeyRotatorTest method beforeEach.
@Before
public void beforeEach() {
oldUuid = UUID.randomUUID();
UUID activeUuid = UUID.randomUUID();
encryptedValueDataService = mock(EncryptedValueDataService.class);
keySet = new EncryptionKeySet();
keySet.add(new EncryptionKey(mock(EncryptionService.class), oldUuid, mock(Key.class)));
keySet.add(new EncryptionKey(mock(EncryptionService.class), activeUuid, mock(Key.class)));
keySet.setActive(activeUuid);
encryptedValue1 = mock(EncryptedValue.class);
encryptedValue2 = mock(EncryptedValue.class);
encryptedValue3 = mock(EncryptedValue.class);
encryptionKeyCanaryMapper = mock(EncryptionKeyCanaryMapper.class);
inactiveCanaries = newArrayList(oldUuid);
when(encryptedValueDataService.findByCanaryUuids(inactiveCanaries)).thenReturn(new SliceImpl<>(asList(encryptedValue1, encryptedValue2))).thenReturn(new SliceImpl<>(asList(encryptedValue3))).thenReturn(new SliceImpl<>(new ArrayList<>()));
final EncryptionKeyRotator encryptionKeyRotator = new EncryptionKeyRotator(encryptedValueDataService, encryptionKeyCanaryMapper, keySet);
encryptionKeyRotator.rotate();
}
Aggregations