@Test public void unsubscribeKnownSubscriptioValidateRepository() { String subscriptionId = subscribeTestSubscriber(); UnsubscribeRequest request = new UnsubscribeRequest(); request.setSubscriptionId(subscriptionId); service.unsubscribe(request, SUBSCRIBER_IDENTITY); assertNull(subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(SUBSCRIBER_IDENTITY, DELIVERY_ADDRESS)); }
@Override public UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Unsubscribing {}", subscriberIdentity); UnsubscribeResponse unsubscribeResponse = new UnsubscribeResponse(); try { Subscription subscription = subscriptionRepository.findBySubscriptionId(parameters.getSubscriptionId()); if (subscription != null) { subscriptionRepository.delete(subscription); unsubscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { LOG.warn("Unable to unsubscribe unkown subscription {}", subscriberIdentity); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } } catch (Exception e) { LOG.error("Unsubscribing of {} failed", subscriberIdentity, e); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } return unsubscribeResponse; }
MotownVasPublisherService implements VasPublisherService { @Override public UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Unsubscribing {}", subscriberIdentity); UnsubscribeResponse unsubscribeResponse = new UnsubscribeResponse(); try { Subscription subscription = subscriptionRepository.findBySubscriptionId(parameters.getSubscriptionId()); if (subscription != null) { subscriptionRepository.delete(subscription); unsubscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { LOG.warn("Unable to unsubscribe unkown subscription {}", subscriberIdentity); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } } catch (Exception e) { LOG.error("Unsubscribing of {} failed", subscriberIdentity, e); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } return unsubscribeResponse; } }
MotownVasPublisherService implements VasPublisherService { @Override public UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Unsubscribing {}", subscriberIdentity); UnsubscribeResponse unsubscribeResponse = new UnsubscribeResponse(); try { Subscription subscription = subscriptionRepository.findBySubscriptionId(parameters.getSubscriptionId()); if (subscription != null) { subscriptionRepository.delete(subscription); unsubscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { LOG.warn("Unable to unsubscribe unkown subscription {}", subscriberIdentity); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } } catch (Exception e) { LOG.error("Unsubscribing of {} failed", subscriberIdentity, e); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } return unsubscribeResponse; }  }
MotownVasPublisherService implements VasPublisherService { @Override public UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Unsubscribing {}", subscriberIdentity); UnsubscribeResponse unsubscribeResponse = new UnsubscribeResponse(); try { Subscription subscription = subscriptionRepository.findBySubscriptionId(parameters.getSubscriptionId()); if (subscription != null) { subscriptionRepository.delete(subscription); unsubscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { LOG.warn("Unable to unsubscribe unkown subscription {}", subscriberIdentity); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } } catch (Exception e) { LOG.error("Unsubscribing of {} failed", subscriberIdentity, e); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } return unsubscribeResponse; }  @Override SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); @Override GetChargePointInfoResponse getChargePointInfo(@WebParam(partName = "parameters", name = "getChargePointInfoRequest", targetNamespace = VAS_NAMESPACE) GetChargePointInfoRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); @Override UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); void setSubscriptionRepository(SubscriptionRepository subscriptionRepository); void setChargingStationRepository(ChargingStationRepository chargingStationRepository); void setVasConversionService(VasConversionService vasConversionService); }
MotownVasPublisherService implements VasPublisherService { @Override public UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Unsubscribing {}", subscriberIdentity); UnsubscribeResponse unsubscribeResponse = new UnsubscribeResponse(); try { Subscription subscription = subscriptionRepository.findBySubscriptionId(parameters.getSubscriptionId()); if (subscription != null) { subscriptionRepository.delete(subscription); unsubscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { LOG.warn("Unable to unsubscribe unkown subscription {}", subscriberIdentity); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } } catch (Exception e) { LOG.error("Unsubscribing of {} failed", subscriberIdentity, e); unsubscribeResponse.setStatus(SubscribeStatus.REJECTED); } return unsubscribeResponse; }  @Override SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); @Override GetChargePointInfoResponse getChargePointInfo(@WebParam(partName = "parameters", name = "getChargePointInfoRequest", targetNamespace = VAS_NAMESPACE) GetChargePointInfoRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); @Override UnsubscribeResponse unsubscribe(@WebParam(partName = "parameters", name = "unsubscribeRequest", targetNamespace = VAS_NAMESPACE) UnsubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity); void setSubscriptionRepository(SubscriptionRepository subscriptionRepository); void setChargingStationRepository(ChargingStationRepository chargingStationRepository); void setVasConversionService(VasConversionService vasConversionService); static final String VAS_NAMESPACE; }