Cleanup sparky-be pom
[aai/sparky-be.git] / sparkybe-onap-service / src / test / java / org / onap / aai / sparky / dal / ActiveInventoryAdapterTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.aai.sparky.dal;
23
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertNull;
26
27 import java.util.ArrayList;
28
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.onap.aai.restclient.enums.RestAuthenticationMode;
32 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
33 import org.onap.aai.sparky.config.oxm.OxmModelLoader;
34 import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
35
36 public class ActiveInventoryAdapterTest {
37
38   private OxmModelLoader oxmModelLoader;
39   private OxmEntityLookup oxmEntityLookup;
40   private RestEndpointConfig endpointConfig;
41   private ActiveInventoryAdapter aaiAdapter;
42   private ArrayList<String> queryParams;
43
44   @Before
45   public void init() throws Exception {
46     oxmModelLoader = new OxmModelLoader("v11",null);
47     oxmEntityLookup = new OxmEntityLookup();
48     endpointConfig = new RestEndpointConfig();
49     queryParams = new ArrayList<String>();
50     endpointConfig.setRestAuthenticationMode(RestAuthenticationMode.SSL_BASIC);
51     aaiAdapter = new ActiveInventoryAdapter(oxmModelLoader, oxmEntityLookup, endpointConfig,"aai");
52   }
53
54
55   @SuppressWarnings("static-access")
56   @Test
57   public void updateValues() throws Exception {
58
59     assertNotNull(aaiAdapter.getMessageHeaders());
60     assertNotNull(aaiAdapter.getBasicAuthenticationCredentials());
61     assertNotNull(aaiAdapter.getResourceBasePath());
62     assertNotNull(aaiAdapter.extractResourcePath("/services/inventory/v12/"));
63     assertNotNull(aaiAdapter.getGenericQueryForSelfLink("", queryParams));
64     assertNull(aaiAdapter.getSelfLinkForEntity("pserver", "PrimaryKeyName", "PrimaryKeyValue"));
65     assertNotNull(
66         aaiAdapter.queryActiveInventory("https://server.proxy:8443/aai/v11/", "application/json","sync"));
67     assertNotNull(aaiAdapter.queryActiveInventoryWithRetries(
68         "https://server.proxy:8443/aai/v11/business/customers/", "application/json", 4,"sync"));
69     aaiAdapter.setOxmEntityLookup(oxmEntityLookup);
70     assertNotNull(aaiAdapter.getOxmEntityLookup());
71     aaiAdapter.setEndpointConfig(endpointConfig);
72     assertNotNull(aaiAdapter.getEndpointConfig());
73   }
74
75
76 }