Skip to content

Commit

Permalink
undo rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jingy-li committed Feb 7, 2025
1 parent a1b2dce commit 8836dc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public DaVinciBlobFinder(ClientConfig clientConfig) {
* @param storeName
* @return the store client
*/
AbstractAvroStoreClient startStoreClient(String storeName) {
AbstractAvroStoreClient getStoreClient(String storeName) {
return storeToClientMap.computeIfAbsent(storeName, k -> {
// update the config with respective store name
ClientConfig storeClientConfig = ClientConfig.cloneConfig(clientConfig).setStoreName(storeName);
Expand All @@ -60,7 +60,7 @@ AbstractAvroStoreClient startStoreClient(String storeName) {

@Override
public BlobPeersDiscoveryResponse discoverBlobPeers(String storeName, int version, int partition) {
AbstractAvroStoreClient storeClient = startStoreClient(storeName);
AbstractAvroStoreClient storeClient = getStoreClient(storeName);

String uri = buildUriForBlobDiscovery(storeName, version, partition);
CompletableFuture<BlobPeersDiscoveryResponse> futureResponse = CompletableFuture.supplyAsync(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void setUp() {

@Test
public void testDiscoverBlobPeers_Success() {
Mockito.doReturn(storeClient).when(daVinciBlobFinder).startStoreClient(storeName);
Mockito.doReturn(storeClient).when(daVinciBlobFinder).getStoreClient(storeName);

String responseBodyJson =
"{\"error\":false,\"errorMessage\":\"\",\"discoveryResult\":[\"host1\",\"host2\",\"host3\"]}";
Expand All @@ -68,7 +68,7 @@ public void testDiscoverBlobPeers_Success() {

@Test
public void testDiscoverBlobPeers_CallsTransportClientWithCorrectURI() {
Mockito.doReturn(storeClient).when(daVinciBlobFinder).startStoreClient(storeName);
Mockito.doReturn(storeClient).when(daVinciBlobFinder).getStoreClient(storeName);
String responseBodyJson =
"{\"error\":false,\"errorMessage\":\"\",\"discoveryResult\":[\"host1\",\"host2\",\"host3\"]}";
byte[] responseBody = responseBodyJson.getBytes(StandardCharsets.UTF_8);
Expand All @@ -90,7 +90,7 @@ public void testDiscoverBlobPeers_CallsTransportClientWithCorrectURI() {

@Test
public void testDiscoverBlobPeers_ContentDeserializationError() throws Exception {
Mockito.doReturn(storeClient).when(daVinciBlobFinder).startStoreClient(storeName);
Mockito.doReturn(storeClient).when(daVinciBlobFinder).getStoreClient(storeName);

String responseBodyJson = "{\"error\":true,\"errorMessage\":\"some error\",\"discoveryResult\":[]}";
byte[] responseBody = responseBodyJson.getBytes(StandardCharsets.UTF_8);
Expand All @@ -112,7 +112,7 @@ public void testDiscoverBlobPeers_ContentDeserializationError() throws Exception

@Test
public void testDiscoverBlobPeers_ClientWithIncorrectUri() {
Mockito.doReturn(storeClient).when(daVinciBlobFinder).startStoreClient(storeName);
Mockito.doReturn(storeClient).when(daVinciBlobFinder).getStoreClient(storeName);

CompletableFuture<byte[]> futureResponse = new CompletableFuture<>();
futureResponse.completeExceptionally(new RuntimeException("Test Exception"));
Expand Down Expand Up @@ -145,13 +145,13 @@ public void testGetStoreClient() throws IOException {
ClientFactory.setTransportClientProvider(clientConfigTransportClientFunction);

// ClientConfig is initialized with storeName
AbstractAvroStoreClient storeClient = daVinciBlobFinder.startStoreClient(storeName);
AbstractAvroStoreClient storeClient = daVinciBlobFinder.getStoreClient(storeName);
Assert.assertNotNull(storeClient);
Assert.assertEquals(storeClient.getStoreName(), storeName);

// Even if the daVinciBlobFinder is initialized at the beginning with "storeName", the getStoreClient
// method should be able to return a store client for "storeName2"
AbstractAvroStoreClient storeClient2 = daVinciBlobFinder.startStoreClient("storeName2");
AbstractAvroStoreClient storeClient2 = daVinciBlobFinder.getStoreClient("storeName2");
Assert.assertNotNull(storeClient2);
Assert.assertEquals(storeClient2.getStoreName(), "storeName2");

Expand Down

0 comments on commit 8836dc0

Please sign in to comment.