More license header changes to appc-client files
[appc.git] / appc-client / client-kit / src / test / java / org / onap / appc / client / lcm / impl / business / TestAppcLifeCycleManagerServiceFactoryImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.client.lcm.impl.business;
25
26
27 import org.junit.Assert;
28 import org.junit.Ignore;
29 import org.junit.Test;
30 import org.onap.appc.client.lcm.api.ApplicationContext;
31 import org.onap.appc.client.lcm.api.LifeCycleManagerStateful;
32 import org.onap.appc.client.lcm.exceptions.AppcClientException;
33 import org.onap.appc.client.lcm.impl.business.LCMRequestProcessor;
34
35 import java.io.FileInputStream;
36 import java.io.FileNotFoundException;
37 import java.io.IOException;
38 import java.io.InputStream;
39 import java.util.Properties;
40
41 public class TestAppcLifeCycleManagerServiceFactoryImpl {
42
43     AppcLifeCycleManagerServiceFactoryImpl appcLifeCycleManagerServiceFactory=new AppcLifeCycleManagerServiceFactoryImpl();
44
45     @Ignore
46     public void testCreateLifeCycleManagerStateful() throws AppcClientException{
47         LifeCycleManagerStateful lifeCycleManagerStateful;
48         ApplicationContext applicationContext=new ApplicationContext();
49         applicationContext.setApplicationID("AppID");
50         applicationContext.setMechID("mechId");
51         String folder="src/test/resources/data";
52         Properties properties =getProperties(folder);
53         lifeCycleManagerStateful=appcLifeCycleManagerServiceFactory.createLifeCycleManagerStateful(applicationContext,properties);
54
55         Assert.assertNotNull(lifeCycleManagerStateful);
56
57     }
58
59     public static Properties getProperties(String folder) {
60         Properties prop = new Properties();
61
62         InputStream conf = null;
63         try {
64             conf = new FileInputStream(folder + "client-simulator.properties");
65         } catch (FileNotFoundException e) {
66
67         }
68         if (conf != null) {
69             try {
70                 prop.load(conf);
71             } catch (IOException e) {
72                 e.printStackTrace();
73             }
74         } else {
75             try {
76                 prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("client-simulator.properties"));
77             } catch (Exception e) {
78                 throw new RuntimeException("### ERROR ### - Could not load properties to test");
79             }
80         }
81         return prop;
82     }
83 }