• 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/server/FederatedHMSHandlerFactory.java
1
/**
2
 * Copyright (C) 2016-2023 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.server;
17

18
import org.apache.hadoop.hive.conf.HiveConf;
19
import org.springframework.beans.factory.annotation.Autowired;
20
import org.springframework.stereotype.Component;
21

22
import com.hotels.bdp.waggledance.api.WaggleDanceException;
23
import com.hotels.bdp.waggledance.api.model.DatabaseResolution;
24
import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration;
25
import com.hotels.bdp.waggledance.mapping.model.QueryMapping;
26
import com.hotels.bdp.waggledance.mapping.service.MappingEventListener;
27
import com.hotels.bdp.waggledance.mapping.service.MetaStoreMappingFactory;
28
import com.hotels.bdp.waggledance.mapping.service.impl.MonitoredDatabaseMappingService;
29
import com.hotels.bdp.waggledance.mapping.service.impl.NotifyingFederationService;
30
import com.hotels.bdp.waggledance.mapping.service.impl.PrefixBasedDatabaseMappingService;
31
import com.hotels.bdp.waggledance.mapping.service.impl.StaticDatabaseMappingService;
32

33
@Component
34
public class FederatedHMSHandlerFactory {
35

36
  private final HiveConf hiveConf;
37
  private final NotifyingFederationService notifyingFederationService;
38
  private final MetaStoreMappingFactory metaStoreMappingFactory;
39
  private final WaggleDanceConfiguration waggleDanceConfiguration;
40
  private final QueryMapping queryMapping;
41

42
  @Autowired
43
  public FederatedHMSHandlerFactory(
×
44
      HiveConf hiveConf,
45
      NotifyingFederationService notifyingFederationService,
46
      MetaStoreMappingFactory metaStoreMappingFactory,
47
      WaggleDanceConfiguration waggleDanceConfiguration,
48
      QueryMapping queryMapping) {
49
    this.hiveConf = hiveConf;
×
50
    this.notifyingFederationService = notifyingFederationService;
×
51
    this.metaStoreMappingFactory = metaStoreMappingFactory;
×
52
    this.waggleDanceConfiguration = waggleDanceConfiguration;
×
53
    this.queryMapping = queryMapping;
×
54
  }
×
55

56
  public CloseableIHMSHandler create() {
57
    MappingEventListener service = createDatabaseMappingService();
×
58
    MonitoredDatabaseMappingService monitoredService = new MonitoredDatabaseMappingService(service);
×
59

60
    CloseableIHMSHandler baseHandler = new FederatedHMSHandler(monitoredService, notifyingFederationService,
×
61
        waggleDanceConfiguration);
×
62
    HiveConf conf = new HiveConf(hiveConf);
×
63
    baseHandler.setConf(conf);
×
64
    return baseHandler;
×
65
  }
66

67
  private MappingEventListener createDatabaseMappingService() {
68
    if (waggleDanceConfiguration.getDatabaseResolution() == DatabaseResolution.MANUAL) {
×
69
      return new StaticDatabaseMappingService(metaStoreMappingFactory, notifyingFederationService.getAll(),
×
70
          queryMapping);
×
71
    } else if (waggleDanceConfiguration.getDatabaseResolution() == DatabaseResolution.PREFIXED) {
×
72
      return new PrefixBasedDatabaseMappingService(metaStoreMappingFactory, notifyingFederationService.getAll(),
×
73
          queryMapping);
×
74
    } else {
75
      throw new WaggleDanceException("Cannot instantiate databaseMappingService for prefixType '"
×
76
          + waggleDanceConfiguration.getDatabaseResolution()
×
77
          + "'");
×
78
    }
79
  }
80

81
}
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