Adding new LCM features to the client lib
[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 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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.client.lcm.impl.business;
26
27
28 import org.junit.Assert;
29 import org.junit.Ignore;
30 import org.junit.Test;
31 import org.onap.appc.client.lcm.api.ApplicationContext;
32 import org.onap.appc.client.lcm.api.LifeCycleManagerStateful;
33 import org.onap.appc.client.lcm.exceptions.AppcClientException;
34 import org.onap.appc.client.lcm.impl.business.LCMRequestProcessor;
35
36 import java.io.FileInputStream;
37 import java.io.FileNotFoundException;
38 import java.io.IOException;
39 import java.io.InputStream;
40 import java.util.Properties;
41
42 public class TestAppcLifeCycleManagerServiceFactoryImpl {
43
44     AppcLifeCycleManagerServiceFactoryImpl appcLifeCycleManagerServiceFactory=new AppcLifeCycleManagerServiceFactoryImpl();
45
46     @Ignore
47     public void testCreateLifeCycleManagerStateful() throws AppcClientException{
48         LifeCycleManagerStateful lifeCycleManagerStateful;
49         ApplicationContext applicationContext=new ApplicationContext();
50         applicationContext.setApplicationID("AppID");
51         applicationContext.setMechID("mechId");
52         String folder="src/test/resources/data";
53         Properties properties =getProperties(folder);
54         lifeCycleManagerStateful=appcLifeCycleManagerServiceFactory.createLifeCycleManagerStateful(applicationContext,properties);
55
56         Assert.assertNotNull(lifeCycleManagerStateful);
57
58     }
59
60     public static Properties getProperties(String folder) {
61         Properties prop = new Properties();
62
63         InputStream conf = null;
64         try {
65             conf = new FileInputStream(folder + "client-simulator.properties");
66         } catch (FileNotFoundException e) {
67
68         }
69         if (conf != null) {
70             try {
71                 prop.load(conf);
72             } catch (IOException e) {
73                 e.printStackTrace();
74             }
75         } else {
76             try {
77                 prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("client-simulator.properties"));
78             } catch (Exception e) {
79                 throw new RuntimeException("### ERROR ### - Could not load properties to test");
80             }
81         }
82         return prop;
83     }
84 }