/** * Tests {@link OperationExecutionRecord#OperationExecutionRecord(String, String, long, long, long, String, int, int)}. */ @Test public void testSignatureStringSessionIDTraceIDTinToutEoiEss() { // NOPMD (assert missing) final String sessionId = "IaYyf8m9B"; final long traceId = 3486095; // any number will do final String hostname = "srv-gvNH6CgYFS"; final long tin = 33444; // any number will do final long tout = 33449; // any number will do final int eoi = BookstoreOperationExecutionRecordFactory.EXEC0_0__BOOKSTORE_SEARCHBOOK_EOI; final int ess = BookstoreOperationExecutionRecordFactory.EXEC0_0__BOOKSTORE_SEARCHBOOK_ESS; final OperationExecutionRecord opExecutionRecord = new OperationExecutionRecord(BookstoreOperationExecutionRecordFactory.FQ_SIGNATURE_BOOKSTORE_SEARCH_BOOK, sessionId, traceId, tin, tout, hostname, eoi, ess); this.checkTraceId(opExecutionRecord, traceId); this.checkTinTout(opExecutionRecord, tin, tout); this.checkEoiEss(opExecutionRecord, eoi, ess); this.checkHostName(opExecutionRecord, hostname); this.checkSessionId(opExecutionRecord, sessionId); this.checkToFromBinaryAllFields(opExecutionRecord); }
private void checkToFromBinaryAllFields(final OperationExecutionRecord opExecutionRecord) { final WriterListener receiver = new WriterListener(); final IWriterRegistry<String> writerRegistry = new WriterRegistry(receiver); final ByteBuffer buffer = ByteBuffer.allocate(OperationExecutionRecord.SIZE); opExecutionRecord.serialize(BinaryValueSerializer.create(buffer, writerRegistry)); buffer.flip(); final OperationExecutionRecord deserializedRecord = new OperationExecutionRecord(BinaryValueDeserializer.create(buffer, receiver.getReaderRegistry())); Assert.assertEquals("Records not equal (binary)", opExecutionRecord, deserializedRecord); this.checkEoiEss(deserializedRecord, opExecutionRecord.getEoi(), opExecutionRecord.getEss()); this.checkHostName(deserializedRecord, opExecutionRecord.getHostname()); this.checkSessionId(deserializedRecord, opExecutionRecord.getSessionId()); this.checkTinTout(deserializedRecord, opExecutionRecord.getTin(), opExecutionRecord.getTout()); this.checkTraceId(deserializedRecord, opExecutionRecord.getTraceId()); } }