diff --git a/.codegen.json b/.codegen.json index 62e4908e9..b0e1d9a7c 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1,6 +1,6 @@ { "mode": "java_v0", - "api_changelog": true, + "api_changelog": false, "sync": { "allow_from_packages": [ "**/*.java", diff --git a/.codegen/_last_sha b/.codegen/_last_sha index ab0b9f674..75fc7edbc 100644 --- a/.codegen/_last_sha +++ b/.codegen/_last_sha @@ -1 +1 @@ -7216eeb8c5e517080d626f64b36209fea64788b3 \ No newline at end of file +880d3221a1560a48172008865530ea224f5905a4 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fe24da69a..588937433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Version changelog +## Release v0.159.0 (2026-10-02) + +### API Changes +* Add `environment` field for `com.databricks.sdk.service.sandbox.SandboxSpec`. +* Add `TABLE_FOREIGN_DELTA_DELTASHARING` enum value for `com.databricks.sdk.service.catalog.SecurableKind`. +* [Breaking] Change `environmentVariablesKey` field for `com.databricks.sdk.service.jobs.JobEnvironmentVariables` to be required. +* Change `environmentVariablesKey` field for `com.databricks.sdk.service.jobs.JobEnvironmentVariables` to be required. + ## Release v0.158.0 (2026-10-01) ### API Changes diff --git a/databricks-sdk-java/lockfile.json b/databricks-sdk-java/lockfile.json index c39f4f1e8..05e567000 100644 --- a/databricks-sdk-java/lockfile.json +++ b/databricks-sdk-java/lockfile.json @@ -1,7 +1,7 @@ { "artifactId": "databricks-sdk-java", "groupId": "com.databricks", - "version": "0.158.0", + "version": "0.159.0", "lockFileVersion": 1, "dependencies": [ { diff --git a/databricks-sdk-java/pom.xml b/databricks-sdk-java/pom.xml index 27990837c..9474165f9 100644 --- a/databricks-sdk-java/pom.xml +++ b/databricks-sdk-java/pom.xml @@ -5,7 +5,7 @@ com.databricks databricks-sdk-parent - 0.158.0 + 0.159.0 databricks-sdk-java Databricks SDK for Java diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java index 5a67b6d37..9e9eb1460 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java @@ -36,7 +36,7 @@ public String getValue() { // TODO: check if reading from // /META-INF/maven/com.databricks/databrics-sdk-java/pom.properties // or getClass().getPackage().getImplementationVersion() is enough. - private static final String version = "0.158.0"; + private static final String version = "0.159.0"; public static void withProduct(String product, String productVersion) { UserAgent.product = product; diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableKind.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableKind.java index a6a0868ab..467063ccb 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableKind.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableKind.java @@ -27,6 +27,7 @@ public enum SecurableKind { TABLE_FOREIGN_BIGQUERY, TABLE_FOREIGN_DATABRICKS, TABLE_FOREIGN_DELTASHARING, + TABLE_FOREIGN_DELTA_DELTASHARING, TABLE_FOREIGN_HIVE_METASTORE, TABLE_FOREIGN_HIVE_METASTORE_DBFS_EXTERNAL, TABLE_FOREIGN_HIVE_METASTORE_DBFS_MANAGED, diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/UpdateFeatureRequest.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/UpdateFeatureRequest.java index b7516e5f1..b9b4aa729 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/UpdateFeatureRequest.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/UpdateFeatureRequest.java @@ -11,7 +11,7 @@ @Generated public class UpdateFeatureRequest { - /** Feature to update. */ + /** Feature whose full_name identifies the target. Only description is mutable. */ @JsonProperty("feature") private Feature feature; @@ -22,7 +22,7 @@ public class UpdateFeatureRequest { */ @JsonIgnore private String fullName; - /** The list of fields to update. */ + /** Fields to update. The only supported path is description. */ @JsonIgnore @QueryParam("update_mask") private String updateMask; diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateCdfConfigRequest.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateCdfConfigRequest.java index 85fb29ff4..8f44bc49a 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateCdfConfigRequest.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/CreateCdfConfigRequest.java @@ -12,8 +12,8 @@ @Generated public class CreateCdfConfigRequest { /** - * The CdfConfig to create. The catalog, schema, and postgres_schema fields are required; all - * other fields are output only and ignored on input. + * The CdfConfig to create. The catalog, schema, and postgres_schema fields are required; + * service_principal is optional. All other fields are output only and ignored on input. */ @JsonProperty("cdf_config") private CdfConfig cdfConfig; diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java index bafd715ac..08a746247 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresAPI.java @@ -240,8 +240,8 @@ public CdfConfig getCdfConfig(String name) { } /** - * Get a single Lakebase CDF configuration, including the source Postgres schema, target Unity - * Catalog schema, and the identity under which writes are authorized. + * Get a single Lakebase CDF configuration, including the source Postgres schema and target Unity + * Catalog schema. */ public CdfConfig getCdfConfig(GetCdfConfigRequest request) { return impl.getCdfConfig(request); diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresService.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresService.java index 522f83252..16dc997e4 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresService.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/postgres/PostgresService.java @@ -109,8 +109,8 @@ DatabaseCredential generateDatabaseCredential( Catalog getCatalog(GetCatalogRequest getCatalogRequest); /** - * Get a single Lakebase CDF configuration, including the source Postgres schema, target Unity - * Catalog schema, and the identity under which writes are authorized. + * Get a single Lakebase CDF configuration, including the source Postgres schema and target Unity + * Catalog schema. */ CdfConfig getCdfConfig(GetCdfConfigRequest getCdfConfigRequest); diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/EnvironmentSpec.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/EnvironmentSpec.java new file mode 100644 index 000000000..c24d10277 --- /dev/null +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/EnvironmentSpec.java @@ -0,0 +1,46 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package com.databricks.sdk.service.sandbox; + +import com.databricks.sdk.support.Generated; +import com.databricks.sdk.support.ToStringer; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +@Generated +public class EnvironmentSpec { + /** + * A Unity Catalog container artifact (e.g. `catalog.schema.folder.image:tag`) to run as the + * sandbox environment. When set, this image is used as the environment instead of resolving a + * managed image from `environment_version`. + */ + @JsonProperty("image_uri") + private String imageUri; + + public EnvironmentSpec setImageUri(String imageUri) { + this.imageUri = imageUri; + return this; + } + + public String getImageUri() { + return imageUri; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EnvironmentSpec that = (EnvironmentSpec) o; + return Objects.equals(imageUri, that.imageUri); + } + + @Override + public int hashCode() { + return Objects.hash(imageUri); + } + + @Override + public String toString() { + return new ToStringer(EnvironmentSpec.class).add("imageUri", imageUri).toString(); + } +} diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/SandboxSpec.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/SandboxSpec.java index d63edad13..ddf7ce3d7 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/SandboxSpec.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/service/sandbox/SandboxSpec.java @@ -13,6 +13,10 @@ public class SandboxSpec { @JsonProperty("compute") private ComputeSpec compute; + /** The execution environment to use for the sandbox. */ + @JsonProperty("environment") + private EnvironmentSpec environment; + public SandboxSpec setCompute(ComputeSpec compute) { this.compute = compute; return this; @@ -22,21 +26,33 @@ public ComputeSpec getCompute() { return compute; } + public SandboxSpec setEnvironment(EnvironmentSpec environment) { + this.environment = environment; + return this; + } + + public EnvironmentSpec getEnvironment() { + return environment; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SandboxSpec that = (SandboxSpec) o; - return Objects.equals(compute, that.compute); + return Objects.equals(compute, that.compute) && Objects.equals(environment, that.environment); } @Override public int hashCode() { - return Objects.hash(compute); + return Objects.hash(compute, environment); } @Override public String toString() { - return new ToStringer(SandboxSpec.class).add("compute", compute).toString(); + return new ToStringer(SandboxSpec.class) + .add("compute", compute) + .add("environment", environment) + .toString(); } } diff --git a/databricks-sdk-java/src/test/java/com/databricks/sdk/AccountClientTest.java b/databricks-sdk-java/src/test/java/com/databricks/sdk/AccountClientTest.java index f529d3525..ef0fd414e 100644 --- a/databricks-sdk-java/src/test/java/com/databricks/sdk/AccountClientTest.java +++ b/databricks-sdk-java/src/test/java/com/databricks/sdk/AccountClientTest.java @@ -1,10 +1,15 @@ package com.databricks.sdk; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.databricks.sdk.core.DatabricksConfig; import com.databricks.sdk.core.HostType; +import com.databricks.sdk.core.http.Response; import com.databricks.sdk.service.provisioning.Workspace; +import java.util.Collections; import org.junit.jupiter.api.Test; public class AccountClientTest { @@ -12,7 +17,7 @@ public class AccountClientTest { @Test public void testGetWorkspaceClientForTraditionalAccount() { DatabricksConfig accountConfig = - new DatabricksConfig() + testConfig() .setHost("https://accounts.cloud.databricks.com") .setAccountId("test-account") .setToken("test-token"); @@ -34,10 +39,7 @@ public void testGetWorkspaceClientForTraditionalAccount() { public void testGetWorkspaceClientForUnifiedHost() { String unifiedHost = "https://unified.databricks.com"; DatabricksConfig accountConfig = - new DatabricksConfig() - .setHost(unifiedHost) - .setAccountId("test-account") - .setToken("test-token"); + testConfig().setHost(unifiedHost).setAccountId("test-account").setToken("test-token"); AccountClient accountClient = new AccountClient(accountConfig); @@ -61,10 +63,7 @@ public void testGetWorkspaceClientForUnifiedHost() { public void testGetWorkspaceClientForSpogHostDoesNotMutateAccountConfig() { String spogHost = "https://mycompany.databricks.com"; DatabricksConfig accountConfig = - new DatabricksConfig() - .setHost(spogHost) - .setAccountId("test-account") - .setToken("test-token"); + testConfig().setHost(spogHost).setAccountId("test-account").setToken("test-token"); AccountClient accountClient = new AccountClient(accountConfig); @@ -91,4 +90,10 @@ public void testGetWorkspaceClientForSpogHostDoesNotMutateAccountConfig() { assertEquals(spogHost, wc1.config().getHost()); assertEquals(spogHost, wc2.config().getHost()); } + + private static DatabricksConfig testConfig() { + DatabricksConfig config = new DatabricksConfig(); + config.setHttpClient(request -> new Response(request, 200, "OK", Collections.emptyMap(), "{}")); + return config; + } } diff --git a/databricks-sdk-java/src/test/java/com/databricks/sdk/ClientHttpFixtureTest.java b/databricks-sdk-java/src/test/java/com/databricks/sdk/ClientHttpFixtureTest.java new file mode 100644 index 000000000..95a5506dc --- /dev/null +++ b/databricks-sdk-java/src/test/java/com/databricks/sdk/ClientHttpFixtureTest.java @@ -0,0 +1,187 @@ +package com.databricks.sdk; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import com.databricks.sdk.core.DatabricksConfig; +import com.databricks.sdk.core.DummyCredentialsProvider; +import com.databricks.sdk.core.FixtureServer; +import com.databricks.sdk.core.FixtureServer.FixtureMapping; +import com.databricks.sdk.service.iam.ListAccountUsersRequest; +import com.databricks.sdk.service.iam.ListUsersRequest; +import com.databricks.sdk.service.iam.MeRequest; +import com.databricks.sdk.service.iam.User; +import com.databricks.sdk.service.provisioning.Workspace; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +public class ClientHttpFixtureTest { + private static final String ACCOUNT_ID = "00000000-0000-0000-0000-000000000000"; + private static final long WORKSPACE_ID = 123456789L; + + @Test + void derivedWorkspaceClientIsIsolatedAndRoutesAtHttpBoundary() throws IOException { + Map> workspaceHeader = + Collections.singletonMap( + "X-Databricks-Workspace-Id", Collections.singletonList(String.valueOf(WORKSPACE_ID))); + FixtureMapping getWorkspace = + fixture( + "GET", + "/api/2.0/accounts/" + ACCOUNT_ID + "/workspaces/" + WORKSPACE_ID, + "{\"account_id\":\"" + + ACCOUNT_ID + + "\",\"deployment_name\":\"fixture-workspace\",\"workspace_id\":" + + WORKSPACE_ID + + ",\"workspace_name\":\"fixture\",\"workspace_status\":\"RUNNING\"}"); + FixtureMapping currentUser = + new FixtureMapping.Builder() + .validateMethod("GET") + .validatePath("/api/2.0/preview/scim/v2/Me") + .validateHeadersPresent(workspaceHeader) + .withResponse( + "{\"active\":true,\"id\":\"user-1\"," + "\"userName\":\"fixture@databricks.com\"}", + 200) + .build(); + + try (FixtureServer server = new FixtureServer().with(getWorkspace).with(currentUser)) { + DatabricksConfig accountConfig = + fixtureConfig(server).setAccountId(ACCOUNT_ID).setWorkspaceId(null); + AccountClient account = new AccountClient(accountConfig); + + Workspace workspace = account.workspaces().get(WORKSPACE_ID); + WorkspaceClient derived = account.getWorkspaceClient(workspace); + User me = derived.currentUser().me(new MeRequest()); + + assertEquals("fixture@databricks.com", me.getUserName()); + assertEquals(server.getUrl(), derived.config().getHost()); + assertEquals(String.valueOf(WORKSPACE_ID), derived.config().getWorkspaceId()); + assertEquals(server.getUrl(), account.config().getHost()); + assertEquals(ACCOUNT_ID, account.config().getAccountId()); + assertNull(account.config().getWorkspaceId()); + server.assertAllFixturesConsumed(); + } + } + + @Test + void workspaceScimPaginationAdvancesStartIndexAtHttpBoundary() throws IOException { + List pages = + Arrays.asList( + fixture( + "GET", + "/api/2.0/preview/scim/v2/Users?count=2&startIndex=1", + usersPage( + "{\"active\":true,\"id\":\"user-1\"," + + "\"userName\":\"one@databricks.com\"}," + + "{\"active\":true,\"id\":\"user-2\"," + + "\"userName\":\"two@databricks.com\"}", + 2, + 1, + 3)), + fixture( + "GET", + "/api/2.0/preview/scim/v2/Users?count=2&startIndex=3", + usersPage( + "{\"active\":true,\"id\":\"user-3\"," + + "\"userName\":\"three@databricks.com\"}", + 1, + 3, + 3)), + fixture( + "GET", + "/api/2.0/preview/scim/v2/Users?count=2&startIndex=4", + usersPage("", 0, 4, 3))); + + try (FixtureServer server = new FixtureServer().with(pages)) { + WorkspaceClient workspace = new WorkspaceClient(fixtureConfig(server)); + + List userNames = + userNames(workspace.users().list(new ListUsersRequest().setCount(2L))); + + assertEquals( + Arrays.asList("one@databricks.com", "two@databricks.com", "three@databricks.com"), + userNames); + server.assertAllFixturesConsumed(); + } + } + + @Test + void accountScimPaginationAdvancesStartIndexAtHttpBoundary() throws IOException { + String endpoint = "/api/2.0/accounts/" + ACCOUNT_ID + "/scim/v2/Users"; + List pages = + Arrays.asList( + fixture( + "GET", + endpoint + "?count=2&startIndex=1", + usersPage( + "{\"active\":true,\"id\":\"user-1\"," + + "\"userName\":\"one@databricks.com\"}," + + "{\"active\":true,\"id\":\"user-2\"," + + "\"userName\":\"two@databricks.com\"}", + 2, + 1, + 3)), + fixture( + "GET", + endpoint + "?count=2&startIndex=3", + usersPage( + "{\"active\":true,\"id\":\"user-3\"," + + "\"userName\":\"three@databricks.com\"}", + 1, + 3, + 3)), + fixture("GET", endpoint + "?count=2&startIndex=4", usersPage("", 0, 4, 3))); + + try (FixtureServer server = new FixtureServer().with(pages)) { + AccountClient account = new AccountClient(fixtureConfig(server).setAccountId(ACCOUNT_ID)); + + List userNames = + userNames(account.users().list(new ListAccountUsersRequest().setCount(2L))); + + assertEquals( + Arrays.asList("one@databricks.com", "two@databricks.com", "three@databricks.com"), + userNames); + server.assertAllFixturesConsumed(); + } + } + + private static DatabricksConfig fixtureConfig(FixtureServer server) { + return new DatabricksConfig() + .setHost(server.getUrl()) + .setCredentialsProvider(new DummyCredentialsProvider()) + .setDisableRetries(true); + } + + private static FixtureMapping fixture(String method, String path, String response) { + return new FixtureMapping.Builder() + .validateMethod(method) + .validatePath(path) + .withResponse(response, 200) + .build(); + } + + private static String usersPage( + String users, long itemsPerPage, long startIndex, long totalResults) { + return "{\"Resources\":[" + + users + + "],\"itemsPerPage\":" + + itemsPerPage + + ",\"startIndex\":" + + startIndex + + ",\"totalResults\":" + + totalResults + + "}"; + } + + private static List userNames(Iterable users) { + List result = new ArrayList<>(); + for (User user : users) { + result.add(user.getUserName()); + } + return result; + } +} diff --git a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/FixtureServer.java b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/FixtureServer.java index c78b8f4cb..36c101bf4 100644 --- a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/FixtureServer.java +++ b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/FixtureServer.java @@ -26,6 +26,7 @@ public static class Builder { private ArrayList validations = new ArrayList<>(); private String response; private int statusCode; + private Map> responseHeaders; private String redirectUrl; private int redirectStatusCode; @@ -104,12 +105,22 @@ public Builder validateBody(String body) { return this; } + public Builder validate(Validation validation) { + this.validations.add(validation); + return this; + } + public Builder withResponse(String response, int statusCode) { this.response = response; this.statusCode = statusCode; return this; } + public Builder withResponseHeaders(Map> responseHeaders) { + this.responseHeaders = responseHeaders; + return this; + } + public Builder withRedirect(String redirectUrl, int redirectStatusCode) { this.redirectUrl = redirectUrl; this.redirectStatusCode = redirectStatusCode; @@ -124,12 +135,13 @@ public FixtureMapping build() { } }; return new FixtureMapping( - validation, response, redirectUrl, redirectStatusCode, statusCode); + validation, response, responseHeaders, redirectUrl, redirectStatusCode, statusCode); } } private final Validation validation; private final String response; + private final Map> responseHeaders; private String redirectUrl; private int redirectStatusCode; private int statusCode; @@ -137,16 +149,19 @@ public FixtureMapping build() { FixtureMapping(Validation validation, String response) { this.validation = validation; this.response = response; + this.responseHeaders = null; } FixtureMapping( Validation validation, String response, + Map> responseHeaders, String redirectUrl, int redirectStatusCode, int statusCode) { this.validation = validation; this.response = response; + this.responseHeaders = responseHeaders; this.redirectUrl = redirectUrl; this.redirectStatusCode = redirectStatusCode; this.statusCode = statusCode; @@ -160,6 +175,10 @@ String getResponse() { return response; } + Map> getResponseHeaders() { + return responseHeaders; + } + int getStatusCode() { return statusCode; } @@ -208,7 +227,8 @@ private void handlerInner(HttpExchange exchange) throws IOException { respond( exchange, 404, - "{\"error_code\":\"NOT_FOUND\",\"message\":\"auto-stubbed by test framework\"}"); + "{\"error_code\":\"NOT_FOUND\",\"message\":\"auto-stubbed by test framework\"}", + null); return; } @@ -229,36 +249,60 @@ private void handlerInner(HttpExchange exchange) throws IOException { respondRedirect(exchange, response.getRedirectUrl(), response.getRedirectStatusCode()); return; } - respondSuccess(exchange, response.getResponse(), response.getStatusCode()); + respondSuccess( + exchange, + response.getResponse(), + response.getStatusCode(), + response.getResponseHeaders()); } - private void respond(HttpExchange exchange, int statusCode, String body) throws IOException { + private void respond( + HttpExchange exchange, + int statusCode, + String body, + Map> responseHeaders) + throws IOException { Headers headers = exchange.getResponseHeaders(); headers.add("Connection", "close"); - headers.add("Content-Type", "text/plain"); - exchange.sendResponseHeaders(statusCode, body.length()); - exchange.getResponseBody().write(body.getBytes()); + if (responseHeaders != null) { + for (Map.Entry> entry : responseHeaders.entrySet()) { + headers.put(entry.getKey(), entry.getValue()); + } + } + if (responseHeaders == null + || responseHeaders.keySet().stream() + .noneMatch(name -> "Content-Type".equalsIgnoreCase(name))) { + headers.add("Content-Type", "text/plain"); + } + byte[] responseBody = body.getBytes(StandardCharsets.UTF_8); + long responseLength = "HEAD".equals(exchange.getRequestMethod()) ? -1 : responseBody.length; + exchange.sendResponseHeaders(statusCode, responseLength); + exchange.getResponseBody().write(responseBody); exchange.close(); } private void respondBadRequest(HttpExchange exchange, String body) throws IOException { - respond(exchange, 400, body); + respond(exchange, 400, body, null); } private void respondInternalServerError(HttpExchange exchange, String body) throws IOException { - respond(exchange, 500, body); + respond(exchange, 500, body, null); } - private void respondSuccess(HttpExchange exchange, String body, int statusCode) + private void respondSuccess( + HttpExchange exchange, + String body, + int statusCode, + Map> responseHeaders) throws IOException { - respond(exchange, statusCode, body); + respond(exchange, statusCode, body, responseHeaders); } private void respondRedirect(HttpExchange exchange, String location, int statusCode) throws IOException { Headers headers = exchange.getResponseHeaders(); headers.add("Location", location); - respond(exchange, statusCode, ""); + respond(exchange, statusCode, "", null); } } @@ -285,6 +329,12 @@ public FixtureServer with(Collection fs) { return this; } + public void assertAllFixturesConsumed() { + if (!fixtures.isEmpty()) { + fail("Expected all HTTP fixtures to be consumed, but " + fixtures.size() + " remain"); + } + } + @Override public void close() { server.stop(0); diff --git a/examples/docs/pom.xml b/examples/docs/pom.xml index decf52c96..b33e2ecbf 100644 --- a/examples/docs/pom.xml +++ b/examples/docs/pom.xml @@ -24,7 +24,7 @@ com.databricks databricks-sdk-java - 0.158.0 + 0.159.0 diff --git a/examples/spring-boot-oauth-u2m-demo/pom.xml b/examples/spring-boot-oauth-u2m-demo/pom.xml index c7ce8ef89..dc6dccdf9 100644 --- a/examples/spring-boot-oauth-u2m-demo/pom.xml +++ b/examples/spring-boot-oauth-u2m-demo/pom.xml @@ -40,7 +40,7 @@ com.databricks databricks-sdk-java - 0.158.0 + 0.159.0 diff --git a/lockfile.json b/lockfile.json index 7e08b4e88..eb48526d4 100644 --- a/lockfile.json +++ b/lockfile.json @@ -1,7 +1,7 @@ { "artifactId": "databricks-sdk-parent", "groupId": "com.databricks", - "version": "0.158.0", + "version": "0.159.0", "lockFileVersion": 1, "dependencies": [], "mavenPlugins": [], diff --git a/pom.xml b/pom.xml index 9bffcb13a..63794e638 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.databricks databricks-sdk-parent - 0.158.0 + 0.159.0 pom Databricks SDK for Java The Databricks SDK for Java includes functionality to accelerate development with Java for diff --git a/shaded/pom.xml b/shaded/pom.xml index 57f6a31de..9aa7639c6 100644 --- a/shaded/pom.xml +++ b/shaded/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - 0.158.0 + 0.159.0 com.databricks