InMemoryLinkMetadata extends TLVStructure implements LinkMetadata, Identity { public String getDecodedClientId() { return clientId; } InMemoryLinkMetadata(String clientId);  InMemoryLinkMetadata(String clientId, String machineId, Long sequenceNumber, Long requestTime);  InMemoryLinkMetadata(TLVElement tlvElement); @Override int getElementType(); TLVStructure getMetadataStructure(); IdentityType getType(); byte[] getClientId(); String getDecodedClientId(); byte[] getMachineId(); String getDecodedMachineId(); Long getSequenceNumber(); Long getRequestTime(); static final int ELEMENT_TYPE_METADATA; static final int ELEMENT_TYPE_CLIENT_ID; static final int ELEMENT_TYPE_MACHINE_ID; static final int ELEMENT_TYPE_SEQUENCE_NUMBER; static final int ELEMENT_TYPE_REQUEST_TIME; static final int ELEMENT_TYPE_PADDING; }
@Test public void testCreateNewLeftLink() throws Exception { InMemoryLinkMetadata metadata = new InMemoryLinkMetadata(TEST_CLIENT_ID, TEST_MACHINE_ID, TEST_SEQUENCE_NUMBER, CURRENT_TIME); assertEquals(metadata.getDecodedClientId(), TEST_CLIENT_ID); TLVElement rootElement = metadata.getRootElement(); assertEquals(5, rootElement.getChildElements().size()); int paddingLength = 2; assertEquals(rootElement.getChildElements().get(0).getContentLength(), paddingLength); assertEquals(rootElement.getChildElements().get(1).getDecodedString(), TEST_CLIENT_ID); assertEquals(rootElement.getChildElements().get(2).getDecodedString(), TEST_MACHINE_ID); assertEquals(rootElement.getChildElements().get(3).getDecodedLong(), TEST_SEQUENCE_NUMBER); assertEquals(rootElement.getChildElements().get(4).getDecodedLong(), CURRENT_TIME); }
@Test public void testCreateNewLeftLinkWithClientId() throws Exception { InMemoryLinkMetadata metadata = new InMemoryLinkMetadata(TEST_CLIENT_ID); assertEquals(metadata.getDecodedClientId(), TEST_CLIENT_ID); TLVElement rootElement = metadata.getRootElement(); assertEquals(2, rootElement.getChildElements().size()); int paddingLength = 1; assertEquals(rootElement.getChildElements().get(0).getContentLength(), paddingLength); assertEquals(rootElement.getChildElements().get(1).getDecodedString(), TEST_CLIENT_ID); }