X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-interactions%2Fmodel-simulators%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fsimulators%2FCdsSimulator.java;fp=models-interactions%2Fmodel-simulators%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fsimulators%2FCdsSimulator.java;h=1677a35042fd0e5a3ac42533c9c24c5da67f1214;hb=6372b62fcd8813d7d49fb279b933ffe2e4637048;hp=222bd7fee780c13b90e2c45b7c9806a97c459e2b;hpb=da708d64dc27f36ed5da733fca14ebfb4cc2832b;p=policy%2Fmodels.git 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());