1850c222dbf51729680c739e385a593eea5636ca
[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.apex.model.contextmodel.handling;
22
23 import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
24 import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
25 import org.onap.apex.model.contextmodel.concepts.AxContextModel;
26 import org.onap.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 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
37                 "com.ericsson.apex.concept.TestContextSchema000");
38         final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
39                 "com.ericsson.apex.concept.TestContextSchema00A");
40         final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
41                 "com.ericsson.apex.concept.TestContextSchema00C");
42
43         final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
44                 testContextSchema000.getKey());
45         final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"), "GLOBAL", true, testContextSchema00A.getKey());
46         final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
47                 testContextSchema00C.getKey());
48         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
49                 testContextSchema00C.getKey());
50
51         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
52         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
53         contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
54         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
55
56         contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
57         contextModel.getAlbums().getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
58         contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
59         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
60
61         return contextModel;
62     }
63
64     public AxContextModel getEmptyModel() {
65         return new AxContextModel(new AxArtifactKey("Context", "0.0.1"));
66     }
67
68     public AxContextModel getShellModel() {
69         final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
70                 "com.ericsson.apex.concept.TestContextSchema000");
71         final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
72                 "com.ericsson.apex.concept.TestContextSchema00A");
73         final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
74                 "com.ericsson.apex.concept.TestContextSchema00C");
75
76         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
77         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
78         contextModel.getSchemas().getSchemasMap().put(testContextSchema00A.getKey(), testContextSchema00A);
79         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
80
81         return contextModel;
82     }
83
84     public AxContextModel getSingleEntryModel() {
85         final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
86                 "com.ericsson.apex.concept.TestContextSchema000");
87
88         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
89                 testContextSchema000.getKey());
90
91         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
92         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
93
94         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
95
96         return contextModel;
97     }
98
99     public AxContextModel getNoGlobalContextModel() {
100         final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
101                 "com.ericsson.apex.concept.TestContextSchema000");
102         final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
103                 "com.ericsson.apex.concept.TestContextSchema00C");
104
105         final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
106                 testContextSchema000.getKey());
107         final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
108                 testContextSchema00C.getKey());
109         final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
110                 testContextSchema00C.getKey());
111
112         final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
113         contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
114         contextModel.getSchemas().getSchemasMap().put(testContextSchema00C.getKey(), testContextSchema00C);
115
116         contextModel.getAlbums().getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
117         contextModel.getAlbums().getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
118         contextModel.getAlbums().getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
119
120         return contextModel;
121     }
122 }