2c6f8e172aa71cd011da172821b8b032c2c94e10
[policy/apex-pdp.git] /
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.model.contextmodel.handling;
22
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;
27
28 /**
29  * This class creates sample Policy Models
30  *
31  * @author Liam Fallon (liam.fallon@ericsson.com)
32  */
33 public class TestContextComparisonFactory {
34
35     public AxContextModel getFullModel() {
36         final AxContextSchema testContextSchema000 =
37                 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
38                         "org.onap.policy.apex.concept.TestContextSchema000");
39         final AxContextSchema testContextSchema00A =
40                 new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
41                         "org.onap.policy.apex.concept.TestContextSchema00A");
42         final AxContextSchema testContextSchema00C =
43                 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
44                         "org.onap.policy.apex.concept.TestContextSchema00C");
45
46         final AxContextAlbum externalContextAlbum = new AxContextAlbum(
47                 new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
48         final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
49                 "GLOBAL", true, testContextSchema00A.getKey());
50         final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
51                 "APPLICATION", true, testContextSchema00C.getKey());
52         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
53                 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
54
55         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
56         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
57         contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
58         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
59
60         contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
61         contextModel.getAlbums().getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
62         contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
63         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
64
65         return contextModel;
66     }
67
68     public AxContextModel getEmptyModel() {
69         return new AxContextModel(new AxArtifactKey("Context", "0.0.1"));
70     }
71
72     public AxContextModel getShellModel() {
73         final AxContextSchema testContextSchema000 =
74                 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
75                         "org.onap.policy.apex.concept.TestContextSchema000");
76         final AxContextSchema testContextSchema00A =
77                 new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
78                         "org.onap.policy.apex.concept.TestContextSchema00A");
79         final AxContextSchema testContextSchema00C =
80                 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
81                         "org.onap.policy.apex.concept.TestContextSchema00C");
82
83         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
84         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
85         contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
86         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
87
88         return contextModel;
89     }
90
91     public AxContextModel getSingleEntryModel() {
92         final AxContextSchema testContextSchema000 =
93                 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
94                         "org.onap.policy.apex.concept.TestContextSchema000");
95
96         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
97                 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema000.getKey());
98
99         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
100         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
101
102         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
103
104         return contextModel;
105     }
106
107     public AxContextModel getNoGlobalContextModel() {
108         final AxContextSchema testContextSchema000 =
109                 new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
110                         "org.onap.policy.apex.concept.TestContextSchema000");
111         final AxContextSchema testContextSchema00C =
112                 new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
113                         "org.onap.policy.apex.concept.TestContextSchema00C");
114
115         final AxContextAlbum externalContextAlbum = new AxContextAlbum(
116                 new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
117         final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
118                 "APPLICATION", true, testContextSchema00C.getKey());
119         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
120                 new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
121
122         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
123         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
124         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
125
126         contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
127         contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
128         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
129
130         return contextModel;
131     }
132 }