2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.model.contextmodel.handling;
23 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
24 import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
25 import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
26 import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
29 * This class creates sample Policy Models.
31 * @author Liam Fallon (liam.fallon@ericsson.com)
33 public class TestContextComparisonFactory {
36 * Get a full context model.
39 public AxContextModel getFullModel() {
40 final AxContextSchema testContextSchema000 =
41 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
42 "org.onap.policy.apex.concept.TestContextSchema000");
43 final AxContextSchema testContextSchema00A =
44 new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
45 "org.onap.policy.apex.concept.TestContextSchema00A");
46 final AxContextSchema testContextSchema00C =
47 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
48 "org.onap.policy.apex.concept.TestContextSchema00C");
50 final AxContextAlbum externalContextAlbum = new AxContextAlbum(
51 new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
52 final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
53 "GLOBAL", true, testContextSchema00A.getKey());
54 final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
55 "APPLICATION", true, testContextSchema00C.getKey());
56 final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
57 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
59 final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
60 contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
61 contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
62 contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
64 contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
65 contextModel.getAlbums().getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
66 contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
67 contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
72 public AxContextModel getEmptyModel() {
73 return new AxContextModel(new AxArtifactKey("Context", "0.0.1"));
77 * Get a skeleton model.
80 public AxContextModel getShellModel() {
81 final AxContextSchema testContextSchema000 =
82 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
83 "org.onap.policy.apex.concept.TestContextSchema000");
84 final AxContextSchema testContextSchema00A =
85 new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
86 "org.onap.policy.apex.concept.TestContextSchema00A");
87 final AxContextSchema testContextSchema00C =
88 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
89 "org.onap.policy.apex.concept.TestContextSchema00C");
91 final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
92 contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
93 contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
94 contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
100 * Get a single entry model.
101 * @return The single entry model
103 public AxContextModel getSingleEntryModel() {
104 final AxContextSchema testContextSchema000 =
105 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
106 "org.onap.policy.apex.concept.TestContextSchema000");
108 final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
109 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema000.getKey());
111 final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
112 contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
114 contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
120 * Get a model with no global entries.
123 public AxContextModel getNoGlobalContextModel() {
124 final AxContextSchema testContextSchema000 =
125 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
126 "org.onap.policy.apex.concept.TestContextSchema000");
127 final AxContextSchema testContextSchema00C =
128 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
129 "org.onap.policy.apex.concept.TestContextSchema00C");
131 final AxContextAlbum externalContextAlbum = new AxContextAlbum(
132 new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
133 final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
134 "APPLICATION", true, testContextSchema00C.getKey());
135 final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
136 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
138 final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
139 contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
140 contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
142 contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
143 contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
144 contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);