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

ExpediaGroup / drone-fly / #84

23 May 2025 09:23AM UTC coverage: 56.14% (+1.8%) from 54.357%
#84

push

web-flow
Remove Codahale Metrics and use Micrometer (#39)

* Adding metrics from micrometer

* remove junk

* remove imports

* more imports

1 of 7 new or added lines in 2 files covered. (14.29%)

6 existing lines in 1 file now uncovered.

128 of 228 relevant lines covered (56.14%)

0.56 hits per line

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

0.0
/drone-fly-app/src/main/java/com/expediagroup/dataplatform/dronefly/app/context/CommonBeans.java
1
/**
2
 * Copyright (C) 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.expediagroup.dataplatform.dronefly.app.context;
17

18
import java.util.List;
19
import java.util.Properties;
20
import java.util.stream.Collectors;
21

22
import org.apache.hadoop.hive.conf.HiveConf;
23
import org.apache.hadoop.hive.metastore.MetaStoreEventListener;
24
import org.apache.hadoop.hive.metastore.api.MetaException;
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27
import org.springframework.beans.factory.annotation.Value;
28
import org.springframework.boot.context.properties.ConfigurationProperties;
29
import org.springframework.context.annotation.Bean;
30
import org.springframework.context.annotation.Configuration;
31
import org.springframework.context.annotation.Primary;
32

33
import com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaMessageReader;
34
import com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaMessageReader.KafkaMessageReaderBuilder;
35
import com.expediagroup.dataplatform.dronefly.app.messaging.MessageReaderAdapter;
36
import com.expediagroup.dataplatform.dronefly.app.service.ListenerCatalog;
37
import com.expediagroup.dataplatform.dronefly.app.service.factory.ListenerCatalogFactory;
38

39
@Configuration
40
public class CommonBeans {
×
41

UNCOV
42
  private static final Logger log = LoggerFactory.getLogger(CommonBeans.class);
×
43
  public static final String CONSUMER_PROPERTIES_PREFIX = "apiary.messaging.consumer";
44

45
  @Value("${instance.name:drone-fly}")
46
  private String instanceName;
47

48
  @Value("${apiary.bootstrap.servers}")
49
  private String bootstrapServers;
50

51
  @Value("${apiary.kafka.topic.name}")
52
  private String topicName;
53

54
  @Value("${apiary.listener.list:}")
55
  private String confListenerList;
56

57
  @Bean
58
  public HiveConf hiveConf() {
UNCOV
59
    return new HiveConf();
×
60
  }
61

62
  @Bean
63
  @Primary
64
  @ConfigurationProperties(CONSUMER_PROPERTIES_PREFIX)
65
  public Properties getEnvProperties() {
UNCOV
66
    return new Properties();
×
67
  }
68

69
  @Bean
70
  public ListenerCatalog listenerCatalog(HiveConf conf) throws MetaException {
71
    ListenerCatalog listenerCatalog = new ListenerCatalogFactory(conf).newInstance(confListenerList);
×
72
    List<MetaStoreEventListener> listenerList = listenerCatalog.getListeners();
×
73
    String listeners = listenerList.stream().map(x -> x.getClass().getName()).collect(Collectors.joining(", "));
×
74
    log.info("DroneFly is starting with {} listeners: {}", listenerList.size(), listeners);
×
UNCOV
75
    return listenerCatalog;
×
76
  }
77

78
  @Bean
79
  public MessageReaderAdapter messageReaderAdapter() {
80
    Properties consumerProperties = getConsumerProperties();
×
81
    KafkaMessageReader delegate = KafkaMessageReaderBuilder.
×
NEW
82
        builder(bootstrapServers, topicName, instanceName).
×
NEW
83
        withConsumerProperties(consumerProperties).
×
NEW
84
        build();
×
UNCOV
85
    return new MessageReaderAdapter(delegate);
×
86
  }
87

88
  private Properties getConsumerProperties() {
89
    Properties consumerProperties = new Properties();
×
90
    getEnvProperties().forEach((key, value) -> {
×
NEW
91
      consumerProperties.put(key.toString(), value.toString());
×
NEW
92
      log.info("Consumer property {} set with value: {}", key, value);
×
NEW
93
    });
×
UNCOV
94
    return consumerProperties;
×
95
  }
96
}
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