@Test public void messageFormatTtlUpdateRecordTest() throws IOException, MessageFormatException { StoreKey key = new MockId("id1"); short accountId = Utils.getRandomShort(TestUtils.RANDOM); short containerId = Utils.getRandomShort(TestUtils.RANDOM); long ttlUpdateTimeMs = SystemTime.getInstance().milliseconds() + TestUtils.RANDOM.nextInt(); long updatedExpiryMs = ttlUpdateTimeMs + TestUtils.RANDOM.nextInt(); short lifeVersion = 1; short oldMessageFormatHeaderVersion = MessageFormatRecord.headerVersionToUse; for (short messageFormatHeaderVersion : new short[]{MessageFormatRecord.Message_Header_Version_V2, MessageFormatRecord.Message_Header_Version_V3}) { MessageFormatRecord.headerVersionToUse = messageFormatHeaderVersion; MessageFormatInputStream messageFormatStream = new TtlUpdateMessageFormatInputStream(key, accountId, containerId, updatedExpiryMs, ttlUpdateTimeMs, lifeVersion); long ttlUpdateRecordSize = MessageFormatRecord.Update_Format_V3.getRecordSize(SubRecord.Type.TTL_UPDATE); int headerSize = MessageFormatRecord.getHeaderSizeForVersion(MessageFormatRecord.headerVersionToUse); Assert.assertEquals(headerSize + ttlUpdateRecordSize + key.sizeInBytes(), messageFormatStream.getSize()); checkTtlUpdateMessage(messageFormatStream, ttlUpdateRecordSize, key, accountId, containerId, updatedExpiryMs, ttlUpdateTimeMs, lifeVersion); } MessageFormatRecord.headerVersionToUse = oldMessageFormatHeaderVersion; }
public long getSize() { return messageLength; }
MessageFormatInputStream extends InputStream { public long getSize() { return messageLength; } }
MessageFormatInputStream extends InputStream { public long getSize() { return messageLength; }  }
MessageFormatInputStream extends InputStream { public long getSize() { return messageLength; }  @Override int read(); @Override int read(byte b[], int off, int len); @Override int available(); long getSize(); }
MessageFormatInputStream extends InputStream { public long getSize() { return messageLength; }  @Override int read(); @Override int read(byte b[], int off, int len); @Override int available(); long getSize();  }