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;
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.mountpointregistrar.impl.FaultConfig;
31 public class TestFaultConfig {
34 private static final String TESTCONFIG_CONTENT = "[fault]\n"
35 + "TransportType=HTTPNOAUTH\n"
37 + "username=username\n"
38 + "password=password\n"
39 + "host=onap-dmap:3904\n"
40 + "topic=unauthenticated.SEC_FAULT_OUTPUT\n"
41 + "contenttype=application/json\n"
47 + "jersey.config.client.readTimeout=25000\n"
48 + "jersey.config.client.connectTimeout=25000\n"
53 private ConfigurationFileRepresentation cfg;
54 private static final String CONFIGURATIONFILE = "test2.properties";
58 Files.asCharSink(new File(CONFIGURATIONFILE), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
59 cfg = new ConfigurationFileRepresentation(CONFIGURATIONFILE);
60 FaultConfig faultCfg = new FaultConfig(cfg);
61 assertEquals("fault", faultCfg.getSectionName());
62 assertEquals("HTTPNOAUTH", faultCfg.getTransportType());
63 assertEquals("onap-dmap:3904", faultCfg.getHostPort());
64 assertEquals("unauthenticated.SEC_FAULT_OUTPUT", faultCfg.getTopic());
65 assertEquals("application/json", faultCfg.getContenttype());
66 assertEquals("myG", faultCfg.getConsumerGroup());
67 assertEquals("C1", faultCfg.getConsumerId());
68 assertEquals("20000", faultCfg.getTimeout());
69 assertEquals("10000", faultCfg.getLimit());
70 assertEquals("5000", faultCfg.getFetchPause());
71 assertEquals("http", faultCfg.getProtocol());
72 assertEquals("username", faultCfg.getUsername());
73 assertEquals("password", faultCfg.getPassword());
74 assertEquals("25000", faultCfg.getClientReadTimeout());
75 assertEquals("25000", faultCfg.getClientConnectTimeout());
77 } catch (IOException e) {
83 public void cleanUp() {
84 File file = new File(CONFIGURATIONFILE);
86 System.out.println("File exists, Deleting it");