Catalog alignment
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / ElementOperationMock.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc;
22
23 import fj.data.Either;
24 import org.openecomp.sdc.be.config.Configuration;
25 import org.openecomp.sdc.be.dao.api.ActionStatus;
26 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
27 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
28 import org.openecomp.sdc.be.model.ArtifactType;
29 import org.openecomp.sdc.be.model.Category;
30 import org.openecomp.sdc.be.model.PropertyScope;
31 import org.openecomp.sdc.be.model.Tag;
32 import org.openecomp.sdc.be.model.category.CategoryDefinition;
33 import org.openecomp.sdc.be.model.category.GroupingDefinition;
34 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
35 import org.openecomp.sdc.be.model.operations.api.IElementOperation;
36 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
37 import org.openecomp.sdc.be.resources.data.CategoryData;
38
39 import java.util.ArrayList;
40 import java.util.List;
41 import java.util.Map;
42
43 public class ElementOperationMock implements IElementOperation {
44
45     CategoryDefinition resourceCategory;
46     CategoryDefinition serviceCategory;
47     CategoryDefinition productCategory;
48
49     Category oldService;
50
51     public ElementOperationMock() {
52         resourceCategory = new CategoryDefinition();
53         resourceCategory.setName("Network Layer 2-3");
54         SubCategoryDefinition subCategoryDefinition = new SubCategoryDefinition();
55         subCategoryDefinition.setName("Router");
56         SubCategoryDefinition subCategoryDefinition1 = new SubCategoryDefinition();
57         subCategoryDefinition1.setName("Gateway");
58
59         resourceCategory.addSubCategory(subCategoryDefinition);
60         resourceCategory.addSubCategory(subCategoryDefinition1);
61
62         serviceCategory = new CategoryDefinition();
63         serviceCategory.setName("Mobility");
64         oldService = new Category();
65         oldService.setName("Mobility");
66
67         productCategory = new CategoryDefinition();
68         productCategory.setName("Network Layer 2-31");
69         SubCategoryDefinition subCategoryDefinition11 = new SubCategoryDefinition();
70         subCategoryDefinition11.setName("Router1");
71         GroupingDefinition group = new GroupingDefinition();
72         group.setName("group1");
73         subCategoryDefinition11.addGrouping(group);
74         productCategory.addSubCategory(subCategoryDefinition11);
75
76     }
77
78     @Override
79     public Either<List<CategoryDefinition>, ActionStatus> getAllResourceCategories() {
80
81         List<CategoryDefinition> categories = new ArrayList<>();
82         categories.add(resourceCategory);
83         return Either.left(categories);
84
85     }
86
87     @Override
88     public Either<List<CategoryDefinition>, ActionStatus> getAllServiceCategories() {
89
90         List<CategoryDefinition> categories = new ArrayList<>();
91         categories.add(serviceCategory);
92         return Either.left(categories);
93
94     }
95
96     /*
97      * @Override public Either<Category, ActionStatus> getCategory(String name) { if (name.equals(resourceCategory.getName())){ return Either.left(resourceCategory); } else { return Either.right(ActionStatus.CATEGORY_NOT_FOUND); } }
98      */
99
100     @Override
101     public Either<List<Tag>, ActionStatus> getAllTags() {
102         // TODO Auto-generated method stub
103         return null;
104     }
105
106     @Override
107     public Either<List<PropertyScope>, ActionStatus> getAllPropertyScopes() {
108         // TODO Auto-generated method stub
109         return null;
110     }
111
112     @Override
113     public Either<List<ArtifactType>, ActionStatus> getAllArtifactTypes() {
114         // TODO Auto-generated method stub
115         return null;
116     }
117
118     @Override
119     public Either<Map<String, Object>, ActionStatus> getAllDeploymentArtifactTypes() {
120         // TODO Auto-generated method stub
121         return null;
122     }
123
124     @Override
125     public <T extends GraphNode> Either<CategoryData, StorageOperationStatus> getCategoryData(String name, NodeTypeEnum type, Class<T> clazz) {
126         // TODO Auto-generated method stub
127         return null;
128     }
129
130     @Override
131     public Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> getDefaultHeatTimeout() {
132         // TODO Auto-generated method stub
133         return null;
134     }
135
136     @Override
137     public Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType) {
138         // TODO Auto-generated method stub
139         return null;
140     }
141
142     @Override
143     public Either<CategoryDefinition, ActionStatus> deleteCategory(NodeTypeEnum nodeType, String categoryId) {
144         // TODO Auto-generated method stub
145         return null;
146     }
147
148     @Override
149     public Either<Boolean, ActionStatus> isCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName) {
150         // TODO Auto-generated method stub
151         return null;
152     }
153
154     @Override
155     public Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType) {
156         // TODO Auto-generated method stub
157         return null;
158     }
159
160     @Override
161     public Either<List<CategoryDefinition>, ActionStatus> getAllCategories(NodeTypeEnum nodeType, boolean inTransaction) {
162
163         List<CategoryDefinition> categories = new ArrayList<>();
164         switch (nodeType) {
165         case ResourceNewCategory:
166             categories.add(resourceCategory);
167             break;
168         case ProductCategory:
169             categories.add(productCategory);
170             break;
171         case ServiceNewCategory:
172             categories.add(serviceCategory);
173             break;
174         default:
175             break;
176         }
177         return Either.left(categories);
178     }
179
180     @Override
181     public Either<CategoryDefinition, ActionStatus> getCategory(NodeTypeEnum nodeType, String categoryId) {
182         // TODO Auto-generated method stub
183         return null;
184     }
185
186     @Override
187     public Either<SubCategoryDefinition, ActionStatus> getSubCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName) {
188         // TODO Auto-generated method stub
189         return null;
190     }
191
192     @Override
193     public Either<Boolean, ActionStatus> isSubCategoryUniqueForCategory(NodeTypeEnum nodeType, String subCategoryNormName, String parentCategoryId) {
194         // TODO Auto-generated method stub
195         return null;
196     }
197
198     @Override
199     public Either<SubCategoryDefinition, ActionStatus> deleteSubCategory(NodeTypeEnum nodeType, String subCategoryId) {
200         // TODO Auto-generated method stub
201         return null;
202     }
203
204     @Override
205     public Either<GroupingDefinition, ActionStatus> createGrouping(String subCategoryId, GroupingDefinition grouping, NodeTypeEnum nodeType) {
206         // TODO Auto-generated method stub
207         return null;
208     }
209
210     @Override
211     public Either<GroupingDefinition, ActionStatus> deleteGrouping(NodeTypeEnum nodeType, String groupingId) {
212         // TODO Auto-generated method stub
213         return null;
214     }
215
216     @Override
217     public Either<SubCategoryDefinition, ActionStatus> getSubCategory(NodeTypeEnum nodeType, String subCategoryId) {
218         // TODO Auto-generated method stub
219         return null;
220     }
221
222     @Override
223     public Either<Boolean, ActionStatus> isGroupingUniqueForSubCategory(NodeTypeEnum nodeType, String groupingNormName, String parentSubCategoryId) {
224         // TODO Auto-generated method stub
225         return null;
226     }
227
228     @Override
229     public Either<GroupingDefinition, ActionStatus> getGroupingUniqueForType(NodeTypeEnum nodeType, String groupingNormalizedName) {
230         // TODO Auto-generated method stub
231         return null;
232     }
233
234     @Override
235     public Either<Map<String, String>, ActionStatus> getResourceTypesMap() {
236         // TODO Auto-generated method stub
237         return null;
238     }
239
240     @Override
241     public <T extends GraphNode> Either<org.openecomp.sdc.be.resources.data.category.CategoryData, StorageOperationStatus> getNewCategoryData(String name, NodeTypeEnum type, Class<T> clazz) {
242         // TODO Auto-generated method stub
243         return null;
244     }
245
246     @Override
247     public Either<List<CategoryDefinition>, ActionStatus> getAllProductCategories() {
248         List<CategoryDefinition> categories = new ArrayList<>();
249         categories.add(productCategory);
250         return Either.left(categories);
251     }
252
253     @Override
254     public Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType, boolean inTransaction) {
255         // TODO Auto-generated method stub
256         return null;
257     }
258
259     @Override
260     public Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType, boolean inTransaction) {
261         // TODO Auto-generated method stub
262         return null;
263     }
264
265 }