AuditDBStoreImpl implements AuditStore { protected final AuditRepositoryRecord createDBAuditObj(LogEventSecureRequestType mess, AssertionType assertion) { AuditRepositoryRecord auditRec = new AuditRepositoryRecord(); String eventCommunityId = mess.getRemoteHCID(); auditRec.setRemoteHcid(eventCommunityId); auditRec.setDirection(mess.getDirection()); auditRec.setMessage(getBlobFromAuditMessage(mess.getAuditMessage())); XMLGregorianCalendar xMLCalDate = mess.getEventTimestamp(); if (xMLCalDate != null) { auditRec.setEventTimestamp(convertXMLGregorianCalendarToDate(xMLCalDate)); } auditRec.setEventType(mess.getEventType()); auditRec.setEventId(mess.getEventID()); auditRec.setMessageId(mess.getRequestMessageId()); auditRec.setRelatesTo(mess.getRelatesTo()); auditRec.setUserId(mess.getUserId()); return auditRec; }  @Override boolean saveAuditRecord(LogEventSecureRequestType request, AssertionType assertion);  }
@Test public void testCreateDBAuditObj() { AuditDBStoreImpl dbStore = new AuditDBStoreImpl() { @Override protected Blob getBlobFromAuditMessage(AuditMessageType mess) { return mock(Blob.class); } }; AssertionType assertion = createAssertion(); LogEventSecureRequestType auditObj = createLogEventSecureObj(assertion); AuditRepositoryRecord dbRec = dbStore.createDBAuditObj(auditObj, assertion); assertEquals("AuditRepositoryRecord.Direction mismatch", dbRec.getDirection(), auditObj.getDirection()); assertEquals("AuditRepositoryRecord.EventType mismatch", dbRec.getEventType(), EVENT_TYPE); assertEquals("AuditRepositoryRecord.EventId mismatch", dbRec.getEventId(), EVENT_ID_CODE_DISP_NAME); assertEquals("AuditRepositoryRecord.RelatesTo", dbRec.getRelatesTo(), RELATES_TO_1); assertNotNull("AuditRepositoryRecord.MessageId", dbRec.getMessageId()); }