}
public void testSerialSerialKeyExtractor()
throws IOException {
SerialFormat keyFormat = new SerialFormat(catalog, String.class);
SerialFormat valueFormat = new SerialFormat(catalog, String.class);
SerialFormat indexKeyFormat = new SerialFormat(catalog, String.class);
EntityBinding binding = new MySerialSerialBinding(keyFormat,
valueFormat);
KeyExtractor extractor = new MySerialSerialExtractor(keyFormat,
valueFormat,
indexKeyFormat);
assertSame(keyFormat, extractor.getPrimaryKeyFormat());
assertSame(valueFormat, extractor.getValueFormat());
assertSame(indexKeyFormat, extractor.getIndexKeyFormat());
String val = "key#value?indexKey";
binding.objectToValue(val, buffer);
binding.objectToKey(val, keyBuffer);
extractor.extractIndexKey(keyBuffer, buffer, indexKeyBuffer);
assertEquals("indexKey", indexKeyFormat.dataToObject(indexKeyBuffer));
extractor.clearIndexKey(buffer);
extractor.extractIndexKey(keyBuffer, buffer, indexKeyBuffer);
assertEquals(0, indexKeyBuffer.getDataLength());
}