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

HotelsDotCom / waggle-dance / #452

22 Sep 2025 01:46PM UTC coverage: 69.253% (-0.004%) from 69.257%
#452

push

web-flow
feature: added traffic control glue config (#352)

* feature: added traffic control glue config

* fixed conflict

14 of 17 new or added lines in 2 files covered. (82.35%)

2624 of 3789 relevant lines covered (69.25%)

0.69 hits per line

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

60.55
/waggle-dance-api/src/main/java/com/hotels/bdp/waggledance/api/model/AbstractMetaStore.java
1
/**
2
 * Copyright (C) 2016-2025 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.api.model;
17

18
import static com.hotels.bdp.waggledance.api.model.ConnectionType.DIRECT;
19
import static com.hotels.bdp.waggledance.api.model.ConnectionType.TUNNELED;
20

21
import java.beans.Transient;
22
import java.util.Collections;
23
import java.util.HashMap;
24
import java.util.List;
25
import java.util.Map;
26

27
import javax.validation.Valid;
28
import javax.validation.constraints.NotBlank;
29
import javax.validation.constraints.NotNull;
30

31
import com.fasterxml.jackson.annotation.JsonIgnore;
32
import com.fasterxml.jackson.annotation.JsonProperty;
33
import com.fasterxml.jackson.annotation.JsonSubTypes;
34
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
35
import com.fasterxml.jackson.annotation.JsonTypeInfo;
36
import com.google.common.base.MoreObjects;
37
import com.google.common.base.Objects;
38
import com.google.common.collect.HashBiMap;
39

40
import com.hotels.hcommon.hive.metastore.client.tunnelling.MetastoreTunnel;
41

42
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "federationType")
43
@JsonSubTypes({
44
    @Type(value = PrimaryMetaStore.class, name = "PRIMARY"),
45
    @Type(value = FederatedMetaStore.class, name = "FEDERATED") })
46
public abstract class AbstractMetaStore {
47
  private String databasePrefix;
48
  private String hiveMetastoreFilterHook;
49
  private List<String> writableDatabaseWhitelist;
50
  private List<String> mappedDatabases;
51
  private @Valid List<MappedTables> mappedTables;
52
  private Map<String, String> databaseNameMapping = new HashMap<>();
1✔
53
  private @NotBlank String name;
54
  private String remoteMetaStoreUris;
55
  private @Valid MetastoreTunnel metastoreTunnel;
56
  private @NotNull AccessControlType accessControlType = AccessControlType.READ_ONLY;
1✔
57
  private transient @JsonProperty @NotNull MetaStoreStatus status = MetaStoreStatus.UNKNOWN;
1✔
58
  private long latency = 0;
1✔
59
  private transient @JsonIgnore HashBiMap<String, String> databaseNameBiMapping = HashBiMap.create();
1✔
60
  private boolean impersonationEnabled;
61
  private Map<String, String> configurationProperties = new HashMap<>();
1✔
62
  private GlueConfig glueConfig;
63
  private String readOnlyRemoteMetaStoreUris;
64
  private GlueConfig readOnlyGlueConfig;
65

66
  public AbstractMetaStore() {}
1✔
67

68
  public AbstractMetaStore(String name, String remoteMetaStoreUris, AccessControlType accessControlType) {
×
69
    this.name = name;
×
70
    this.remoteMetaStoreUris = remoteMetaStoreUris;
×
71
    this.accessControlType = accessControlType;
×
72
  }
×
73

74
  public AbstractMetaStore(
75
      String name,
76
      String remoteMetaStoreUris,
77
      AccessControlType accessControlType,
78
      List<String> writableDatabaseWhitelist) {
1✔
79
    this.name = name;
1✔
80
    this.remoteMetaStoreUris = remoteMetaStoreUris;
1✔
81
    this.accessControlType = accessControlType;
1✔
82
    this.writableDatabaseWhitelist = writableDatabaseWhitelist;
1✔
83
  }
1✔
84

85
  public AbstractMetaStore(
86
          String name,
87
          String remoteMetaStoreUris,
88
          String databasePrefix,
89
          AccessControlType accessControlType,
90
          List<String> writableDatabaseWhitelist) {
1✔
91
    this.name = name;
1✔
92
    this.remoteMetaStoreUris = remoteMetaStoreUris;
1✔
93
    this.databasePrefix = databasePrefix;
1✔
94
    this.accessControlType = accessControlType;
1✔
95
    this.writableDatabaseWhitelist = writableDatabaseWhitelist;
1✔
96
  }
1✔
97

98

99
  public static FederatedMetaStore newFederatedInstance(String name, String remoteMetaStoreUris) {
100
    return new FederatedMetaStore(name, remoteMetaStoreUris);
1✔
101
  }
102

103
  public static PrimaryMetaStore newPrimaryInstance(
104
      String name,
105
      String remoteMetaStoreUris,
106
      AccessControlType accessControlType) {
107
    return new PrimaryMetaStore(name, remoteMetaStoreUris, accessControlType);
1✔
108
  }
109

110
  public static PrimaryMetaStore newPrimaryInstance(String name, String remoteMetaStoreUris) {
111
    return new PrimaryMetaStore(name, remoteMetaStoreUris, AccessControlType.READ_ONLY);
1✔
112
  }
113

114
  public static PrimaryMetaStore newPrimaryInstance(
115
          String name,
116
          String remoteMetaStoreUris,
117
          String databasePrefix,
118
          AccessControlType accessControlType) {
119
    return new PrimaryMetaStore(name, remoteMetaStoreUris, databasePrefix, accessControlType);
1✔
120
  }
121

122
  public String getDatabasePrefix() {
123
    return databasePrefix;
1✔
124
  }
125

126
  public void setDatabasePrefix(String databasePrefix) {
127
    this.databasePrefix = databasePrefix;
1✔
128
  }
1✔
129

130
  public String getHiveMetastoreFilterHook() {
131
    return hiveMetastoreFilterHook;
1✔
132
  }
133

134
  public void setHiveMetastoreFilterHook(String hiveMetastoreFilterHook) {
135
    this.hiveMetastoreFilterHook = hiveMetastoreFilterHook;
×
136
  }
×
137

138
  public String getName() {
139
    return name;
1✔
140
  }
141

142
  public void setName(String name) {
143
    this.name = name;
1✔
144
  }
1✔
145

146
  public String getRemoteMetaStoreUris() {
147
    return remoteMetaStoreUris;
1✔
148
  }
149

150
  public void setRemoteMetaStoreUris(String remoteMetaStoreUris) {
151
    this.remoteMetaStoreUris = remoteMetaStoreUris;
1✔
152
  }
1✔
153

154
  public String getReadOnlyRemoteMetaStoreUris() {
155
    return readOnlyRemoteMetaStoreUris;
1✔
156
  }
157
  
158
  public void setReadOnlyRemoteMetaStoreUris(String readOnlyRemoteMetaStoreUris) {
159
    this.readOnlyRemoteMetaStoreUris = readOnlyRemoteMetaStoreUris;
×
160
  }
×
161
  
162
  public MetastoreTunnel getMetastoreTunnel() {
163
    return metastoreTunnel;
1✔
164
  }
165

166
  public void setMetastoreTunnel(MetastoreTunnel metastoreTunnel) {
167
    this.metastoreTunnel = metastoreTunnel;
1✔
168
  }
1✔
169

170
  public ConnectionType getConnectionType() {
171
    if (getMetastoreTunnel() != null) {
1✔
172
      return TUNNELED;
×
173
    }
174
    return DIRECT;
1✔
175
  }
176

177
  abstract public FederationType getFederationType();
178

179
  public AccessControlType getAccessControlType() {
180
    return accessControlType;
1✔
181
  }
182

183
  public void setAccessControlType(AccessControlType accessControlType) {
184
    this.accessControlType = accessControlType;
1✔
185
  }
1✔
186

187
  public List<String> getWritableDatabaseWhiteList() {
188
    if (writableDatabaseWhitelist == null) {
1✔
189
      return Collections.emptyList();
1✔
190
    }
191
    return Collections.unmodifiableList(writableDatabaseWhitelist);
1✔
192
  }
193

194
  public void setWritableDatabaseWhiteList(List<String> writableDatabaseWhitelist) {
195
    this.writableDatabaseWhitelist = writableDatabaseWhitelist;
×
196
  }
×
197

198
  public long getLatency() {
199
    return latency;
1✔
200
  }
201

202
  public void setLatency(long latency) {
203
    this.latency = latency;
×
204
  }
×
205

206
  public List<String> getMappedDatabases() {
207
    return mappedDatabases;
1✔
208
  }
209

210
  public void setMappedDatabases(List<String> mappedDatabases) {
211
    this.mappedDatabases = mappedDatabases;
1✔
212
  }
1✔
213

214
  public List<MappedTables> getMappedTables() {
215
    return mappedTables;
1✔
216
  }
217

218
  public void setMappedTables(List<MappedTables> mappedTables) {
219
    this.mappedTables = mappedTables;
1✔
220
  }
1✔
221

222
  public Map<String, String> getDatabaseNameMapping() {
223
    return databaseNameMapping;
1✔
224
  }
225

226
  public void setDatabaseNameMapping(Map<String, String> databaseNameMapping) {
227
    if (databaseNameMapping == null) {
1✔
228
      databaseNameMapping = Collections.emptyMap();
1✔
229
    }
230
    this.databaseNameMapping = Collections.unmodifiableMap(databaseNameMapping);
1✔
231
    databaseNameBiMapping = HashBiMap.create(databaseNameMapping);
1✔
232
  }
1✔
233

234
  public GlueConfig getGlueConfig() {
235
    return glueConfig;
1✔
236
  }
237

238
  public void setGlueConfig(GlueConfig glueConfig) {
239
    this.glueConfig = glueConfig;
×
240
  }
×
241

242
  public GlueConfig getReadOnlyGlueConfig() {
243
    return readOnlyGlueConfig;
1✔
244
  }
245

246
  public void setReadOnlyGlueConfig(GlueConfig readOnlyGlueConfig) {
NEW
247
    this.readOnlyGlueConfig = readOnlyGlueConfig;
×
NEW
248
  }
×
249
  
250
  @Transient
251
  public HashBiMap<String, String> getDatabaseNameBiMapping() {
252
    return databaseNameBiMapping;
1✔
253
  }
254

255
  public Map<String, String> getConfigurationProperties() {
256
    return configurationProperties;
1✔
257
  }
258

259
  public void setConfigurationProperties(
260
          Map<String, String> configurationProperties) {
261
    this.configurationProperties = configurationProperties;
×
262
  }
×
263
  
264
  @Transient
265
  public MetaStoreStatus getStatus() {
266
    return status;
×
267
  }
268

269
  @Transient
270
  public void setStatus(MetaStoreStatus status) {
271
    this.status = status;
×
272
  }
×
273

274
  public boolean isImpersonationEnabled() {
275
    return impersonationEnabled;
1✔
276
  }
277

278
  public void setImpersonationEnabled(boolean impersonationEnabled) {
279
    this.impersonationEnabled = impersonationEnabled;
×
280
  }
×
281

282
  @Override
283
  public int hashCode() {
284
    return Objects.hashCode(name);
×
285
  }
286

287
  @Override
288
  public boolean equals(Object obj) {
289
    if (obj == null) {
1✔
290
      return false;
1✔
291
    }
292
    if (getClass() != obj.getClass()) {
×
293
      return false;
×
294
    }
295
    final AbstractMetaStore other = (AbstractMetaStore) obj;
×
296
    return Objects.equal(name, other.name);
×
297
  }
298

299
  @Override
300
  public String toString() {
301
    return MoreObjects
×
302
        .toStringHelper(this)
×
303
        .add("name", name)
×
304
        .add("databasePrefix", databasePrefix)
×
305
        .add("federationType", getFederationType())
×
306
        .add("remoteMetaStoreUris", remoteMetaStoreUris)
×
307
        .add("readOnlyRemoteMetaStoreUris", readOnlyRemoteMetaStoreUris)
×
308
        .add("metastoreTunnel", metastoreTunnel)
×
309
        .add("accessControlType", accessControlType)
×
310
        .add("writableDatabaseWhiteList", writableDatabaseWhitelist)
×
311
        .add("latency", latency)
×
312
        .add("status", status)
×
313
        .toString();
×
314
  }
315
}
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