@Test public void testGetRecord() throws Exception { ReplicaId replicaId = new ReplicaId(PARTITION_ID, String.format(TestReplicaSessionManager.CONNECT_STRING_TEMPLATE, 0)); MockReplicaConnectionFactory connectionFactory = new MockReplicaConnectionFactory(NUM_PARTITIONS); try { ArrayList<Record> records = makeRecords(0, 10); connectionFactory.setCurrentSession(PARTITION_ID, SESSION_ID); connectionFactory.appendRecords(PARTITION_ID, SESSION_ID, records); CompletableFuture<ReplicaConnection> future = new CompletableFuture<>(); future.complete(connectionFactory.get(replicaId.partitionId, SESSION_ID)); ReplicaReader reader = new ReplicaReader(future); for (Record r : records) { RecordHeader recordHeader = reader.getRecordHeader(r.transactionId); assertEquals(r.transactionId, recordHeader.transactionId); assertEquals(r.reqId, recordHeader.reqId); assertEquals(r.header, recordHeader.header); } assertNull(reader.getRecordHeader(11)); for (Record r : records) { Record record = reader.getRecord(r.transactionId); assertEquals(r.reqId, record.reqId); assertEquals(r.header, record.header); assertTrue(Arrays.equals(r.data, record.data)); assertEquals(r.checksum, record.checksum); } assertNull(reader.getRecord(11)); } finally { connectionFactory.close(); } }
public Record getRecord(long transactionId) throws ReplicaReaderException { try { return getConnection().getRecord(transactionId); } catch (ReplicaConnectionException | StorageRpcException ex) { throw new ReplicaReaderException("error getting transaction record", ex); } }
ReplicaReader { public Record getRecord(long transactionId) throws ReplicaReaderException { try { return getConnection().getRecord(transactionId); } catch (ReplicaConnectionException | StorageRpcException ex) { throw new ReplicaReaderException("error getting transaction record", ex); } } }
ReplicaReader { public Record getRecord(long transactionId) throws ReplicaReaderException { try { return getConnection().getRecord(transactionId); } catch (ReplicaConnectionException | StorageRpcException ex) { throw new ReplicaReaderException("error getting transaction record", ex); } } ReplicaReader(CompletableFuture<ReplicaConnection> connectionFuture); }
ReplicaReader { public Record getRecord(long transactionId) throws ReplicaReaderException { try { return getConnection().getRecord(transactionId); } catch (ReplicaConnectionException | StorageRpcException ex) { throw new ReplicaReaderException("error getting transaction record", ex); } } ReplicaReader(CompletableFuture<ReplicaConnection> connectionFuture); Record getRecord(long transactionId); ArrayList<Record> getRecordList(long transactionId, int maxNumRecords); RecordHeader getRecordHeader(long transactionId); ArrayList<RecordHeader> getRecordHeaderList(long transactionId, int maxNumRecords); }
ReplicaReader { public Record getRecord(long transactionId) throws ReplicaReaderException { try { return getConnection().getRecord(transactionId); } catch (ReplicaConnectionException | StorageRpcException ex) { throw new ReplicaReaderException("error getting transaction record", ex); } } ReplicaReader(CompletableFuture<ReplicaConnection> connectionFuture); Record getRecord(long transactionId); ArrayList<Record> getRecordList(long transactionId, int maxNumRecords); RecordHeader getRecordHeader(long transactionId); ArrayList<RecordHeader> getRecordHeaderList(long transactionId, int maxNumRecords);  }