Oadr20bVENEiEventService { public boolean isUpdatedEvent(VtnSessionConfiguration vtnConfiguration, String requestId, OadrEvent event) throws Oadr20bDistributeEventApplicationLayerException { String eventID = event.getEiEvent().getEventDescriptor().getEventID(); long modificationNumber = event.getEiEvent().getEventDescriptor().getModificationNumber(); OadrEvent oadrEvent = getOadrEvents(vtnConfiguration).get(eventID); if (oadrEvent == null) { return false; } long knownModificationNumber = oadrEvent.getEiEvent().getEventDescriptor().getModificationNumber(); if (knownModificationNumber > modificationNumber) { throw new Oadr20bDistributeEventApplicationLayerException( "registred event " + eventID + " has a modification number higher than retrieved event", Oadr20bResponseBuilders.newOadr20bResponseBuilder(requestId, HttpStatus.NOT_ACCEPTABLE_406, "") .build()); } return modificationNumber > knownModificationNumber; }  OadrResponseType oadrDistributeEvent(VtnSessionConfiguration vtnConfiguration, OadrDistributeEventType event); boolean isKnownEvent(VtnSessionConfiguration vtnConfiguration, OadrEvent event); boolean isUpdatedEvent(VtnSessionConfiguration vtnConfiguration, String requestId, OadrEvent event); void saveOadrEvent(VtnSessionConfiguration vtnConfiguration, OadrEvent event); void removeAll(VtnSessionConfiguration vtnConfiguration, List<String> eventIdList); Map<String, OadrEvent> getOadrEvents(VtnSessionConfiguration vtnConfiguration); void putOadrEvents(VtnSessionConfiguration vtnConfiguration, OadrEvent event); List<ScheduledFuture<?>> getScheduledTask(VtnSessionConfiguration vtnConfiguration, String eventId); void addScheduledTask(VtnSessionConfiguration vtnConfiguration, String eventId, ScheduledFuture<?> task); List<String> findMissingEventID(VtnSessionConfiguration vtnConfiguration, List<String> retrievedIdList); void clearOadrEvents(); void addListener(Oadr20bVENEiEventServiceListener listener); Object handle(VtnSessionConfiguration multiConfig, String raw, OadrPayload oadrPayload); String request(String username, String payload);  }
@Test public void isUpdatedEventTest() throws Oadr20bDistributeEventApplicationLayerException { String eventId = "event1"; String requestId = ""; OadrEvent createOadrEvent = createOadrEvent(eventId, 0L); oadr20bVENEiEventService.saveOadrEvent(VTN_SOURCE, createOadrEvent); assertFalse(oadr20bVENEiEventService.isUpdatedEvent(VTN_SOURCE, requestId, createOadrEvent)); createOadrEvent = createOadrEvent(eventId, 1L); assertTrue(oadr20bVENEiEventService.isUpdatedEvent(VTN_SOURCE, requestId, createOadrEvent)); boolean exception = false; try { createOadrEvent = createOadrEvent(eventId, -1L); oadr20bVENEiEventService.isUpdatedEvent(VTN_SOURCE, requestId, createOadrEvent); } catch (Oadr20bDistributeEventApplicationLayerException e) { exception = true; } assertTrue(exception); oadr20bVENEiEventService.clearOadrEvents(); }