1 /*******************************************************************************
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==========================================================================
17 ******************************************************************************/
19 package org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.test;
21 import static org.junit.Assert.assertEquals;
24 import java.io.IOException;
25 import java.nio.charset.StandardCharsets;
27 import org.junit.After;
28 import org.junit.Test;
29 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
30 import org.onap.ccsdk.features.sdnr.wt.mountpointstateprovider.impl.GeneralConfig;
32 import com.google.common.io.Files;
34 public class GeneralConfigTest {
36 private static final String TESTCONFIG_CONTENT="[general]\n" +
37 "dmaapEnabled=false\n" +
38 "TransportType=HTTPNOAUTH\n" +
39 "host=onap-dmap:3904\n" +
40 "topic=unauthenticated.SDNR_MOUNTPOINT_STATE_INFO\n" +
41 "contenttype=application/json\n" +
44 "maxBatchSize=100\n" +
46 "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");