@Test public void test() throws AuditException { @SuppressWarnings("unchecked") Map<PredicateKey, String> predicateMap = (Map<PredicateKey, String>) mock(Map.class); doReturn(predicateMap).when(auditService).createPredicateMap(); SecurityEvent event = new MaliciousFileDetectedEvent(IP_ADDRESS, USER_NAME, FILE_UPLOADED); listener.audit(event); verify(auditService).audit("MaliciousFileDetectedEventListener", USER_NAME, SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, FILE_UPLOADED, predicateMap); }
@Override public void audit(SecurityEvent event) { MaliciousFileDetectedEvent maliciousFileDetectedEvent = (MaliciousFileDetectedEvent) event; Map<PredicateKey, String> predicateMap = auditService .createPredicateMap(); predicateMap.put(SecurityPredicateKey.IP_ADDRESS, event.getIpAddress()); try { auditService.audit("MaliciousFileDetectedEventListener", maliciousFileDetectedEvent.getUserName(), SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, maliciousFileDetectedEvent.getFileName(), predicateMap); } catch (AuditException e) { logger.error(e.getMessage(), e); } }
MaliciousFileDetectedEventListener extends SecurityEventListener { @Override public void audit(SecurityEvent event) { MaliciousFileDetectedEvent maliciousFileDetectedEvent = (MaliciousFileDetectedEvent) event; Map<PredicateKey, String> predicateMap = auditService .createPredicateMap(); predicateMap.put(SecurityPredicateKey.IP_ADDRESS, event.getIpAddress()); try { auditService.audit("MaliciousFileDetectedEventListener", maliciousFileDetectedEvent.getUserName(), SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, maliciousFileDetectedEvent.getFileName(), predicateMap); } catch (AuditException e) { logger.error(e.getMessage(), e); } } }
MaliciousFileDetectedEventListener extends SecurityEventListener { @Override public void audit(SecurityEvent event) { MaliciousFileDetectedEvent maliciousFileDetectedEvent = (MaliciousFileDetectedEvent) event; Map<PredicateKey, String> predicateMap = auditService .createPredicateMap(); predicateMap.put(SecurityPredicateKey.IP_ADDRESS, event.getIpAddress()); try { auditService.audit("MaliciousFileDetectedEventListener", maliciousFileDetectedEvent.getUserName(), SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, maliciousFileDetectedEvent.getFileName(), predicateMap); } catch (AuditException e) { logger.error(e.getMessage(), e); } } MaliciousFileDetectedEventListener(EventService eventService,
			AuditService auditService); }
MaliciousFileDetectedEventListener extends SecurityEventListener { @Override public void audit(SecurityEvent event) { MaliciousFileDetectedEvent maliciousFileDetectedEvent = (MaliciousFileDetectedEvent) event; Map<PredicateKey, String> predicateMap = auditService .createPredicateMap(); predicateMap.put(SecurityPredicateKey.IP_ADDRESS, event.getIpAddress()); try { auditService.audit("MaliciousFileDetectedEventListener", maliciousFileDetectedEvent.getUserName(), SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, maliciousFileDetectedEvent.getFileName(), predicateMap); } catch (AuditException e) { logger.error(e.getMessage(), e); } } MaliciousFileDetectedEventListener(EventService eventService,
			AuditService auditService); @Override boolean canHandle(Object event); @Override void handle(Object event); @Override void audit(SecurityEvent event); }
MaliciousFileDetectedEventListener extends SecurityEventListener { @Override public void audit(SecurityEvent event) { MaliciousFileDetectedEvent maliciousFileDetectedEvent = (MaliciousFileDetectedEvent) event; Map<PredicateKey, String> predicateMap = auditService .createPredicateMap(); predicateMap.put(SecurityPredicateKey.IP_ADDRESS, event.getIpAddress()); try { auditService.audit("MaliciousFileDetectedEventListener", maliciousFileDetectedEvent.getUserName(), SecurityAuditVerb.UPLOADS_MALICIOUS_FILE, maliciousFileDetectedEvent.getFileName(), predicateMap); } catch (AuditException e) { logger.error(e.getMessage(), e); } } MaliciousFileDetectedEventListener(EventService eventService,
			AuditService auditService); @Override boolean canHandle(Object event); @Override void handle(Object event); @Override void audit(SecurityEvent event);  }