if (i == 1)
sharedValue = v;
else
m1filesCount++;
fch.write(property1MultivaluedId, v, new SimpleChangedSizeHandler());
}
fch.commit();
// add another multivalued with shared file
final String property2MultivaluedId = IdGenerator.generate();
long m2fileSize = 0;
long m2filesCount = 0;
fch = openCASChannel(digestType);
for (int i = 0; i < 4; i++)
{
ValueData v;
if (i == 2)
{
// use shared
sharedValue =
new StreamPersistedValueData(i, sharedValue.getAsStream(), SpoolConfig.getDefaultSpoolConfig());
v = sharedValue;
}
else
{
// new file
m2filesCount++;
File f = createBLOBTempFile(350);
addedSize += (m2fileSize = f.length()); // add size
v = new StreamPersistedValueData(i, new FileInputStream(f), SpoolConfig.getDefaultSpoolConfig());
}
fch.write(property2MultivaluedId, v, new SimpleChangedSizeHandler());
}
fch.commit();
// add some single valued properties, two new property will have shared value too
String property1Id = null;
String property2Id = null;
sharedValue = new StreamPersistedValueData(0, sharedValue.getAsStream(), SpoolConfig.getDefaultSpoolConfig());
for (int i = 0; i < 10; i++)
{
String pid = IdGenerator.generate();
ValueData v;
if (i == 1)
{
property1Id = pid;
v = sharedValue;
}
else if (i == 5)
{
property2Id = pid;
v = sharedValue;
}
else
{
File f = createBLOBTempFile(425);
addedSize += f.length();
v = new StreamPersistedValueData(i, new FileInputStream(f), SpoolConfig.getDefaultSpoolConfig());
}
FileIOChannel vfch = openCASChannel(digestType);
vfch.write(pid, v, new SimpleChangedSizeHandler());
vfch.commit();
}
// final size
long finalSize = initialSize + addedSize;