AT&T 1712 and 1802 release code
[so.git] / adapters / mso-sdnc-adapter / src / test / java / org / openecomp / mso / adapters / sdnc / impl / RequestTunablesTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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 org.junit.AfterClass;
24 import org.junit.Before;
25 import org.junit.Test;
26
27 import org.openecomp.mso.properties.MsoJavaProperties;
28 import org.openecomp.mso.properties.MsoPropertiesException;
29 import org.openecomp.mso.properties.MsoPropertiesFactory;
30
31 public class RequestTunablesTest {
32
33         private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
34         
35         public static final String SDNC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.sdnc.properties").toString().substring(5);
36         
37         @Before
38         public final void initBeforeEachTest() throws MsoPropertiesException {
39                         msoPropertiesFactory.removeAllMsoProperties();
40                         msoPropertiesFactory.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", SDNC_PROP);
41         }
42
43         @AfterClass
44         public static final void kill () throws MsoPropertiesException {
45
46                     msoPropertiesFactory.removeMsoProperties("MSO_PROP_SDNC_ADAPTER");
47         }
48         
49     /**
50      * Test method for
51      * {@link org.openecomp.mso.adapters.sdnc.impl.RequestTunables#RequestTunables(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
52      * .
53      */
54     @Test
55     public final void testRequestTunables () {
56         RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
57         assert(rt.getReqId ().length ()==0);
58         rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
59         rt.setTunables ();
60         System.out.println(rt.toString ());
61       //  assert (rt.getReqMethod ().equals ("toto"));
62         assert (rt.getTimeout () != null);
63         assert (rt.getAction ().equals ("query"));
64         assert (rt.getMsoAction ().equals ("msoAction"));
65         assert (rt.getHeaderName ().equals ("sdnc-request-header"));
66         assert (rt.getOperation ().length () == 0);
67         assert (rt.getAsyncInd ().equals ("N"));
68         assert (rt.getReqId ().equals ("reqId"));
69     }
70
71 }