• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HotelsDotCom / waggle-dance / #318

pending completion
#318

push

web-flow
Feature/upgrade springboot (#268)

* update springboot to 2.1.18

* update springboot to 2.2.13

* Upgrade to srping boot 2.7.11

* Update changelog

* Update changelog

* fix version

3 of 3 new or added lines in 2 files covered. (100.0%)

132 of 3058 relevant lines covered (4.32%)

0.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/model/DatabaseNameMapping.java
1
/**
2
 * Copyright (C) 2016-2020 Expedia, Inc.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.hotels.bdp.waggledance.mapping.model;
17

18
import java.util.ArrayList;
19
import java.util.Collections;
20
import java.util.HashMap;
21
import java.util.List;
22
import java.util.Map;
23

24
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
26

27
import com.google.common.collect.BiMap;
28

29
public class DatabaseNameMapping extends MetaStoreMappingDecorator {
30

31
  private final static Logger log = LoggerFactory.getLogger(DatabaseNameMapping.class);
×
32

33
  private final Map<String, String> inbound;
34
  private final Map<String, String> outbound;
35

36
  public DatabaseNameMapping(MetaStoreMapping metaStoreMapping, BiMap<String, String> databaseNameMap) {
37
    super(metaStoreMapping);
×
38
    if (databaseNameMap != null && !databaseNameMap.isEmpty()) {
×
39
      inbound = new HashMap<>(databaseNameMap.inverse());
×
40
      outbound = new HashMap<>(databaseNameMap);
×
41
    } else {
×
42
      inbound = Collections.emptyMap();
×
43
      outbound = Collections.emptyMap();
×
44
    }
45
  }
×
46

47
  @Override
48
  public String transformOutboundDatabaseName(String databaseName) {
49
    return transformOutboundDatabaseNameMultiple(databaseName).get(0);
×
50
  }
51

52
  @Override
53
  public List<String> transformOutboundDatabaseNameMultiple(String databaseName) {
54
    List<String> results = new ArrayList<>();
×
55
    results.addAll(super.transformOutboundDatabaseNameMultiple(databaseName));
×
56
    if (outbound.containsKey(databaseName)) {
×
57
      String result = outbound.get(databaseName);
×
58
      List<String> databases = super.transformOutboundDatabaseNameMultiple(result);
×
59
      log.debug("transformOutboundDatabaseName '" + databaseName + "' to '" + databases + "'");
×
60
      results.addAll(databases);
×
61
    }
62
    return results;
×
63
  }
64

65
  @Override
66
  public String transformInboundDatabaseName(String databaseName) {
67
    String newDatabaseName = super.transformInboundDatabaseName(databaseName);
×
68
    String result = inbound.getOrDefault(newDatabaseName, newDatabaseName);
×
69
    log.debug("transformInboundDatabaseName '" + databaseName + "' to '" + result + "'");
×
70
    return result;
×
71
  }
72

73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc