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);
}
Aggregations