Search in sources :

Example 1 with TokenIdentifierCodec

use of org.apache.hadoop.ozone.om.codec.TokenIdentifierCodec in project ozone by apache.

the class TestOzoneTokenIdentifier method testTokenPersistence.

@Test
public void testTokenPersistence() throws IOException {
    OzoneTokenIdentifier idWrite = getIdentifierInst();
    idWrite.setOmServiceId("defaultServiceId");
    byte[] oldIdBytes = idWrite.getBytes();
    TokenIdentifierCodec idCodec = new TokenIdentifierCodec();
    OzoneTokenIdentifier idRead = null;
    try {
        idRead = idCodec.fromPersistedFormat(oldIdBytes);
    } catch (IOException ex) {
        Assert.fail("Should not fail to load old token format");
    }
    Assert.assertEquals("Deserialize Serialized Token should equal.", idWrite, idRead);
}
Also used : TokenIdentifierCodec(org.apache.hadoop.ozone.om.codec.TokenIdentifierCodec) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 TokenIdentifierCodec (org.apache.hadoop.ozone.om.codec.TokenIdentifierCodec)1 Test (org.junit.Test)1