summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-simulators')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java15
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java6
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java4
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java12
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java9
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java5
9 files changed, 30 insertions, 33 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java
index 3b0d8cd72..a8ec6e5e9 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLcmTopicServer.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -46,7 +46,7 @@ public class AppcLcmTopicServer extends TopicServer<AppcLcmDmaapWrapper> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appclcm/appc.lcm.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appclcm/appc.lcm.success.json");
return response.replace("${replaceMe}", request.getBody().getInput().getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java
index c3f0435c9..9447e01ac 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/AppcLegacyTopicServer.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -46,7 +46,7 @@ public class AppcLegacyTopicServer extends TopicServer<Request> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appc/appc.legacy.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/appc/appc.legacy.success.json");
return response.replace("${replaceMe}", request.getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
index 222bd7fee..1677a3504 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/CdsSimulator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,7 +34,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
@@ -93,7 +92,7 @@ public class CdsSimulator implements Runnable {
public void onNext(final ExecutionServiceInput executionServiceInput) {
LOGGER.info("Received request input to CDS: {}", executionServiceInput);
try {
- Builder builder = getResponse(executionServiceInput, countOfSuccesfulEvents);
+ var builder = getResponse(executionServiceInput, countOfSuccesfulEvents);
TimeUnit.MILLISECONDS.sleep(requestedResponseDelayMs);
responseObserver.onNext(builder.build());
} catch (InvalidProtocolBufferException e) {
@@ -151,9 +150,9 @@ public class CdsSimulator implements Runnable {
*/
public Builder getResponse(ExecutionServiceInput executionServiceInput, int countOfSuccesfulEvents)
throws InvalidProtocolBufferException {
- String resourceName = "DefaultResponseEvent";
+ var resourceName = "DefaultResponseEvent";
if (!StringUtils.isBlank(executionServiceInput.getActionIdentifiers().getActionName())) {
- ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+ var actionIdentifiers = executionServiceInput.getActionIdentifiers();
resourceName = actionIdentifiers.getBlueprintName() + "-" + actionIdentifiers.getActionName();
}
if (countOfSuccesfulEvents > 0 && countOfEvents.getAndIncrement() % countOfSuccesfulEvents == 0) {
@@ -163,11 +162,11 @@ public class CdsSimulator implements Runnable {
resourceName = resourceName + ".json";
}
LOGGER.info("Fetching response from {}", resourceName);
- String responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
- Builder builder = ExecutionServiceOutput.newBuilder();
+ var responseString = ResourceUtils.getResourceAsString(resourceLocation + resourceName);
+ var builder = ExecutionServiceOutput.newBuilder();
if (null == responseString) {
LOGGER.info("Expected response file {} not found in {}", resourceName, resourceLocation);
- ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+ var actionIdentifiers = executionServiceInput.getActionIdentifiers();
builder.setCommonHeader(executionServiceInput.getCommonHeader());
builder.setActionIdentifiers(actionIdentifiers);
builder.setPayload(executionServiceInput.getPayload());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
index f915f86d8..7a33a1950 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,7 +49,7 @@ public class GuardSimulatorJaxRs {
@SuppressWarnings("unchecked")
Map<String, String> guard = (Map<String, String>) req.getResource().get("guard");
String clName = guard.get("clname");
- DecisionResponse response = new DecisionResponse();
+ var response = new DecisionResponse();
if (DENY_CLNAME.equals(clName)) {
response.setStatus("Deny");
response.setAdvice(Collections.emptyMap());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
index b6e8b04bc..7a28791ba 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Huawei. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. 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.
@@ -65,9 +65,9 @@ public class SdncSimulatorJaxRs {
private String makeSuccessResponse() {
- final SdncResponse response = new SdncResponse();
+ final var response = new SdncResponse();
response.setRequestId(UUID.randomUUID().toString());
- SdncResponseOutput responseOutput = new SdncResponseOutput();
+ var responseOutput = new SdncResponseOutput();
responseOutput.setResponseCode("200");
responseOutput.setAckFinalIndicator("Y");
responseOutput.setSvcRequestId(UUID.randomUUID().toString());
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java
index 9aad4d4b3..cf297e5d9 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SdnrTopicServer.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -46,7 +46,7 @@ public class SdnrTopicServer extends TopicServer<PciMessage> {
return null;
}
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/sdnr/vpci.sdnr.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/sdnr/vpci.sdnr.success.json");
return response.replace("${replaceMe}", request.getBody().getInput().getCommonHeader().getSubRequestId());
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 12a523a65..3d2187895 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2020 Wipro Limited.
* ================================================================================
@@ -135,9 +135,9 @@ public class SoSimulatorJaxRs {
}
private String makeStarted() {
- String requestId = UUID.randomUUID().toString();
+ var requestId = UUID.randomUUID().toString();
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.started.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.started.json");
incomplete.add(requestId);
@@ -145,17 +145,17 @@ public class SoSimulatorJaxRs {
}
private String makeImmediateComplete() {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json");
return response.replace(REPLACE_ME, UUID.randomUUID().toString());
}
private String makeComplete(String requestId) {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json");
return response.replace(REPLACE_ME, requestId);
}
private String makeStillRunning(String requestId) {
- String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.still.running.json");
+ var response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.still.running.json");
return response.replace(REPLACE_ME, requestId);
}
}
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
index d9fb52bd9..51f2f9d46 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.simulators;
import java.io.IOException;
-import java.util.Properties;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
@@ -81,7 +80,7 @@ public class Util {
* @throws IOException if an I/O error occurs
*/
public static CdsSimulator buildCdsSim() throws InterruptedException, IOException {
- final CdsSimulator testServer = new CdsSimulator(LOCALHOST, CDSSIM_SERVER_PORT);
+ final var testServer = new CdsSimulator(LOCALHOST, CDSSIM_SERVER_PORT);
testServer.start();
waitForServerToListen(testServer.getPort());
return testServer;
@@ -155,7 +154,7 @@ public class Util {
* @throws InterruptedException if a thread is interrupted
*/
public static HttpServletServer buildDmaapSim() throws InterruptedException {
- String json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json");
+ var json = ResourceUtils.getResourceAsString("org/onap/policy/simulators/dmaap/DmaapParameters.json");
DmaapSimParameterGroup params = null;
try {
params = new StandardCoder().decode(json, DmaapSimParameterGroup.class);
@@ -166,7 +165,7 @@ public class Util {
DmaapSimProvider.setInstance(new DmaapSimProvider(params));
- Properties props = DmaapSimRestServer.getServerProperties(params.getRestServerParameters());
+ var props = DmaapSimRestServer.getServerProperties(params.getRestServerParameters());
final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "."
+ params.getRestServerParameters().getName();
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
index cf21c7bab..3702fdd6d 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/VfcSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("/api/nslcm/v1")
@@ -53,7 +52,7 @@ public class VfcSimulatorJaxRs {
try {
response.flushBuffer();
} catch (Exception e) {
- final Logger logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
+ final var logger = LoggerFactory.getLogger(VfcSimulatorJaxRs.class);
logger.error("flushBuffer threw: ", e);
return "";
}