0845315f674fcc85160ac6df455e31c2f7128c3e
[so.git] /
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 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      *
42      * @throws MsoPropertiesException
43      */
44     @BeforeClass
45     public static final void prepare() throws MsoPropertiesException {
46         ClassLoader classLoader = RequestTunablesTest.class.getClassLoader();
47         String path = classLoader.getResource("mso.properties").toString().substring(5);
48
49         msoPropertiesFactory.initializeMsoProperties(RequestTunables.MSO_PROP_SDNC_ADAPTER, path);
50
51     }
52
53     /**
54      * Test method for
55      * {@link org.openecomp.mso.adapters.sdnc.impl.RequestTunables#RequestTunables(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
56      * .
57      */
58     @Test
59     public final void testRequestTunables() {
60         RequestTunables rt = new RequestTunables(null, null, "op", null, msoPropertiesFactory);
61         assert (rt.getReqId().length() == 0);
62         rt = new RequestTunables("reqId", "msoAction", null, "query", msoPropertiesFactory);
63         rt.setTunables();
64         System.out.println(rt.toString());
65         //  assert (rt.getReqMethod ().equals ("toto"));
66         assert (rt.getTimeout() != null);
67         assert (rt.getAction().equals("query"));
68         assert (rt.getMsoAction().equals("msoAction"));
69         assert (rt.getHeaderName().equals("sdnc-request-header"));
70         assert (rt.getOperation().length() == 0);
71         assert (rt.getAsyncInd().equals("N"));
72         assert (rt.getReqId().equals("reqId"));
73     }
74
75 }