Skip to content

Commit

Permalink
Fix some unit tests because of not save the yaml config not timely (#289
Browse files Browse the repository at this point in the history
)

.
  • Loading branch information
flaming-archer authored Sep 6, 2023
1 parent a345e74 commit 88cc45a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2016-2019 Expedia, Inc.
* Copyright (C) 2016-2023 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,4 +31,5 @@ public interface FederatedMetaStoreStorage {

void update(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore);

void saveFederation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public void loadFederation() {
}

@PreDestroy
@Override
public void saveFederation() {
if (writeConfigOnShutdown) {
yamlMarshaller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.hotels.bdp.waggledance.conf.GraphiteConfiguration;
import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration;
import com.hotels.bdp.waggledance.conf.YamlStorageConfiguration;
import com.hotels.bdp.waggledance.mapping.service.FederatedMetaStoreStorage;
import com.hotels.bdp.waggledance.server.MetaStoreProxyServer;
import com.hotels.bdp.waggledance.yaml.YamlFactory;
import com.hotels.hcommon.hive.metastore.client.tunnelling.MetastoreTunnel;
Expand Down Expand Up @@ -327,6 +328,10 @@ private MetaStoreProxyServer getProxy() {
return applicationContext.getBean(MetaStoreProxyServer.class);
}

private FederatedMetaStoreStorage getFederatedMetaStoreStorage() {
return applicationContext.getBean(FederatedMetaStoreStorage.class);
}

public Map<String, String> run() throws Exception {
Map<String, String> props = populateProperties();
WaggleDance.register(this);
Expand All @@ -348,6 +353,7 @@ public void waitForService() throws Exception {
public void stop() throws Exception {
if (applicationContext != null) {
getProxy().stop();
getFederatedMetaStoreStorage().saveFederation();
long delay = 1;
while (applicationContext != null) {
if (delay >= 15) {
Expand Down

0 comments on commit 88cc45a

Please sign in to comment.