@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { if (isGzipped(bytes)) { return gzipDelegate.deserialize(bytes, clazz); } else { return defaultDelegate.deserialize(bytes, clazz); } }
@Before public void setUp() throws Exception { testDelegate = new GzipBridgeThriftSerializationDelegate(); }
@Test public void testDeserialize_readingFromGzipBridge() throws Exception { GlobalStreamId id = new GlobalStreamId("first", "second"); byte[] serialized = new GzipBridgeThriftSerializationDelegate().serialize(id); GlobalStreamId id2 = testDelegate.deserialize(serialized, GlobalStreamId.class); assertEquals(id2.get_componentId(), id.get_componentId()); assertEquals(id2.get_streamId(), id.get_streamId()); }
@Override public <T> T deserialize(byte[] bytes, Class<T> clazz) { if (isGzipped(bytes)) { return gzipDelegate.deserialize(bytes, clazz); } else { return defaultDelegate.deserialize(bytes,clazz); } }