2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.config;
21 import static org.junit.jupiter.api.Assertions.assertEquals;
22 import com.google.common.io.Files;
24 import java.io.IOException;
25 import java.nio.charset.StandardCharsets;
26 import org.junit.After;
27 import org.junit.Test;
28 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
29 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.config.StrimziKafkaConfig;
31 public class TestStrimziKafkaConfig {
34 private static final String TESTCONFIG_CONTENT = "[strimzi-kafka]\n"
35 + "strimziEnabled=false\n"
36 + "bootstrapServers=onap-strimzi-kafka-0:9094,onap-strimzi-kafka-1:9094\n"
37 + "securityProtocol=PLAINTEXT\n"
38 + "saslMechanism=PLAIN\n"
39 + "saslJaasConfig=PLAIN\n"
43 private ConfigurationFileRepresentation cfg;
44 private static final String CONFIGURATIONFILE = "test2.properties";
49 Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
50 cfg = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
51 StrimziKafkaConfig sKafkaCfg = new StrimziKafkaConfig(cfg);
52 assertEquals("strimzi-kafka", sKafkaCfg.getSectionName());
53 assertEquals("onap-strimzi-kafka-0:9094,onap-strimzi-kafka-1:9094", sKafkaCfg.getBootstrapServers());
54 assertEquals("PLAINTEXT", sKafkaCfg.getSecurityProtocol());
55 assertEquals(false, sKafkaCfg.getEnabled());
56 assertEquals("PLAIN", sKafkaCfg.getSaslJaasConfig());
57 assertEquals("PLAIN", sKafkaCfg.getSaslMechanism());
58 } catch (IOException e) {
64 public void cleanUp() {
65 File file = new File(CONFIGURATIONFILE);
67 System.out.println("File exists, Deleting it");