fileVersions.add(new FileVersion(0, 123, System.currentTimeMillis(), metaChunks1));
fileVersions.add(new FileVersion(1, 123, System.currentTimeMillis(), metaChunks2));
MetaFileSmall metaFileSmall = new MetaFileSmall(metaFileEncryptionKeys.getPublic(), fileVersions,
chunkEncryptionKeys);
// encrypt the meta file
HybridEncryptedContent encryptedMetaFile = H2HEncryptionUtil.encryptHybrid(metaFileSmall,
metaFileEncryptionKeys.getPublic());
encryptedMetaFile.generateVersionKey();
// initialize put
Parameters parameters = new Parameters()
.setLocationKey(H2HEncryptionUtil.key2String(metaFileSmall.getId()))
.setContentKey(H2HConstants.META_FILE).setVersionKey(encryptedMetaFile.getVersionKey())
.setProtectionKeys(protectionKeysOld).setData(encryptedMetaFile);
// indicate to generate hash
parameters.setHashFlag(true);
// put encrypted meta file into network
getter.getDataManager().putUnblocked(parameters).awaitUninterruptibly();
// verify put
Assert.assertNotNull(getter.getDataManager().getUnblocked(parameters).awaitUninterruptibly()
.getData());
// initialize a fake process context
BasePKUpdateContext context = new TestMetaFilePKUpdateContext(protectionKeysOld, protectionKeysNew,
metaFileSmall, parameters.getHash(), encryptedMetaFile.getVersionKey());
// create a change protection keys process step
ChangeProtectionKeysStep step = new ChangeProtectionKeysStep(context, getter.getDataManager());
// run process, should not fail
UseCaseTestUtil.executeProcessTillSucceded(step);