2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.model.policymodel.handling;
25 import java.util.UUID;
26 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
27 import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
28 import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
29 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
30 import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
31 import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
32 import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
33 import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
34 import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
35 import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
36 import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
37 import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
38 import org.onap.policy.apex.model.eventmodel.concepts.AxField;
39 import org.onap.policy.apex.model.eventmodel.concepts.AxInputField;
40 import org.onap.policy.apex.model.eventmodel.concepts.AxOutputField;
41 import org.onap.policy.apex.model.policymodel.concepts.AxPolicies;
42 import org.onap.policy.apex.model.policymodel.concepts.AxPolicy;
43 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
44 import org.onap.policy.apex.model.policymodel.concepts.AxState;
45 import org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic;
46 import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
47 import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType;
48 import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference;
49 import org.onap.policy.apex.model.policymodel.concepts.AxTask;
50 import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic;
51 import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter;
52 import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic;
53 import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
56 * Model creator for model tests.
58 * @author Liam Fallon (liam.fallon@ericsson.com)
60 public class SupportApexPolicyModelCreator implements TestApexModelCreator<AxPolicyModel> {
63 public AxPolicyModel getModel() {
64 final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItem0", "0.0.1"), "Java",
66 final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItem1", "0.0.1"), "Java",
68 final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java",
69 "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000");
70 final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
71 "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A");
73 final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
74 schemas.getSchemasMap().put(schema0.getKey(), schema0);
75 schemas.getSchemasMap().put(schema1.getKey(), schema1);
76 schemas.getSchemasMap().put(schema2.getKey(), schema2);
77 schemas.getSchemasMap().put(schema3.getKey(), schema3);
79 final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION",
80 true, schema3.getKey());
81 final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false,
84 final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", "0.0.1"));
85 albums.getAlbumsMap().put(album0.getKey(), album0);
86 albums.getAlbumsMap().put(album1.getKey(), album1);
88 final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEvent", "0.0.1"),
89 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
90 inEvent.getParameterMap().put("IEPAR0",
91 new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR0"), schema0.getKey()));
92 inEvent.getParameterMap().put("IEPAR1",
93 new AxField(new AxReferenceKey(inEvent.getKey(), "IEPAR1"), schema1.getKey()));
95 final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEvent0", "0.0.1"),
96 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
97 outEvent0.getParameterMap().put("OE0PAR0",
98 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR0"), schema0.getKey()));
99 outEvent0.getParameterMap().put("OE0PAR1",
100 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PAR1"), schema1.getKey()));
101 outEvent0.getParameterMap().put("OE1PAR0",
102 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR0"), schema0.getKey()));
103 outEvent0.getParameterMap().put("OE1PAR1",
104 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PAR1"), schema1.getKey()));
106 final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEvent1", "0.0.1"),
107 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
108 outEvent1.getParameterMap().put("OE1PAR0",
109 new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR0"), schema0.getKey()));
110 outEvent1.getParameterMap().put("OE1PAR1",
111 new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PAR1"), schema1.getKey()));
113 final AxEvents events = new AxEvents(new AxArtifactKey("events", "0.0.1"));
114 events.getEventMap().put(inEvent.getKey(), inEvent);
115 events.getEventMap().put(outEvent0.getKey(), outEvent0);
116 events.getEventMap().put(outEvent1.getKey(), outEvent1);
118 final AxTask task = new AxTask(new AxArtifactKey("task", "0.0.1"));
120 for (final AxField field : inEvent.getFields()) {
121 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
122 "inputFields", field.getKey().getLocalName());
123 final AxInputField inputField = new AxInputField(fieldkey, field.getSchema());
124 task.getInputFields().put(inputField.getKey().getLocalName(), inputField);
127 for (final AxField field : outEvent0.getFields()) {
128 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
129 "outputFields", field.getKey().getLocalName());
130 final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema());
131 task.getOutputFields().put(outputField.getKey().getLocalName(), outputField);
134 for (final AxField field : outEvent1.getFields()) {
135 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
136 "outputFields", field.getKey().getLocalName());
137 final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema());
138 task.getOutputFields().put(outputField.getKey().getLocalName(), outputField);
141 task.setInputEvent(inEvent);
142 task.setOutputEvents(Map.of(outEvent0.getId(), outEvent0, outEvent1.getId(), outEvent1));
144 final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter0"),
145 "Task parameter 0 value");
146 final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameter1"),
147 "Task parameter 1 value");
149 task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0);
150 task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1);
151 task.getContextAlbumReferences().add(album0.getKey());
152 task.getContextAlbumReferences().add(album1.getKey());
154 final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogic"), "MVEL",
156 task.setTaskLogic(taskLogic);
158 final AxTasks tasks = new AxTasks(new AxArtifactKey("tasks", "0.0.1"));
159 tasks.getTaskMap().put(task.getKey(), task);
161 final AxPolicy policy = new AxPolicy(new AxArtifactKey("policy", "0.0.1"));
162 policy.setTemplate("FREEFORM");
164 final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "state"));
165 final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic(
166 new AxReferenceKey(state.getKey(), "taskSelectionLogic"), "MVEL", "Some TS logic ");
168 state.setTrigger(inEvent.getKey());
169 state.getContextAlbumReferences().add(album0.getKey());
170 state.getContextAlbumReferences().add(album1.getKey());
171 state.setTaskSelectionLogic(taskSelectionLogic);
172 state.setDefaultTask(task.getKey());
174 final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutput0"),
175 outEvent0.getKey(), AxReferenceKey.getNullKey());
176 state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0);
178 final AxStateTaskReference stateTaskReference = new AxStateTaskReference(
179 new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT,
180 stateOutput0.getKey());
182 state.getTaskReferences().put(task.getKey(), stateTaskReference);
184 policy.getStateMap().put(state.getKey().getLocalName(), state);
185 policy.setFirstState(state.getKey().getLocalName());
187 final AxPolicies policies = new AxPolicies(new AxArtifactKey("policies", "0.0.1"));
188 policies.getPolicyMap().put(policy.getKey(), policy);
190 final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
191 final AxPolicyModel policyModel = new AxPolicyModel(new AxArtifactKey("PolicyModel", "0.0.1"));
192 policyModel.setKeyInformation(keyInformation);
193 policyModel.setSchemas(schemas);
194 policyModel.setAlbums(albums);
195 policyModel.setEvents(events);
196 policyModel.setTasks(tasks);
197 policyModel.setPolicies(policies);
198 policyModel.getKeyInformation().generateKeyInfo(policyModel);
200 int uuidIncrementer = 0;
201 for (final AxKeyInfo keyInfo : policyModel.getKeyInformation().getKeyInfoMap().values()) {
202 final String uuidString = String.format("ce9168c-e6df-414f-9646-6da464b6e%03d", uuidIncrementer++);
203 keyInfo.setUuid(UUID.fromString(uuidString));
206 final AxValidationResult result = new AxValidationResult();
207 policyModel.validate(result);
213 * Gets another policy model.
217 public AxPolicyModel getAnotherModel() {
218 final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("eventContextItemA0", "0.0.1"), "Java",
220 final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("eventContextItemA1", "0.0.1"), "Java",
222 final AxContextSchema schema2 = new AxContextSchema(new AxArtifactKey("StringTypeA", "0.0.1"), "Java",
223 "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000");
224 final AxContextSchema schema3 = new AxContextSchema(new AxArtifactKey("MapTypeA", "0.0.1"), "Java",
225 "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A");
227 final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("ContextSchemasA", "0.0.1"));
228 schemas.getSchemasMap().put(schema0.getKey(), schema0);
229 schemas.getSchemasMap().put(schema1.getKey(), schema1);
230 schemas.getSchemasMap().put(schema2.getKey(), schema2);
231 schemas.getSchemasMap().put(schema3.getKey(), schema3);
233 final AxContextAlbum album0 = new AxContextAlbum(new AxArtifactKey("contextAlbumA0", "0.0.1"), "APPLICATION",
234 true, schema3.getKey());
235 final AxContextAlbum album1 = new AxContextAlbum(new AxArtifactKey("contextAlbumA1", "0.0.1"), "GLOBAL", false,
238 final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("contextA", "0.0.1"));
239 albums.getAlbumsMap().put(album0.getKey(), album0);
240 albums.getAlbumsMap().put(album1.getKey(), album1);
242 final AxEvent inEvent = new AxEvent(new AxArtifactKey("inEventA", "0.0.1"),
243 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
244 inEvent.getParameterMap().put("IEPARA0",
245 new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA0"), schema0.getKey()));
246 inEvent.getParameterMap().put("IEPARA1",
247 new AxField(new AxReferenceKey(inEvent.getKey(), "IEPARA1"), schema1.getKey()));
249 final AxEvent outEvent0 = new AxEvent(new AxArtifactKey("outEventA0", "0.0.1"),
250 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
251 outEvent0.getParameterMap().put("OE0PARA0",
252 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA0"), schema0.getKey()));
253 outEvent0.getParameterMap().put("OE0PARA1",
254 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE0PARA1"), schema1.getKey()));
255 outEvent0.getParameterMap().put("OE1PARA0",
256 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA0"), schema0.getKey()));
257 outEvent0.getParameterMap().put("OE1PARA1",
258 new AxField(new AxReferenceKey(outEvent0.getKey(), "OE1PARA1"), schema1.getKey()));
260 final AxEvent outEvent1 = new AxEvent(new AxArtifactKey("outEventA1", "0.0.1"),
261 "org.onap.policy.apex.model.policymodel.events", "Source", "Target");
262 outEvent1.getParameterMap().put("OE1PARA0",
263 new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA0"), schema0.getKey()));
264 outEvent1.getParameterMap().put("OE1PARA1",
265 new AxField(new AxReferenceKey(outEvent1.getKey(), "OE1PARA1"), schema1.getKey()));
267 final AxEvents events = new AxEvents(new AxArtifactKey("eventsA", "0.0.1"));
268 events.getEventMap().put(inEvent.getKey(), inEvent);
269 events.getEventMap().put(outEvent0.getKey(), outEvent0);
270 events.getEventMap().put(outEvent1.getKey(), outEvent1);
272 final AxTask task = new AxTask(new AxArtifactKey("taskA", "0.0.1"));
274 for (final AxField field : inEvent.getFields()) {
275 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
276 "inputFieldsA", field.getKey().getLocalName());
277 final AxInputField inputField = new AxInputField(fieldkey, field.getSchema());
278 task.getInputFields().put(inputField.getKey().getLocalName(), inputField);
281 for (final AxField field : outEvent0.getFields()) {
282 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
283 "outputFieldsA", field.getKey().getLocalName());
284 final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema());
285 task.getOutputFields().put(outputField.getKey().getLocalName(), outputField);
288 for (final AxField field : outEvent1.getFields()) {
289 final AxReferenceKey fieldkey = new AxReferenceKey(task.getKey().getName(), task.getKey().getVersion(),
290 "outputFieldsA", field.getKey().getLocalName());
291 final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema());
292 task.getOutputFields().put(outputField.getKey().getLocalName(), outputField);
295 task.setInputEvent(inEvent);
296 task.setOutputEvents(Map.of(outEvent0.getId(), outEvent0, outEvent1.getId(), outEvent1));
298 final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA0"),
299 "Task parameter 0 value");
300 final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(task.getKey(), "taskParameterA1"),
301 "Task parameter 1 value");
303 task.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0);
304 task.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1);
305 task.getContextAlbumReferences().add(album0.getKey());
306 task.getContextAlbumReferences().add(album1.getKey());
308 final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "taskLogicA"), "MVEL",
310 task.setTaskLogic(taskLogic);
312 final AxTasks tasks = new AxTasks(new AxArtifactKey("tasksA", "0.0.1"));
313 tasks.getTaskMap().put(task.getKey(), task);
315 final AxPolicy policy = new AxPolicy(new AxArtifactKey("policyA", "0.0.1"));
316 policy.setTemplate("FREEFORM");
318 final AxState state = new AxState(new AxReferenceKey(policy.getKey(), "stateA"));
319 final AxTaskSelectionLogic taskSelectionLogic = new AxTaskSelectionLogic(
320 new AxReferenceKey(state.getKey(), "taskSelectionLogicA"), "MVEL", "Some TS logic ");
322 state.setTrigger(inEvent.getKey());
323 state.getContextAlbumReferences().add(album0.getKey());
324 state.getContextAlbumReferences().add(album1.getKey());
325 state.setTaskSelectionLogic(taskSelectionLogic);
326 state.setDefaultTask(task.getKey());
328 final AxStateOutput stateOutput0 = new AxStateOutput(new AxReferenceKey(state.getKey(), "stateOutputA0"),
329 outEvent0.getKey(), AxReferenceKey.getNullKey());
330 state.getStateOutputs().put(stateOutput0.getKey().getLocalName(), stateOutput0);
332 final AxStateTaskReference stateTaskReference = new AxStateTaskReference(
333 new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.DIRECT,
334 stateOutput0.getKey());
336 state.getTaskReferences().put(task.getKey(), stateTaskReference);
338 policy.getStateMap().put(state.getKey().getLocalName(), state);
339 policy.setFirstState(state.getKey().getLocalName());
341 final AxPolicies policies = new AxPolicies(new AxArtifactKey("policiesA", "0.0.1"));
342 policies.getPolicyMap().put(policy.getKey(), policy);
344 final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKeyA", "0.0.1"));
345 final AxPolicyModel policyModel = new AxPolicyModel(new AxArtifactKey("PolicyModelA", "0.0.1"));
346 policyModel.setKeyInformation(keyInformation);
347 policyModel.setSchemas(schemas);
348 policyModel.setAlbums(albums);
349 policyModel.setEvents(events);
350 policyModel.setTasks(tasks);
351 policyModel.setPolicies(policies);
352 policyModel.getKeyInformation().generateKeyInfo(policyModel);
354 int uuidIncrementer = 0;
355 for (final AxKeyInfo keyInfo : policyModel.getKeyInformation().getKeyInfoMap().values()) {
356 final String uuidString = String.format("ce9168c-e6df-414f-9646-6da464b6e%03d", uuidIncrementer++);
357 keyInfo.setUuid(UUID.fromString(uuidString));
360 final AxValidationResult result = new AxValidationResult();
361 policyModel.validate(result);
367 public AxPolicyModel getMalstructuredModel() {
368 final AxPolicyModel policyModel = new AxPolicyModel(new AxArtifactKey("policyModel", "0.0.1"));
373 public AxPolicyModel getObservationModel() {
374 final AxPolicyModel policyModel = getModel();
376 final AxState state = policyModel.getPolicies().get("policy").getStateMap().get("state");
377 final AxTask task = policyModel.getTasks().get("task");
379 final AxStateFinalizerLogic stateFinalizerLogic = new AxStateFinalizerLogic(
380 new AxReferenceKey(state.getKey(), "SFL"), "MVEL", "Some SF logic ");
381 state.getStateFinalizerLogicMap().put(stateFinalizerLogic.getKey().getLocalName(), stateFinalizerLogic);
382 final AxStateTaskReference stateTaskReference = new AxStateTaskReference(
383 new AxReferenceKey(state.getKey(), task.getKey().getName()), AxStateTaskOutputType.LOGIC,
384 stateFinalizerLogic.getKey());
386 state.getTaskReferences().put(task.getKey(), stateTaskReference);
392 public AxPolicyModel getWarningModel() {
393 final AxPolicyModel policyModel = getModel();
395 final AxState anotherState = new AxState(
396 new AxReferenceKey(new AxArtifactKey("policy", "0.0.1"), "anotherState"));
398 final AxEvent inEvent = policyModel.getEvents().getEventMap().get(new AxArtifactKey("inEvent", "0.0.1"));
399 final AxEvent outEvent0 = policyModel.getEvents().getEventMap().get(new AxArtifactKey("outEvent0", "0.0.1"));
401 final AxTask anotherTask = new AxTask(new AxArtifactKey("anotherTask", "0.0.1"));
403 for (final AxField field : inEvent.getFields()) {
404 final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(),
405 anotherTask.getKey().getVersion(), "inputFields", field.getKey().getLocalName());
406 final AxInputField inputField = new AxInputField(fieldkey, field.getSchema());
407 anotherTask.getInputFields().put(inputField.getKey().getLocalName(), inputField);
410 for (final AxField field : outEvent0.getFields()) {
411 final AxReferenceKey fieldkey = new AxReferenceKey(anotherTask.getKey().getName(),
412 anotherTask.getKey().getVersion(), "outputFields", field.getKey().getLocalName());
413 final AxOutputField outputField = new AxOutputField(fieldkey, field.getSchema());
414 anotherTask.getOutputFields().put(outputField.getKey().getLocalName(), outputField);
417 anotherTask.setInputEvent(inEvent);
418 anotherTask.setOutputEvents(Map.of(outEvent0.getId(), outEvent0));
419 final AxTaskParameter taskPar0 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter0"),
420 "Task parameter 0 value");
421 final AxTaskParameter taskPar1 = new AxTaskParameter(new AxReferenceKey(anotherTask.getKey(), "taskParameter1"),
422 "Task parameter 1 value");
424 anotherTask.getTaskParameters().put(taskPar0.getKey().getLocalName(), taskPar0);
425 anotherTask.getTaskParameters().put(taskPar1.getKey().getLocalName(), taskPar1);
427 final AxTaskLogic taskLogic = new AxTaskLogic(new AxReferenceKey(anotherTask.getKey(), "taskLogic"), "MVEL",
429 anotherTask.setTaskLogic(taskLogic);
430 policyModel.getTasks().getTaskMap().put(anotherTask.getKey(), anotherTask);
432 final AxStateOutput anotherStateOutput0 = new AxStateOutput(
433 new AxReferenceKey(anotherState.getKey(), "stateOutput0"), outEvent0.getKey(),
434 AxReferenceKey.getNullKey());
435 anotherState.setTrigger(inEvent.getKey());
436 anotherState.getStateOutputs().put(anotherStateOutput0.getKey().getLocalName(), anotherStateOutput0);
437 anotherState.setDefaultTask(anotherTask.getKey());
438 final AxStateTaskReference anotherStateTaskReference = new AxStateTaskReference(
439 new AxReferenceKey(anotherState.getKey(), anotherTask.getKey().getName()),
440 AxStateTaskOutputType.DIRECT, anotherStateOutput0.getKey());
441 anotherState.getTaskReferences().put(anotherTask.getKey(), anotherStateTaskReference);
443 policyModel.getPolicies().getPolicyMap().get(new AxArtifactKey("policy", "0.0.1")).getStateMap()
444 .put(anotherState.getKey().getLocalName(), anotherState);
446 policyModel.getKeyInformation().generateKeyInfo(policyModel);
452 public AxPolicyModel getInvalidModel() {
453 final AxPolicyModel policyModel = getModel();
455 policyModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
456 policyModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1")).setScope("UNDEFINED");
458 final AxEvent outEvent0 = policyModel.getEvents().get("outEvent0");
459 outEvent0.getParameterMap().remove("OE1PAR0");
460 outEvent0.getParameterMap().remove("OE1PAR1");