@Test public void testAudit() throws AuditException { AuditServiceImpl spy = spy(sut); Object auditingObjectMock = this; String subjectMock = "subjectMock"; AuditVerb auditVerbMock = AcsAuditVerb.DEPLOY_POLICY; String objectMock = "objectMock"; Map<PredicateKey, String> predicateMapMock = new HashMap<PredicateKey, String>(); AuditorFacade afMock = mock(AuditorFacade.class); doReturn(afMock).when(spy).createAuditorFacade(subjectMock, auditVerbMock, objectMock); spy.audit(auditingObjectMock, subjectMock, auditVerbMock, objectMock, predicateMapMock); verify(afMock, times(1)).audit(); }
@Override public void audit(Object auditingObject, String subject, AuditVerb verb, String object, Map<PredicateKey, String> predicateMap) throws AuditException { AuditorFacade af = createAuditorFacade(subject, verb, object); String hostAddress = null; try { hostAddress = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { logger.error("Cannot find the host of auditingObject."); logger.error(e.getMessage(), e); } Application app = createApplication(auditingObject, hostAddress); af.originating(app); af.setPredicateMap(mapKeyToString(predicateMap)); af.audit(); }
AuditServiceImpl implements AuditService { @Override public void audit(Object auditingObject, String subject, AuditVerb verb, String object, Map<PredicateKey, String> predicateMap) throws AuditException { AuditorFacade af = createAuditorFacade(subject, verb, object); String hostAddress = null; try { hostAddress = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { logger.error("Cannot find the host of auditingObject."); logger.error(e.getMessage(), e); } Application app = createApplication(auditingObject, hostAddress); af.originating(app); af.setPredicateMap(mapKeyToString(predicateMap)); af.audit(); } }
AuditServiceImpl implements AuditService { @Override public void audit(Object auditingObject, String subject, AuditVerb verb, String object, Map<PredicateKey, String> predicateMap) throws AuditException { AuditorFacade af = createAuditorFacade(subject, verb, object); String hostAddress = null; try { hostAddress = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { logger.error("Cannot find the host of auditingObject."); logger.error(e.getMessage(), e); } Application app = createApplication(auditingObject, hostAddress); af.originating(app); af.setPredicateMap(mapKeyToString(predicateMap)); af.audit(); } AuditServiceImpl(String applicationName); }
AuditServiceImpl implements AuditService { @Override public void audit(Object auditingObject, String subject, AuditVerb verb, String object, Map<PredicateKey, String> predicateMap) throws AuditException { AuditorFacade af = createAuditorFacade(subject, verb, object); String hostAddress = null; try { hostAddress = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { logger.error("Cannot find the host of auditingObject."); logger.error(e.getMessage(), e); } Application app = createApplication(auditingObject, hostAddress); af.originating(app); af.setPredicateMap(mapKeyToString(predicateMap)); af.audit(); } AuditServiceImpl(String applicationName); @Override void audit(Object auditingObject, String subject, AuditVerb verb,
			String object, Map<PredicateKey, String> predicateMap); @Override Map<PredicateKey, String> createPredicateMap(); @Override String getApplicationName(); @Override void init(); @Override void destroy(); }
AuditServiceImpl implements AuditService { @Override public void audit(Object auditingObject, String subject, AuditVerb verb, String object, Map<PredicateKey, String> predicateMap) throws AuditException { AuditorFacade af = createAuditorFacade(subject, verb, object); String hostAddress = null; try { hostAddress = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { logger.error("Cannot find the host of auditingObject."); logger.error(e.getMessage(), e); } Application app = createApplication(auditingObject, hostAddress); af.originating(app); af.setPredicateMap(mapKeyToString(predicateMap)); af.audit(); } AuditServiceImpl(String applicationName); @Override void audit(Object auditingObject, String subject, AuditVerb verb,
			String object, Map<PredicateKey, String> predicateMap); @Override Map<PredicateKey, String> createPredicateMap(); @Override String getApplicationName(); @Override void init(); @Override void destroy();  }