Merge "Remove tests which do not test anything"
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / java / org / openecomp / mso / bpmn / infrastructure / properties / BPMNProperties.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Huawei 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 package org.openecomp.mso.bpmn.infrastructure.properties;
21
22 import org.openecomp.mso.logger.MessageEnum;
23 import org.openecomp.mso.logger.MsoLogger;
24 import org.openecomp.mso.properties.MsoPropertiesException;
25 import org.openecomp.mso.properties.MsoPropertiesFactory;
26
27 import java.util.Arrays;
28 import java.util.List;
29
30 public class BPMNProperties {
31
32     public static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
33
34     private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
35
36     public static String getProperty(String key, String defaultValue) {
37         String value;
38         try {
39             value =  new MsoPropertiesFactory().getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA).getProperty(key, defaultValue);
40         } catch (MsoPropertiesException e) {
41              msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: "
42                      + MSO_PROP_APIHANDLER_INFRA, "BPMN", "", MsoLogger.ErrorCode.DataError,
43                      "Exception - Mso Properties ID not found in cache", e);
44             return null;
45         }
46         msoLogger.debug("Config read for " + MSO_PROP_APIHANDLER_INFRA + " - key:" + key + " value:" + value);
47         return value;
48     }
49
50     public static List<String> getResourceSequenceProp(String input) {
51         String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null);
52         if (resourceSequence != null) {
53             return Arrays.asList(resourceSequence.split(","));
54         }
55         return null;
56     }
57 }