Skip to content

Package: EsMigratorSetting

EsMigratorSetting

nameinstructionbranchcomplexitylinemethod
EsMigratorSetting()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getInstance()
M: 14 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
resetInstance()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.extras.esmigrator.settings;
14:
15: import org.eclipse.kapua.commons.setting.AbstractKapuaSetting;
16:
17: public class EsMigratorSetting extends AbstractKapuaSetting<EsMigratorSettingKey> {
18:
19: private static final String CONFIG_RESOURCE_NAME = "es-migrator-setting.properties";
20:
21: private static EsMigratorSetting instance;
22:
23: private EsMigratorSetting() {
24: super(CONFIG_RESOURCE_NAME);
25: }
26:
27: /**
28: * Return the broker setting instance (singleton)
29: */
30: public static EsMigratorSetting getInstance() {
31: synchronized (EsMigratorSetting.class) {
32:• if (instance == null) {
33: instance = new EsMigratorSetting();
34: }
35: return instance;
36: }
37: }
38:
39: /**
40: * Allow re-setting the global instance
41: * <p>
42: * This method clears out the internal global instance in order to let the next call
43: * to {@link #getInstance()} return a fresh instance.
44: * </p>
45: * <p>
46: * This may be helpful for unit tests which need to change system properties for testing
47: * different behaviors.
48: * </p>
49: */
50: public static void resetInstance() {
51: synchronized (EsMigratorSetting.class) {
52: instance = null;
53: }
54: }
55:
56: }