Skip to content

Commit

Permalink
Set StorageDescriptor location
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyx committed Jul 29, 2024
1 parent 1ff4846 commit 9508e99
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import static com.hotels.bdp.waggledance.api.model.AbstractMetaStore.newFederatedInstance;

import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -39,7 +38,6 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
Expand Down Expand Up @@ -72,7 +70,6 @@ public class MetaStoreMappingFactoryImplTest {
new WaggleDanceConfiguration(), new SplitTrafficMetastoreClientFactory());

private MetaStoreMappingFactoryImpl factory;
public @Rule TemporaryFolder temporaryFolder = new TemporaryFolder();

@Before
public void init() {
Expand Down Expand Up @@ -173,12 +170,11 @@ public void loadMetastoreFilterHookWithCustomConfig() throws Exception{
assertThat(filterHook, instanceOf(PrefixingMetastoreFilter.class));

Table table = new Table();
StorageDescriptor sd = new StorageDescriptor();
File localWarehouseUri = temporaryFolder.newFolder("local-warehouse");
sd.setLocation(new File(localWarehouseUri,"local_database/local_table").toURI().toString());
table.setSd(sd);
StorageDescriptor sd = new StorageDescriptor();
sd.setLocation("file:///tmp/local_database/local_table");
table.setSd(sd);

String oldLocation=sd.getLocation();
assertThat(filterHook.filterTable(table).getSd().getLocation(), equalTo("prefix-test-" + oldLocation ) );
String oldLocation=sd.getLocation();
assertThat(filterHook.filterTable(table).getSd().getLocation(), equalTo("prefix-test-" + oldLocation ) );
}
}

0 comments on commit 9508e99

Please sign in to comment.