@Test public void subscribeAcceptedValidateResponse() { SubscribeRequest request = new SubscribeRequest(); request.setDeliveryAddress(DELIVERY_ADDRESS); SubscribeResponse response = service.subscribe(request, SUBSCRIBER_IDENTITY); assertEquals(SubscribeStatus.ACCEPTED, response.getStatus()); assertNotNull(response.getSubscriptionId()); }
@Override public SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Subscribing {}", subscriberIdentity); SubscribeResponse subscribeResponse = new SubscribeResponse(); try { String deliveryAddress = parameters.getDeliveryAddress(); if (subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(subscriberIdentity, deliveryAddress) == null) { Subscription subscription = new Subscription(subscriberIdentity, deliveryAddress); subscriptionRepository.insert(subscription); subscribeResponse.setSubscriptionId(subscription.getSubscriptionId()); subscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { subscribeResponse.setStatus(SubscribeStatus.DUPLICATE_IGNORED); } } catch (Exception e) { LOG.error("Subscription failed", e); subscribeResponse.setStatus(SubscribeStatus.REJECTED); } return subscribeResponse; }
MotownVasPublisherService implements VasPublisherService { @Override public SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Subscribing {}", subscriberIdentity); SubscribeResponse subscribeResponse = new SubscribeResponse(); try { String deliveryAddress = parameters.getDeliveryAddress(); if (subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(subscriberIdentity, deliveryAddress) == null) { Subscription subscription = new Subscription(subscriberIdentity, deliveryAddress); subscriptionRepository.insert(subscription); subscribeResponse.setSubscriptionId(subscription.getSubscriptionId()); subscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { subscribeResponse.setStatus(SubscribeStatus.DUPLICATE_IGNORED); } } catch (Exception e) { LOG.error("Subscription failed", e); subscribeResponse.setStatus(SubscribeStatus.REJECTED); } return subscribeResponse; } }
MotownVasPublisherService implements VasPublisherService { @Override public SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Subscribing {}", subscriberIdentity); SubscribeResponse subscribeResponse = new SubscribeResponse(); try { String deliveryAddress = parameters.getDeliveryAddress(); if (subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(subscriberIdentity, deliveryAddress) == null) { Subscription subscription = new Subscription(subscriberIdentity, deliveryAddress); subscriptionRepository.insert(subscription); subscribeResponse.setSubscriptionId(subscription.getSubscriptionId()); subscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { subscribeResponse.setStatus(SubscribeStatus.DUPLICATE_IGNORED); } } catch (Exception e) { LOG.error("Subscription failed", e); subscribeResponse.setStatus(SubscribeStatus.REJECTED); } return subscribeResponse; }  }
MotownVasPublisherService implements VasPublisherService { @Override public SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Subscribing {}", subscriberIdentity); SubscribeResponse subscribeResponse = new SubscribeResponse(); try { String deliveryAddress = parameters.getDeliveryAddress(); if (subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(subscriberIdentity, deliveryAddress) == null) { Subscription subscription = new Subscription(subscriberIdentity, deliveryAddress); subscriptionRepository.insert(subscription); subscribeResponse.setSubscriptionId(subscription.getSubscriptionId()); subscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { subscribeResponse.setStatus(SubscribeStatus.DUPLICATE_IGNORED); } } catch (Exception e) { LOG.error("Subscription failed", e); subscribeResponse.setStatus(SubscribeStatus.REJECTED); } return subscribeResponse; }  @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 SubscribeResponse subscribe(@WebParam(partName = "parameters", name = "subscribeRequest", targetNamespace = VAS_NAMESPACE) SubscribeRequest parameters, @WebParam(partName = "SubscriberIdentity", name = "subscriberIdentity", targetNamespace = VAS_NAMESPACE, header = true) String subscriberIdentity) { LOG.info("Subscribing {}", subscriberIdentity); SubscribeResponse subscribeResponse = new SubscribeResponse(); try { String deliveryAddress = parameters.getDeliveryAddress(); if (subscriptionRepository.findBySubscriberIdentityAndDeliveryAddress(subscriberIdentity, deliveryAddress) == null) { Subscription subscription = new Subscription(subscriberIdentity, deliveryAddress); subscriptionRepository.insert(subscription); subscribeResponse.setSubscriptionId(subscription.getSubscriptionId()); subscribeResponse.setStatus(SubscribeStatus.ACCEPTED); } else { subscribeResponse.setStatus(SubscribeStatus.DUPLICATE_IGNORED); } } catch (Exception e) { LOG.error("Subscription failed", e); subscribeResponse.setStatus(SubscribeStatus.REJECTED); } return subscribeResponse; }  @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; }