5d05e65886752f5406d40847e47265ec0a8017d8
[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.BaseType;
30 import org.openecomp.sdc.be.model.Category;
31 import org.openecomp.sdc.be.model.PropertyScope;
32 import org.openecomp.sdc.be.model.Tag;
33 import org.openecomp.sdc.be.model.category.CategoryDefinition;
34 import org.openecomp.sdc.be.model.category.GroupingDefinition;
35 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
36 import org.openecomp.sdc.be.model.operations.api.IElementOperation;
37 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
38 import org.openecomp.sdc.be.resources.data.CategoryData;
39
40 import java.util.ArrayList;
41 import java.util.List;
42 import java.util.Map;
43
44 public class ElementOperationMock implements IElementOperation {
45
46     CategoryDefinition resourceCategory;
47     CategoryDefinition serviceCategory;
48     CategoryDefinition productCategory;
49
50     Category oldService;
51
52     public ElementOperationMock() {
53         resourceCategory = new CategoryDefinition();
54         resourceCategory.setName("Network Layer 2-3");
55         SubCategoryDefinition subCategoryDefinition = new SubCategoryDefinition();
56         subCategoryDefinition.setName("Router");
57         SubCategoryDefinition subCategoryDefinition1 = new SubCategoryDefinition();
58         subCategoryDefinition1.setName("Gateway");
59
60         resourceCategory.addSubCategory(subCategoryDefinition);
61         resourceCategory.addSubCategory(subCategoryDefinition1);
62
63         serviceCategory = new CategoryDefinition();
64         serviceCategory.setName("Mobility");
65         oldService = new Category();
66         oldService.setName("Mobility");
67
68         productCategory = new CategoryDefinition();
69         productCategory.setName("Network Layer 2-31");
70         SubCategoryDefinition subCategoryDefinition11 = new SubCategoryDefinition();
71         subCategoryDefinition11.setName("Router1");
72         GroupingDefinition group = new GroupingDefinition();
73         group.setName("group1");
74         subCategoryDefinition11.addGrouping(group);
75         productCategory.addSubCategory(subCategoryDefinition11);
76
77     }
78
79     @Override
80     public Either<List<CategoryDefinition>, ActionStatus> getAllResourceCategories() {
81
82         List<CategoryDefinition> categories = new ArrayList<>();
83         categories.add(resourceCategory);
84         return Either.left(categories);
85
86     }
87
88     @Override
89     public Either<List<CategoryDefinition>, ActionStatus> getAllServiceCategories() {
90
91         List<CategoryDefinition> categories = new ArrayList<>();
92         categories.add(serviceCategory);
93         return Either.left(categories);
94
95     }
96
97     /*
98      * @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); } }
99      */
100
101     @Override
102     public Either<List<Tag>, ActionStatus> getAllTags() {
103         // TODO Auto-generated method stub
104         return null;
105     }
106
107     @Override
108     public Either<List<PropertyScope>, ActionStatus> getAllPropertyScopes() {
109         // TODO Auto-generated method stub
110         return null;
111     }
112
113     @Override
114     public List<ArtifactType> getAllArtifactTypes() {
115         // TODO Auto-generated method stub
116         return null;
117     }
118
119     @Override
120     public <T extends GraphNode> Either<CategoryData, StorageOperationStatus> getCategoryData(String name, NodeTypeEnum type, Class<T> clazz) {
121         // TODO Auto-generated method stub
122         return null;
123     }
124
125     @Override
126     public Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> getDefaultHeatTimeout() {
127         // TODO Auto-generated method stub
128         return null;
129     }
130
131     @Override
132     public Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType) {
133         // TODO Auto-generated method stub
134         return null;
135     }
136     
137     @Override
138     public Either<CategoryDefinition, ActionStatus> updateCategory(CategoryDefinition category, NodeTypeEnum nodeType) {
139         // TODO Auto-generated method stub
140         return null;
141     }
142
143     @Override
144     public Either<CategoryDefinition, ActionStatus> deleteCategory(NodeTypeEnum nodeType, String categoryId) {
145         // TODO Auto-generated method stub
146         return null;
147     }
148
149     @Override
150     public Either<Boolean, ActionStatus> isCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName) {
151         // TODO Auto-generated method stub
152         return null;
153     }
154
155     @Override
156     public Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType) {
157         // TODO Auto-generated method stub
158         return null;
159     }
160     
161     @Override
162     public Either<SubCategoryDefinition, ActionStatus> updateSubCategory(String subCategoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType) {
163         // TODO Auto-generated method stub
164         return null;
165     }
166
167     @Override
168     public Either<List<CategoryDefinition>, ActionStatus> getAllCategories(NodeTypeEnum nodeType, boolean inTransaction) {
169
170         List<CategoryDefinition> categories = new ArrayList<>();
171         switch (nodeType) {
172         case ResourceNewCategory:
173             categories.add(resourceCategory);
174             break;
175         case ProductCategory:
176             categories.add(productCategory);
177             break;
178         case ServiceNewCategory:
179             categories.add(serviceCategory);
180             break;
181         default:
182             break;
183         }
184         return Either.left(categories);
185     }
186
187     @Override
188     public Either<CategoryDefinition, ActionStatus> getCategory(NodeTypeEnum nodeType, String categoryId) {
189         // TODO Auto-generated method stub
190         return null;
191     }
192
193     @Override
194     public Either<SubCategoryDefinition, ActionStatus> getSubCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName) {
195         // TODO Auto-generated method stub
196         return null;
197     }
198
199     @Override
200     public Either<Boolean, ActionStatus> isSubCategoryUniqueForCategory(NodeTypeEnum nodeType, String subCategoryNormName, String parentCategoryId) {
201         // TODO Auto-generated method stub
202         return null;
203     }
204
205     @Override
206     public Either<SubCategoryDefinition, ActionStatus> deleteSubCategory(NodeTypeEnum nodeType, String subCategoryId) {
207         // TODO Auto-generated method stub
208         return null;
209     }
210
211     @Override
212     public Either<GroupingDefinition, ActionStatus> createGrouping(String subCategoryId, GroupingDefinition grouping, NodeTypeEnum nodeType) {
213         // TODO Auto-generated method stub
214         return null;
215     }
216
217     @Override
218     public Either<GroupingDefinition, ActionStatus> deleteGrouping(NodeTypeEnum nodeType, String groupingId) {
219         // TODO Auto-generated method stub
220         return null;
221     }
222
223     @Override
224     public Either<SubCategoryDefinition, ActionStatus> getSubCategory(NodeTypeEnum nodeType, String subCategoryId) {
225         // TODO Auto-generated method stub
226         return null;
227     }
228
229     @Override
230     public Either<Boolean, ActionStatus> isGroupingUniqueForSubCategory(NodeTypeEnum nodeType, String groupingNormName, String parentSubCategoryId) {
231         // TODO Auto-generated method stub
232         return null;
233     }
234
235     @Override
236     public Either<GroupingDefinition, ActionStatus> getGroupingUniqueForType(NodeTypeEnum nodeType, String groupingNormalizedName) {
237         // TODO Auto-generated method stub
238         return null;
239     }
240
241     @Override
242     public Either<Map<String, String>, ActionStatus> getResourceTypesMap() {
243         // TODO Auto-generated method stub
244         return null;
245     }
246
247     @Override
248     public <T extends GraphNode> Either<org.openecomp.sdc.be.resources.data.category.CategoryData, StorageOperationStatus> getNewCategoryData(String name, NodeTypeEnum type, Class<T> clazz) {
249         // TODO Auto-generated method stub
250         return null;
251     }
252
253     @Override
254     public Either<List<CategoryDefinition>, ActionStatus> getAllProductCategories() {
255         List<CategoryDefinition> categories = new ArrayList<>();
256         categories.add(productCategory);
257         return Either.left(categories);
258     }
259
260     @Override
261     public Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType, boolean inTransaction) {
262         // TODO Auto-generated method stub
263         return null;
264     }
265     
266     @Override
267     public Either<CategoryDefinition, ActionStatus> updateCategory(CategoryDefinition category, NodeTypeEnum nodeType, boolean inTransaction) {
268         // TODO Auto-generated method stub
269         return null;
270     }
271
272     @Override
273     public Either<SubCategoryDefinition, ActionStatus> createSubCategory(String categoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType, boolean inTransaction) {
274         // TODO Auto-generated method stub
275         return null;
276     }
277     
278     @Override
279     public Either<SubCategoryDefinition, ActionStatus> updateSubCategory(String subCategoryId, SubCategoryDefinition subCategory, NodeTypeEnum nodeType, boolean inTransaction) {
280         // TODO Auto-generated method stub
281         return null;
282     }
283
284     @Override
285     public List<BaseType> getBaseTypes(String categoryName) {
286         // TODO Auto-generated method stub
287         return null;
288     }
289
290 }