From 4c5c31eb9a2513af080d60d0f537b8339856150d Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Wed, 2 Sep 2020 17:19:26 +0100 Subject: APEX standalone support for ToscaPolicy format Legacy format support is removed, and Tosca format support is added. Change-Id: I3cfc181ccb5471a5d224c0162af18c1fa0fdbc70 Issue-ID: POLICY-2812 Signed-off-by: a.sreekumar --- .../apex/service/engine/main/ApexActivator.java | 12 +- .../engine/main/ApexCommandLineArguments.java | 114 +---- .../service/parameters/ApexParameterHandler.java | 80 ++- .../engineservice/EngineServiceParameters.java | 209 +------- .../service/engine/event/PluginFactoriesTest.java | 9 +- .../engine/main/ApexCommandLineArgumentsTest.java | 129 ++--- .../apex/service/engine/main/ApexMainTest.java | 16 +- .../engine/parameters/ApexParametersTest.java | 7 +- .../engine/parameters/ContextParameterTests.java | 27 +- .../engine/parameters/ExecutorParameterTests.java | 24 +- .../service/engine/parameters/ParameterTests.java | 41 +- .../engine/parameters/ProducerConsumerTests.java | 25 +- .../engine/parameters/SyncParameterTests.java | 29 +- .../engine/runtime/impl/EngineServiceImplTest.java | 280 +++-------- .../src/test/resources/parameters/badParams.json | 67 ++- .../parameters/badParamsModelNotFile.json | 64 --- .../src/test/resources/parameters/blankParams.json | 29 +- .../test/resources/parameters/correctParams.json | 533 ++++++++++++++++++-- .../parameters/correctParamsJavaProperties.json | 547 +++++++++++++++++++-- .../resources/parameters/factoryGoodParams.json | 119 +++-- .../src/test/resources/parameters/goodParams.json | 121 +++-- .../resources/parameters/goodParamsRelative.json | 120 +++-- .../resources/parameters/javaPropertiesBad.json | 119 +++-- .../resources/parameters/javaPropertiesEmpty.json | 91 ++-- .../resources/parameters/javaPropertiesOK.json | 103 ++-- .../src/test/resources/parameters/noParams.json | 14 + .../parameters/prodConsBadCTParClass.json | 85 ++-- .../parameters/prodConsBadEPParClass.json | 85 ++-- .../resources/parameters/prodConsBadFileName.json | 83 ++-- .../parameters/prodConsMismatchCTParClass.json | 83 ++-- .../parameters/prodConsMismatchEPParClass.json | 83 ++-- .../test/resources/parameters/prodConsNoCT.json | 83 ++-- .../resources/parameters/prodConsNoCTParClass.json | 81 +-- .../test/resources/parameters/prodConsNoEP.json | 83 ++-- .../resources/parameters/prodConsNoEPParClass.json | 81 +-- .../resources/parameters/prodConsOKFileName.json | 83 ++-- .../parameters/prodConsWrongTypeCTParClass.json | 83 ++-- .../parameters/prodConsWrongTypeEPParClass.json | 83 ++-- .../serviceContextBadClassDistParams.json | 49 +- .../serviceContextBadClassLockParams.json | 49 +- .../parameters/serviceContextBadClassParams.json | 39 +- .../serviceContextBadClassPersistParams.json | 49 +- .../parameters/serviceContextBadParams.json | 39 +- .../serviceContextBadPluginClassParams.json | 39 +- .../serviceContextBadPluginNameParams.json | 39 +- .../parameters/serviceContextNoParams.json | 37 +- .../parameters/serviceContextOKDefaultParams.json | 89 ++-- .../parameters/serviceContextOKDistParams.json | 91 ++-- .../parameters/serviceContextOKFlushParams.json | 93 ++-- .../parameters/serviceContextOKFullParams.json | 101 ++-- .../parameters/serviceExecutorBadParams.json | 43 +- .../serviceExecutorBadPluginNameParams.json | 47 +- .../serviceExecutorBadPluginValueBlankParams.json | 47 +- .../serviceExecutorBadPluginValueObjectParams.json | 51 +- .../serviceExecutorBadPluginValueParams.json | 47 +- .../parameters/serviceExecutorEmptyParams.json | 43 +- .../serviceExecutorNoExecutorParams.json | 37 +- .../parameters/serviceExecutorNoParams.json | 81 +-- .../resources/parameters/superDooperParams.json | 82 +-- .../parameters/syncBadParamsBadPeers.json | 143 +++--- .../parameters/syncBadParamsBadTimeout.json | 121 +++-- .../parameters/syncBadParamsInvalidTimeout.json | 147 +++--- .../parameters/syncBadParamsNoSyncWithPeer.json | 141 +++--- .../parameters/syncBadParamsNotSyncWithPeer.json | 143 +++--- .../parameters/syncBadParamsUnpairedTimeout.json | 147 +++--- .../test/resources/parameters/syncGoodParams.json | 139 +++--- .../parameters/syncGoodParamsBothTimeout.json | 147 +++--- .../parameters/syncGoodParamsConsumerTimeout.json | 143 +++--- .../parameters/syncGoodParamsProducerTimeout.json | 143 +++--- .../resources/parameters/syncMismatchedPeers.json | 139 +++--- .../parameters/syncMismatchedTimeout.json | 143 +++--- .../parameters/syncUnusedConsumerPeers.json | 137 +++--- .../parameters/syncUnusedProducerPeers.json | 139 +++--- .../services/onappf/handler/ApexEngineHandler.java | 56 +-- .../onappf/comm/TestPdpStateChangeListener.java | 5 +- .../onappf/comm/TestPdpUpdateListener.java | 9 +- 76 files changed, 4275 insertions(+), 2884 deletions(-) delete mode 100644 services/services-engine/src/test/resources/parameters/badParamsModelNotFile.json (limited to 'services') diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java index 233fa1aa0..4d3349b83 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java @@ -22,7 +22,6 @@ package org.onap.policy.apex.service.engine.main; -import java.io.IOException; import java.util.AbstractMap; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -51,7 +50,6 @@ import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParame import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; import org.onap.policy.common.parameters.ParameterService; -import org.onap.policy.common.utils.resources.TextFileUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -150,15 +148,13 @@ public class ApexActivator { inputParametersMap.putAll(apexParams.getEventInputParameters()); outputParametersMap.putAll(apexParams.getEventOutputParameters()); // Check if a policy model file has been specified - if (apexParams.getEngineServiceParameters().getPolicyModelFileName() != null) { - LOGGER.debug("deploying policy model in \"{}\" to the apex engines . . .", - apexParams.getEngineServiceParameters().getPolicyModelFileName()); + if (apexParams.getEngineServiceParameters().getPolicyModel() != null) { + LOGGER.debug("deploying policy model to the apex engines . . ."); try { - final String policyModelString = TextFileUtils - .getTextFileAsString(apexParams.getEngineServiceParameters().getPolicyModelFileName()); + final String policyModelString = apexParams.getEngineServiceParameters().getPolicyModel(); AxPolicyModel policyModel = EngineServiceImpl.createModel(engineKey, policyModelString); policyModelsMap.put(apexParamsEntry.getKey(), policyModel); - } catch (ApexException | IOException e) { + } catch (ApexException e) { throw new ApexRuntimeException("Failed to create the apex model.", e); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java index 89c47d6bc..31131b465 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java @@ -26,6 +26,8 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.net.URL; import java.util.Arrays; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; @@ -56,9 +58,9 @@ public class ApexCommandLineArguments { // Apache Commons CLI options private final Options options; - // The command line options - private String modelFilePath = null; - private String configurationFilePath = null; + @Getter + @Setter + private String toscaPolicyFilePath = null; private String relativeFileRoot = null; /** @@ -79,16 +81,6 @@ public class ApexCommandLineArguments { .required(false) .type(Boolean.class) .build()); - options.addOption(Option.builder("c") - .longOpt("config-file") - .desc("the full path to the configuration file to use, " - + "the configuration file must be a Json file " - + "containing the Apex configuration parameters") - .hasArg() - .argName("CONFIG_FILE") - .required(false) - .type(String.class) - .build()); options.addOption(Option.builder("rfr") .longOpt("relative-file-root") .desc("the root file path for relative file paths specified in the Apex configuration file, " @@ -98,11 +90,10 @@ public class ApexCommandLineArguments { .required(false) .type(String.class) .build()); - options.addOption(Option.builder("m").longOpt("model-file") - .desc("the full path to the model file to use, if set it overrides the model file set in the " - + "configuration file").hasArg().argName("MODEL_FILE") - .required(false) - .type(String.class).build()); + options.addOption(Option.builder("p").longOpt("tosca-policy-file") + .desc("the full path to the ToscaPolicy file to use.").hasArg().argName("TOSCA_POLICY_FILE") + .required(false) + .type(String.class).build()); //@formatter:on } @@ -133,9 +124,7 @@ public class ApexCommandLineArguments { */ public String parse(final String[] args) throws ApexException { // Clear all our arguments - setConfigurationFilePath(null); - setModelFilePath(null); - + setToscaPolicyFilePath(null); CommandLine commandLine = null; try { commandLine = new DefaultParser().parse(options, args); @@ -146,12 +135,12 @@ public class ApexCommandLineArguments { // Arguments left over after Commons CLI does its stuff final String[] remainingArgs = commandLine.getArgs(); - if (remainingArgs.length > 0 && commandLine.hasOption('c') || remainingArgs.length > 1) { + if (remainingArgs.length > 0 && commandLine.hasOption('p') || remainingArgs.length > 1) { throw new ApexException("too many command line arguments specified : " + Arrays.toString(args)); } if (remainingArgs.length == 1) { - configurationFilePath = remainingArgs[0]; + toscaPolicyFilePath = remainingArgs[0]; } if (commandLine.hasOption('h')) { @@ -162,20 +151,15 @@ public class ApexCommandLineArguments { return version(); } - if (commandLine.hasOption('c')) { - setConfigurationFilePath(commandLine.getOptionValue('c')); - } - if (commandLine.hasOption("rfr")) { setRelativeFileRoot(commandLine.getOptionValue("rfr")); } else { setRelativeFileRoot(null); } - if (commandLine.hasOption('m')) { - setModelFilePath(commandLine.getOptionValue('m')); + if (commandLine.hasOption('p')) { + toscaPolicyFilePath = commandLine.getOptionValue('p'); } - return null; } @@ -185,12 +169,7 @@ public class ApexCommandLineArguments { * @throws ApexException on command argument validation errors */ public void validate() throws ApexException { - validateReadableFile("Apex configuration", configurationFilePath); - - if (checkSetModelFilePath()) { - validateReadableFile("Apex model", modelFilePath); - } - + validateReadableFile("Tosca Policy", toscaPolicyFilePath); validateRelativeFileRoot(); } @@ -219,42 +198,6 @@ public class ApexCommandLineArguments { return stringWriter.toString(); } - /** - * Gets the model file path. - * - * @return the model file path - */ - public String getModelFilePath() { - return ResourceUtils.getFilePath4Resource(modelFilePath); - } - - /** - * Sets the model file path. - * - * @param modelFilePath the model file path - */ - public void setModelFilePath(final String modelFilePath) { - this.modelFilePath = modelFilePath; - } - - /** - * Check set model file path. - * - * @return true, if check set model file path - */ - public boolean checkSetModelFilePath() { - return modelFilePath != null && modelFilePath.length() > 0; - } - - /** - * Gets the configuration file path. - * - * @return the configuration file path - */ - public String getConfigurationFilePath() { - return configurationFilePath; - } - /** * Gets the root file path for relative file paths in the configuration file. * @@ -264,24 +207,6 @@ public class ApexCommandLineArguments { return relativeFileRoot; } - /** - * Gets the full expanded configuration file path. - * - * @return the configuration file path - */ - public String getFullConfigurationFilePath() { - return ResourceUtils.getFilePath4Resource(getConfigurationFilePath()); - } - - /** - * Sets the configuration file path. - * - * @param configurationFilePath the configuration file path - */ - public void setConfigurationFilePath(final String configurationFilePath) { - this.configurationFilePath = configurationFilePath; - - } /** * Sets the root file path for relative file paths in the configuration file. @@ -305,15 +230,6 @@ public class ApexCommandLineArguments { System.setProperty(APEX_RELATIVE_FILE_ROOT, relativeFileRootValue); } - /** - * Check set configuration file path. - * - * @return true, if check set configuration file path - */ - public boolean checkSetConfigurationFilePath() { - return configurationFilePath != null && configurationFilePath.length() > 0; - } - /** * Validate readable file. * diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java index f88733f60..9a07b4ad5 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterHandler.java @@ -24,8 +24,14 @@ package org.onap.policy.apex.service.parameters; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import java.io.FileReader; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map.Entry; import org.onap.policy.apex.core.engine.EngineParameters; +import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.main.ApexCommandLineArguments; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParametersJsonAdapter; @@ -35,6 +41,8 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParame import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterException; import org.onap.policy.common.parameters.ParameterService; +import org.onap.policy.common.utils.coder.StandardCoder; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -44,8 +52,18 @@ import org.slf4j.ext.XLoggerFactory; * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexParameterHandler { + private static final String EVENT_OUTPUT_PARAMETERS = "eventOutputParameters"; + + private static final String EVENT_INPUT_PARAMETERS = "eventInputParameters"; + + private static final String ENGINE_SERVICE_PARAMETERS = "engineServiceParameters"; + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexParameterHandler.class); + private static final String POLICY_TYPE_IMPL = "policy_type_impl"; + private String policyModel; + private String apexConfig; + /** * Read the parameters from the parameter file. * @@ -58,9 +76,10 @@ public class ApexParameterHandler { ParameterService.clear(); ApexParameters parameters = null; - + String toscaPolicyFilePath = arguments.getToscaPolicyFilePath(); // Read the parameters try { + parseConfigAndModel(toscaPolicyFilePath); // Register the adapters for our carrier technologies and event protocols with GSON // @formatter:off final Gson gson = new GsonBuilder() @@ -72,41 +91,33 @@ public class ApexParameterHandler { new EventProtocolParametersJsonAdapter()) .create(); // @formatter:on - parameters = gson.fromJson(new FileReader(arguments.getFullConfigurationFilePath()), ApexParameters.class); + parameters = gson.fromJson(apexConfig, ApexParameters.class); } catch (final Exception e) { - final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath() - + "\"\n" + "(" + e.getClass().getSimpleName() + "):" + e.getMessage(); - LOGGER.error(errorMessage, e); + final String errorMessage = "error reading parameters from \"" + toscaPolicyFilePath + "\"\n" + "(" + + e.getClass().getSimpleName() + "):" + e.getMessage(); throw new ParameterException(errorMessage, e); } // The JSON processing returns null if there is an empty file if (parameters == null) { - final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\""; - LOGGER.error(errorMessage); + final String errorMessage = "no parameters found in \"" + toscaPolicyFilePath + "\""; throw new ParameterException(errorMessage); } - // Check if we should override the model file parameter - final String modelFilePath = arguments.getModelFilePath(); - if (modelFilePath != null && modelFilePath.replaceAll("\\s+", "").length() > 0) { - parameters.getEngineServiceParameters().setPolicyModelFileName(modelFilePath); + if (null != parameters.getEngineServiceParameters()) { + parameters.getEngineServiceParameters().setPolicyModel(policyModel); } // Validate the parameters final GroupValidationResult validationResult = parameters.validate(); if (!validationResult.isValid()) { - String returnMessage = "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() - + "\"\n"; + String returnMessage = "validation error(s) on parameters from \"" + toscaPolicyFilePath + "\"\n"; returnMessage += validationResult.getResult(); - - LOGGER.error(returnMessage); throw new ParameterException(returnMessage); } if (!validationResult.isClean()) { - String returnMessage = "validation messages(s) on parameters from \"" + arguments.getConfigurationFilePath() - + "\"\n"; + String returnMessage = "validation messages(s) on parameters from \"" + toscaPolicyFilePath + "\"\n"; returnMessage += validationResult.getResult(); LOGGER.info(returnMessage); @@ -134,4 +145,37 @@ public class ApexParameterHandler { ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() .getPersistorParameters()); } + + private void parseConfigAndModel(final String toscaPolicyFilePath) throws ApexException { + policyModel = null; + apexConfig = null; + final StandardCoder standardCoder = new StandardCoder(); + JsonObject apexConfigJsonObject = new JsonObject(); + try { + ToscaServiceTemplate toscaServiceTemplate = standardCoder + .decode(Files.readString(Paths.get(toscaPolicyFilePath)), ToscaServiceTemplate.class); + for (Entry property : toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0) + .entrySet().iterator().next().getValue().getProperties().entrySet()) { + JsonElement body = null; + if ("javaProperties".equals(property.getKey())) { + body = standardCoder.convert(property.getValue(), JsonArray.class); + } else if (EVENT_INPUT_PARAMETERS.equals(property.getKey()) + || ENGINE_SERVICE_PARAMETERS.equals(property.getKey()) + || EVENT_OUTPUT_PARAMETERS.equals(property.getKey())) { + body = standardCoder.convert(property.getValue(), JsonObject.class); + if (ENGINE_SERVICE_PARAMETERS.equals(property.getKey())) { + JsonElement policyModelObject = ((JsonObject) body).get(POLICY_TYPE_IMPL); + if (null != policyModelObject) { + policyModel = standardCoder.encode(policyModelObject); + } + ((JsonObject) body).remove(POLICY_TYPE_IMPL); + } + } + apexConfigJsonObject.add(property.getKey(), body); + } + apexConfig = standardCoder.encode(apexConfigJsonObject); + } catch (Exception e) { + throw new ApexException("Parsing config and model from the tosca policy failed.", e); + } + } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java index 52dcd3d3c..d67c44ef5 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParameters.java @@ -1,26 +1,29 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.parameters.engineservice; -import java.io.File; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.core.engine.EngineParameters; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; @@ -54,6 +57,8 @@ import org.onap.policy.common.parameters.ValidationStatus; * */ // @formatter:on +@Getter +@Setter public class EngineServiceParameters implements ParameterGroup { private static final int MAX_PORT = 65535; @@ -74,7 +79,6 @@ public class EngineServiceParameters implements ParameterGroup { public static final int DEFAULT_DEPLOYMENT_PORT = 34421; // Constants for repeated strings - private static final String POLICY_MODEL_FILE_NAME = "policyModelFileName"; // Apex engine service parameters private String name = DEFAULT_NAME; @@ -82,7 +86,7 @@ public class EngineServiceParameters implements ParameterGroup { private int id = DEFAULT_ID; private int instanceCount = DEFAULT_INSTANCE_COUNT; private int deploymentPort = DEFAULT_DEPLOYMENT_PORT; - private String policyModelFileName = null; + private String policyModel = null; private long periodicEventPeriod = 0; // @formatter:on @@ -111,7 +115,7 @@ public class EngineServiceParameters implements ParameterGroup { /** * Sets the key of the Apex engine service. - * + * * @param key the the Apex engine service key */ public void setEngineKey(final AxArtifactKey key) { @@ -119,151 +123,6 @@ public class EngineServiceParameters implements ParameterGroup { this.setVersion(key.getVersion()); } - /** - * Gets the name of the engine service. - * - * @return the name of the engine service - */ - public String getName() { - return name; - } - - /** - * Sets the name of the engine service. - * - * @param name the name of the engine service - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Gets the version of the engine service. - * - * @return the version of the engine service - */ - public String getVersion() { - return version; - } - - /** - * Sets the version of the engine service. - * - * @param version the version of the engine service - */ - public void setVersion(final String version) { - this.version = version; - } - - /** - * Gets the id of the engine service. - * - * @return the id of the engine service - */ - public int getId() { - return id; - } - - /** - * Sets the id of the engine service. - * - * @param id the id of the engine service - */ - public void setId(final int id) { - this.id = id; - } - - /** - * Gets the instance count of the engine service. - * - * @return the instance count of the engine service - */ - public int getInstanceCount() { - return instanceCount; - } - - /** - * Sets the instance count of the engine service. - * - * @param instanceCount the instance count of the engine service - */ - public void setInstanceCount(final int instanceCount) { - this.instanceCount = instanceCount; - } - - /** - * Gets the deployment port of the engine service. - * - * @return the deployment port of the engine service - */ - public int getDeploymentPort() { - return deploymentPort; - } - - /** - * Sets the deployment port of the engine service. - * - * @param deploymentPort the deployment port of the engine service - */ - public void setDeploymentPort(final int deploymentPort) { - this.deploymentPort = deploymentPort; - } - - /** - * Gets the file name of the policy engine for deployment on the engine service. - * - * @return the file name of the policy engine for deployment on the engine service - */ - public String getPolicyModelFileName() { - return policyModelFileName; - } - - /** - * Sets the file name of the policy engine for deployment on the engine service. - * - * @param policyModelFileName the file name of the policy engine for deployment on the engine service - */ - public void setPolicyModelFileName(final String policyModelFileName) { - this.policyModelFileName = policyModelFileName; - } - - /** - * Get the period in milliseconds at which periodic events are sent, zero means no periodic events are being sent. - * - * @return the periodic period - */ - public long getPeriodicEventPeriod() { - return periodicEventPeriod; - } - - /** - * Set the period in milliseconds at which periodic events are sent, zero means no periodic events are to be sent, - * negative values are illegal. - * - * @param periodicEventPeriod the periodic period - */ - public void setPeriodicEventPeriod(final long periodicEventPeriod) { - this.periodicEventPeriod = periodicEventPeriod; - } - - /** - * Gets the engine parameters for engines in the engine service. - * - * @return the engine parameters for engines in the engine service - */ - public EngineParameters getEngineParameters() { - return engineParameters; - } - - /** - * Sets the engine parameters for engines in the engine service. - * - * @param engineParameters the engine parameters for engines in the engine service - */ - public void setEngineParameters(final EngineParameters engineParameters) { - this.engineParameters = engineParameters; - } - /** * {@inheritDoc}. */ @@ -275,8 +134,8 @@ public class EngineServiceParameters implements ParameterGroup { validateNumericParameters(result); - if (policyModelFileName != null) { - validatePolicyModelFileName(result); + if (StringUtils.isBlank(policyModel)) { + result.setResult("policyModel", ValidationStatus.INVALID, "must be specified"); } result.setResult("engineParameters", engineParameters.validate()); @@ -285,7 +144,7 @@ public class EngineServiceParameters implements ParameterGroup { /** * Validate string parameters. - * + * * @param result the result of string parameter validation */ private void validateStringParameters(final GroupValidationResult result) { @@ -327,44 +186,4 @@ public class EngineServiceParameters implements ParameterGroup { } } - /** - * Validate the policy model file name parameter. - * - * @param result the variable in which to store the result of the validation - */ - private void validatePolicyModelFileName(final GroupValidationResult result) { - if (policyModelFileName.trim().length() == 0) { - result.setResult(POLICY_MODEL_FILE_NAME, ValidationStatus.INVALID, - "\"" + policyModelFileName + "\" invalid, must be specified as a non-empty string"); - return; - } - - String absolutePolicyFileName = null; - - // Resolve the file name if it is a relative file name - File policyModelFile = new File(policyModelFileName); - if (policyModelFile.isAbsolute()) { - absolutePolicyFileName = policyModelFileName; - } else { - absolutePolicyFileName = System.getProperty("APEX_RELATIVE_FILE_ROOT") + File.separator - + policyModelFileName; - policyModelFile = new File(absolutePolicyFileName); - } - - // Check that the file exists - if (!policyModelFile.exists()) { - result.setResult(POLICY_MODEL_FILE_NAME, ValidationStatus.INVALID, "not found"); - } else if (!policyModelFile.isFile()) { - // Check that the file is a regular file - result.setResult(POLICY_MODEL_FILE_NAME, ValidationStatus.INVALID, "is not a plain file"); - } else { - // OK, we found the file and it's OK, so reset the file name - policyModelFileName = absolutePolicyFileName; - - // Check that the file is readable - if (!policyModelFile.canRead()) { - result.setResult(POLICY_MODEL_FILE_NAME, ValidationStatus.INVALID, "is not readable"); - } - } - } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/PluginFactoriesTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/PluginFactoriesTest.java index 3055daeef..514b3b1e5 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/PluginFactoriesTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/PluginFactoriesTest.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Bell Canada. 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -41,7 +42,7 @@ public class PluginFactoriesTest { @Test public void testEventConsumerFactory() throws ApexEventException, ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/factoryGoodParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/factoryGoodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArgumentsTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArgumentsTest.java index 09fbe91fe..09663c0bf 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArgumentsTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArgumentsTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -43,99 +44,62 @@ public class ApexCommandLineArgumentsTest { public void testCommandLineArguments() throws ApexException { final ApexCommandLineArguments apexArguments = new ApexCommandLineArguments(); - final String[] args00 = - { "" }; - assertThatThrownBy(() -> { - apexArguments.parse(args00); - apexArguments.validate(); - }).hasMessage("Apex configuration file was not specified as an argument"); - final String[] args01 = - { "-h" }; + final String[] args00 = {""}; + apexArguments.parse(args00); + assertThatThrownBy(() -> apexArguments.validate()) + .hasMessage("Tosca Policy file was not specified as an argument"); + final String[] args01 = {"-h"}; final String result = apexArguments.parse(args01); assertTrue(result.startsWith("usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]")); - final String[] args02 = - { "-v" }; + final String[] args02 = {"-v"}; final String result02 = apexArguments.parse(args02); assertTrue(result02.startsWith("Apex Adaptive Policy Engine")); - final String[] args03 = - { "-v", "-h" }; - + final String[] args03 = {"-v", "-h"}; final String result03 = apexArguments.parse(args03); assertTrue(result03.startsWith("usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]")); - final String[] args04 = - { "-h", "-v" }; - + final String[] args04 = {"-h", "-v"}; final String result04 = apexArguments.parse(args04); assertTrue(result04.startsWith("usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]")); - final String[] args05 = - { "-a" }; + final String[] args05 = {"-a"}; assertThatThrownBy(() -> apexArguments.parse(args05)) .hasMessage("invalid command line arguments specified : Unrecognized option: -a"); - final String[] args06 = - { "-c", "hello", "-m", "goodbye", "-h", "-v" }; + + final String[] args06 = {"-p", "goodbye", "-h", "-v"}; final String result06 = apexArguments.parse(args06); assertTrue(result06.startsWith("usage: org.onap.policy.apex.service.engine.main.ApexMain [options...]")); - final String[] args07 = - { "-c", "hello", "-m", "goodbye", "-h", "aaa" }; + final String[] args07 = {"-p", "goodbye", "-h", "aaa"}; assertThatThrownBy(() -> apexArguments.parse(args07)) - .hasMessage("too many command line arguments specified : [-c, hello, -m, goodbye, -h, aaa]"); + .hasMessage("too many command line arguments specified : [-p, goodbye, -h, aaa]"); } @Test public void testCommandLineFileParameters() throws ApexException { final ApexCommandLineArguments apexArguments = new ApexCommandLineArguments(); - final String[] args00 = - { "-c", "zooby" }; - assertThatThrownBy(() -> { - apexArguments.parse(args00); - apexArguments.validate(); - }).hasMessage("Apex configuration file \"zooby\" does not exist"); - final String[] args01 = - { "-c" }; - assertThatThrownBy(() -> { - apexArguments.parse(args01); - apexArguments.validate(); - }).hasMessage("invalid command line arguments specified : Missing argument for option: c"); - final String[] args02 = - { "-c", "src/test/resources/parameters/goodParams.json" }; - apexArguments.parse(args02); - apexArguments.validate(); + final String[] args00 = {"-c", "zooby"}; + assertThatThrownBy(() -> apexArguments.parse(args00)) + .hasMessage("invalid command line arguments specified : Unrecognized option: -c"); - final String[] args03 = - { "-c", "src/test/resources/parameters/goodParams.json", "-m", "zooby" }; - assertThatThrownBy(() -> { - apexArguments.parse(args03); - apexArguments.validate(); - }).hasMessage("Apex model file \"zooby\" does not exist"); - final String[] args04 = - { "-m" }; - assertThatThrownBy(() -> { - apexArguments.parse(args04); - apexArguments.validate(); - }).hasMessage("invalid command line arguments specified : Missing argument for option: m"); - final String[] args05 = - { "-c", "src/test/resources/parameters/goodParams.json", "-m" }; - assertThatThrownBy(() -> { - apexArguments.parse(args05); - apexArguments.validate(); - }).hasMessage("invalid command line arguments specified : Missing argument for option: m"); - final String[] args06 = - { "-c", "src/test/resources/parameters/goodParams.json", "-m", - "src/test/resources/main/DummyModelFile.json" }; - apexArguments.parse(args06); + final String[] args01 = {"-p"}; + assertThatThrownBy(() -> apexArguments.parse(args01)) + .hasMessage("invalid command line arguments specified : Missing argument for option: p"); + + final String[] args02 = {"-p", "src/test/resources/parameters/goodParams.json"}; + apexArguments.parse(args02); apexArguments.validate(); - final String[] args07 = - { "-c", "parameters/goodParams.json", "-m", "main/DummyModelFile.json" }; + final String[] args03 = {"-p", "src/test/resources/parameters/goodParams.json", "-m", "zooby"}; + assertThatThrownBy(() -> apexArguments.parse(args03)) + .hasMessage("invalid command line arguments specified : Unrecognized option: -m"); - apexArguments.parse(args07); + final String[] args06 = {"-p", "src/test/resources/parameters/goodParams.json"}; + apexArguments.parse(args06); apexArguments.validate(); } @@ -143,33 +107,26 @@ public class ApexCommandLineArgumentsTest { public void testCommandLineRelativeRootParameters() throws ApexException { final ApexCommandLineArguments apexArguments = new ApexCommandLineArguments(); - final String[] args00 = - { "-c", "src/test/resources/parameters/goodParams.json", "-rfr", "zooby" }; - assertThatThrownBy(() -> { - apexArguments.parse(args00); - apexArguments.validate(); - }).hasMessageContaining("zooby\" does not exist or is not a directory"); - final String[] args01 = - { "-rfr" }; - assertThatThrownBy(() -> { - apexArguments.parse(args01); - apexArguments.validate(); - }).hasMessage("invalid command line arguments specified : Missing argument for option: rfr"); - final String[] args02 = - { "-c", "src/test/resources/parameters/goodParams.json", "-rfr", "pom.xml" }; - assertThatThrownBy(() -> { - apexArguments.parse(args02); - apexArguments.validate(); - }).hasMessageContaining("pom.xml\" does not exist or is not a directory"); - final String[] args03 = - { "-c", "src/test/resources/parameters/goodParams.json", "-rfr", "target" }; + final String[] args00 = {"-p", "src/test/resources/parameters/goodParams.json", "-rfr", "zooby"}; + apexArguments.parse(args00); + assertThatThrownBy(() -> apexArguments.validate()) + .hasMessageContaining("zooby\" does not exist or is not a directory"); + + final String[] args01 = {"-rfr"}; + assertThatThrownBy(() -> apexArguments.parse(args01)) + .hasMessage("invalid command line arguments specified : Missing argument for option: rfr"); + final String[] args02 = {"-p", "src/test/resources/parameters/goodParams.json", "-rfr", "pom.xml"}; + apexArguments.parse(args02); + assertThatThrownBy(() -> apexArguments.validate()) + .hasMessageContaining("pom.xml\" does not exist or is not a directory"); + + final String[] args03 = {"-p", "src/test/resources/parameters/goodParams.json", "-rfr", "target"}; apexArguments.parse(args03); apexArguments.validate(); final String[] args04 = - { "-c", "src/test/resources/parameters/goodParamsRelative.json", "-rfr", "src/test/resources" }; - + {"-p", "src/test/resources/parameters/goodParamsRelative.json", "-rfr", "src/test/resources"}; apexArguments.parse(args04); apexArguments.validate(); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java index f38dcaa40..122e47bb1 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java @@ -62,9 +62,9 @@ public class ApexMainTest { ApexMain.main(null); await().atMost(200, TimeUnit.MILLISECONDS).until(() -> outContent.toString() - .contains("Apex configuration file was not specified as an argument")); + .contains("Tosca Policy file was not specified as an argument")); assertThat(outContent.toString()) - .contains("Apex configuration file was not specified as an argument"); + .contains("Tosca Policy file was not specified as an argument"); } @Test @@ -100,7 +100,7 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = { "-c", "src/test/resources/parameters/badParams.json" }; + String[] args = { "-p", "src/test/resources/parameters/badParams.json" }; final ApexMain apexMain = new ApexMain(args); await().atMost(200, TimeUnit.MILLISECONDS).until(() -> outContent.toString() @@ -114,7 +114,7 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = { "-c", "src/test/resources/parameters/correctParams.json" }; + String[] args = { "-p", "src/test/resources/parameters/correctParams.json" }; final ApexMain apexMain = new ApexMain(args); assertEquals("MyApexEngine", @@ -129,7 +129,7 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = { "-c", "src/test/resources/parameters/correctParamsJavaProperties.json" }; + String[] args = { "-p", "src/test/resources/parameters/correctParamsJavaProperties.json" }; final ApexMain apexMain = new ApexMain(args); assertEquals("MyApexEngine", @@ -147,8 +147,7 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); Map argsMap = new HashMap(); - String[] args = {"-c", "src/test/resources/parameters/correctParams.json", "-m", - "src/test/resources/policymodels/SmallModel.json"}; + String[] args = {"-p", "src/test/resources/parameters/correctParams.json"}; argsMap.put(new ToscaPolicyIdentifier("id1", "v1"), args); final ApexMain apexMain = new ApexMain(argsMap); ApexParameters apexParam = (ApexParameters) apexMain.getApexParametersMap().values().toArray()[0]; @@ -163,8 +162,7 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); Map argsMap = new HashMap(); - String[] args = {"-c", "src/test/resources/parameters/correctParams.json", "-m", - "src/test/resources/policymodels/SmallModel.json"}; + String[] args = {"-p", "src/test/resources/parameters/correctParams.json"}; argsMap.put(new ToscaPolicyIdentifier("id1", "v1"), args); argsMap.put(new ToscaPolicyIdentifier("id2", "v2"), args); final ApexMain apexMain = new ApexMain(argsMap); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java index 1c816768f..9557ca8f9 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -41,7 +42,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesOk() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesOK.json" }; + final String[] args = {"-p", "src/test/resources/parameters/javaPropertiesOK.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -55,7 +56,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesEmpty() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesEmpty.json" }; + final String[] args = {"-p", "src/test/resources/parameters/javaPropertiesEmpty.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -65,7 +66,7 @@ public class ApexParametersTest { @Test public void testJavaPropertiesBad() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/javaPropertiesBad.json" }; + final String[] args = {"-p", "src/test/resources/parameters/javaPropertiesBad.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java index e8485d109..a55afbed4 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -40,7 +41,7 @@ public class ContextParameterTests { @Test public void testNoParamsTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextNoParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextNoParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -51,7 +52,7 @@ public class ContextParameterTests { @Test public void testBadParamsTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -62,7 +63,7 @@ public class ContextParameterTests { @Test public void testBadPluginParamNameTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadPluginNameParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadPluginNameParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -74,7 +75,7 @@ public class ContextParameterTests { @Test public void testBadClassParamTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadClassParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( @@ -86,7 +87,7 @@ public class ContextParameterTests { @Test public void testBadPluginClassTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadPluginClassParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadPluginClassParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -102,7 +103,7 @@ public class ContextParameterTests { @Test public void testOkFlushParamTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKFlushParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextOKFlushParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -115,7 +116,7 @@ public class ContextParameterTests { @Test public void testOkDefaultParamTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKDefaultParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextOKDefaultParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -128,7 +129,7 @@ public class ContextParameterTests { @Test public void testOkDistParamTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKDistParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextOKDistParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -142,7 +143,7 @@ public class ContextParameterTests { @Test public void testOkFullDefaultParamTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/goodParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -164,7 +165,7 @@ public class ContextParameterTests { @Test public void testOkFullParamTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextOKFullParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextOKFullParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -192,7 +193,7 @@ public class ContextParameterTests { @Test public void testBadClassDistParamTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassDistParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadClassDistParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -207,7 +208,7 @@ public class ContextParameterTests { @Test public void testBadClassLockParamTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassLockParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadClassLockParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -222,7 +223,7 @@ public class ContextParameterTests { @Test public void testBadClassPersistParamTest() { - final String[] args = { "-c", "src/test/resources/parameters/serviceContextBadClassPersistParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/serviceContextBadClassPersistParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java index 5d1b3f726..92a7b7d54 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -23,7 +24,6 @@ package org.onap.policy.apex.service.engine.parameters; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import org.junit.After; import org.junit.Test; @@ -45,7 +45,7 @@ public class ExecutorParameterTests { @Test public void testNoParamsTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorNoParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorNoParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -56,7 +56,7 @@ public class ExecutorParameterTests { @Test public void testBadParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorBadParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -68,7 +68,7 @@ public class ExecutorParameterTests { @Test public void testNoExecutorParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorNoExecutorParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorNoExecutorParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -80,7 +80,7 @@ public class ExecutorParameterTests { @Test public void testEmptyParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorEmptyParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorEmptyParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -92,7 +92,7 @@ public class ExecutorParameterTests { @Test public void testBadPluginParamNameTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginNameParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorBadPluginNameParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -104,7 +104,7 @@ public class ExecutorParameterTests { @Test public void testBadPluginParamObjectTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -116,7 +116,7 @@ public class ExecutorParameterTests { @Test public void testBadPluginParamBlankTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -128,7 +128,7 @@ public class ExecutorParameterTests { @Test public void testBadPluginParamValueTest() { - final String[] args = {"-c", "src/test/resources/parameters/serviceExecutorBadPluginValueParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/serviceExecutorBadPluginValueParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -141,7 +141,7 @@ public class ExecutorParameterTests { @Test public void testGoodParametersTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/goodParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -160,7 +160,7 @@ public class ExecutorParameterTests { final String[] args = { "-rfr", "src/test/resources", - "-c", + "-p", "src/test/resources/parameters/goodParamsRelative.json" }; // @formatter:on @@ -173,7 +173,5 @@ public class ExecutorParameterTests { assertEquals(45, parameters.getEngineServiceParameters().getId()); assertEquals(19, parameters.getEngineServiceParameters().getInstanceCount()); assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort()); - assertTrue(parameters.getEngineServiceParameters().getPolicyModelFileName() - .endsWith("policymodels/SmallModel.json")); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java index 4948ab5f3..da4ceaa12 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -26,6 +27,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.nio.file.NoSuchFileException; import java.util.Arrays; import org.junit.Test; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.ApexFileEventConsumer; @@ -48,27 +50,25 @@ import org.onap.policy.common.parameters.ParameterException; public class ParameterTests { @Test public void testInvalidParametersNoFileTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/invalidNoFile.json"}; + final String[] args = {"-p", "src/test/resources/parameters/invalidNoFile.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessageStartingWith("error reading parameters from \"src") - .hasMessageContaining("FileNotFoundException"); + .hasRootCauseInstanceOf(NoSuchFileException.class); } @Test public void testInvalidParametersEmptyTest() { - final String[] args = {"-c", "src/test/resources/parameters/empty.json"}; + final String[] args = {"-p", "src/test/resources/parameters/empty.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessageStartingWith("validation error(s) on parameters from \"src/test/resources/parameters/empty" - + ".json\""); + .hasMessageStartingWith("error reading parameters from \"src/test/resources/parameters/empty.json"); } @Test public void testInvalidParametersNoParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/noParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/noParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -85,7 +85,7 @@ public class ParameterTests { @Test public void testInvalidParametersBlankParamsTest() { - final String[] args = {"-c", "src/test/resources/parameters/blankParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/blankParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -97,6 +97,7 @@ public class ParameterTests { + "INVALID, parameter group has status INVALID\n" + " field \"id\" type \"int\" value \"-1\" INVALID, " + "id not specified or specified value [-1] invalid, must be specified as id >= 0\n" + + " field \"policyModel\" type \"java.lang.String\" value \"null\" INVALID, must be specified\n" + " parameter group map \"eventOutputParameters\" INVALID, " + "at least one event output must be specified\n" + " parameter group map \"eventInputParameters\" INVALID, " @@ -105,7 +106,7 @@ public class ParameterTests { @Test public void testInvalidParametersTest() { - final String[] args = {"-c", "src/test/resources/parameters/badParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/badParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -123,8 +124,6 @@ public class ParameterTests { + "instanceCount [-345] invalid, must be specified as instanceCount >= 1\n" + " field \"deploymentPort\" type \"int\" value \"65536\" INVALID, " + "deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n" - + " field \"policyModelFileName\" type \"java.lang.String\" " - + "value \"/some/file/name.xml\" INVALID, not found\n" + " parameter group map \"eventOutputParameters\" INVALID, " + "parameter group map has status INVALID\n" + " parameter group \"FirstProducer\" type " + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID" @@ -145,25 +144,9 @@ public class ParameterTests { + "\"null\" invalid, must be specified as a non-empty string\n"); } - @Test - public void testModelNotFileTest() { - final String[] args = {"-c", "src/test/resources/parameters/badParamsModelNotFile.json"}; - final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); - - assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessage("validation error(s) on parameters from " - + "\"src/test/resources/parameters/badParamsModelNotFile.json\"\n" - + "parameter group \"APEX_PARAMETERS\" type " - + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, " - + "parameter group has status INVALID\n" + " parameter group \"MyApexEngine\" type " - + "\"org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters\" " - + "INVALID, parameter group has status INVALID\n" + " field \"policyModelFileName\" " - + "type \"java.lang.String\" value \"src/test\" INVALID, is not a plain file\n"); - } - @Test public void testGoodParametersTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/goodParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -207,7 +190,7 @@ public class ParameterTests { @Test public void testSuperDooperParametersTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/superDooperParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/superDooperParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java index 8c7c9df82..0ef4fa252 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -40,7 +41,7 @@ import org.onap.policy.common.parameters.ParameterException; public class ProducerConsumerTests { @Test public void testGoodParametersTest() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/goodParams.json" }; + final String[] args = {"-p", "src/test/resources/parameters/goodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -70,7 +71,7 @@ public class ProducerConsumerTests { @Test public void testNoCarrierTechnology() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsNoCT.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsNoCT.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -86,7 +87,7 @@ public class ProducerConsumerTests { @Test public void testNoEventProcol() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsNoEP.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsNoEP.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -111,7 +112,7 @@ public class ProducerConsumerTests { @Test public void testNoCarrierTechnologyParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsNoCTParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsNoCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -122,7 +123,7 @@ public class ProducerConsumerTests { @Test public void testMismatchCarrierTechnologyParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsMismatchCTParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsMismatchCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( @@ -135,7 +136,7 @@ public class ProducerConsumerTests { @Test public void testWrongTypeCarrierTechnologyParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsWrongTypeCTParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsWrongTypeCTParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( @@ -151,7 +152,7 @@ public class ProducerConsumerTests { @Test public void testOkFileNameCarrierTechnology() throws ParameterException { - final String[] args = { "-c", "src/test/resources/parameters/prodConsOKFileName.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsOKFileName.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -166,7 +167,7 @@ public class ProducerConsumerTests { @Test public void testBadFileNameCarrierTechnology() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsBadFileName.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsBadFileName.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( @@ -186,7 +187,7 @@ public class ProducerConsumerTests { @Test public void testBadEventProtocolParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsBadEPParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsBadEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -199,7 +200,7 @@ public class ProducerConsumerTests { @Test public void testNoEventProtocolParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsNoEPParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsNoEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -210,7 +211,7 @@ public class ProducerConsumerTests { @Test public void testMismatchEventProtocolParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsMismatchEPParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsMismatchEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( @@ -224,7 +225,7 @@ public class ProducerConsumerTests { @Test public void testWrongTypeEventProtocolParClass() { - final String[] args = { "-c", "src/test/resources/parameters/prodConsWrongTypeEPParClass.json" }; + final String[] args = {"-p", "src/test/resources/parameters/prodConsWrongTypeEPParClass.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage( diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java index 91f8c6699..9f420d8fb 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -45,7 +46,7 @@ import org.onap.policy.common.parameters.ParameterException; public class SyncParameterTests { @Test public void testSyncBadNoSyncWithPeer() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -63,7 +64,7 @@ public class SyncParameterTests { @Test public void testSyncBadNotSyncWithPeer() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -81,7 +82,7 @@ public class SyncParameterTests { @Test public void testSyncBadSyncBadPeers() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsBadPeers.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsBadPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -110,7 +111,7 @@ public class SyncParameterTests { @Test public void testSyncBadSyncInvalidTimeout() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsInvalidTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsInvalidTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -141,7 +142,7 @@ public class SyncParameterTests { @Test public void testSyncBadSyncBadTimeout() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsBadTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsBadTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -159,7 +160,7 @@ public class SyncParameterTests { @Test public void testSyncBadSyncUnpairedTimeout() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncBadParamsUnpairedTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncBadParamsUnpairedTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -190,7 +191,7 @@ public class SyncParameterTests { @Test public void testSyncGoodSyncGoodTimeoutProducer() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsProducerTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncGoodParamsProducerTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -207,7 +208,7 @@ public class SyncParameterTests { @Test public void testSyncGoodSyncGoodTimeoutConsumer() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsConsumerTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncGoodParamsConsumerTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -224,7 +225,7 @@ public class SyncParameterTests { @Test public void testSyncGoodSyncGoodTimeoutBoth() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncGoodParamsBothTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncGoodParamsBothTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); @@ -241,7 +242,7 @@ public class SyncParameterTests { @Test public void testSyncUnusedConsumerPeers() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncUnusedConsumerPeers.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncUnusedConsumerPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -266,7 +267,7 @@ public class SyncParameterTests { @Test public void testSyncMismatchedPeers() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncMismatchedPeers.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncMismatchedPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -297,7 +298,7 @@ public class SyncParameterTests { @Test public void testSyncUnusedProducerPeers() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncUnusedProducerPeers.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncUnusedProducerPeers.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -320,7 +321,7 @@ public class SyncParameterTests { @Test public void testSyncMismatchedTimeout() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncMismatchedTimeout.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncMismatchedTimeout.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) @@ -345,7 +346,7 @@ public class SyncParameterTests { @Test public void testSyncGoodParametersTest() throws ParameterException { - final String[] args = {"-c", "src/test/resources/parameters/syncGoodParams.json"}; + final String[] args = {"-p", "src/test/resources/parameters/syncGoodParams.json"}; final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args); final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java index eb99c97bb..e9a1a858e 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -21,6 +22,7 @@ package org.onap.policy.apex.service.engine.runtime.impl; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -73,7 +75,7 @@ public class EngineServiceImplTest { simpleModelString = TextFileUtils.getTextFileAsString("src/test/resources/policymodels/SmallModel.json"); differentModelString = - TextFileUtils.getTextFileAsString("src/test/resources/policymodels/SmallModelDifferent.json"); + TextFileUtils.getTextFileAsString("src/test/resources/policymodels/SmallModelDifferent.json"); final ApexModelReader modelReader = new ApexModelReader<>(AxPolicyModel.class); simpleModel = modelReader.read(new ByteArrayInputStream(simpleModelString.getBytes())); @@ -110,18 +112,18 @@ public class EngineServiceImplTest { ExecutorParameters jsExecutorParameters = new ExecutorParameters(); jsExecutorParameters.setName("JAVASCRIPT"); jsExecutorParameters - .setTaskSelectionExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTse"); + .setTaskSelectionExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTse"); jsExecutorParameters.setTaskExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTe"); jsExecutorParameters - .setStateFinalizerExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummySfe"); + .setStateFinalizerExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummySfe"); engineParameters.getExecutorParameterMap().put("JAVASCRIPT", jsExecutorParameters); ExecutorParameters mvvelExecutorParameters = new ExecutorParameters(); mvvelExecutorParameters.setName("MVEL"); mvvelExecutorParameters - .setTaskSelectionExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTse"); + .setTaskSelectionExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTse"); mvvelExecutorParameters.setTaskExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummyTe"); mvvelExecutorParameters - .setStateFinalizerExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummySfe"); + .setStateFinalizerExecutorPluginClass("org.onap.policy.apex.service.engine.runtime.impl.DummySfe"); engineParameters.getExecutorParameterMap().put("MVEL", jsExecutorParameters); ParameterService.register(engineParameters); } @@ -142,26 +144,17 @@ public class EngineServiceImplTest { @Test public void testEngineServiceImplSanity() throws ApexException { - try { - EngineServiceImpl.create(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine service configuration parameters are null", apEx.getMessage()); - } - + assertThatThrownBy(() -> EngineServiceImpl.create(null)).isInstanceOf(ApexException.class) + .hasMessage("engine service configuration parameters are null"); EngineServiceParameters config = new EngineServiceParameters(); config.setInstanceCount(0); - - try { - EngineServiceImpl.create(config); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("Invalid engine service configuration parameters:", apEx.getMessage().substring(0, 48)); - } + assertThatThrownBy(() -> EngineServiceImpl.create(config)).isInstanceOf(ApexException.class) + .hasMessageContaining("Invalid engine service configuration parameters"); config.setId(123); config.setEngineKey(new AxArtifactKey("Engine", "0.0.1")); config.setInstanceCount(1); + config.setPolicyModel("policyModelContent"); EngineServiceImpl esImpl = EngineServiceImpl.create(config); assertEquals("Engine:0.0.1", esImpl.getKey().getId()); @@ -171,12 +164,8 @@ public class EngineServiceImplTest { esImpl.registerActionListener(null, new DummyApexEventListener()); esImpl.registerActionListener("DummyListener", new DummyApexEventListener()); - try { - esImpl.deregisterActionListener(null); - fail("test should throw an exception"); - } catch (Exception apEx) { - assertEquals("removeEventListener()<-Engine-0:0.0.1,STOPPED, listenerName is null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.deregisterActionListener(null)) + .hasMessage("removeEventListener()<-Engine-0:0.0.1,STOPPED, listenerName is null"); esImpl.deregisterActionListener("DummyListener"); @@ -185,38 +174,21 @@ public class EngineServiceImplTest { assertNull(esImpl.getApexModelKey()); - try { - esImpl.getRuntimeInfo(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.getRuntimeInfo(null)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.getRuntimeInfo(new AxArtifactKey("DummyKey", "0.0.1")); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine with key DummyKey:0.0.1 not found in engine service", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.getRuntimeInfo(new AxArtifactKey("DummyKey", "0.0.1"))) + .isInstanceOf(ApexException.class).hasMessage("engine with key DummyKey:0.0.1 not found in engine service"); String runtimeInfo = esImpl.getRuntimeInfo(esImpl.getEngineKeys().iterator().next()); assertEquals("{\n \"TimeStamp\":", runtimeInfo.substring(0, 16)); assertEquals(AxEngineState.STOPPED, esImpl.getState()); - try { - esImpl.getStatus(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } - - try { - esImpl.getStatus(new AxArtifactKey("DummyKey", "0.0.1")); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine with key DummyKey:0.0.1 not found in engine service", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.getStatus(null)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); + assertThatThrownBy(() -> esImpl.getStatus(new AxArtifactKey("DummyKey", "0.0.1"))) + .isInstanceOf(ApexException.class).hasMessage("engine with key DummyKey:0.0.1 not found in engine service"); String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next()); assertTrue(status.contains("\n \"apexEngineModel\" :")); @@ -230,182 +202,84 @@ public class EngineServiceImplTest { assertTrue(esImpl.isStopped(new AxArtifactKey("DummyKey", "0.0.1"))); assertTrue(esImpl.isStopped(esImpl.getEngineKeys().iterator().next())); - try { - esImpl.start(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } - - try { - esImpl.start(new AxArtifactKey("DummyKey", "0.0.1")); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine with key DummyKey:0.0.1 not found in engine service", apEx.getMessage()); - } - - try { - esImpl.start(esImpl.getEngineKeys().iterator().next()); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("start()<-Engine-0:0.0.1,STOPPED, cannot start engine, " - + "engine has not been initialized, its model is not loaded", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.start(null)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.startAll(); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("start()<-Engine-0:0.0.1,STOPPED, cannot start engine, " - + "engine has not been initialized, its model is not loaded", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.start(new AxArtifactKey("DummyKey", "0.0.1"))).isInstanceOf(ApexException.class) + .hasMessage("engine with key DummyKey:0.0.1 not found in engine service"); - try { - esImpl.stop(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.start(esImpl.getEngineKeys().iterator().next())) + .isInstanceOf(ApexException.class).hasMessage("start()<-Engine-0:0.0.1,STOPPED, cannot start engine, " + + "engine has not been initialized, its model is not loaded"); - try { - esImpl.stop(new AxArtifactKey("DummyKey", "0.0.1")); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine with key DummyKey:0.0.1 not found in engine service", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.startAll()).isInstanceOf(ApexException.class) + .hasMessage("start()<-Engine-0:0.0.1,STOPPED, cannot start engine, " + + "engine has not been initialized, its model is not loaded"); - try { - esImpl.stop(esImpl.getEngineKeys().iterator().next()); - } catch (ApexException apEx) { - fail("test should not throw an exception"); - } + assertThatThrownBy(() -> esImpl.stop(null)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.stop(); - } catch (ApexException apEx) { - fail("test should not throw an exception"); - } + assertThatThrownBy(() -> esImpl.stop(new AxArtifactKey("DummyKey", "0.0.1"))).isInstanceOf(ApexException.class) + .hasMessage("engine with key DummyKey:0.0.1 not found in engine service"); - try { - esImpl.sendEvent(null); - } catch (Exception apEx) { - fail("test should not throw an exception"); - } + esImpl.stop(esImpl.getEngineKeys().iterator().next()); - try { - esImpl.sendEvent(new ApexEvent("SomeEvent", "0.0.1", "the.event.namespace", "EventSource", "EventTarget")); - } catch (ApexException apEx) { - fail("test should not throw an exception"); - } + esImpl.stop(); + esImpl.sendEvent(null); + esImpl.sendEvent(new ApexEvent("SomeEvent", "0.0.1", "the.event.namespace", "EventSource", "EventTarget")); esImpl.startPeriodicEvents(100000); - try { - esImpl.startPeriodicEvents(100000); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " - + "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.startPeriodicEvents(100000)).isInstanceOf(ApexException.class) + .hasMessage("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " + + "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]"); esImpl.stopPeriodicEvents(); - try { - esImpl.stopPeriodicEvents(); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("Peiodic event geneation not running on engine Engine:0.0.1", apEx.getMessage()); - } - try { - esImpl.clear(null); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.stopPeriodicEvents()).isInstanceOf(ApexException.class) + .hasMessage("Peiodic event geneation not running on engine Engine:0.0.1"); - try { - esImpl.clear(new AxArtifactKey("DummyKey", "0.0.1")); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine with key DummyKey:0.0.1 not found in engine service", apEx.getMessage()); - } - - try { - esImpl.clear(esImpl.getEngineKeys().iterator().next()); - } catch (ApexException apEx) { - fail("test should not throw an exception"); - } + assertThatThrownBy(() -> esImpl.clear(null)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.clear(); - } catch (ApexException apEx) { - fail("test should not throw an exception"); - } + assertThatThrownBy(() -> esImpl.clear(new AxArtifactKey("DummyKey", "0.0.1"))).isInstanceOf(ApexException.class) + .hasMessage("engine with key DummyKey:0.0.1 not found in engine service"); + esImpl.clear(esImpl.getEngineKeys().iterator().next()); + esImpl.clear(); - try { - esImpl.updateModel(null, (String) null, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(null, (String) null, true)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), (String) null, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("model for updating engine service with key DummyKey:0.0.1 is empty", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), (String) null, true)) + .isInstanceOf(ApexException.class) + .hasMessage("model for updating engine service with key DummyKey:0.0.1 is empty"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), "", true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("model for updating engine service with key DummyKey:0.0.1 is empty", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), "", true)) + .isInstanceOf(ApexException.class) + .hasMessage("model for updating engine service with key DummyKey:0.0.1 is empty"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), "I am not an Apex model", true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("failed to unmarshal the apex model on engine service DummyKey:0.0.1", apEx.getMessage()); - } + assertThatThrownBy( + () -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), "I am not an Apex model", true)) + .isInstanceOf(ApexException.class) + .hasMessage("failed to unmarshal the apex model on engine service DummyKey:0.0.1"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), simpleModelString, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine service key DummyKey:0.0.1 does not match the keyEngine:0.0.1 of this engine service", - apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), simpleModelString, true)) + .isInstanceOf(ApexException.class) + .hasMessage("engine service key DummyKey:0.0.1 does not match the keyEngine:0.0.1 of this engine service"); - try { - esImpl.updateModel(null, simpleModelString, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(null, simpleModelString, true)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.updateModel(null, (AxPolicyModel) null, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine key must be specified and may not be null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(null, (AxPolicyModel) null, true)).isInstanceOf(ApexException.class) + .hasMessage("engine key must be specified and may not be null"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), (AxPolicyModel) null, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("model for updating on engine service with key DummyKey:0.0.1 is null", apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), (AxPolicyModel) null, true)) + .isInstanceOf(ApexException.class) + .hasMessage("model for updating on engine service with key DummyKey:0.0.1 is null"); - try { - esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), simpleModel, true); - fail("test should throw an exception"); - } catch (ApexException apEx) { - assertEquals("engine service key DummyKey:0.0.1 does not match the keyEngine:0.0.1 of this engine service", - apEx.getMessage()); - } + assertThatThrownBy(() -> esImpl.updateModel(new AxArtifactKey("DummyKey", "0.0.1"), simpleModel, true)) + .isInstanceOf(ApexException.class) + .hasMessage("engine service key DummyKey:0.0.1 does not match the keyEngine:0.0.1 of this engine service"); } @Test @@ -414,7 +288,7 @@ public class EngineServiceImplTest { config.setId(123); config.setEngineKey(new AxArtifactKey("Engine", "0.0.1")); config.setInstanceCount(1); - + config.setPolicyModel("policyModelContent"); EngineServiceImpl esImpl = EngineServiceImpl.create(config); assertEquals("Engine:0.0.1", esImpl.getKey().getId()); diff --git a/services/services-engine/src/test/resources/parameters/badParams.json b/services/services-engine/src/test/resources/parameters/badParams.json index c3b96c7ba..33aaed4f3 100644 --- a/services/services-engine/src/test/resources/parameters/badParams.json +++ b/services/services-engine/src/test/resources/parameters/badParams.json @@ -1,31 +1,48 @@ { - "engineServiceParameters": { - "name": "hello there", - "version": "PA1", - "id": -45, - "instanceCount": -345, - "deploymentPort": 65536, - "policyModelFileName": "/some/file/name.xml" - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "hello there", + "version": "PA1", + "id": -45, + "instanceCount": -345, + "deploymentPort": 65536, + "policy_type_impl": { + "apexPolicyModel": {} + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE" + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/badParamsModelNotFile.json b/services/services-engine/src/test/resources/parameters/badParamsModelNotFile.json deleted file mode 100644 index 8dec995be..000000000 --- a/services/services-engine/src/test/resources/parameters/badParamsModelNotFile.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MyOtherProducer": { - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/bbb.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - } - } - } -} \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/blankParams.json b/services/services-engine/src/test/resources/parameters/blankParams.json index d874ae98b..ca3b39026 100644 --- a/services/services-engine/src/test/resources/parameters/blankParams.json +++ b/services/services-engine/src/test/resources/parameters/blankParams.json @@ -1,11 +1,20 @@ { - "engineServiceParameters": { - - }, - "eventInputParameters": { - - }, - "eventOutputParameters": { - - } -} + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": {}, + "eventInputParameters": {}, + "eventOutputParameters": {} + } + } + } + ] + } +} \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/correctParams.json b/services/services-engine/src/test/resources/parameters/correctParams.json index 90f5fa15b..43fef1cbe 100644 --- a/services/services-engine/src/test/resources/parameters/correctParams.json +++ b/services/services-engine/src/test/resources/parameters/correctParams.json @@ -1,43 +1,512 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 2, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 2, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "keyInformation": { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "keyInfoMap": { + "entry": [ + { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "UUID": "fec1b353-b35f-4384-b7d9-69622059c248", + "description": "Generated description for a concept called \"BasicContextAlbum\" with version \"0.0.1\" and UUID \"fec1b353-b35f-4384-b7d9-69622059c248\"" + } + }, + { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "UUID": "cc8d3c1a-e975-459a-bcd2-69f423eaa1f3", + "description": "Generated description for a concept called \"BasicEvent\" with version \"0.0.1\" and UUID \"cc8d3c1a-e975-459a-bcd2-69f423eaa1f3\"" + } + }, + { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "UUID": "d0c5d8ee-5fe7-4978-89ce-4a3e69cad043", + "description": "Generated description for a concept called \"BasicPolicy\" with version \"0.0.1\" and UUID \"d0c5d8ee-5fe7-4978-89ce-4a3e69cad043\"" + } + }, + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "UUID": "c5651414-fc1c-493b-878d-75f0ce685c36", + "description": "Generated description for a concept called \"BasicTask\" with version \"0.0.1\" and UUID \"c5651414-fc1c-493b-878d-75f0ce685c36\"" + } + }, + { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "UUID": "790ff718-8dc0-44e0-89d8-1b3bbe238310", + "description": "Generated description for a concept called \"IntType\" with version \"0.0.1\" and UUID \"790ff718-8dc0-44e0-89d8-1b3bbe238310\"" + } + }, + { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "UUID": "a1bd1f4e-713b-456b-b1a8-bb48beee28e8", + "description": "Generated description for a concept called \"SmallModel\" with version \"0.0.1\" and UUID \"a1bd1f4e-713b-456b-b1a8-bb48beee28e8\"" + } + }, + { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "UUID": "72bed9af-ab7d-3379-b9f7-b5eca5c9ef22", + "description": "Generated description for concept referred to by key \"SmallModel_Albums:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "UUID": "796dc6b0-627d-34ae-a5e2-1bc4b4b486b8", + "description": "Generated description for concept referred to by key \"SmallModel_Events:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "UUID": "b4876774-6907-3d27-a2b8-f05737c5ee4a", + "description": "Generated description for concept referred to by key \"SmallModel_KeyInfo:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "UUID": "5bcf946b-67be-3190-a906-f954896f999f", + "description": "Generated description for concept referred to by key \"SmallModel_Policies:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "UUID": "c25bf5c3-7f1e-3667-b8a9-971ba21517bc", + "description": "Generated description for concept referred to by key \"SmallModel_Schemas:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "UUID": "43b015ca-2ed1-3a35-b103-e8a5aa68f1ef", + "description": "Generated description for concept referred to by key \"SmallModel_Tasks:0.0.1\"" + } + } + ] + } + }, + "policies": { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "policyMap": { + "entry": [ + { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "template": "FREEFORM", + "state": { + "entry": [ + { + "key": "OnlyState", + "value": { + "stateKey": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "OnlyState" + }, + "trigger": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "OnlyOutput", + "value": { + "key": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "OnlyOutput" + }, + "outgoingEvent": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "BasicContextAlbum", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "BasicTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "BasicTask" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "OnlyOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState": "OnlyState" + } + } + ] + } + }, + "tasks": { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "taskMap": { + "entry": [ + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "inputFields": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "outputFields": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "BasicContextAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "executor.logger.debug(executor.subject.id);\nvar gc = executor.getContextAlbum(\"BasicContextAlbum\");\nexecutor.logger.debug(gc.name);\nexecutor.logger.debug(executor.inFields);\n\nexecutor.logger.debug(executor.eo);\n\nvar returnValue = executor.isTrue;" + } + } + } + ] + } + }, + "events": { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "eventMap": { + "entry": [ + { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.events", + "source": "source", + "target": "target", + "parameter": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + } + } + } + ] + } + }, + "albums": { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "albums": { + "entry": [ + { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "scope": "GLOBAL", + "isWritable": true, + "itemSchema": { + "name": "IntType", + "version": "0.0.1" + } + } + } + ] + } + }, + "schemas": { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "schemas": { + "entry": [ + { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.Integer" + } + } + ] + } + } + } + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "standardIo": true + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "src/test/resources/events/TestPojoEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json b/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json index e92254655..8c1f99903 100644 --- a/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json +++ b/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json @@ -1,47 +1,522 @@ { - "javaProperties" : [ - ["javax.net.ssl.trustStore", "trust-store-file"], - ["javax.net.ssl.trustStorePassword", "UG9sMWN5XzBuYXA="] - ], - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 2, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "javaProperties": [ + [ + "javax.net.ssl.trustStore", + "trust-store-file" + ], + [ + "javax.net.ssl.trustStorePassword", + "UG9sMWN5XzBuYXA=" + ] + ], + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 2, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "keyInformation": { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "keyInfoMap": { + "entry": [ + { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "UUID": "fec1b353-b35f-4384-b7d9-69622059c248", + "description": "Generated description for a concept called \"BasicContextAlbum\" with version \"0.0.1\" and UUID \"fec1b353-b35f-4384-b7d9-69622059c248\"" + } + }, + { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "UUID": "cc8d3c1a-e975-459a-bcd2-69f423eaa1f3", + "description": "Generated description for a concept called \"BasicEvent\" with version \"0.0.1\" and UUID \"cc8d3c1a-e975-459a-bcd2-69f423eaa1f3\"" + } + }, + { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "UUID": "d0c5d8ee-5fe7-4978-89ce-4a3e69cad043", + "description": "Generated description for a concept called \"BasicPolicy\" with version \"0.0.1\" and UUID \"d0c5d8ee-5fe7-4978-89ce-4a3e69cad043\"" + } + }, + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "UUID": "c5651414-fc1c-493b-878d-75f0ce685c36", + "description": "Generated description for a concept called \"BasicTask\" with version \"0.0.1\" and UUID \"c5651414-fc1c-493b-878d-75f0ce685c36\"" + } + }, + { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "UUID": "790ff718-8dc0-44e0-89d8-1b3bbe238310", + "description": "Generated description for a concept called \"IntType\" with version \"0.0.1\" and UUID \"790ff718-8dc0-44e0-89d8-1b3bbe238310\"" + } + }, + { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel", + "version": "0.0.1" + }, + "UUID": "a1bd1f4e-713b-456b-b1a8-bb48beee28e8", + "description": "Generated description for a concept called \"SmallModel\" with version \"0.0.1\" and UUID \"a1bd1f4e-713b-456b-b1a8-bb48beee28e8\"" + } + }, + { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "UUID": "72bed9af-ab7d-3379-b9f7-b5eca5c9ef22", + "description": "Generated description for concept referred to by key \"SmallModel_Albums:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "UUID": "796dc6b0-627d-34ae-a5e2-1bc4b4b486b8", + "description": "Generated description for concept referred to by key \"SmallModel_Events:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_KeyInfo", + "version": "0.0.1" + }, + "UUID": "b4876774-6907-3d27-a2b8-f05737c5ee4a", + "description": "Generated description for concept referred to by key \"SmallModel_KeyInfo:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "UUID": "5bcf946b-67be-3190-a906-f954896f999f", + "description": "Generated description for concept referred to by key \"SmallModel_Policies:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "UUID": "c25bf5c3-7f1e-3667-b8a9-971ba21517bc", + "description": "Generated description for concept referred to by key \"SmallModel_Schemas:0.0.1\"" + } + }, + { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "UUID": "43b015ca-2ed1-3a35-b103-e8a5aa68f1ef", + "description": "Generated description for concept referred to by key \"SmallModel_Tasks:0.0.1\"" + } + } + ] + } + }, + "policies": { + "key": { + "name": "SmallModel_Policies", + "version": "0.0.1" + }, + "policyMap": { + "entry": [ + { + "key": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "BasicPolicy", + "version": "0.0.1" + }, + "template": "FREEFORM", + "state": { + "entry": [ + { + "key": "OnlyState", + "value": { + "stateKey": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "OnlyState" + }, + "trigger": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "OnlyOutput", + "value": { + "key": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "OnlyOutput" + }, + "outgoingEvent": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "BasicContextAlbum", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "BasicTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "BasicTask" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "BasicPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnlyState", + "localName": "OnlyOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState": "OnlyState" + } + } + ] + } + }, + "tasks": { + "key": { + "name": "SmallModel_Tasks", + "version": "0.0.1" + }, + "taskMap": { + "entry": [ + { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicTask", + "version": "0.0.1" + }, + "inputFields": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "outputFields": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "BasicContextAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "executor.logger.debug(executor.subject.id);\nvar gc = executor.getContextAlbum(\"BasicContextAlbum\");\nexecutor.logger.debug(gc.name);\nexecutor.logger.debug(executor.inFields);\n\nexecutor.logger.debug(executor.eo);\n\nvar returnValue = executor.isTrue;" + } + } + } + ] + } + }, + "events": { + "key": { + "name": "SmallModel_Events", + "version": "0.0.1" + }, + "eventMap": { + "entry": [ + { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.events", + "source": "source", + "target": "target", + "parameter": { + "entry": [ + { + "key": "intPar", + "value": { + "key": "intPar", + "fieldSchemaKey": { + "name": "IntType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + } + } + } + ] + } + }, + "albums": { + "key": { + "name": "SmallModel_Albums", + "version": "0.0.1" + }, + "albums": { + "entry": [ + { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "BasicContextAlbum", + "version": "0.0.1" + }, + "scope": "GLOBAL", + "isWritable": true, + "itemSchema": { + "name": "IntType", + "version": "0.0.1" + } + } + } + ] + } + }, + "schemas": { + "key": { + "name": "SmallModel_Schemas", + "version": "0.0.1" + }, + "schemas": { + "entry": [ + { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "IntType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.Integer" + } + } + ] + } + } + } + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "standardIo": true + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "src/test/resources/events/TestPojoEvent.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/factoryGoodParams.json b/services/services-engine/src/test/resources/parameters/factoryGoodParams.json index 87448f5e7..c83b4e984 100644 --- a/services/services-engine/src/test/resources/parameters/factoryGoodParams.json +++ b/services/services-engine/src/test/resources/parameters/factoryGoodParams.json @@ -1,64 +1,81 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MyOtherProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + }, + "MyOtherProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/goodParams.json b/services/services-engine/src/test/resources/parameters/goodParams.json index f323b0b51..af075c023 100644 --- a/services/services-engine/src/test/resources/parameters/goodParams.json +++ b/services/services-engine/src/test/resources/parameters/goodParams.json @@ -1,64 +1,81 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MyOtherProducer": { - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + }, + "MyOtherProducer": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } } - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/goodParamsRelative.json b/services/services-engine/src/test/resources/parameters/goodParamsRelative.json index b3d193111..937034ce7 100644 --- a/services/services-engine/src/test/resources/parameters/goodParamsRelative.json +++ b/services/services-engine/src/test/resources/parameters/goodParamsRelative.json @@ -1,64 +1,80 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MyOtherProducer": { - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + }, + "MyOtherProducer": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "aaa.json" + } } - } - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "bbb.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/javaPropertiesBad.json b/services/services-engine/src/test/resources/parameters/javaPropertiesBad.json index dc663bd56..f9de6c76f 100644 --- a/services/services-engine/src/test/resources/parameters/javaPropertiesBad.json +++ b/services/services-engine/src/test/resources/parameters/javaPropertiesBad.json @@ -1,53 +1,82 @@ { - "javaProperties" : [ - ["property0"], - ["property1", "property1Value", "propertyExtraValue"], - [], - [null, "proeprtyValue"], - null, - ["propertyname", null] - ], - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - }, - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "javaProperties": [ + [ + "property0" + ], + [ + "property1", + "property1Value", + "propertyExtraValue" + ], + [], + [ + null, + "proeprtyValue" + ], + null, + [ + "propertyname", + null + ] + ], + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } -} \ No newline at end of file + } + ] + } +} diff --git a/services/services-engine/src/test/resources/parameters/javaPropertiesEmpty.json b/services/services-engine/src/test/resources/parameters/javaPropertiesEmpty.json index aca972302..2e94dc9a8 100644 --- a/services/services-engine/src/test/resources/parameters/javaPropertiesEmpty.json +++ b/services/services-engine/src/test/resources/parameters/javaPropertiesEmpty.json @@ -1,46 +1,63 @@ { - "javaProperties" : [], - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - }, - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "javaProperties": [], + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/javaPropertiesOK.json b/services/services-engine/src/test/resources/parameters/javaPropertiesOK.json index 74b967f74..c3168ebdd 100644 --- a/services/services-engine/src/test/resources/parameters/javaPropertiesOK.json +++ b/services/services-engine/src/test/resources/parameters/javaPropertiesOK.json @@ -1,49 +1,72 @@ { - "javaProperties" : [ - ["property0", "property0Value"], - ["property1", "property1Value"] - ], - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - }, - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "javaProperties": [ + [ + "property0", + "property0Value" + ], + [ + "property1", + "property1Value" + ] + ], + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/noParams.json b/services/services-engine/src/test/resources/parameters/noParams.json index 7a73a41bf..15ed425a5 100644 --- a/services/services-engine/src/test/resources/parameters/noParams.json +++ b/services/services-engine/src/test/resources/parameters/noParams.json @@ -1,2 +1,16 @@ { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": {} + } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsBadCTParClass.json b/services/services-engine/src/test/resources/parameters/prodConsBadCTParClass.json index 48c2dc905..5b3292651 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsBadCTParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsBadCTParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } -} \ No newline at end of file + } + ] + } +} diff --git a/services/services-engine/src/test/resources/parameters/prodConsBadEPParClass.json b/services/services-engine/src/test/resources/parameters/prodConsBadEPParClass.json index 51e9c3972..2f9348388 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsBadEPParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsBadEPParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JsonEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JsonEventProtocolParameters" + } + } } + } } - } -} \ No newline at end of file + } + ] + } +} diff --git a/services/services-engine/src/test/resources/parameters/prodConsBadFileName.json b/services/services-engine/src/test/resources/parameters/prodConsBadFileName.json index 38fba4480..fbe210ff8 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsBadFileName.json +++ b/services/services-engine/src/test/resources/parameters/prodConsBadFileName.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": null + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsMismatchCTParClass.json b/services/services-engine/src/test/resources/parameters/prodConsMismatchCTParClass.json index 42c3e69ee..8e0629dc6 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsMismatchCTParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsMismatchCTParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_LOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_LOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsMismatchEPParClass.json b/services/services-engine/src/test/resources/parameters/prodConsMismatchEPParClass.json index 1bb893218..5f5047e2f 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsMismatchEPParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsMismatchEPParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_BEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_BEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsNoCT.json b/services/services-engine/src/test/resources/parameters/prodConsNoCT.json index e94f05a5b..63367f805 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsNoCT.json +++ b/services/services-engine/src/test/resources/parameters/prodConsNoCT.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsNoCTParClass.json b/services/services-engine/src/test/resources/parameters/prodConsNoCTParClass.json index 07d50b30f..bd927b2bc 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsNoCTParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsNoCTParClass.json @@ -1,41 +1,58 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsNoEP.json b/services/services-engine/src/test/resources/parameters/prodConsNoEP.json index bdb780f4a..55bc30e41 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsNoEP.json +++ b/services/services-engine/src/test/resources/parameters/prodConsNoEP.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventParameters": { + "eventProtocol": "JSON" } + } }, - "eventParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameterClassName": "org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsNoEPParClass.json b/services/services-engine/src/test/resources/parameters/prodConsNoEPParClass.json index f39173ff8..f85532718 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsNoEPParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsNoEPParClass.json @@ -1,41 +1,58 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsOKFileName.json b/services/services-engine/src/test/resources/parameters/prodConsOKFileName.json index 938c318a7..cad5c82c3 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsOKFileName.json +++ b/services/services-engine/src/test/resources/parameters/prodConsOKFileName.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsWrongTypeCTParClass.json b/services/services-engine/src/test/resources/parameters/prodConsWrongTypeCTParClass.json index adbda5c13..3a4c80ea5 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsWrongTypeCTParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsWrongTypeCTParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/prodConsWrongTypeEPParClass.json b/services/services-engine/src/test/resources/parameters/prodConsWrongTypeEPParClass.json index bbc50bde6..b7c31b033 100644 --- a/services/services-engine/src/test/resources/parameters/prodConsWrongTypeEPParClass.json +++ b/services/services-engine/src/test/resources/parameters/prodConsWrongTypeEPParClass.json @@ -1,42 +1,59 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "aProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "aProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "aConsumer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + "eventInputParameters": { + "aConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadClassDistParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadClassDistParams.json index 12f22c1eb..d25f81702 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadClassDistParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadClassDistParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", - "distributorParameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "distributorParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - } - }, - "executorParameters": { - "MVEL": { + } + }, + "executorParameters": { + "MVEL": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadClassLockParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadClassLockParams.json index 00e6ca64a..b0f326346 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadClassLockParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadClassLockParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", - "lockManagerParameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "lockManagerParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - } - }, - "executorParameters": { - "JAVASCRIPT": { + } + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadClassParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadClassParams.json index c10172d23..94713fe70 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadClassParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadClassParams.json @@ -1,15 +1,32 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "java.lang.Integer" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "java.lang.Integer" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadClassPersistParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadClassPersistParams.json index 8c2331e32..239023aff 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadClassPersistParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadClassPersistParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", - "persistorParameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "persistorParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - } - }, - "executorParameters": { - "JAVASCRIPT": { + } + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadParams.json index abb6b18cf..f5157bbcd 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadParams.json @@ -1,15 +1,32 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "hello" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "hello" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadPluginClassParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadPluginClassParams.json index 1083f18b1..5dc96a4e0 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadPluginClassParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadPluginClassParams.json @@ -1,15 +1,32 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextBadPluginNameParams.json b/services/services-engine/src/test/resources/parameters/serviceContextBadPluginNameParams.json index 7d9d8900c..350d54feb 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextBadPluginNameParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextBadPluginNameParams.json @@ -1,15 +1,32 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassNamelooby": "" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassNamelooby": "" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextNoParams.json b/services/services-engine/src/test/resources/parameters/serviceContextNoParams.json index 44c53bb29..28bf1aec5 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextNoParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextNoParams.json @@ -1,15 +1,30 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": {} + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextOKDefaultParams.json b/services/services-engine/src/test/resources/parameters/serviceContextOKDefaultParams.json index f4fee9fa9..16328ff67 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextOKDefaultParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextOKDefaultParams.json @@ -1,45 +1,62 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" - }, - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters" + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextOKDistParams.json b/services/services-engine/src/test/resources/parameters/serviceContextOKDistParams.json index 5aff80d94..6509fde6c 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextOKDistParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextOKDistParams.json @@ -1,48 +1,65 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "contextParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.DistributorParameters" - } - }, - "executorParameters": { - "JAVASCRIPT": { + } + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextOKFlushParams.json b/services/services-engine/src/test/resources/parameters/serviceContextOKFlushParams.json index 8bae50523..0b1b1e7c0 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextOKFlushParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextOKFlushParams.json @@ -1,49 +1,66 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", - "persistorParameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "persistorParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.PersistorParameters", "flushPeriod": 123456 - } - }, - "executorParameters": { - "JAVASCRIPT": { + } + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceContextOKFullParams.json b/services/services-engine/src/test/resources/parameters/serviceContextOKFullParams.json index 24544d2ab..00be15d79 100644 --- a/services/services-engine/src/test/resources/parameters/serviceContextOKFullParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceContextOKFullParams.json @@ -1,59 +1,76 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "contextParameters": { - "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", - "distributorParameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "distributorParameters": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperDistributorParameters", "configFile": "my/lovely/configFile.xml", "jgroupsFile": "holy/stone.xml", "preferIPv4Stack": false, "jgroupsBindAddress": "fatherted" - }, - "lockManagerParameters": { + }, + "lockManagerParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.LockManagerParameters" - }, - "persistorParameters": { + }, + "persistorParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.PersistorParameters", "flushPeriod": 123456 - } - }, - "executorParameters": { - "JAVASCRIPT": { + } + }, + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorBadParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorBadParams.json index f9f50ee07..84a882977 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorBadParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorBadParams.json @@ -1,18 +1,35 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": "hello" + }, + "ZOOBY": "hello" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginNameParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginNameParams.json index 4a28d58aa..df53f5d63 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginNameParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginNameParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": { + }, + "ZOOBY": { "parameterClassNamelooby": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "LOOBY": { + }, + "LOOBY": { "parameterClassNamelooby": "" + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json index 7dd74ea34..78e1bfff5 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueBlankParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": { + }, + "ZOOBY": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "LOOBY": { + }, + "LOOBY": { "parameterClassName": " " + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json index 2f7219f46..da3ab9552 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueObjectParams.json @@ -1,25 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": { + }, + "ZOOBY": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "LOOBY": { - "parameterClassName": { - - } + }, + "LOOBY": { + "parameterClassName": {} + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueParams.json index 39618055f..116276fb4 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorBadPluginValueParams.json @@ -1,23 +1,40 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": { + }, + "ZOOBY": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "LOOBY": { + }, + "LOOBY": { "parameterClassName": "helloworld" + } } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorEmptyParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorEmptyParams.json index 3927740e3..1a4c30934 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorEmptyParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorEmptyParams.json @@ -1,20 +1,35 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" - }, - "ZOOBY": { - + }, + "ZOOBY": {} } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorNoExecutorParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorNoExecutorParams.json index 0c6618f2e..d5c540191 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorNoExecutorParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorNoExecutorParams.json @@ -1,13 +1,30 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "someParameter": "someValue" + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "someParameter": "someValue" + } + } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/serviceExecutorNoParams.json b/services/services-engine/src/test/resources/parameters/serviceExecutorNoParams.json index 4eb6fe024..db6b7e0b9 100644 --- a/services/services-engine/src/test/resources/parameters/serviceExecutorNoParams.json +++ b/services/services-engine/src/test/resources/parameters/serviceExecutorNoParams.json @@ -1,40 +1,55 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": {} + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/superDooperParams.json b/services/services-engine/src/test/resources/parameters/superDooperParams.json index 75820ebaf..ff06f4688 100644 --- a/services/services-engine/src/test/resources/parameters/superDooperParams.json +++ b/services/services-engine/src/test/resources/parameters/superDooperParams.json @@ -1,17 +1,30 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 345, - "deploymentPort": 65522 - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters", - "parameters": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 345, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters", + "parameters": { "bootstrapServers": "somehost:12345", "acks": 0, "retries": 25, @@ -25,31 +38,36 @@ "producerTopic": "producer-out", "consumerPollTime": 101, "consumerTopicList": [ - "consumer-out-0", - "consumer-out-1", - "consumer-out-2" + "consumer-out-0", + "consumer-out-1", + "consumer-out-2" ], "keySerializer": "some.key.serailizer", "valueSerializer": "some.value.serailizer", "keyDeserializer": "some.key.deserailizer", "valueDeserializer": "some.value.deserailizer" + } + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" } + } }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - } - } - }, - "eventInputParameters": { - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + "eventInputParameters": { + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } } + } } - } -} + } + ] + } +} \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsBadPeers.json b/services/services-engine/src/test/resources/parameters/syncBadParamsBadPeers.json index 355531417..06cfd1f5c 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsBadPeers.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsBadPeers.json @@ -1,72 +1,89 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer1" - }, - "SyncProducer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer1" + }, + "SyncProducer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer1" - }, - "SyncConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer1" + }, + "SyncConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + } + } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsBadTimeout.json b/services/services-engine/src/test/resources/parameters/syncBadParamsBadTimeout.json index 7a04a439a..d2e93d2d4 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsBadTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsBadTimeout.json @@ -1,65 +1,80 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": "src/test/resources/policymodels/SmallModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "FirstProducer": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MyOtherProducer": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } + }, + "MyOtherProducer": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "synchronousTimeout": 12345 + } }, - "synchronousTimeout": 12345 - } - }, - "eventInputParameters": { - "TheFileConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "TheFileConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - } - }, - "MySuperDooperConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "MySuperDooperConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + } + } } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsInvalidTimeout.json b/services/services-engine/src/test/resources/parameters/syncBadParamsInvalidTimeout.json index 6a4270b27..3f95bd912 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsInvalidTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsInvalidTimeout.json @@ -1,76 +1,93 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousTimeout": -10, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousTimeout": -3, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousTimeout": -10, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousTimeout": -3, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "synchronousTimeout": -1, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "synchronousTimeout": -1, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousTimeout": -99999999 + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousTimeout": -99999999 + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json b/services/services-engine/src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json index 8c6910a13..de8df54f4 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json @@ -1,71 +1,88 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0" - }, - "SyncConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer1" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0" + }, + "SyncConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer1" + } + } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json b/services/services-engine/src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json index e1ed8316a..c8544a680 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json @@ -1,72 +1,89 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } + } }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousMode": false, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": false, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0" - }, - "SyncConsumer1": { - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer1" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0" + }, + "SyncConsumer1": { + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer1" + } + } + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncBadParamsUnpairedTimeout.json b/services/services-engine/src/test/resources/parameters/syncBadParamsUnpairedTimeout.json index 9e24926b9..20ff05fed 100644 --- a/services/services-engine/src/test/resources/parameters/syncBadParamsUnpairedTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncBadParamsUnpairedTimeout.json @@ -1,76 +1,93 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousTimeout": 10, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousTimeout": 3, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousTimeout": 10, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousTimeout": 3, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "synchronousTimeout": 1, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "synchronousTimeout": 1, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousTimeout": 99999999 + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousTimeout": 99999999 + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncGoodParams.json b/services/services-engine/src/test/resources/parameters/syncGoodParams.json index 2a29254de..4b134cc04 100644 --- a/services/services-engine/src/test/resources/parameters/syncGoodParams.json +++ b/services/services-engine/src/test/resources/parameters/syncGoodParams.json @@ -1,72 +1,89 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncGoodParamsBothTimeout.json b/services/services-engine/src/test/resources/parameters/syncGoodParamsBothTimeout.json index 1988b76bd..4d2ad3205 100644 --- a/services/services-engine/src/test/resources/parameters/syncGoodParamsBothTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncGoodParamsBothTimeout.json @@ -1,76 +1,93 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "synchronousTimeout": 12345, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousTimeout": 1, - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "synchronousTimeout": 12345, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousTimeout": 1, + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousTimeout": 12345, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousTimeout": 12345, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "synchronousTimeout": 1, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "synchronousTimeout": 1, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncGoodParamsConsumerTimeout.json b/services/services-engine/src/test/resources/parameters/syncGoodParamsConsumerTimeout.json index b294a22f7..cc0906ac1 100644 --- a/services/services-engine/src/test/resources/parameters/syncGoodParamsConsumerTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncGoodParamsConsumerTimeout.json @@ -1,74 +1,91 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousTimeout": 12345, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousTimeout": 12345, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "synchronousTimeout": 1, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "synchronousTimeout": 1, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncGoodParamsProducerTimeout.json b/services/services-engine/src/test/resources/parameters/syncGoodParamsProducerTimeout.json index 824f0f6c2..6d117f7f2 100644 --- a/services/services-engine/src/test/resources/parameters/syncGoodParamsProducerTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncGoodParamsProducerTimeout.json @@ -1,74 +1,91 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "synchronousTimeout": 12345, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "synchronousTimeout": 12345, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1", - "synchronousTimeout": 1 - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1", + "synchronousTimeout": 1 + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncMismatchedPeers.json b/services/services-engine/src/test/resources/parameters/syncMismatchedPeers.json index 4ca73fc74..152506a1e 100644 --- a/services/services-engine/src/test/resources/parameters/syncMismatchedPeers.json +++ b/services/services-engine/src/test/resources/parameters/syncMismatchedPeers.json @@ -1,72 +1,89 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer1" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer0" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer1" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer0" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncMismatchedTimeout.json b/services/services-engine/src/test/resources/parameters/syncMismatchedTimeout.json index e4f9ea335..c7a784cf6 100644 --- a/services/services-engine/src/test/resources/parameters/syncMismatchedTimeout.json +++ b/services/services-engine/src/test/resources/parameters/syncMismatchedTimeout.json @@ -1,74 +1,91 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1", - "synchronousTimeout" : 456 - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1", + "synchronousTimeout": 456 + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true, + "synchronousTimeout": 123 + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true, - "synchronousTimeout" : 123 + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncUnusedConsumerPeers.json b/services/services-engine/src/test/resources/parameters/syncUnusedConsumerPeers.json index 3f2c8c555..bcc6245fc 100644 --- a/services/services-engine/src/test/resources/parameters/syncUnusedConsumerPeers.json +++ b/services/services-engine/src/test/resources/parameters/syncUnusedConsumerPeers.json @@ -1,72 +1,87 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": "src/test/resources/policymodels/SmallModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer0" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer0" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer0", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer0", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-engine/src/test/resources/parameters/syncUnusedProducerPeers.json b/services/services-engine/src/test/resources/parameters/syncUnusedProducerPeers.json index c377ea6fc..001205a1f 100644 --- a/services/services-engine/src/test/resources/parameters/syncUnusedProducerPeers.json +++ b/services/services-engine/src/test/resources/parameters/syncUnusedProducerPeers.json @@ -1,72 +1,89 @@ { - "engineServiceParameters": { - "name": "MyApexEngine", - "version": "0.0.1", - "id": 45, - "instanceCount": 19, - "deploymentPort": 65522, - "policyModelFileName": "src/test/resources/policymodels/SmallModel.json", - "engineParameters": { - "executorParameters": { - "JAVASCRIPT": { + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "onap.policies.apex.Simplecontrolloop": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "onap.policies.apex.Simplecontrolloop", + "version": "1.0.0", + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 19, + "deploymentPort": 65522, + "policy_type_impl": { + "apexPolicyModel": {} + }, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperExecutorParameters" + } } - } - } - }, - "eventOutputParameters": { - "SyncProducer0": { - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { - "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncConsumer0" - }, - "SyncProducer1": { - "synchronousMode": true, - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventOutputParameters": { + "SyncProducer0": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/aaa.json" - } - }, - "eventProtocolParameters": { - "eventProtocol": "JSON" - }, - "synchronousPeer": "SyncConsumer1" - } - }, - "eventInputParameters": { - "SyncConsumer0": { - "eventProtocolParameters": { - "eventProtocol": "JSON" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncConsumer0" + }, + "SyncProducer1": { + "synchronousMode": true, + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "target/aaa.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousPeer": "SyncConsumer1" + } }, - "synchronousMode": true, - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "FILE", - "parameters": { + "eventInputParameters": { + "SyncConsumer0": { + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "synchronousMode": true, + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { "fileName": "target/bbb.json" + } } + }, + "SyncConsumer1": { + "synchronousPeer": "SyncProducer1", + "carrierTechnologyParameters": { + "carrierTechnology": "SUPER_DOOPER", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "SUPER_TOK_DEL", + "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" + }, + "synchronousMode": true + } } - }, - "SyncConsumer1": { - "synchronousPeer": "SyncProducer1", - "carrierTechnologyParameters": { - "carrierTechnology": "SUPER_DOOPER", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperCarrierTechnologyParameters" - }, - "eventProtocolParameters": { - "eventProtocol": "SUPER_TOK_DEL", - "parameterClassName": "org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperTokenDelimitedEventProtocolParameters" - }, - "synchronousMode": true + } } - } + } + ] + } } \ No newline at end of file diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java index 699ec4584..f90938013 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. 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. @@ -20,16 +21,12 @@ package org.onap.policy.apex.services.onappf.handler; -import com.google.gson.JsonObject; +import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel; import org.onap.policy.apex.service.engine.main.ApexMain; @@ -38,6 +35,8 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +46,6 @@ import org.slf4j.LoggerFactory; * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ public class ApexEngineHandler { - private static final String POLICY_TYPE_IMPL = "policy_type_impl"; private static final Logger LOGGER = LoggerFactory.getLogger(ApexEngineHandler.class); @@ -91,51 +89,25 @@ public class ApexEngineHandler { throws ApexStarterException { Map policyArgsMap = new LinkedHashMap<>(); for (ToscaPolicy policy : policies) { + String policyName = policy.getIdentifier().getName(); final StandardCoder standardCoder = new StandardCoder(); - String policyModel = ""; - String apexConfig; - JsonObject apexConfigJsonObject = new JsonObject(); + ToscaServiceTemplate toscaServiceTemplate = new ToscaServiceTemplate(); + ToscaTopologyTemplate toscaTopologyTemplate = new ToscaTopologyTemplate(); + toscaTopologyTemplate.setPolicies(List.of(Map.of(policyName, policy))); + toscaServiceTemplate.setToscaTopologyTemplate(toscaTopologyTemplate); + File file; try { - for (Entry property : policy.getProperties().entrySet()) { - JsonObject body = standardCoder.decode(standardCoder.encode(property.getValue()), JsonObject.class); - if ("engineServiceParameters".equals(property.getKey())) { - policyModel = standardCoder.encode(body.get(POLICY_TYPE_IMPL)); - body.remove(POLICY_TYPE_IMPL); - } - apexConfigJsonObject.add(property.getKey(), body); - } - apexConfig = standardCoder.encode(apexConfigJsonObject); - } catch (CoderException e) { + file = File.createTempFile(policyName, ".json"); + standardCoder.encode(file, toscaServiceTemplate); + } catch (CoderException | IOException e) { throw new ApexStarterException(e); } - - final String modelFilePath = createFile(policyModel, "modelFile"); - - final String apexConfigFilePath = createFile(apexConfig, "apexConfigFile"); - final String[] apexArgs = { "-c", apexConfigFilePath, "-m", modelFilePath }; + final String[] apexArgs = {"-p", file.getAbsolutePath()}; policyArgsMap.put(policy.getIdentifier(), apexArgs); } return policyArgsMap; } - /** - * Method to create the policy model file. - * - * @param fileContent the content of the file - * @param fileName the name of the file - * @throws ApexStarterException if the file creation failed - */ - private String createFile(final String fileContent, final String fileName) throws ApexStarterException { - try { - final Path path = Files.createTempFile(fileName, ".json"); - Files.write(path, fileContent.getBytes(StandardCharsets.UTF_8)); - return path.toAbsolutePath().toString(); - } catch (final IOException e) { - final String errorMessage = "error creating from the properties received in PdpUpdate."; - throw new ApexStarterException(errorMessage, e); - } - } - /** * Method to get the APEX engine statistics. */ diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java index 17f909fcc..1d491ea03 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019 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"); * you may not use this file except in compliance with the License. @@ -156,7 +157,7 @@ public class TestPdpStateChangeListener { assertTrue(outContent.toString().contains("State changed to active. No policies found.")); final ToscaPolicy toscaPolicy = - TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json"); + TestListenerUtils.createToscaPolicy("apex_policy_name", "1.0", "src/test/resources/dummyProperties.json"); final List toscaPolicies = new ArrayList(); toscaPolicies.add(toscaPolicy); final PdpUpdate pdpUpdateMsg = TestListenerUtils.createPdpUpdateMsg(pdpStatus, toscaPolicies); @@ -179,7 +180,7 @@ public class TestPdpStateChangeListener { public void testPdpStateChangeMessageListener_activetopassive() throws InterruptedException, CoderException { final PdpStatus pdpStatus = Registry.get(ApexStarterConstants.REG_PDP_STATUS_OBJECT); final ToscaPolicy toscaPolicy = - TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json"); + TestListenerUtils.createToscaPolicy("apex_policy_name", "1.0", "src/test/resources/dummyProperties.json"); final List toscaPolicies = new ArrayList(); toscaPolicies.add(toscaPolicy); final PdpUpdate pdpUpdateMsg = TestListenerUtils.createPdpUpdateMsg(pdpStatus, toscaPolicies); diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java index 05656af96..d9b8fc09c 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2019 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"); * you may not use this file except in compliance with the License. @@ -142,7 +143,7 @@ public class TestPdpUpdateListener { TestListenerUtils.createPdpStateChangeMsg(PdpState.ACTIVE, "pdpGroup", "pdpSubgroup", pdpStatus.getName()); pdpStateChangeListener.onTopicEvent(INFRA, TOPIC, null, pdpStateChangeMsg); final ToscaPolicy toscaPolicy = - TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json"); + TestListenerUtils.createToscaPolicy("apex_policy_name", "1.0", "src/test/resources/dummyProperties.json"); final List toscaPolicies = new ArrayList(); toscaPolicies.add(toscaPolicy); final PdpUpdate pdpUpdateMsg = TestListenerUtils.createPdpUpdateMsg(pdpStatus, toscaPolicies); @@ -164,7 +165,7 @@ public class TestPdpUpdateListener { TestListenerUtils.createPdpStateChangeMsg(PdpState.ACTIVE, "pdpGroup", "pdpSubgroup", pdpStatus.getName()); pdpStateChangeListener.onTopicEvent(INFRA, TOPIC, null, pdpStateChangeMsg); final ToscaPolicy toscaPolicy = - TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json"); + TestListenerUtils.createToscaPolicy("apex_policy_name", "1.0", "src/test/resources/dummyProperties.json"); final List toscaPolicies = new ArrayList(); toscaPolicies.add(toscaPolicy); final PdpUpdate pdpUpdateMsg = TestListenerUtils.createPdpUpdateMsg(pdpStatus, toscaPolicies); @@ -185,7 +186,7 @@ public class TestPdpUpdateListener { System.setOut(new PrintStream(outContent)); final PdpStatus pdpStatus = Registry.get(ApexStarterConstants.REG_PDP_STATUS_OBJECT); final ToscaPolicy toscaPolicy = - TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json"); + TestListenerUtils.createToscaPolicy("apex_policy_name", "1.0", "src/test/resources/dummyProperties.json"); final ToscaPolicy toscaPolicy2 = TestListenerUtils.createToscaPolicy("apexpolicy2", "1.0", "src/test/resources/dummyProperties.json"); final List toscaPolicies = new ArrayList(); @@ -198,7 +199,7 @@ public class TestPdpUpdateListener { pdpStateChangeListener.onTopicEvent(INFRA, TOPIC, null, pdpStateChangeMsg); final String outString = outContent.toString(); assertTrue(outString.contains( - "Apex engine started. But, only the following polices are running - apex policy name:1.0 . " + "Apex engine started. But, only the following polices are running - apex_policy_name:1.0 . " + "Other policies failed execution. Please see the logs for more details.")); } } -- cgit 1.2.3-korg