diff options
author | romaingimbert <romain.gimbert@orange.com> | 2019-01-24 11:01:03 +0100 |
---|---|---|
committer | romaingimbert <romain.gimbert@orange.com> | 2019-01-24 12:28:42 +0100 |
commit | 69197a8abc78ee825d38908cd46690b3c150caa1 (patch) | |
tree | cd6db2a41e42ca5b7204851ccd8c34c76527a381 /src/main/java/org/onap/nbi/apis/hub/HubResource.java | |
parent | 05733ab5105f440e44eb56dc37e6d14615c36454 (diff) |
hub resource format date
-fix code
-add listener for testing
-add karate test
Change-Id: Ife2d7812c77316b75c55e86056f59d838e117069
Issue-ID: EXTAPI-180
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java/org/onap/nbi/apis/hub/HubResource.java')
-rwxr-xr-x | src/main/java/org/onap/nbi/apis/hub/HubResource.java | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/main/java/org/onap/nbi/apis/hub/HubResource.java b/src/main/java/org/onap/nbi/apis/hub/HubResource.java index 9ef5235..cccd0a8 100755 --- a/src/main/java/org/onap/nbi/apis/hub/HubResource.java +++ b/src/main/java/org/onap/nbi/apis/hub/HubResource.java @@ -1,15 +1,14 @@ /** * Copyright (c) 2018 Orange * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. */ package org.onap.nbi.apis.hub; @@ -44,10 +43,6 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; -import java.net.URI; -import java.util.List; -import java.util.stream.Collectors; - @RestController @RequestMapping("/hub") @EnableScheduling @@ -71,10 +66,10 @@ public class HubResource extends ResourceManagement { Subscriber subscriber = subscriptionService.createSubscription(subscription); URI location = ServletUriComponentsBuilder - .fromCurrentRequest() - .path("/{id}") - .buildAndExpand(subscriber.getId()) - .toUri(); + .fromCurrentRequest() + .path("/{id}") + .buildAndExpand(subscriber.getId()) + .toUri(); return ResponseEntity.created(location).build(); } @@ -82,7 +77,7 @@ public class HubResource extends ResourceManagement { @GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) { - Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId); + Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId); if (subscriber == null) { return ResponseEntity.notFound().build(); } @@ -100,8 +95,8 @@ public class HubResource extends ResourceManagement { headers.add("X-Total-Count", String.valueOf(totalCount)); headers.add("X-Result-Count", String.valueOf(subscribers.size())); List<Subscription> subscriptions = subscribers.stream() - .map(Subscription::createFromSubscriber) - .collect(Collectors.toList()); + .map(Subscription::createFromSubscriber) + .collect(Collectors.toList()); return this.findResponse(subscriptions, filter, headers); |