Skip to content

Commit

Permalink
Add accounts-dod support in the Java SDK (#114)
Browse files Browse the repository at this point in the history
## Changes
Adds support for the accounts-dod.cloud.databricks.us endpoint as an
accounts endpoint in the SDK.

## Tests
- [x] Unit test
  • Loading branch information
mgyucht authored Jun 30, 2023
1 parent 6d7b6b1 commit 844d80d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,7 @@ public boolean isAccountClient() {
if (host == null) {
return false;
}
if (host.contains("https://accounts.")) {
return true;
}
return false;
return host.startsWith("https://accounts.") || host.startsWith("https://accounts-dod.");
}

public OpenIDConnectEndpoints getOidcEndpoints() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.databricks.sdk.core;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

public class DatabricksConfigTest {
@Test
public void testIsAccountHost() {
assertTrue(
new DatabricksConfig().setHost("https://accounts.azuredatabricks.net").isAccountClient());
}

@Test
public void testIsAccountHostDod() {
assertTrue(
new DatabricksConfig()
.setHost("https://accounts-dod.cloud.databricks.us")
.isAccountClient());
}

@Test
public void testIsAccountHostWorkspace() {
assertFalse(
new DatabricksConfig().setHost("https://westeurope.azuredatabricks.net").isAccountClient());
}
}

0 comments on commit 844d80d

Please sign in to comment.