final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec = new Record();
rec.read(new InputViewDataInputStreamWrapper(reader));
testAllRetrievalMethods(rec, permutation2, values);
// test adding and retrieving with full stream serialization and deserialization into the same record
rec = new Record();
for (int i = 0; i < values.length; i++) {
final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec.read(new InputViewDataInputStreamWrapper(reader));
testAllRetrievalMethods(rec, permutation2, values);
// test adding and retrieving with partial stream serialization and deserialization into a new record
rec = new Record();
updatePos = rnd.nextInt(values.length + 1);
for (int i = 0; i < values.length; i++) {
if (i == updatePos) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec = new Record();
rec.read(new InputViewDataInputStreamWrapper(reader));
}
final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
if (updatePos == values.length) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec = new Record();
rec.read(new InputViewDataInputStreamWrapper(reader));
}
testAllRetrievalMethods(rec, permutation2, values);
// test adding and retrieving with partial stream serialization and deserialization into the same record
rec = new Record();
updatePos = rnd.nextInt(values.length + 1);
for (int i = 0; i < values.length; i++) {
if (i == updatePos) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec.read(new InputViewDataInputStreamWrapper(reader));
}
final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
if (updatePos == values.length) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec.read(new InputViewDataInputStreamWrapper(reader));
}
testAllRetrievalMethods(rec, permutation2, values);
// test adding and retrieving with partial stream serialization and deserialization into a new record
rec = new Record();
updatePos = rnd.nextInt(values.length + 1);
for (int i = 0; i < values.length; i++) {
if (i == updatePos) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec = new Record();
rec.read(new InputViewDataInputStreamWrapper(reader));
}
final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec = new Record();
rec.read(new InputViewDataInputStreamWrapper(reader));
testAllRetrievalMethods(rec, permutation2, values);
// test adding and retrieving with partial stream serialization and deserialization into the same record
rec = new Record();
updatePos = rnd.nextInt(values.length + 1);
for (int i = 0; i < values.length; i++) {
if (i == updatePos) {
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec.read(new InputViewDataInputStreamWrapper(reader));
}
final int pos = permutation1[i];
rec.setField(pos, values[pos]);
}
rec.write(new OutputViewDataOutputStreamWrapper(writer));
rec.read(new InputViewDataInputStreamWrapper(reader));
testAllRetrievalMethods(rec, permutation2, values);
}