if(!(cmode == CompatibilityMode.COMPAT_CURRENT || cmode.ordinal() >= CompatibilityMode.COMPAT_1416.ordinal()))
cryptoAlgorithm = Key.ALGO_AES_PCFB_256_SHA256;
else
cryptoAlgorithm = Key.ALGO_AES_CTR_256_SHA256;
SplitFileInserterStorage storage = new SplitFileInserterStorage(data, size, cb, null,
new ClientMetadata(), false, null, smallRAFFactory, false, context,
cryptoAlgorithm, old ? null : cryptoKey, null, hashes, smallBucketFactory, checker,
r, memoryLimitedJobRunner, jobRunner, ticker, keys, false, 0, 0, 0, 0);
storage.start();
cb.waitForFinishedEncode();
assertTrue(storage.getStatus() == Status.ENCODED);
// Encoded. Now try to decode it ...
cb.waitForHasKeys();
Metadata metadata = storage.encodeMetadata();
// Ugly hack because Metadata behaves oddly.
// FIXME make Metadata behave consistently and get rid.
Bucket metaBucket = metadata.toBucket(smallBucketFactory);
Metadata m1 = Metadata.construct(metaBucket);
Bucket copyBucket = m1.toBucket(smallBucketFactory);
assertTrue(BucketTools.equalBuckets(metaBucket, copyBucket));
MyFetchCallback fcb = new MyFetchCallback();
FetchContext fctx = HighLevelSimpleClientImpl.makeDefaultFetchContext(size*2, size*2, smallBucketFactory, new SimpleEventProducer());
SplitFileFetcherStorage fetcherStorage = new SplitFileFetcherStorage(m1, fcb, new ArrayList<COMPRESSOR_TYPE>(),
new ClientMetadata(), false, cmode.code, fctx, false, salt, URI, URI, true, new byte[0],
r, smallBucketFactory, smallRAFFactory, jobRunner, ticker, memoryLimitedJobRunner,
checker, false, null, null, keys);
fetcherStorage.start(false);