diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java index 3ad5fa7ff4b..67dcfce023d 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java @@ -249,7 +249,7 @@ public Response tableExists( TableIdentifier tableIdentifier = TableIdentifier.of(icebergNS, table); boolean exists = tableOperationDispatcher.tableExists(context, tableIdentifier); if (exists) { - return IcebergRestUtils.okWithoutContent(); + return IcebergRestUtils.noContent(); } else { return IcebergRestUtils.notExists(); } diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableRenameOperations.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableRenameOperations.java index bd2021d74d8..23acc1da124 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableRenameOperations.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableRenameOperations.java @@ -68,7 +68,7 @@ public Response renameTable( renameTableRequest.destination()); IcebergRequestContext context = new IcebergRequestContext(httpServletRequest(), catalogName); tableOperationDispatcher.renameTable(context, renameTableRequest); - return IcebergRestUtils.okWithoutContent(); + return IcebergRestUtils.noContent(); } // HTTP request is null in Jersey test, override with a mock request when testing. diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableEvent.java index 46b8514b8cb..b7ebf35b15f 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableEvent.java @@ -29,8 +29,8 @@ @DeveloperApi public class IcebergCreateTableEvent extends IcebergTableEvent { - private CreateTableRequest createTableRequest; - private LoadTableResponse loadTableResponse; + private final CreateTableRequest createTableRequest; + private final LoadTableResponse loadTableResponse; public IcebergCreateTableEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableFailureEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableFailureEvent.java index 07b033d3d3b..1d20a553ace 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableFailureEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTableFailureEvent.java @@ -27,7 +27,7 @@ /** Represent a failure event when creating Iceberg table failed. */ @DeveloperApi public class IcebergCreateTableFailureEvent extends IcebergTableFailureEvent { - private CreateTableRequest createTableRequest; + private final CreateTableRequest createTableRequest; public IcebergCreateTableFailureEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTablePreEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTablePreEvent.java index 552f0d45249..927f11c5c79 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTablePreEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCreateTablePreEvent.java @@ -26,7 +26,7 @@ /** Represent a pre event before creating Iceberg table. */ @DeveloperApi public class IcebergCreateTablePreEvent extends IcebergTablePreEvent { - private CreateTableRequest createTableRequest; + private final CreateTableRequest createTableRequest; public IcebergCreateTablePreEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableEvent.java index 69f517676e4..23fe799c912 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableEvent.java @@ -25,7 +25,7 @@ /** Represent an event after dropping Iceberg table successfully. */ @DeveloperApi public class IcebergDropTableEvent extends IcebergTableEvent { - private boolean purgeRequested; + private final boolean purgeRequested; public IcebergDropTableEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableFailureEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableFailureEvent.java index 8c58bc08f1a..b93daf5cba0 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableFailureEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTableFailureEvent.java @@ -25,7 +25,7 @@ /** Represent a failure event when dropping Iceberg table failed. */ @DeveloperApi public class IcebergDropTableFailureEvent extends IcebergTableFailureEvent { - private boolean purgeRequested; + private final boolean purgeRequested; public IcebergDropTableFailureEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTablePreEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTablePreEvent.java index b8301229a6a..357a43a3902 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTablePreEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergDropTablePreEvent.java @@ -25,7 +25,7 @@ /** Represent a pre event before dropping Iceberg table. */ @DeveloperApi public class IcebergDropTablePreEvent extends IcebergTablePreEvent { - private boolean purgeRequested; + private final boolean purgeRequested; public IcebergDropTablePreEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergLoadTableEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergLoadTableEvent.java index 16e5734c707..066250cb359 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergLoadTableEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergLoadTableEvent.java @@ -27,7 +27,7 @@ /** Represent an event after loading Iceberg table successfully. */ @DeveloperApi public class IcebergLoadTableEvent extends IcebergTableEvent { - private LoadTableResponse loadTableResponse; + private final LoadTableResponse loadTableResponse; public IcebergLoadTableEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableEvent.java index f26b79714f0..42eea5cb2c7 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableEvent.java @@ -27,7 +27,7 @@ /** Represent an event after rename Iceberg table successfully. */ @DeveloperApi public class IcebergRenameTableEvent extends IcebergTableEvent { - private RenameTableRequest renameTableRequest; + private final RenameTableRequest renameTableRequest; public IcebergRenameTableEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableFailureEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableFailureEvent.java index f64a85baccb..9525891b34a 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableFailureEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTableFailureEvent.java @@ -26,7 +26,7 @@ /** Represent an event when rename Iceberg table failed. */ @DeveloperApi public class IcebergRenameTableFailureEvent extends IcebergTableFailureEvent { - private RenameTableRequest renameTableRequest; + private final RenameTableRequest renameTableRequest; public IcebergRenameTableFailureEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTablePreEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTablePreEvent.java index 579f23182f8..1808a1d3c9b 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTablePreEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergRenameTablePreEvent.java @@ -26,7 +26,7 @@ /** Represent an pre event before rename an Iceberg table. */ @DeveloperApi public class IcebergRenameTablePreEvent extends IcebergTablePreEvent { - private RenameTableRequest renameTableRequest; + private final RenameTableRequest renameTableRequest; public IcebergRenameTablePreEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergTableExistsEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergTableExistsEvent.java index 4e54945f230..a8a8f3c1137 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergTableExistsEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergTableExistsEvent.java @@ -25,7 +25,7 @@ /** Represent an event after check Iceberg table exists successfully. */ @DeveloperApi public class IcebergTableExistsEvent extends IcebergTableEvent { - private boolean isExists; + private final boolean isExists; public IcebergTableExistsEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableEvent.java index 7e675213a2c..aebd27d6348 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableEvent.java @@ -29,8 +29,8 @@ @DeveloperApi public class IcebergUpdateTableEvent extends IcebergTableEvent { - private UpdateTableRequest updateTableRequest; - private LoadTableResponse loadTableResponse; + private final UpdateTableRequest updateTableRequest; + private final LoadTableResponse loadTableResponse; public IcebergUpdateTableEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableFailureEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableFailureEvent.java index 7624e248eef..0e288db04af 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableFailureEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTableFailureEvent.java @@ -27,7 +27,7 @@ /** Represent a failure event when updating Iceberg table failed. */ @DeveloperApi public class IcebergUpdateTableFailureEvent extends IcebergTableFailureEvent { - private UpdateTableRequest updateTableRequest; + private final UpdateTableRequest updateTableRequest; public IcebergUpdateTableFailureEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTablePreEvent.java b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTablePreEvent.java index a877a72fc2b..8c6ec378694 100644 --- a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTablePreEvent.java +++ b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergUpdateTablePreEvent.java @@ -26,7 +26,7 @@ /** Represent a pre event before updating Iceberg table. */ @DeveloperApi public class IcebergUpdateTablePreEvent extends IcebergTablePreEvent { - private UpdateTableRequest updateTableRequest; + private final UpdateTableRequest updateTableRequest; public IcebergUpdateTablePreEvent( IcebergRequestContext icebergRequestContext, diff --git a/iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergTableOperations.java b/iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergTableOperations.java index 59822d4bf0b..e6a6b393bab 100644 --- a/iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergTableOperations.java +++ b/iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergTableOperations.java @@ -210,7 +210,7 @@ void testTableExits() { verifyCreateTableSucc("exists_foo1"); dummyEventListener.clearEvent(); - verifyTableExistsStatusCode("exists_foo1", 200); + verifyTableExistsStatusCode("exists_foo1", 204); Assertions.assertTrue(dummyEventListener.popPreEvent() instanceof IcebergTableExistsPreEvent); postEvent = dummyEventListener.popPostEvent(); Assertions.assertTrue(postEvent instanceof IcebergTableExistsEvent); @@ -430,7 +430,7 @@ private void verifyRenameTableSucc(String source, String dest) { Response response = doRenameTable(source, dest); System.out.println(response); System.out.flush(); - Assertions.assertEquals(Status.OK.getStatusCode(), response.getStatus()); + Assertions.assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus()); } private void verifyRenameTableFail(String source, String dest, int status) {