Skip to content

Package: EsClusterDescriptor

EsClusterDescriptor

nameinstructionbranchcomplexitylinemethod
EsClusterDescriptor()
M: 61 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getAction()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getEsClusterNodes()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIndicesPrefix()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIndicesRefreshInterval()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIndicesReplicaNumber()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIndicesShardNumber()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPassword()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUsername()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isEsClusterSsl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2021, 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;
14:
15: import java.util.List;
16:
17: import org.eclipse.kapua.extras.esmigrator.settings.EsMigratorSetting;
18: import org.eclipse.kapua.extras.esmigrator.settings.EsMigratorSettingKey;
19:
20: public class EsClusterDescriptor {
21:
22: private static final boolean DEFAULT_ELASTICSEARCH_CLUSTER_SSL = false;
23: private static final String DEFAULT_ELASTICSEARCH_USERNAME = "";
24: private static final String DEFAULT_ELASTICSEARCH_PASSWORD = "";
25: private static final String DEFAULT_INDEX_REFRESH_INTERVAL = "5s";
26: private static final int DEFAULT_INDEX_SHARD_NUMBER = 1;
27: private static final int DEFAULT_INDEX_REPLICA_NUMBER = 0;
28: private static final String DEFAULT_INDICES_PREFIX = "";
29: private static final String DEFAULT_DATASTORE_INDEX_MIGRATION_COMPLETE_ACTION = "delete";
30:
31: /**
32: * The ES Nodes addresses
33: */
34: private final List<String> esClusterNodes;
35:
36: /**
37: * Use SSL to connect to ES Nodes
38: */
39: private final boolean esClusterSsl;
40:
41: /**
42: * The refresh interval for new indexes
43: */
44: private final String indicesRefreshInterval;
45:
46: /**
47: * The number of shards for new indexes
48: */
49: private final int indicesShardNumber;
50:
51: /**
52: * The number of replicas for new indexes
53: */
54: private final int indicesReplicaNumber;
55:
56: /**
57: * The prefix of all index names to operate on
58: */
59: private final String indicesPrefix;
60:
61: /**
62: * Elasticsearch Cluster Username
63: */
64: private final String username;
65:
66: /**
67: * Elasticsearch Cluster Password
68: */
69: private final String password;
70:
71: /**
72: * Index action to be performed after a successful migration
73: */
74: private final IndexMigrationCompleteAction action;
75:
76: public EsClusterDescriptor() {
77: EsMigratorSetting esMigratorSetting = EsMigratorSetting.getInstance();
78: esClusterNodes = esMigratorSetting.getList(String.class, EsMigratorSettingKey.ELASTICSEARCH_CLUSTER_NODES);
79: esClusterSsl = esMigratorSetting.getBoolean(EsMigratorSettingKey.ELASTICSEARCH_CLUSTER_SSL, DEFAULT_ELASTICSEARCH_CLUSTER_SSL);
80: username = esMigratorSetting.getString(EsMigratorSettingKey.ELASTICSEARCH_USERNAME, DEFAULT_ELASTICSEARCH_USERNAME);
81: password = esMigratorSetting.getString(EsMigratorSettingKey.ELASTICSEARCH_PASSWORD, DEFAULT_ELASTICSEARCH_PASSWORD);
82: indicesRefreshInterval = esMigratorSetting.getString(EsMigratorSettingKey.DATASTORE_INDEX_REFRESH_INTERVAL, DEFAULT_INDEX_REFRESH_INTERVAL);
83: indicesShardNumber = esMigratorSetting.getInt(EsMigratorSettingKey.DATASTORE_INDEX_NUMBER_OF_SHARDS, DEFAULT_INDEX_SHARD_NUMBER);
84: indicesReplicaNumber = esMigratorSetting.getInt(EsMigratorSettingKey.DATASTORE_INDEX_NUMBER_OF_REPLICAS, DEFAULT_INDEX_REPLICA_NUMBER);
85: indicesPrefix = esMigratorSetting.getString(EsMigratorSettingKey.DATASTORE_INDEX_PREFIX, DEFAULT_INDICES_PREFIX);
86: action = IndexMigrationCompleteAction.valueOf(esMigratorSetting.getString(EsMigratorSettingKey.DATASTORE_INDEX_MIGRATION_COMPLETE_ACTION, DEFAULT_DATASTORE_INDEX_MIGRATION_COMPLETE_ACTION).toUpperCase());
87: }
88:
89: public List<String> getEsClusterNodes() {
90: return esClusterNodes;
91: }
92:
93: public boolean isEsClusterSsl() {
94: return esClusterSsl;
95: }
96:
97: public String getIndicesRefreshInterval() {
98: return indicesRefreshInterval;
99: }
100:
101: public int getIndicesShardNumber() {
102: return indicesShardNumber;
103: }
104:
105: public int getIndicesReplicaNumber() {
106: return indicesReplicaNumber;
107: }
108:
109: public String getIndicesPrefix() {
110: return indicesPrefix;
111: }
112:
113: public String getUsername() {
114: return username;
115: }
116:
117: public String getPassword() {
118: return password;
119: }
120:
121: public IndexMigrationCompleteAction getAction() {
122: return action;
123: }
124:
125: }