@Test public void testHandleInternalOtherEvent() throws InterruptedException { NegotiationDetails details = new NegotiationDetails(null, id % 17 + 1); PPNegotiationEvent payload = new PPNegotiationEvent(null, NegotiationStatus.SUCCESSFUL, details); InternalEvent event = new InternalEvent(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT, "eventName", "eventSource", payload); classUnderTest.handleInternalEvent(event); Thread.sleep(TIME_TO_WAIT_IN_MS); assertFalse(finalCallback.negotiationComplete); assertFalse(finalCallback.negotiationError); assertNull(finalCallback.agreementKey); assertNull(finalCallback.fileUris); }
@Override public void handleInternalEvent(InternalEvent event) { String type = event.geteventType(); LOG.info("Internal event received: {}", type); LOG.debug("*** event name : " + event.geteventName()); LOG.debug("*** event source : " + event.geteventSource()); if (type.equals(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT)) { PPNegotiationEvent payload = (PPNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { NegotiationStatus status = payload.getNegotiationStatus(); LOG.debug("negotiation status : " + status); if (status == NegotiationStatus.SUCCESSFUL) { logPerformance(true); notifySuccess(negotiationId); } else if (status == NegotiationStatus.FAILED) { logPerformance(false); notifyFailure(negotiationId); } } } else if (type.equals(EventTypes.FAILED_NEGOTIATION_EVENT)) { FailedNegotiationEvent payload = (FailedNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { Requestor requestor = payload.getDetails().getRequestor(); LOG.debug("negotiation requestor : " + requestor); notifyFailure(negotiationId); } } }
PrivacyPolicyNegotiationListener extends EventListener { @Override public void handleInternalEvent(InternalEvent event) { String type = event.geteventType(); LOG.info("Internal event received: {}", type); LOG.debug("*** event name : " + event.geteventName()); LOG.debug("*** event source : " + event.geteventSource()); if (type.equals(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT)) { PPNegotiationEvent payload = (PPNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { NegotiationStatus status = payload.getNegotiationStatus(); LOG.debug("negotiation status : " + status); if (status == NegotiationStatus.SUCCESSFUL) { logPerformance(true); notifySuccess(negotiationId); } else if (status == NegotiationStatus.FAILED) { logPerformance(false); notifyFailure(negotiationId); } } } else if (type.equals(EventTypes.FAILED_NEGOTIATION_EVENT)) { FailedNegotiationEvent payload = (FailedNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { Requestor requestor = payload.getDetails().getRequestor(); LOG.debug("negotiation requestor : " + requestor); notifyFailure(negotiationId); } } } }
PrivacyPolicyNegotiationListener extends EventListener { @Override public void handleInternalEvent(InternalEvent event) { String type = event.geteventType(); LOG.info("Internal event received: {}", type); LOG.debug("*** event name : " + event.geteventName()); LOG.debug("*** event source : " + event.geteventSource()); if (type.equals(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT)) { PPNegotiationEvent payload = (PPNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { NegotiationStatus status = payload.getNegotiationStatus(); LOG.debug("negotiation status : " + status); if (status == NegotiationStatus.SUCCESSFUL) { logPerformance(true); notifySuccess(negotiationId); } else if (status == NegotiationStatus.FAILED) { logPerformance(false); notifyFailure(negotiationId); } } } else if (type.equals(EventTypes.FAILED_NEGOTIATION_EVENT)) { FailedNegotiationEvent payload = (FailedNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { Requestor requestor = payload.getDetails().getRequestor(); LOG.debug("negotiation requestor : " + requestor); notifyFailure(negotiationId); } } } PrivacyPolicyNegotiationListener(IEventMgr eventMgr); }
PrivacyPolicyNegotiationListener extends EventListener { @Override public void handleInternalEvent(InternalEvent event) { String type = event.geteventType(); LOG.info("Internal event received: {}", type); LOG.debug("*** event name : " + event.geteventName()); LOG.debug("*** event source : " + event.geteventSource()); if (type.equals(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT)) { PPNegotiationEvent payload = (PPNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { NegotiationStatus status = payload.getNegotiationStatus(); LOG.debug("negotiation status : " + status); if (status == NegotiationStatus.SUCCESSFUL) { logPerformance(true); notifySuccess(negotiationId); } else if (status == NegotiationStatus.FAILED) { logPerformance(false); notifyFailure(negotiationId); } } } else if (type.equals(EventTypes.FAILED_NEGOTIATION_EVENT)) { FailedNegotiationEvent payload = (FailedNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { Requestor requestor = payload.getDetails().getRequestor(); LOG.debug("negotiation requestor : " + requestor); notifyFailure(negotiationId); } } } PrivacyPolicyNegotiationListener(IEventMgr eventMgr); void addNegotiationInfo(PrivacyPolicyNegotiationInfo info); void unsubscribeEvents(); @Override void handleInternalEvent(InternalEvent event); @Override void handleExternalEvent(CSSEvent event); }
PrivacyPolicyNegotiationListener extends EventListener { @Override public void handleInternalEvent(InternalEvent event) { String type = event.geteventType(); LOG.info("Internal event received: {}", type); LOG.debug("*** event name : " + event.geteventName()); LOG.debug("*** event source : " + event.geteventSource()); if (type.equals(EventTypes.PRIVACY_POLICY_NEGOTIATION_EVENT)) { PPNegotiationEvent payload = (PPNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { NegotiationStatus status = payload.getNegotiationStatus(); LOG.debug("negotiation status : " + status); if (status == NegotiationStatus.SUCCESSFUL) { logPerformance(true); notifySuccess(negotiationId); } else if (status == NegotiationStatus.FAILED) { logPerformance(false); notifyFailure(negotiationId); } } } else if (type.equals(EventTypes.FAILED_NEGOTIATION_EVENT)) { FailedNegotiationEvent payload = (FailedNegotiationEvent) event.geteventInfo(); Integer negotiationId = new Integer(payload.getDetails().getNegotiationID()); if (negotiationMap.containsKey(negotiationId)) { Requestor requestor = payload.getDetails().getRequestor(); LOG.debug("negotiation requestor : " + requestor); notifyFailure(negotiationId); } } } PrivacyPolicyNegotiationListener(IEventMgr eventMgr); void addNegotiationInfo(PrivacyPolicyNegotiationInfo info); void unsubscribeEvents(); @Override void handleInternalEvent(InternalEvent event); @Override void handleExternalEvent(CSSEvent event);  }