Skip to content

Package: MappingType

MappingType

nameinstructionbranchcomplexitylinemethod
MappingType(String, int, String, String, String, IndexType)
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getIndexType()
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%
getMapping()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMappingName()
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%
getNewIndexSuffix()
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%
static {...}
M: 46 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;
14:
15: import java.io.IOException;
16: import java.nio.charset.StandardCharsets;
17:
18: import org.eclipse.kapua.commons.util.ResourceUtils;
19:
20: import org.apache.commons.io.IOUtils;
21:
22: public enum MappingType {
23:
24: CHANNEL("mappings/channel.json", "channel", "channel", IndexType.DATA_REGISTRY),
25: CLIENT("mappings/client.json", "client", "client", IndexType.DATA_REGISTRY),
26: METRIC("mappings/metric.json", "metric", "metric", IndexType.DATA_REGISTRY);
27:
28: private final String mappingFilePath;
29: private final String mappingName;
30: private final String newIndexSuffix;
31: private final IndexType indexType;
32:
33: MappingType(String mappingFilePath, String mappingName, String newIndexSuffix, IndexType indexType) {
34: this.mappingFilePath = mappingFilePath;
35: this.mappingName = mappingName;
36: this.newIndexSuffix = newIndexSuffix;
37: this.indexType = indexType;
38: }
39:
40: public String getMapping() throws IOException {
41: return IOUtils.toString(ResourceUtils.getResource(mappingFilePath), StandardCharsets.UTF_8);
42: }
43:
44: public String getMappingName() {
45: return mappingName;
46: }
47:
48: public String getNewIndexSuffix() {
49: return newIndexSuffix;
50: }
51:
52: public IndexType getIndexType() {
53: return indexType;
54: }
55: }
56: