Initial OpenECOMP MSO commit
[so.git] / adapters / mso-sdnc-adapter / src / test / java / org / openecomp / mso / adapters / sdnc / impl / RequestTunablesTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
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.mso.adapters.sdnc.impl;
22
23 import java.lang.reflect.Constructor;
24 import java.lang.reflect.InvocationTargetException;
25 import java.lang.reflect.Method;
26
27 import org.junit.BeforeClass;
28 import org.junit.Test;
29
30 import org.openecomp.mso.properties.MsoJavaProperties;
31 import org.openecomp.mso.properties.MsoPropertiesException;
32 import org.openecomp.mso.properties.MsoPropertiesFactory;
33
34 public class RequestTunablesTest {
35
36         public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
37         
38     /**
39      * This method is called before any test occurs.
40      * It creates a fake tree from scratch
41      * @throws MsoPropertiesException 
42      */
43     @BeforeClass
44     public static final void prepare () throws MsoPropertiesException {
45         ClassLoader classLoader = RequestTunablesTest.class.getClassLoader ();
46         String path = classLoader.getResource ("mso.properties").toString ().substring (5);
47         
48         msoPropertiesFactory.initializeMsoProperties(RequestTunables.MSO_PROP_SDNC_ADAPTER, path);
49       
50     }
51
52     /**
53      * Test method for
54      * {@link org.openecomp.mso.adapters.sdnc.impl.RequestTunables#RequestTunables(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
55      * .
56      */
57     @Test
58     public final void testRequestTunables () {
59         RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
60         assert(rt.getReqId ().length ()==0);
61         rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
62         rt.setTunables ();
63         System.out.println(rt.toString ());
64       //  assert (rt.getReqMethod ().equals ("toto"));
65         assert (rt.getTimeout () != null);
66         assert (rt.getAction ().equals ("query"));
67         assert (rt.getMsoAction ().equals ("msoAction"));
68         assert (rt.getHeaderName ().equals ("sdnc-request-header"));
69         assert (rt.getOperation ().length () == 0);
70         assert (rt.getAsyncInd ().equals ("N"));
71         assert (rt.getReqId ().equals ("reqId"));
72     }
73
74 }