use of com.linkedin.data.codec.PsonDataCodec in project rest.li by linkedin.
the class TestData method testPsonDataCodec.
@Test
public void testPsonDataCodec() throws IOException {
int[] bufferSizesToTest = { 17, 19, 23, 29, 31, 37, 41, 43, 47, 0 };
Boolean[] booleanValues = new Boolean[] { Boolean.TRUE, Boolean.FALSE };
PsonDataCodec codec = new PsonDataCodec(true);
PsonDataCodec.Options lastOption = null;
for (int bufferSize : bufferSizesToTest) {
for (boolean encodeCollectionCount : booleanValues) {
for (boolean encodeStringLength : booleanValues) {
PsonDataCodec.Options option = new PsonDataCodec.Options();
option.setEncodeCollectionCount(encodeCollectionCount).setEncodeStringLength(encodeStringLength);
if (bufferSize != 0) {
option.setBufferSize(bufferSize);
}
codec.setOptions(option);
testDataCodec(codec);
if (lastOption != null) {
assertFalse(option.equals(lastOption));
assertNotSame(option.hashCode(), lastOption.hashCode());
assertFalse(option.toString().equals(lastOption.toString()));
}
lastOption = option;
}
}
}
}
use of com.linkedin.data.codec.PsonDataCodec in project rest.li by linkedin.
the class TestData method testPsonCodecNumbers.
@Test
public void testPsonCodecNumbers() throws IOException {
PsonDataCodec codec = new PsonDataCodec();
testCodecNumbers(codec);
}
use of com.linkedin.data.codec.PsonDataCodec in project rest.li by linkedin.
the class TestCloudPerformance method run.
@Test
public void run() throws IOException {
DataCodec[] codecs = { new JacksonDataCodec(), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(false).setEncodeStringLength(false)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(false).setEncodeStringLength(true)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(true).setEncodeStringLength(false)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(true).setEncodeStringLength(true)) };
if (_testOnly == false) {
out.println("Number of elements " + _numElements);
out.println("Number of iterations " + _numIterations);
}
for (DataCodec codec : codecs) {
testSerializeDataMap(codec);
testDeserializeDataMap(codec);
}
testEdgeListAddAll();
testEdgeListEfficientAddAll();
}
Aggregations