You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2023/02/28 17:06:08 UTC

[iceberg] branch master updated: Core: Use server URI from REST server instead of manually constructing it (#6947)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 1fa276f422 Core: Use server URI from REST server instead of manually constructing it (#6947)
1fa276f422 is described below

commit 1fa276f422048a09ce201fbf78ff730aa8b61e64
Author: Eduard Tudenhöfner <et...@gmail.com>
AuthorDate: Tue Feb 28 18:06:00 2023 +0100

    Core: Use server URI from REST server instead of manually constructing it (#6947)
---
 .../test/java/org/apache/iceberg/rest/TestRESTCatalog.java  | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java
index 33b0e2be37..c072b701a0 100644
--- a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java
+++ b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java
@@ -66,7 +66,6 @@ import org.apache.iceberg.rest.responses.LoadTableResponse;
 import org.apache.iceberg.rest.responses.OAuthTokenResponse;
 import org.apache.iceberg.types.Types;
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.handler.gzip.GzipHandler;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -170,10 +169,7 @@ public class TestRESTCatalog extends CatalogTests<RESTCatalog> {
     restCatalog.initialize(
         "prod",
         ImmutableMap.of(
-            CatalogProperties.URI,
-            "http://localhost:" + localPort() + "/",
-            "credential",
-            "catalog:12345"));
+            CatalogProperties.URI, httpServer.getURI().toString(), "credential", "catalog:12345"));
   }
 
   @SuppressWarnings("unchecked")
@@ -1219,7 +1215,7 @@ public class TestRESTCatalog extends CatalogTests<RESTCatalog> {
         "prod",
         ImmutableMap.of(
             CatalogProperties.URI,
-            "http://localhost:" + localPort() + "/",
+            httpServer.getURI().toString(),
             "credential",
             "catalog:12345",
             CatalogProperties.METRICS_REPORTER_IMPL,
@@ -1623,9 +1619,4 @@ public class TestRESTCatalog extends CatalogTests<RESTCatalog> {
             eq(catalogHeaders),
             any());
   }
-
-  private int localPort() {
-    assertThat(httpServer.isRunning()).isTrue();
-    return ((ServerConnector) httpServer.getConnectors()[0]).getLocalPort();
-  }
 }