Merge "Update get Dcae Status flow"
[clamp.git] / src / test / java / org / onap / clamp / clds / it / PolicyConfigurationItCase.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
6  *                             reserved.
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  */
23
24 package org.onap.clamp.clds.it;
25
26 import static org.junit.Assert.assertEquals;
27 import static org.junit.Assert.assertNotNull;
28 import static org.junit.Assert.assertTrue;
29
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.onap.clamp.clds.config.PolicyConfiguration;
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.boot.test.context.SpringBootTest;
35 import org.springframework.test.context.junit4.SpringRunner;
36
37 /**
38  * Test Config Policy read from application.properties.
39  */
40 @RunWith(SpringRunner.class)
41 @SpringBootTest
42 public class PolicyConfigurationItCase {
43
44     @Autowired
45     private PolicyConfiguration policyConfiguration;
46
47     @Test
48     public void testPolicyConfiguration() {
49         assertNotNull(policyConfiguration.getPdpUrl1());
50         assertNotNull(policyConfiguration.getPdpUrl2());
51         assertNotNull(policyConfiguration.getPapUrl());
52         assertNotNull(policyConfiguration.getPolicyEnvironment());
53         assertNotNull(policyConfiguration.getClientId());
54         assertNotNull(policyConfiguration.getClientKey());
55         assertNotNull(policyConfiguration.getNotificationType());
56         assertNotNull(policyConfiguration.getNotificationUebServers());
57         assertEquals(8, policyConfiguration.getProperties().size());
58         assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1))
59             .contains("/pdp/ , testpdp, alpha123"));
60         assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2))
61             .contains("/pdp/ , testpdp, alpha123"));
62         assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL))
63             .contains("/pap/ , testpap, alpha123"));
64         assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE));
65         assertEquals("localhost",
66             policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS));
67         assertEquals("python", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID));
68         assertEquals("dGVzdA==", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY));
69         assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT));
70     }
71 }