diff options
Diffstat (limited to 'services/services-engine/src')
8 files changed, 1330 insertions, 1206 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java index f69eae664..ebb1cdf2d 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -449,7 +449,6 @@ final class EngineWorker implements EngineService { try { final var baOutputStream = new ByteArrayOutputStream(); final ApexModelWriter<AxEngineModel> modelWriter = new ApexModelWriter<>(AxEngineModel.class); - modelWriter.setJsonOutput(true); modelWriter.write(apexEngineModel, baOutputStream); return baOutputStream.toString(); } catch (final Exception e) { 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 cc19080f9..2e97c54fc 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 @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2021 Nordix Foundation. + * Modifications Copyright (C) 2019-2022 Nordix Foundation. * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -41,6 +41,7 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParame import org.onap.policy.common.parameters.ParameterException; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.parameters.ValidationResult; +import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.ext.XLogger; @@ -61,6 +62,8 @@ public class ApexParameterHandler { private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexParameterHandler.class); private static final String POLICY_TYPE_IMPL = "policy_type_impl"; + private static final String APEX_POLICY_MODEL = "apexPolicyModel"; + private String policyModel; private String apexConfig; @@ -81,13 +84,13 @@ public class ApexParameterHandler { // Register the adapters for our carrier technologies and event protocols with GSON // @formatter:off final var gson = new GsonBuilder() - .registerTypeAdapter(EngineParameters.class, - new EngineServiceParametersJsonAdapter()) - .registerTypeAdapter(CarrierTechnologyParameters.class, - new CarrierTechnologyParametersJsonAdapter()) - .registerTypeAdapter(EventProtocolParameters.class, - new EventProtocolParametersJsonAdapter()) - .create(); + .registerTypeAdapter(EngineParameters.class, + new EngineServiceParametersJsonAdapter()) + .registerTypeAdapter(CarrierTechnologyParameters.class, + new CarrierTechnologyParametersJsonAdapter()) + .registerTypeAdapter(EventProtocolParameters.class, + new EventProtocolParametersJsonAdapter()) + .create(); // @formatter:on parameters = gson.fromJson(apexConfig, ApexParameters.class); } catch (final Exception e) { @@ -135,13 +138,13 @@ public class ApexParameterHandler { ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters()); ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters()); ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getSchemaParameters()); + .getSchemaParameters()); ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getDistributorParameters()); + .getDistributorParameters()); ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getLockManagerParameters()); + .getLockManagerParameters()); ParameterService.register(parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters()); + .getPersistorParameters()); } private void parseConfigAndModel(final String toscaPolicyFilePath) throws ApexException { @@ -162,11 +165,7 @@ public class ApexParameterHandler { || 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); + policyModel = extractPolicyModel(standardCoder, body); } } apexConfigJsonObject.add(property.getKey(), body); @@ -176,4 +175,29 @@ public class ApexParameterHandler { throw new ApexException("Parsing config and model from the tosca policy failed.", e); } } + + private String extractPolicyModel(StandardCoder standardCoder, JsonElement body) throws CoderException { + // Check for "policy_type_impl" + JsonElement policyTypeImplObject = ((JsonObject) body).get(POLICY_TYPE_IMPL); + if (null == policyTypeImplObject) { + return null; + } + + // "policy_type_impl" found + if (policyTypeImplObject instanceof JsonObject) { + + // Check for "apexPolicyModel", this is used to encapsulate policy models sometimes + JsonElement policyModelObject = ((JsonObject) policyTypeImplObject).get(APEX_POLICY_MODEL); + + if (policyModelObject != null) { + // Policy model encased in an "apexPolicyModel" object + return standardCoder.encode(policyModelObject); + } else { + // No encasement + return standardCoder.encode(policyTypeImplObject); + } + } else { + return policyTypeImplObject.getAsString(); + } + } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java index c58cb085d..e2149efa5 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ public class JsonEventHandlerForPojoTest { final String policyModelString = TextFileUtils.getTextFileAsString("src/test/resources/policymodels/PojoEventModel.json"); final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<AxPolicyModel>(AxPolicyModel.class); - modelReader.setValidateFlag(false); + modelReader.setValidate(false); final AxPolicyModel apexPolicyModel = modelReader.read(new ByteArrayInputStream(policyModelString.getBytes())); // Set up the models in the model service 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 0095c9630..a903a885e 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 @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -199,7 +199,7 @@ public class EngineServiceImplTest { .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\" :")); + assertTrue(status.contains("\"timestamp\":")); assertFalse(esImpl.isStarted()); assertFalse(esImpl.isStarted(null)); @@ -334,7 +334,7 @@ public class EngineServiceImplTest { assertEquals(AxEngineState.EXECUTING, esImpl.getState()); String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next()); - assertTrue(status.contains("\n \"apexEngineModel\" :")); + assertTrue(status.contains("\"timestamp\":")); assertTrue(esImpl.isStarted()); assertTrue(esImpl.isStarted(esImpl.getEngineKeys().iterator().next())); assertFalse(esImpl.isStopped()); @@ -421,4 +421,4 @@ public class EngineServiceImplTest { fail("test should not throw an exception"); } } -}
\ No newline at end of file +} diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java index c95b465cf..b904fb1d4 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * Modifications Copyright (C) 2021-2022 Bell Canada Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -219,7 +219,7 @@ public class EngineWorkerTest { assertEquals(AxEngineState.STOPPED, worker.getState()); String status = worker.getStatus(worker.getEngineKeys().iterator().next()); - assertEquals("{\"apexEngineModel\":{\"key\":", status.replaceAll("\\s+", "").substring(0, 26)); + assertEquals("{\"TimeStamp\":", runtimeInfo.replaceAll("\\s+", "").substring(0, 13)); assertFalse(worker.isStarted()); assertFalse(worker.isStarted(null)); @@ -380,7 +380,7 @@ public class EngineWorkerTest { assertEquals(AxEngineState.READY, worker.getState()); String status = worker.getStatus(worker.getEngineKeys().iterator().next()); - assertEquals("{\"apexEngineModel\":{\"key\":", status.replaceAll("\\s+", "").substring(0, 26)); + assertEquals("{\"timestamp\":", status.replaceAll("\\s+", "").substring(0, 13)); assertTrue(worker.isStarted()); assertTrue(worker.isStarted(worker.getEngineKeys().iterator().next())); @@ -457,4 +457,4 @@ public class EngineWorkerTest { assertEquals(policyCounter.getPolicyExecutedCount(), policyCounter.getPolicyExecutedFailCount() + policyCounter.getPolicyExecutedSuccessCount()); } -}
\ No newline at end of file +} diff --git a/services/services-engine/src/test/resources/policymodels/PojoEventModel.json b/services/services-engine/src/test/resources/policymodels/PojoEventModel.json index 59ff76ebb..5a7490f75 100644 --- a/services/services-engine/src/test/resources/policymodels/PojoEventModel.json +++ b/services/services-engine/src/test/resources/policymodels/PojoEventModel.json @@ -1,365 +1,392 @@ { - "apexPolicyModel" : { - "key" : { - "name" : "PojoEventModel", - "version" : "0.0.1" - }, - "keyInformation" : { - "key" : { - "name" : "PojoEventModel_KeyInfo", - "version" : "0.0.1" - }, - "keyInfoMap" : { - "entry" : [ { - "key" : { - "name" : "PojoEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEvent", - "version" : "0.0.1" - }, - "UUID" : "60411084-d846-3681-9ba7-093bacfd78d2", - "description" : "Generated description for concept referred to by key \"PojoEvent:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel", - "version" : "0.0.1" - }, - "UUID" : "1a77f36c-7dd2-3188-91d1-5839114f3a3f", - "description" : "Generated description for concept referred to by key \"PojoEventModel:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_Albums", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_Albums", - "version" : "0.0.1" - }, - "UUID" : "b8fe7c9c-2445-3cb0-a671-da2d380e418a", - "description" : "Generated description for concept referred to by key \"PojoEventModel_Albums:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_Events", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_Events", - "version" : "0.0.1" - }, - "UUID" : "fb9f68f9-f5b7-361a-8b8e-df1fe987084e", - "description" : "Generated description for concept referred to by key \"PojoEventModel_Events:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_KeyInfo", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_KeyInfo", - "version" : "0.0.1" - }, - "UUID" : "2156f4d7-cfb2-3e15-ab78-4aced50730bf", - "description" : "Generated description for concept referred to by key \"PojoEventModel_KeyInfo:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_Policies", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_Policies", - "version" : "0.0.1" - }, - "UUID" : "45fd6cff-59de-3511-8398-8a88ad01cd1a", - "description" : "Generated description for concept referred to by key \"PojoEventModel_Policies:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_Schemas", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_Schemas", - "version" : "0.0.1" - }, - "UUID" : "9081b534-62db-384a-b7cc-4e5fc1d781b3", - "description" : "Generated description for concept referred to by key \"PojoEventModel_Schemas:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoEventModel_Tasks", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEventModel_Tasks", - "version" : "0.0.1" - }, - "UUID" : "1e917c60-b5e5-3849-83ca-27d795a633a9", - "description" : "Generated description for concept referred to by key \"PojoEventModel_Tasks:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoListEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoListEvent", - "version" : "0.0.1" - }, - "UUID" : "d9627e71-18ac-38d7-b033-33a704132afc", - "description" : "Generated description for concept referred to by key \"PojoListEvent:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoNoFieldEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoNoFieldEvent", - "version" : "0.0.1" - }, - "UUID" : "d42ab6d1-9b39-3d94-9a65-d47c116a478f", - "description" : "Generated description for concept referred to by key \"PojoNoFieldEvent:0.0.1\"" - } - }, { - "key" : { - "name" : "PojoTooManyFieldsEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoTooManyFieldsEvent", - "version" : "0.0.1" - }, - "UUID" : "1d33d978-297f-3253-b9c6-f0bc9dc63e24", - "description" : "Generated description for concept referred to by key \"PojoTooManyFieldsEvent:0.0.1\"" - } - }, { - "key" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "UUID" : "ad74efe5-833f-30e5-837c-0d9ae607e4a2", - "description" : "Generated description for concept referred to by key \"TestPojoListType:0.0.1\"" - } - }, { - "key" : { - "name" : "TestPojoType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "TestPojoType", - "version" : "0.0.1" - }, - "UUID" : "254c248e-f172-3871-83aa-4de45f01b6c7", - "description" : "Generated description for concept referred to by key \"TestPojoType:0.0.1\"" - } - } ] - } - }, - "policies" : { - "key" : { - "name" : "PojoEventModel_Policies", - "version" : "0.0.1" - }, - "policyMap" : { - "entry" : [ ] - } - }, - "tasks" : { - "key" : { - "name" : "PojoEventModel_Tasks", - "version" : "0.0.1" - }, - "taskMap" : { - "entry" : [ ] - } - }, - "events" : { - "key" : { - "name" : "PojoEventModel_Events", - "version" : "0.0.1" - }, - "eventMap" : { - "entry" : [ { - "key" : { - "name" : "PojoEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoEvent", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.service.engine.event.testpojos", - "source" : "Outside", - "target" : "Apex", - "parameter" : { - "entry" : [ { - "key" : "POJO_PAR", - "value" : { - "key" : "POJO_PAR", - "fieldSchemaKey" : { - "name" : "TestPojoType", - "version" : "0.0.1" - }, - "optional" : false - } - } ] + "key": { + "name": "PojoEventModel", + "version": "0.0.1" + }, + "keyInformation": { + "key": { + "name": "PojoEventModel_KeyInfo", + "version": "0.0.1" + }, + "keyInfoMap": { + "entry": [ + { + "key": { + "name": "PojoEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEvent", + "version": "0.0.1" + }, + "UUID": "60411084-d846-3681-9ba7-093bacfd78d2", + "description": "Generated description for concept referred to by key \"PojoEvent:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel", + "version": "0.0.1" + }, + "UUID": "1a77f36c-7dd2-3188-91d1-5839114f3a3f", + "description": "Generated description for concept referred to by key \"PojoEventModel:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_Albums", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_Albums", + "version": "0.0.1" + }, + "UUID": "b8fe7c9c-2445-3cb0-a671-da2d380e418a", + "description": "Generated description for concept referred to by key \"PojoEventModel_Albums:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_Events", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_Events", + "version": "0.0.1" + }, + "UUID": "fb9f68f9-f5b7-361a-8b8e-df1fe987084e", + "description": "Generated description for concept referred to by key \"PojoEventModel_Events:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_KeyInfo", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_KeyInfo", + "version": "0.0.1" + }, + "UUID": "2156f4d7-cfb2-3e15-ab78-4aced50730bf", + "description": "Generated description for concept referred to by key \"PojoEventModel_KeyInfo:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_Policies", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_Policies", + "version": "0.0.1" + }, + "UUID": "45fd6cff-59de-3511-8398-8a88ad01cd1a", + "description": "Generated description for concept referred to by key \"PojoEventModel_Policies:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_Schemas", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_Schemas", + "version": "0.0.1" + }, + "UUID": "9081b534-62db-384a-b7cc-4e5fc1d781b3", + "description": "Generated description for concept referred to by key \"PojoEventModel_Schemas:0.0.1\"" + } + }, + { + "key": { + "name": "PojoEventModel_Tasks", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEventModel_Tasks", + "version": "0.0.1" + }, + "UUID": "1e917c60-b5e5-3849-83ca-27d795a633a9", + "description": "Generated description for concept referred to by key \"PojoEventModel_Tasks:0.0.1\"" + } + }, + { + "key": { + "name": "PojoListEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoListEvent", + "version": "0.0.1" + }, + "UUID": "d9627e71-18ac-38d7-b033-33a704132afc", + "description": "Generated description for concept referred to by key \"PojoListEvent:0.0.1\"" + } + }, + { + "key": { + "name": "PojoNoFieldEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoNoFieldEvent", + "version": "0.0.1" + }, + "UUID": "d42ab6d1-9b39-3d94-9a65-d47c116a478f", + "description": "Generated description for concept referred to by key \"PojoNoFieldEvent:0.0.1\"" + } + }, + { + "key": { + "name": "PojoTooManyFieldsEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoTooManyFieldsEvent", + "version": "0.0.1" + }, + "UUID": "1d33d978-297f-3253-b9c6-f0bc9dc63e24", + "description": "Generated description for concept referred to by key \"PojoTooManyFieldsEvent:0.0.1\"" + } + }, + { + "key": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "UUID": "ad74efe5-833f-30e5-837c-0d9ae607e4a2", + "description": "Generated description for concept referred to by key \"TestPojoListType:0.0.1\"" + } + }, + { + "key": { + "name": "TestPojoType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "TestPojoType", + "version": "0.0.1" + }, + "UUID": "254c248e-f172-3871-83aa-4de45f01b6c7", + "description": "Generated description for concept referred to by key \"TestPojoType:0.0.1\"" + } + } + ] + } + }, + "policies": { + "key": { + "name": "PojoEventModel_Policies", + "version": "0.0.1" + }, + "policyMap": { + "entry": [] + } + }, + "tasks": { + "key": { + "name": "PojoEventModel_Tasks", + "version": "0.0.1" + }, + "taskMap": { + "entry": [] + } + }, + "events": { + "key": { + "name": "PojoEventModel_Events", + "version": "0.0.1" + }, + "eventMap": { + "entry": [ + { + "key": { + "name": "PojoEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.service.engine.event.testpojos", + "source": "Outside", + "target": "Apex", + "parameter": { + "entry": [ + { + "key": "POJO_PAR", + "value": { + "key": "POJO_PAR", + "fieldSchemaKey": { + "name": "TestPojoType", + "version": "0.0.1" + }, + "optional": false } - } - }, { - "key" : { - "name" : "PojoListEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoListEvent", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.service.engine.event.testpojos", - "source" : "Outside", - "target" : "Apex", - "parameter" : { - "entry" : [ { - "key" : "POJO_LIST_PAR", - "value" : { - "key" : "POJO_LIST_PAR", - "fieldSchemaKey" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "optional" : false - } - } ] + } + ] + } + } + }, + { + "key": { + "name": "PojoListEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoListEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.service.engine.event.testpojos", + "source": "Outside", + "target": "Apex", + "parameter": { + "entry": [ + { + "key": "POJO_LIST_PAR", + "value": { + "key": "POJO_LIST_PAR", + "fieldSchemaKey": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "optional": false } - } - }, { - "key" : { - "name" : "PojoNoFieldEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoNoFieldEvent", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.service.engine.event.testpojos", - "source" : "Outside", - "target" : "Apex", - "parameter" : { - "entry" : [ ] + } + ] + } + } + }, + { + "key": { + "name": "PojoNoFieldEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoNoFieldEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.service.engine.event.testpojos", + "source": "Outside", + "target": "Apex", + "parameter": { + "entry": [] + } + } + }, + { + "key": { + "name": "PojoTooManyFieldsEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PojoTooManyFieldsEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.service.engine.event.testpojos", + "source": "Outside", + "target": "Apex", + "parameter": { + "entry": [ + { + "key": "POJO_LIST_PAR0", + "value": { + "key": "POJO_LIST_PAR0", + "fieldSchemaKey": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "optional": false } - } - }, { - "key" : { - "name" : "PojoTooManyFieldsEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PojoTooManyFieldsEvent", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.service.engine.event.testpojos", - "source" : "Outside", - "target" : "Apex", - "parameter" : { - "entry" : [ { - "key" : "POJO_LIST_PAR0", - "value" : { - "key" : "POJO_LIST_PAR0", - "fieldSchemaKey" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "optional" : false - } - }, { - "key" : "POJO_LIST_PAR1", - "value" : { - "key" : "POJO_LIST_PAR1", - "fieldSchemaKey" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "optional" : false - } - } ] + }, + { + "key": "POJO_LIST_PAR1", + "value": { + "key": "POJO_LIST_PAR1", + "fieldSchemaKey": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "optional": false } - } - } ] - } - }, - "albums" : { - "key" : { - "name" : "PojoEventModel_Albums", - "version" : "0.0.1" - }, - "albums" : { - "entry" : [ ] - } - }, - "schemas" : { - "key" : { - "name" : "PojoEventModel_Schemas", - "version" : "0.0.1" - }, - "schemas" : { - "entry" : [ { - "key" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "TestPojoListType", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "org.onap.policy.apex.service.engine.event.testpojos.DummyPojoList" - } - }, { - "key" : { - "name" : "TestPojoType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "TestPojoType", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "org.onap.policy.apex.service.engine.event.testpojos.DummyPojo" - } - } ] - } - } - } + } + ] + } + } + } + ] + } + }, + "albums": { + "key": { + "name": "PojoEventModel_Albums", + "version": "0.0.1" + }, + "albums": { + "entry": [] + } + }, + "schemas": { + "key": { + "name": "PojoEventModel_Schemas", + "version": "0.0.1" + }, + "schemas": { + "entry": [ + { + "key": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "TestPojoListType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.apex.service.engine.event.testpojos.DummyPojoList" + } + }, + { + "key": { + "name": "TestPojoType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "TestPojoType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.apex.service.engine.event.testpojos.DummyPojo" + } + } + ] + } + } } diff --git a/services/services-engine/src/test/resources/policymodels/SmallModel.json b/services/services-engine/src/test/resources/policymodels/SmallModel.json index 5c0628809..12c402d9a 100644 --- a/services/services-engine/src/test/resources/policymodels/SmallModel.json +++ b/services/services-engine/src/test/resources/policymodels/SmallModel.json @@ -1,416 +1,453 @@ { - "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" - } - } - } ] - } + "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" + } + } } - } ] - }, - "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 + ] + }, + "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" + } + } } - } ] - }, - "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 - } - } ] + } + ] + }, + "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 } - } - } ] - } - }, - "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" + } + ] + }, + "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 } - } - } ] - } - }, - "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" - } - } ] - } - } - } + } + ] + } + } + } + ] + } + }, + "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" + } + } + ] + } + } } diff --git a/services/services-engine/src/test/resources/policymodels/SmallModelDifferent.json b/services/services-engine/src/test/resources/policymodels/SmallModelDifferent.json index bbee7daa3..21ee7e3da 100644 --- a/services/services-engine/src/test/resources/policymodels/SmallModelDifferent.json +++ b/services/services-engine/src/test/resources/policymodels/SmallModelDifferent.json @@ -1,416 +1,453 @@ { - "apexPolicyModel" : { - "key" : { - "name" : "SmallModelDifferent", - "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" : "SmallModelDifferent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "SmallModelDifferent", - "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" - } - } - } ] - } + "key": { + "name": "SmallModelDifferent", + "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": "SmallModelDifferent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SmallModelDifferent", + "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" + } + } } - } ] - }, - "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 + ] + }, + "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" + } + } } - } ] - }, - "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 - } - } ] + } + ] + }, + "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 } - } - } ] - } - }, - "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" + } + ] + }, + "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 } - } - } ] - } - }, - "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" - } - } ] - } - } - } + } + ] + } + } + } + ] + } + }, + "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" + } + } + ] + } + } } |