SerialFormat valueFormat = new SerialFormat(catalog,
MarshalledObject.class);
TupleFormat indexKeyFormat = new TupleFormat();
EntityBinding binding =
new TupleSerialMarshalledBinding(keyFormat, valueFormat);
assertSame(valueFormat, binding.getValueFormat());
assertSame(keyFormat, binding.getKeyFormat());
MarshalledObject val = new MarshalledObject("abc", "primary",
"index1", "index2");
binding.objectToValue(val, buffer);
assertTrue(buffer.getDataLength() > 0);
binding.objectToKey(val, keyBuffer);
assertEquals(val.expectedKeyLength(), keyBuffer.getDataLength());
Object result = binding.dataToObject(keyBuffer, buffer);
assertTrue(result instanceof MarshalledObject);
val = (MarshalledObject) result;
assertEquals("abc", val.getData());
assertEquals("primary", val.getPrimaryKey());
assertEquals("index1", val.getIndexKey1());