Fix: Run both sonar and clm scans in parallel
[ccsdk/cds.git] / ms / sdclistener / application / src / test / java / org / onap / ccsdk / cds / sdclistener / SdcListenerConfigurationTest.java
1 /*
2  * Copyright © 2019 Bell Canada
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.cds.sdclistener;
18
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertFalse;
21
22 import org.junit.Test;
23 import org.junit.runner.RunWith;
24 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.boot.context.properties.EnableConfigurationProperties;
26 import org.springframework.boot.test.context.SpringBootTest;
27 import org.springframework.test.context.junit4.SpringRunner;
28
29 @RunWith(SpringRunner.class)
30 @EnableConfigurationProperties(SdcListenerConfiguration.class)
31 @SpringBootTest(classes = {SdcListenerConfigurationTest.class})
32 public class SdcListenerConfigurationTest {
33
34     @Autowired
35     private SdcListenerConfiguration listenerConfiguration;
36
37     @Test
38     public void testCdsSdcListenerConfiguration() {
39         // disabled as tests breaks in java 17 and it onlt validates property inherited from IConfiguration8
40         // that directly reads from SASL_JAAS_CONFIG ENV variable
41         // environmentVariables.set("SASL_JAAS_CONFIG",
42         // "org.apache.kafka.common.security.scram.ScramLoginModule required username=admin password=admin-secret;");
43         assertEquals("localhost:8443", listenerConfiguration.getSdcAddress());
44         // assertEquals(
45         // "org.apache.kafka.common.security.scram.ScramLoginModule required username=admin password=admin-secret;",
46         // listenerConfiguration.getKafkaSaslJaasConfig());
47         assertEquals("cds", listenerConfiguration.getUser());
48         assertEquals("Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U", listenerConfiguration.getPassword());
49         assertEquals(15, listenerConfiguration.getPollingInterval());
50         assertEquals(60, listenerConfiguration.getPollingTimeout());
51         assertEquals("TOSCA_CSAR", listenerConfiguration.getRelevantArtifactTypes().stream().findFirst().get());
52         assertEquals("cds-id-local", listenerConfiguration.getConsumerGroup());
53         assertEquals("AUTO", listenerConfiguration.getEnvironmentName());
54         assertEquals("cds-id-local", listenerConfiguration.getConsumerID());
55         assertFalse(listenerConfiguration.activateServerTLSAuth());
56         assertEquals(true, listenerConfiguration.isUseHttpsWithSDC());
57     }
58
59 }