2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.mso.db.catalog.test;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.HashMap;
27 import java.util.HashSet;
28 import java.util.List;
32 import org.openecomp.mso.db.catalog.CatalogDatabase;
33 import org.openecomp.mso.db.catalog.beans.HeatTemplate;
34 import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
37 * This class is purely for development testing. It hard-codes a very limited
38 * catalog of HeatTemplates and Services for the case where no actual database
43 public class CatalogTestDatabase extends CatalogDatabase {
45 private static int id = 1;
46 private static Map<String,HeatTemplate> heatTemplates;
49 heatTemplates = new HashMap<String,HeatTemplate>();
51 addTemplate("ApacheDemo", "C:/temp/apache-demo.json", 2,
52 new ArrayList<String>(Arrays.asList("private_subnet_gateway", "private_subnet_cidr")),
53 new ArrayList<String> (Arrays.asList("vnf_id", "public_net_id")));
56 public CatalogTestDatabase () {
59 private static void addTemplate (String name, String path, int timeout, List<String> reqd, List<String> opt)
61 HeatTemplate template = new HeatTemplate();
63 template.setTemplateName("ApacheDemo");
64 template.setTemplatePath("C:/temp/apache-demo.json");
65 template.setTimeoutMinutes(2);
67 Set<HeatTemplateParam> params = new HashSet<HeatTemplateParam>();
69 for (String s : reqd) {
70 HeatTemplateParam param = new HeatTemplateParam();
72 param.setParamName(s);
73 param.setRequired(true);
77 for (String s : opt) {
78 HeatTemplateParam param = new HeatTemplateParam();
80 param.setParamName(s);
81 param.setRequired(false);
84 template.setParameters(params);
86 heatTemplates.put(name, template);
90 public HeatTemplate getHeatTemplate (String templateName)
92 if (heatTemplates.containsKey(templateName)) {
93 return heatTemplates.get(templateName);
100 public HeatTemplate getHeatTemplate (String templateName, String version)
102 return getHeatTemplate(templateName);