Search in sources :

Example 1 with PsonDataCodec

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;
            }
        }
    }
}
Also used : PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with PsonDataCodec

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);
}
Also used : PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with PsonDataCodec

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();
}
Also used : PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) DataCodec(com.linkedin.data.codec.DataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) Test(org.testng.annotations.Test)

Aggregations

PsonDataCodec (com.linkedin.data.codec.PsonDataCodec)3 Test (org.testng.annotations.Test)3 BeforeTest (org.testng.annotations.BeforeTest)2 DataCodec (com.linkedin.data.codec.DataCodec)1 JacksonDataCodec (com.linkedin.data.codec.JacksonDataCodec)1