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