2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.mso.adapters.sdnc.impl;
23 import static org.junit.Assert.*;
25 import org.junit.AfterClass;
26 import org.junit.Before;
27 import org.junit.Test;
29 import org.openecomp.mso.properties.MsoJavaProperties;
30 import org.openecomp.mso.properties.MsoPropertiesException;
31 import org.openecomp.mso.properties.MsoPropertiesFactory;
33 public class RequestTunablesTest {
35 private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
37 public static final String SDNC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.sdnc.properties").toString().substring(5);
40 public final void initBeforeEachTest() throws MsoPropertiesException {
41 msoPropertiesFactory.removeAllMsoProperties();
42 msoPropertiesFactory.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", SDNC_PROP);
46 public static final void kill () throws MsoPropertiesException {
48 msoPropertiesFactory.removeMsoProperties("MSO_PROP_SDNC_ADAPTER");
53 * {@link org.openecomp.mso.adapters.sdnc.impl.RequestTunables#RequestTunables(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
57 public final void testRequestTunables () {
58 RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
59 assertEquals(0, rt.getReqId ().length ());
60 rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
62 System.out.println(rt.toString ());
63 // assert (rt.getReqMethod ().equals ("toto"));
64 assertNotNull(rt.getTimeout ());
65 assertEquals("query", rt.getAction ());
66 assertEquals("msoAction", rt.getMsoAction ());
67 assertEquals("sdnc-request-header", rt.getHeaderName ());
68 assertEquals(0, rt.getOperation ().length ());
69 assertEquals("N", rt.getAsyncInd ());
70 assertEquals("reqId", rt.getReqId ());
74 public final void testRequestTunablesSet() {
75 RequestTunables rt = new RequestTunables("reqId", "gammainternet", "service-configuration-operation", "changeactivate", msoPropertiesFactory);
77 assertNotNull(rt.getTimeout ());
78 assertEquals("changeactivate", rt.getAction ());
79 assertEquals("gammainternet", rt.getMsoAction ());
80 assertEquals("sdnc-request-header", rt.getHeaderName ());
81 assertEquals("service-configuration-operation", rt.getOperation ());
82 assertEquals("N", rt.getAsyncInd ());
83 assertEquals("reqId", rt.getReqId ());