2 * Copyright (c) 2010-2020 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.influxdb.internal;
15 import static org.openhab.persistence.influxdb.internal.InfluxDBConfiguration.DATABASE_PARAM;
16 import static org.openhab.persistence.influxdb.internal.InfluxDBConfiguration.RETENTION_POLICY_PARAM;
17 import static org.openhab.persistence.influxdb.internal.InfluxDBConfiguration.TOKEN_PARAM;
18 import static org.openhab.persistence.influxdb.internal.InfluxDBConfiguration.URL_PARAM;
19 import static org.openhab.persistence.influxdb.internal.InfluxDBConfiguration.VERSION_PARAM;
21 import java.util.HashMap;
24 import org.eclipse.jdt.annotation.NonNullByDefault;
25 import org.eclipse.jdt.annotation.Nullable;
28 * @author Joan Pujol Espinar - Initial contribution
31 public class ConfigurationTestHelper {
33 public static Map<String, @Nullable Object> createValidConfigurationParameters() {
34 Map<String, @Nullable Object> config = new HashMap<>();
35 config.put(URL_PARAM, "http://localhost:8086");
36 config.put(VERSION_PARAM, InfluxDBVersion.V2.name());
37 config.put(TOKEN_PARAM, "sampletoken");
38 config.put(DATABASE_PARAM, "openhab");
39 config.put(RETENTION_POLICY_PARAM, "default");
43 public static InfluxDBConfiguration createValidConfiguration() {
44 return new InfluxDBConfiguration(createValidConfigurationParameters());
47 public static Map<String, @Nullable Object> createInvalidConfigurationParameters() {
48 Map<String, @Nullable Object> config = createValidConfigurationParameters();
49 config.remove(TOKEN_PARAM);