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.mountpointstateprovider.test;
21 import static org.junit.Assert.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.mountpointstateprovider.impl.GeneralConfig;
31 public class GeneralConfigTest {
34 private static final String TESTCONFIG_CONTENT =
36 + "dmaapEnabled=false\n"
37 + "TransportType=HTTPNOAUTH\n"
38 + "host=onap-dmap:3904\n"
39 + "topic=unauthenticated.SDNR_MOUNTPOINT_STATE_INFO\n"
40 + "contenttype=application/json\n"
43 + "maxBatchSize=100\n"
45 + "MessageSentThreadOccurance=50\n";
48 private ConfigurationFileRepresentation globalCfg;
53 Files.asCharSink(new File("test.properties"), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
54 globalCfg = new ConfigurationFileRepresentation("test.properties");
55 GeneralConfig cfg = new GeneralConfig(globalCfg);
56 assertEquals("onap-dmap:3904", cfg.getHostPort());
57 assertEquals(false, cfg.getEnabled());
58 assertEquals("unauthenticated.SDNR_MOUNTPOINT_STATE_INFO", cfg.getTopic());
59 assertEquals("application/json", cfg.getContenttype());
60 assertEquals("20000", cfg.getTimeout());
61 assertEquals("10000", cfg.getLimit());
62 assertEquals("100", cfg.getMaxBatchSize());
63 assertEquals("250", cfg.getMaxAgeMs());
64 assertEquals("50", cfg.getMessageSentThreadOccurrence());
65 assertEquals("HTTPNOAUTH", cfg.getTransportType());
66 assertEquals("general", cfg.getSectionName());
68 } catch (IOException e) {
69 // TODO Auto-generated catch block
75 public void cleanUp() {
76 File file = new File("test.properties");
78 System.out.println("File exists, Deleting it");