summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/pnfsimulator/rest
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2021-03-10 12:55:08 +0100
committerZebek Bogumil <bogumil.zebek@nokia.com>2021-03-10 12:55:08 +0100
commitbae12bf7d5a92a4d6be22e9ce8c3dc9878c59f36 (patch)
tree5cbb50a4c336d7ebee4c402f20f0e036a3bca814 /src/main/java/org/onap/pnfsimulator/rest
parent4af5241ab25b0103d8ea680789aaf9a8696dfc75 (diff)
Package rename
Step 2: package rename, fix pom.xml, fix integration tests Issue-ID: INT-1869 Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com> Change-Id: Ia4c6823e4facc3791583fb39caba3bcc125b3af7
Diffstat (limited to 'src/main/java/org/onap/pnfsimulator/rest')
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java241
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/TemplateController.java112
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/model/FullEvent.java48
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/model/SearchExp.java42
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/model/SimulatorParams.java46
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/model/SimulatorRequest.java55
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/model/TemplateRequest.java38
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java35
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/util/JsonObjectDeserializer.java42
-rw-r--r--src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java62
10 files changed, 0 insertions, 721 deletions
diff --git a/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java b/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java
deleted file mode 100644
index f2c70dd..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.JsonSyntaxException;
-import org.json.JSONException;
-import org.onap.pnfsimulator.event.EventData;
-import org.onap.pnfsimulator.event.EventDataService;
-import org.onap.pnfsimulator.rest.model.FullEvent;
-import org.onap.pnfsimulator.rest.model.SimulatorRequest;
-import org.onap.pnfsimulator.rest.util.DateUtil;
-import org.onap.pnfsimulator.rest.util.ResponseBuilder;
-import org.onap.pnfsimulator.simulator.SimulatorService;
-import org.onap.pnfsimulator.simulator.client.HttpResponseAdapter;
-import org.onap.pnfsimulator.simulatorconfig.SimulatorConfig;
-import org.quartz.SchedulerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.validation.Valid;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import static org.onap.pnfsimulator.logging.MdcVariables.INSTANCE_UUID;
-import static org.onap.pnfsimulator.logging.MdcVariables.INVOCATION_ID;
-import static org.onap.pnfsimulator.logging.MdcVariables.REQUEST_ID;
-import static org.onap.pnfsimulator.logging.MdcVariables.RESPONSE_CODE;
-import static org.onap.pnfsimulator.logging.MdcVariables.SERVICE_NAME;
-import static org.onap.pnfsimulator.logging.MdcVariables.X_INVOCATION_ID;
-import static org.onap.pnfsimulator.logging.MdcVariables.X_ONAP_REQUEST_ID;
-import static org.onap.pnfsimulator.rest.util.ResponseBuilder.MESSAGE;
-import static org.onap.pnfsimulator.rest.util.ResponseBuilder.TIMESTAMP;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.OK;
-
-@RestController
-@RequestMapping("/simulator")
-public class SimulatorController {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SimulatorController.class);
- private static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
- private static final String INCORRECT_TEMPLATE_MESSAGE = "Cannot start simulator, template %s is not in valid format: %s";
- private static final String NOT_EXISTING_TEMPLATE = "Cannot start simulator - template %s not found.";
- private static final String BREAKING_CHARACTER_REGEX = "[\n|\r|\t]";
- private final DateFormat responseDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss,SSS");
- private final SimulatorService simulatorService;
- private EventDataService eventDataService;
-
- @Autowired
- public SimulatorController(SimulatorService simulatorService,
- EventDataService eventDataService) {
- this.simulatorService = simulatorService;
- this.eventDataService = eventDataService;
- }
-
- /**
- * @deprecated
- */
- @PostMapping("test")
- @Deprecated
- public ResponseEntity<Map<String, Object>> test(@Valid @RequestBody SimulatorRequest simulatorRequest) {
- MDC.put("test", "test");
- String simulatorRequestString = simulatorRequest.toString();
- LOGGER.info(ENTRY, simulatorRequestString);
- return buildResponse(OK, ImmutableMap.of(MESSAGE, "message1234"));
- }
-
- @PostMapping(value = "start")
- public ResponseEntity<Map<String, Object>> start(@RequestHeader HttpHeaders headers,
- @Valid @RequestBody SimulatorRequest triggerEventRequest) {
- logContextHeaders(headers, "/simulator/start");
- LOGGER.info(ENTRY, "Simulator started");
-
- try {
- return processRequest(triggerEventRequest);
-
- } catch (JSONException | JsonSyntaxException e) {
- MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
- LOGGER.warn("Cannot trigger event, invalid json format: {}", e.getMessage());
- LOGGER.debug("Received json has invalid format", e);
- return buildResponse(BAD_REQUEST, ImmutableMap.of(MESSAGE, String
- .format(INCORRECT_TEMPLATE_MESSAGE, triggerEventRequest.getTemplateName(),
- e.getMessage())));
- } catch (GeneralSecurityException e) {
- MDC.put(RESPONSE_CODE, INTERNAL_SERVER_ERROR.toString());
- LOGGER.error("Client certificate validation failed: {}", e.getMessage());
- return buildResponse(INTERNAL_SERVER_ERROR,
- ImmutableMap.of(MESSAGE, "Invalid or misconfigured client certificate"));
- } catch (IOException e) {
- MDC.put(RESPONSE_CODE, BAD_REQUEST.toString());
- LOGGER.warn("Json validation failed: {}", e.getMessage());
- return buildResponse(BAD_REQUEST,
- ImmutableMap.of(MESSAGE, String.format(NOT_EXISTING_TEMPLATE, triggerEventRequest.getTemplateName())));
- } catch (Exception e) {
- MDC.put(RESPONSE_CODE, INTERNAL_SERVER_ERROR.toString());
- LOGGER.error("Cannot trigger event - unexpected exception", e);
- return buildResponse(INTERNAL_SERVER_ERROR,
- ImmutableMap.of(MESSAGE, "Unexpected exception: " + e.getMessage()));
- } finally {
- MDC.clear();
- }
- }
-
- /**
- * @deprecated
- */
- @GetMapping("all-events")
- @Deprecated
- public ResponseEntity<Map<String, Object>> allEvents() {
- List<EventData> eventDataList = eventDataService.getAllEvents();
- StringBuilder sb = new StringBuilder();
- eventDataList.forEach(e -> sb.append(e).append(System.lineSeparator()));
-
- return ResponseBuilder
- .status(OK).put(MESSAGE, sb.toString())
- .build();
- }
-
- @GetMapping("config")
- public ResponseEntity<Map<String, Object>> getConfig() {
- SimulatorConfig configToGet = simulatorService.getConfiguration();
- return buildResponse(OK, ImmutableMap.of("simulatorConfig", configToGet));
- }
-
- @PutMapping("config")
- public ResponseEntity<Map<String, Object>> updateConfig(@Valid @RequestBody SimulatorConfig newConfig) {
- SimulatorConfig updatedConfig = simulatorService.updateConfiguration(newConfig);
- return buildResponse(OK, ImmutableMap.of("simulatorConfig", updatedConfig));
- }
-
- @PostMapping("cancel/{jobName}")
- public ResponseEntity<Map<String, Object>> cancelEvent(@PathVariable String jobName) throws SchedulerException {
- String jobNameNoBreakingCharacters = replaceBreakingCharacters(jobName);
- LOGGER.info(ENTRY, "Cancel called on {}.", jobNameNoBreakingCharacters);
- boolean isCancelled = simulatorService.cancelEvent(jobName);
- return createCancelEventResponse(isCancelled);
- }
-
- @PostMapping("cancel")
- public ResponseEntity<Map<String, Object>> cancelAllEvent() throws SchedulerException {
- LOGGER.info(ENTRY, "Cancel called on all jobs");
- boolean isCancelled = simulatorService.cancelAllEvents();
- return createCancelEventResponse(isCancelled);
- }
-
- @PostMapping("event")
- public ResponseEntity<Map<String, Object>> sendEventDirectly(@RequestHeader HttpHeaders headers, @Valid @RequestBody FullEvent event)
- throws IOException, GeneralSecurityException {
- logContextHeaders(headers, "/simulator/event");
- LOGGER.info(ENTRY, "Trying to send one-time event directly to VES Collector");
- HttpResponseAdapter response = simulatorService.triggerOneTimeEvent(event);
- return buildResponse(response);
- }
-
- private String replaceBreakingCharacters(String jobName) {
- return jobName.replaceAll(BREAKING_CHARACTER_REGEX, "_");
- }
-
- private ResponseEntity<Map<String, Object>> processRequest(SimulatorRequest triggerEventRequest)
- throws IOException, SchedulerException, GeneralSecurityException {
-
- String jobName = simulatorService.triggerEvent(triggerEventRequest);
- MDC.put(RESPONSE_CODE, OK.toString());
- return buildResponse(OK, ImmutableMap.of(MESSAGE, "Request started", "jobName", jobName));
- }
-
- private ResponseEntity<Map<String, Object>> buildResponse(HttpStatus endStatus, Map<String, Object> parameters) {
- ResponseBuilder builder = ResponseBuilder
- .status(endStatus)
- .put(TIMESTAMP, DateUtil.getTimestamp(responseDateFormat));
- parameters.forEach(builder::put);
- return builder.build();
- }
-
- private ResponseEntity<Map<String, Object>> buildResponse(HttpResponseAdapter response) {
- HttpStatus status = HttpStatus.valueOf(response.getCode());
- Map<String, Object> parameters;
- if (response.getMessage().isEmpty()) {
- parameters = Map.of(MESSAGE, "One-time direct event sent successfully");
- } else {
- parameters = Map.of(MESSAGE, response.getMessage());
- }
- return buildResponse(status, parameters);
- }
-
- private void logContextHeaders(HttpHeaders headers, String serviceName) {
- MDC.put(REQUEST_ID, headers.getFirst(X_ONAP_REQUEST_ID));
- MDC.put(INVOCATION_ID, headers.getFirst(X_INVOCATION_ID));
- MDC.put(INSTANCE_UUID, UUID.randomUUID().toString());
- MDC.put(SERVICE_NAME, serviceName);
- }
-
- private ResponseEntity<Map<String, Object>> createCancelEventResponse(boolean isCancelled) {
- if (isCancelled) {
- return buildResponse(OK, ImmutableMap.of(MESSAGE, "Event(s) was cancelled"));
- } else {
- return buildResponse(NOT_FOUND, ImmutableMap.of(MESSAGE, "Simulator was not able to cancel event(s)"));
- }
- }
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/TemplateController.java b/src/main/java/org/onap/pnfsimulator/rest/TemplateController.java
deleted file mode 100644
index 8f8fee7..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/TemplateController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Simulator
- * ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest;
-
-import java.time.Instant;
-import java.util.List;
-import java.util.Optional;
-import javax.validation.Valid;
-
-import com.google.gson.Gson;
-import org.onap.pnfsimulator.db.Storage;
-import org.onap.pnfsimulator.rest.model.TemplateRequest;
-import org.onap.pnfsimulator.rest.model.SearchExp;
-import org.onap.pnfsimulator.template.Template;
-import org.onap.pnfsimulator.template.search.IllegalJsonValueException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.server.ResponseStatusException;
-
-
-@RestController
-@RequestMapping("/template")
-public class TemplateController {
- static final String TEMPLATE_NOT_FOUND_MSG = "A template with given name does not exist";
- static final String CANNOT_OVERRIDE_TEMPLATE_MSG = "Cannot overwrite existing template. Use override=true to override";
- private final Storage<Template> service;
-
- @Autowired
- public TemplateController(Storage<Template> service) {
- this.service = service;
- }
-
- @GetMapping("list")
- public ResponseEntity<List<Template>> list() {
- return new ResponseEntity<>(service.getAll(), HttpStatus.OK);
- }
-
- @GetMapping("get/{templateName}")
- public ResponseEntity<String> get(@PathVariable String templateName) {
- Optional<Template> template = service.get(templateName);
- return template
- .map(this::createTemplateResponse)
- .orElse(this.createTemplateNotFoundResponse());
- }
-
- private ResponseEntity<String> createTemplateResponse(Template template) {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
- return new ResponseEntity<>(new Gson().toJson(template),headers, HttpStatus.OK);
- }
-
- private ResponseEntity<String> createTemplateNotFoundResponse() {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.TEXT_PLAIN);
- return new ResponseEntity<>(TEMPLATE_NOT_FOUND_MSG, headers, HttpStatus.NOT_FOUND);
- }
-
- @PostMapping("upload")
- public ResponseEntity<String> upload(
- @RequestBody @Valid TemplateRequest templateRequest,
- @RequestParam(required = false) boolean override) {
- String msg = "";
- HttpStatus status = HttpStatus.CREATED;
- Template template = new Template(templateRequest.getName(), templateRequest.getTemplate(), Instant.now().getNano());
- if (!service.tryPersistOrOverwrite(template, override)) {
- status = HttpStatus.CONFLICT;
- msg = CANNOT_OVERRIDE_TEMPLATE_MSG;
- }
- return new ResponseEntity<>(msg, status);
- }
-
- @PostMapping("search")
- public ResponseEntity<List<String>> searchByCriteria(@RequestBody SearchExp queryJson) {
- try {
- List<String> templateNames = service.getIdsByContentCriteria(queryJson.getSearchExpr());
- return new ResponseEntity<>(templateNames, HttpStatus.OK);
- } catch (IllegalJsonValueException ex) {
- throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("Try again with correct parameters. Cause: %s", ex.getMessage()), ex);
- }
-
- }
-
-
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/model/FullEvent.java b/src/main/java/org/onap/pnfsimulator/rest/model/FullEvent.java
deleted file mode 100644
index 77d9b3d..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/model/FullEvent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * FULL-EVENT
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.google.gson.JsonObject;
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-import org.onap.pnfsimulator.rest.util.JsonObjectDeserializer;
-import org.springframework.lang.Nullable;
-
-import javax.validation.constraints.NotNull;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Getter
-@ToString
-@EqualsAndHashCode
-public class FullEvent {
-
- @Nullable
- private String vesServerUrl;
-
- @NotNull
- @JsonDeserialize(using = JsonObjectDeserializer.class)
- private JsonObject event;
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/model/SearchExp.java b/src/main/java/org/onap/pnfsimulator/rest/model/SearchExp.java
deleted file mode 100644
index 41d112f..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/model/SearchExp.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Simulator
- * ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.google.gson.JsonObject;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-import org.onap.pnfsimulator.rest.util.JsonObjectDeserializer;
-
-import javax.validation.constraints.NotNull;
-
-@Getter
-@NoArgsConstructor
-@AllArgsConstructor
-@ToString
-public class SearchExp {
-
- @NotNull
- @JsonDeserialize(using = JsonObjectDeserializer.class)
- private JsonObject searchExpr;
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorParams.java b/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorParams.java
deleted file mode 100644
index 787583e..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorParams.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.model;
-
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-
-import javax.validation.constraints.NotNull;
-import org.springframework.lang.Nullable;
-
-@Getter
-@EqualsAndHashCode
-@AllArgsConstructor
-@NoArgsConstructor
-public class SimulatorParams {
-
- @NotNull
- private String vesServerUrl;
-
- @Nullable
- private Integer repeatInterval;
-
- @Nullable
- private Integer repeatCount;
-
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorRequest.java b/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorRequest.java
deleted file mode 100644
index d00b311..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/model/SimulatorRequest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.google.gson.JsonObject;
-import javax.validation.constraints.NotNull;
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-import org.onap.pnfsimulator.rest.util.JsonObjectDeserializer;
-import org.springframework.lang.Nullable;
-
-@Getter
-@ToString
-@EqualsAndHashCode
-@AllArgsConstructor
-@NoArgsConstructor
-public class SimulatorRequest {
-
- @NotNull
- private SimulatorParams simulatorParams;
-
- @NotNull
- private String templateName;
-
- @Nullable
- @JsonDeserialize(using = JsonObjectDeserializer.class)
- private JsonObject patch;
-
- @Nullable
- @JsonDeserialize(using = JsonObjectDeserializer.class)
- private JsonObject variables;
-
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/model/TemplateRequest.java b/src/main/java/org/onap/pnfsimulator/rest/model/TemplateRequest.java
deleted file mode 100644
index f1e0243..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/model/TemplateRequest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Simulator
- * ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.model;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-import org.bson.Document;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Getter
-@Setter
-@ToString
-public class TemplateRequest {
- private String name;
- private Document template;
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java b/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java
deleted file mode 100644
index 9a5c9ca..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/util/DateUtil.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.util;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-public final class DateUtil {
-
- private DateUtil() {
- }
-
- public static String getTimestamp(DateFormat dateFormat) {
-
- return dateFormat.format(new Date());
- }
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/util/JsonObjectDeserializer.java b/src/main/java/org/onap/pnfsimulator/rest/util/JsonObjectDeserializer.java
deleted file mode 100644
index f89c4a7..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/util/JsonObjectDeserializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.util;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-
-public class JsonObjectDeserializer extends JsonDeserializer<JsonObject> {
- private Gson gson = new Gson();
-
- @Override
- public JsonObject deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
- ObjectCodec oc = jsonParser.getCodec();
- JsonNode node = oc.readTree(jsonParser);
- return gson.fromJson(node.toString(), JsonObject.class);
- }
-}
diff --git a/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java b/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java
deleted file mode 100644
index 1fdd7cf..0000000
--- a/src/main/java/org/onap/pnfsimulator/rest/util/ResponseBuilder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.pnfsimulator.rest.util;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-public class ResponseBuilder {
-
- public static final String TIMESTAMP = "timestamp";
- public static final String MESSAGE = "message";
- public static final String SIMULATOR_STATUS = "simulatorStatus";
- public static final String REMAINING_TIME = "remainingTime";
-
- private HttpStatus httpStatus;
- private Map<String, Object> body = new LinkedHashMap<>();
-
- private ResponseBuilder(HttpStatus httpStatus) {
- this.httpStatus = httpStatus;
- }
-
- public static ResponseBuilder status(HttpStatus httpStatus) {
-
- return new ResponseBuilder(httpStatus);
- }
-
- public ResponseBuilder put(String key, Object value) {
-
- body.put(key, value);
- return this;
- }
-
- public ResponseEntity<Map<String,Object>> build() {
-
- if (body.isEmpty()) {
- return ResponseEntity.status(httpStatus).build();
- }
-
- return ResponseEntity.status(httpStatus).body(body);
- }
-
-}