World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#10492] Improvment: Add events for enable / disable metalake and catalog (#10488)
Abhijeet Singhb43277a9f030
diff --git a/core/src/main/java/org/apache/gravitino/audit/AuditLog.java b/core/src/main/java/org/apache/gravitino/audit/AuditLog.javaindex 3ff613c37b..e1b77f5ecb 100644--- a/core/src/main/java/org/apache/gravitino/audit/AuditLog.java+++ b/core/src/main/java/org/apache/gravitino/audit/AuditLog.java@@ -45,6 +45,10 @@ import org.apache.gravitino.listener.api.event.CreateTableEvent;import org.apache.gravitino.listener.api.event.CreateTableFailureEvent;import org.apache.gravitino.listener.api.event.CreateTopicEvent;import org.apache.gravitino.listener.api.event.CreateTopicFailureEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.DropCatalogEvent;import org.apache.gravitino.listener.api.event.DropCatalogFailureEvent;import org.apache.gravitino.listener.api.event.DropFilesetEvent;@@ -57,6 +61,10 @@ import org.apache.gravitino.listener.api.event.DropTableEvent;import org.apache.gravitino.listener.api.event.DropTableFailureEvent;import org.apache.gravitino.listener.api.event.DropTopicEvent;import org.apache.gravitino.listener.api.event.DropTopicFailureEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.Event;import org.apache.gravitino.listener.api.event.EventSource;import org.apache.gravitino.listener.api.event.GetFileLocationEvent;@@ -201,6 +209,10 @@ public interface AuditLog {LIST_METALAKE,+ ENABLE_METALAKE,++ DISABLE_METALAKE,+CREATE_CATALOG,LOAD_CATALOG,@@ -211,6 +223,10 @@ public interface AuditLog {LIST_CATALOG,+ ENABLE_CATALOG,++ DISABLE_CATALOG,+CREATE_SCHEMA,ALTER_SCHEMA,@@ -277,6 +293,12 @@ public interface AuditLog {return LOAD_METALAKE;} else if (event instanceof ListMetalakeEvent || event instanceof ListMetalakeFailureEvent) {return LIST_METALAKE;+ } else if (event instanceof EnableMetalakeEvent+ || event instanceof EnableMetalakeFailureEvent) {+ return ENABLE_METALAKE;+ } else if (event instanceof DisableMetalakeEvent+ || event instanceof DisableMetalakeFailureEvent) {+ return DISABLE_METALAKE;} else if (event instanceof CreateCatalogEvent|| event instanceof CreateCatalogFailureEvent) {return CREATE_CATALOG;@@ -288,6 +310,12 @@ public interface AuditLog {return LOAD_CATALOG;} else if (event instanceof ListCatalogEvent || event instanceof ListCatalogFailureEvent) {return LIST_CATALOG;+ } else if (event instanceof EnableCatalogEvent+ || event instanceof EnableCatalogFailureEvent) {+ return ENABLE_CATALOG;+ } else if (event instanceof DisableCatalogEvent+ || event instanceof DisableCatalogFailureEvent) {+ return DISABLE_CATALOG;} else if (event instanceof CreateSchemaEvent || event instanceof CreateSchemaFailureEvent) {return CREATE_SCHEMA;} else if (event instanceof AlterSchemaEvent || event instanceof AlterSchemaFailureEvent) {diff --git a/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java b/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.javaindex 6027809e4c..99c8911012 100644--- a/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java+++ b/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java@@ -35,6 +35,8 @@ public class CompatibilityUtils {.put(OperationType.DROP_METALAKE, Operation.DROP_METALAKE).put(OperationType.LOAD_METALAKE, Operation.LOAD_METALAKE).put(OperationType.LIST_METALAKE, Operation.LIST_METALAKE)+ .put(OperationType.ENABLE_METALAKE, Operation.ENABLE_METALAKE)+ .put(OperationType.DISABLE_METALAKE, Operation.DISABLE_METALAKE)// Catalog operation.put(OperationType.CREATE_CATALOG, Operation.CREATE_CATALOG)@@ -42,6 +44,8 @@ public class CompatibilityUtils {.put(OperationType.DROP_CATALOG, Operation.DROP_CATALOG).put(OperationType.LOAD_CATALOG, Operation.LOAD_CATALOG).put(OperationType.LIST_CATALOG, Operation.LIST_CATALOG)+ .put(OperationType.ENABLE_CATALOG, Operation.ENABLE_CATALOG)+ .put(OperationType.DISABLE_CATALOG, Operation.DISABLE_CATALOG)// Schema operation.put(OperationType.CREATE_SCHEMA, Operation.CREATE_SCHEMA)diff --git a/core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.java b/core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.javaindex 782ef7df4e..afaf131593 100644--- a/core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.java+++ b/core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.java@@ -37,9 +37,15 @@ import org.apache.gravitino.listener.api.event.AlterCatalogPreEvent;import org.apache.gravitino.listener.api.event.CreateCatalogEvent;import org.apache.gravitino.listener.api.event.CreateCatalogFailureEvent;import org.apache.gravitino.listener.api.event.CreateCatalogPreEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogPreEvent;import org.apache.gravitino.listener.api.event.DropCatalogEvent;import org.apache.gravitino.listener.api.event.DropCatalogFailureEvent;import org.apache.gravitino.listener.api.event.DropCatalogPreEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogPreEvent;import org.apache.gravitino.listener.api.event.ListCatalogEvent;import org.apache.gravitino.listener.api.event.ListCatalogFailureEvent;import org.apache.gravitino.listener.api.event.ListCatalogPreEvent;@@ -192,13 +198,27 @@ public class CatalogEventDispatcher implements CatalogDispatcher {@Overridepublic void enableCatalog(NameIdentifier ident)throws NoSuchCatalogException, CatalogNotInUseException {- // todo: support enable catalog event- dispatcher.enableCatalog(ident);+ eventBus.dispatchEvent(new EnableCatalogPreEvent(PrincipalUtils.getCurrentUserName(), ident));+ try {+ dispatcher.enableCatalog(ident);+ eventBus.dispatchEvent(new EnableCatalogEvent(PrincipalUtils.getCurrentUserName(), ident));+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new EnableCatalogFailureEvent(PrincipalUtils.getCurrentUserName(), ident, e));+ throw e;+ }}@Overridepublic void disableCatalog(NameIdentifier ident) throws NoSuchCatalogException {- // todo: support disable catalog event- dispatcher.disableCatalog(ident);+ eventBus.dispatchEvent(new DisableCatalogPreEvent(PrincipalUtils.getCurrentUserName(), ident));+ try {+ dispatcher.disableCatalog(ident);+ eventBus.dispatchEvent(new DisableCatalogEvent(PrincipalUtils.getCurrentUserName(), ident));+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new DisableCatalogFailureEvent(PrincipalUtils.getCurrentUserName(), ident, e));+ throw e;+ }}}diff --git a/core/src/main/java/org/apache/gravitino/listener/MetalakeEventDispatcher.java b/core/src/main/java/org/apache/gravitino/listener/MetalakeEventDispatcher.javaindex 0ff109a483..02dbce3f6c 100644--- a/core/src/main/java/org/apache/gravitino/listener/MetalakeEventDispatcher.java+++ b/core/src/main/java/org/apache/gravitino/listener/MetalakeEventDispatcher.java@@ -33,9 +33,15 @@ import org.apache.gravitino.listener.api.event.AlterMetalakePreEvent;import org.apache.gravitino.listener.api.event.CreateMetalakeEvent;import org.apache.gravitino.listener.api.event.CreateMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.CreateMetalakePreEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeFailureEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakePreEvent;import org.apache.gravitino.listener.api.event.DropMetalakeEvent;import org.apache.gravitino.listener.api.event.DropMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.DropMetalakePreEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeFailureEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakePreEvent;import org.apache.gravitino.listener.api.event.ListMetalakeEvent;import org.apache.gravitino.listener.api.event.ListMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.ListMetalakePreEvent;@@ -161,13 +167,27 @@ public class MetalakeEventDispatcher implements MetalakeDispatcher {@Overridepublic void enableMetalake(NameIdentifier ident) throws NoSuchMetalakeException {- // todo: support enable metalake event- dispatcher.enableMetalake(ident);+ eventBus.dispatchEvent(new EnableMetalakePreEvent(PrincipalUtils.getCurrentUserName(), ident));+ try {+ dispatcher.enableMetalake(ident);+ eventBus.dispatchEvent(new EnableMetalakeEvent(PrincipalUtils.getCurrentUserName(), ident));+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new EnableMetalakeFailureEvent(PrincipalUtils.getCurrentUserName(), ident, e));+ throw e;+ }}@Overridepublic void disableMetalake(NameIdentifier ident) throws NoSuchMetalakeException {- // todo: support disable metalake event- dispatcher.disableMetalake(ident);+ eventBus.dispatchEvent(new DisableMetalakePreEvent(PrincipalUtils.getCurrentUserName(), ident));+ try {+ dispatcher.disableMetalake(ident);+ eventBus.dispatchEvent(new DisableMetalakeEvent(PrincipalUtils.getCurrentUserName(), ident));+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new DisableMetalakeFailureEvent(PrincipalUtils.getCurrentUserName(), ident, e));+ throw e;+ }}}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogEvent.javanew file mode 100644index 0000000000..7ffb8fea0b--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered upon successfully disabling a catalog. */+@DeveloperApi+public final class DisableCatalogEvent extends CatalogEvent {++ /**+ * Constructs an instance of {@code DisableCatalogEvent}.+ *+ * @param user The username of the individual who initiated the catalog disabling operation.+ * @param identifier The identifier of the disabled catalog.+ */+ public DisableCatalogEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogFailureEvent.javanew file mode 100644index 0000000000..2e8251435e--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogFailureEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered when an attempt to disable a catalog fails. */+@DeveloperApi+public final class DisableCatalogFailureEvent extends CatalogFailureEvent {+ /**+ * Constructs an instance of {@code DisableCatalogFailureEvent}.+ *+ * @param user The username of the individual who initiated the catalog disablement.+ * @param identifier The identifier of the catalog that failed to be disabled.+ * @param exception The exception that was encountered during the catalog disablement attempt.+ */+ public DisableCatalogFailureEvent(String user, NameIdentifier identifier, Exception exception) {+ super(user, identifier, exception);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogPreEvent.javanew file mode 100644index 0000000000..d71f85dd2e--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableCatalogPreEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is generated before a catalog is disabled. */+@DeveloperApi+public final class DisableCatalogPreEvent extends CatalogPreEvent {++ /**+ * Constructs an instance of {@code DisableCatalogPreEvent}.+ *+ * @param user The username of the individual who initiated the disable catalog operation.+ * @param identifier The identifier of the catalog to be disabled.+ */+ public DisableCatalogPreEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeEvent.javanew file mode 100644index 0000000000..47f95d9fa8--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered upon successfully disabling a metalake. */+@DeveloperApi+public final class DisableMetalakeEvent extends MetalakeEvent {++ /**+ * Constructs an instance of {@code DisableMetalakeEvent}.+ *+ * @param user The username of the individual who initiated the metalake disabling operation.+ * @param identifier The identifier of the disabled metalake.+ */+ public DisableMetalakeEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeFailureEvent.javanew file mode 100644index 0000000000..1cd1e8fbed--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakeFailureEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered when an attempt to disable a metalake fails. */+@DeveloperApi+public final class DisableMetalakeFailureEvent extends MetalakeFailureEvent {+ /**+ * Constructs an instance of {@code DisableMetalakeFailureEvent}.+ *+ * @param user The username of the individual who initiated the metalake disablement.+ * @param identifier The identifier of the metalake that failed to be disabled.+ * @param exception The exception that was encountered during the metalake disablement attempt.+ */+ public DisableMetalakeFailureEvent(String user, NameIdentifier identifier, Exception exception) {+ super(user, identifier, exception);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakePreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakePreEvent.javanew file mode 100644index 0000000000..92982f59a0--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableMetalakePreEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event triggered before disabling a metalake. */+@DeveloperApi+public class DisableMetalakePreEvent extends MetalakePreEvent {++ /**+ * Constructs an instance of {@code DisableMetalakePreEvent}.+ *+ * @param user The username of the individual who initiated the disable metalake operation.+ * @param identifier The identifier of the metalake to be disabled.+ */+ public DisableMetalakePreEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogEvent.javanew file mode 100644index 0000000000..5af3e97239--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered upon successfully enabling a catalog. */+@DeveloperApi+public final class EnableCatalogEvent extends CatalogEvent {++ /**+ * Constructs an instance of {@code EnableCatalogEvent}.+ *+ * @param user The username of the individual who initiated the catalog enabling operation.+ * @param identifier The identifier of the enabled catalog.+ */+ public EnableCatalogEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogFailureEvent.javanew file mode 100644index 0000000000..b96971dd46--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogFailureEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered when an attempt to enable a catalog fails. */+@DeveloperApi+public final class EnableCatalogFailureEvent extends CatalogFailureEvent {+ /**+ * Constructs an instance of {@code EnableCatalogFailureEvent}.+ *+ * @param user The username of the individual who initiated the catalog enablement.+ * @param identifier The identifier of the catalog that failed to be enabled.+ * @param exception The exception that was encountered during the catalog enablement attempt.+ */+ public EnableCatalogFailureEvent(String user, NameIdentifier identifier, Exception exception) {+ super(user, identifier, exception);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogPreEvent.javanew file mode 100644index 0000000000..c3c25a4e45--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableCatalogPreEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is generated before a catalog is enabled. */+@DeveloperApi+public final class EnableCatalogPreEvent extends CatalogPreEvent {++ /**+ * Constructs an instance of {@code EnableCatalogPreEvent}.+ *+ * @param user The username of the individual who initiated the enable catalog operation.+ * @param identifier The identifier of the catalog to be enabled.+ */+ public EnableCatalogPreEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_CATALOG;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeEvent.javanew file mode 100644index 0000000000..8690912edf--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered upon successfully enabling a metalake. */+@DeveloperApi+public final class EnableMetalakeEvent extends MetalakeEvent {++ /**+ * Constructs an instance of {@code EnableMetalakeEvent}.+ *+ * @param user The username of the individual who initiated the metalake enabling operation.+ * @param identifier The identifier of the enabled metalake.+ */+ public EnableMetalakeEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeFailureEvent.javanew file mode 100644index 0000000000..c691e4ae2f--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakeFailureEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event that is triggered when an attempt to enable a metalake fails. */+@DeveloperApi+public final class EnableMetalakeFailureEvent extends MetalakeFailureEvent {+ /**+ * Constructs an instance of {@code EnableMetalakeFailureEvent}.+ *+ * @param user The username of the individual who initiated the metalake enablement.+ * @param identifier The identifier of the metalake that failed to be enabled.+ * @param exception The exception that was encountered during the metalake enablement attempt.+ */+ public EnableMetalakeFailureEvent(String user, NameIdentifier identifier, Exception exception) {+ super(user, identifier, exception);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakePreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakePreEvent.javanew file mode 100644index 0000000000..90e97a123e--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableMetalakePreEvent.java@@ -0,0 +1,43 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.annotation.DeveloperApi;++/** Represents an event triggered before enabling a metalake. */+@DeveloperApi+public class EnableMetalakePreEvent extends MetalakePreEvent {++ /**+ * Constructs an instance of {@code EnableMetalakePreEvent}.+ *+ * @param user The username of the individual who initiated the enable metalake operation.+ * @param identifier The identifier of the metalake to be enabled.+ */+ public EnableMetalakePreEvent(String user, NameIdentifier identifier) {+ super(user, identifier);+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_METALAKE;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java b/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.javaindex b2ea3c8b3c..948c50caa2 100644--- a/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java@@ -69,6 +69,8 @@ public enum OperationType {ALTER_CATALOG,LOAD_CATALOG,LIST_CATALOG,+ ENABLE_CATALOG,+ DISABLE_CATALOG,// Partition eventADD_PARTITION,@@ -92,6 +94,8 @@ public enum OperationType {LIST_METALAKE,DROP_METALAKE,LOAD_METALAKE,+ ENABLE_METALAKE,+ DISABLE_METALAKE,// View eventCREATE_VIEW,diff --git a/core/src/test/java/org/apache/gravitino/audit/TestOperation.java b/core/src/test/java/org/apache/gravitino/audit/TestOperation.javaindex cd0bc9da91..3a9bedb983 100644--- a/core/src/test/java/org/apache/gravitino/audit/TestOperation.java+++ b/core/src/test/java/org/apache/gravitino/audit/TestOperation.java@@ -54,6 +54,10 @@ import org.apache.gravitino.listener.api.event.CreateTableEvent;import org.apache.gravitino.listener.api.event.CreateTableFailureEvent;import org.apache.gravitino.listener.api.event.CreateTopicEvent;import org.apache.gravitino.listener.api.event.CreateTopicFailureEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogEvent;+import org.apache.gravitino.listener.api.event.DisableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeEvent;+import org.apache.gravitino.listener.api.event.DisableMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.DropCatalogEvent;import org.apache.gravitino.listener.api.event.DropCatalogFailureEvent;import org.apache.gravitino.listener.api.event.DropFilesetEvent;@@ -66,6 +70,10 @@ import org.apache.gravitino.listener.api.event.DropTableEvent;import org.apache.gravitino.listener.api.event.DropTableFailureEvent;import org.apache.gravitino.listener.api.event.DropTopicEvent;import org.apache.gravitino.listener.api.event.DropTopicFailureEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogEvent;+import org.apache.gravitino.listener.api.event.EnableCatalogFailureEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeEvent;+import org.apache.gravitino.listener.api.event.EnableMetalakeFailureEvent;import org.apache.gravitino.listener.api.event.Event;import org.apache.gravitino.listener.api.event.GetFileLocationEvent;import org.apache.gravitino.listener.api.event.GetFileLocationFailureEvent;@@ -483,6 +491,44 @@ public class TestOperation {AuditLog.Operation.fromEvent(loadTopicFailureEvent), AuditLog.Operation.LOAD_TOPIC);}+ @Test+ public void testEnableDisableOperation() {+ Event enableMetalakeEvent = new EnableMetalakeEvent(USER, metalakeIdentifier);+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(enableMetalakeEvent), AuditLog.Operation.ENABLE_METALAKE);+ Event enableMetalakeFailureEvent =+ new EnableMetalakeFailureEvent(USER, metalakeIdentifier, new Exception());+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(enableMetalakeFailureEvent),+ AuditLog.Operation.ENABLE_METALAKE);++ Event disableMetalakeEvent = new DisableMetalakeEvent(USER, metalakeIdentifier);+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(disableMetalakeEvent), AuditLog.Operation.DISABLE_METALAKE);+ Event disableMetalakeFailureEvent =+ new DisableMetalakeFailureEvent(USER, metalakeIdentifier, new Exception());+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(disableMetalakeFailureEvent),+ AuditLog.Operation.DISABLE_METALAKE);++ Event enableCatalogEvent = new EnableCatalogEvent(USER, catalogIdentifier);+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(enableCatalogEvent), AuditLog.Operation.ENABLE_CATALOG);+ Event enableCatalogFailureEvent =+ new EnableCatalogFailureEvent(USER, catalogIdentifier, new Exception());+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(enableCatalogFailureEvent), AuditLog.Operation.ENABLE_CATALOG);++ Event disableCatalogEvent = new DisableCatalogEvent(USER, catalogIdentifier);+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(disableCatalogEvent), AuditLog.Operation.DISABLE_CATALOG);+ Event disableCatalogFailureEvent =+ new DisableCatalogFailureEvent(USER, catalogIdentifier, new Exception());+ Assertions.assertEquals(+ AuditLog.Operation.fromEvent(disableCatalogFailureEvent),+ AuditLog.Operation.DISABLE_CATALOG);+ }+@Testpublic void testExistsOperation() {Event partitionExistsEvent =diff --git a/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java b/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.javaindex 3021fdd56c..5ddf3c834d 100644--- a/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java+++ b/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java@@ -38,11 +38,15 @@ public class TestCompatibilityUtils {{OperationType.DROP_METALAKE, Operation.DROP_METALAKE},{OperationType.LOAD_METALAKE, Operation.LOAD_METALAKE},{OperationType.LIST_METALAKE, Operation.LIST_METALAKE},+ {OperationType.ENABLE_METALAKE, Operation.ENABLE_METALAKE},+ {OperationType.DISABLE_METALAKE, Operation.DISABLE_METALAKE},{OperationType.CREATE_CATALOG, Operation.CREATE_CATALOG},{OperationType.ALTER_CATALOG, Operation.ALTER_CATALOG},{OperationType.DROP_CATALOG, Operation.DROP_CATALOG},{OperationType.LOAD_CATALOG, Operation.LOAD_CATALOG},{OperationType.LIST_CATALOG, Operation.LIST_CATALOG},+ {OperationType.ENABLE_CATALOG, Operation.ENABLE_CATALOG},+ {OperationType.DISABLE_CATALOG, Operation.DISABLE_CATALOG},{OperationType.CREATE_SCHEMA, Operation.CREATE_SCHEMA},{OperationType.ALTER_SCHEMA, Operation.ALTER_SCHEMA},{OperationType.DROP_SCHEMA, Operation.DROP_SCHEMA},diff --git a/core/src/test/java/org/apache/gravitino/listener/api/event/TestCatalogEvent.java b/core/src/test/java/org/apache/gravitino/listener/api/event/TestCatalogEvent.javaindex f334f8c166..0bbb7caff2 100644--- a/core/src/test/java/org/apache/gravitino/listener/api/event/TestCatalogEvent.java+++ b/core/src/test/java/org/apache/gravitino/listener/api/event/TestCatalogEvent.java@@ -184,6 +184,40 @@ public class TestCatalogEvent {Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());}+ @Test+ void testEnableCatalogEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake", catalog.name());+ dispatcher.enableCatalog(identifier);+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(EnableCatalogEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.ENABLE_CATALOG, event.operationType());+ Assertions.assertEquals(OperationStatus.SUCCESS, event.operationStatus());++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(identifier, preEvent.identifier());+ Assertions.assertEquals(EnableCatalogPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.ENABLE_CATALOG, preEvent.operationType());+ Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());+ }++ @Test+ void testDisableCatalogEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake", catalog.name());+ dispatcher.disableCatalog(identifier);+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(DisableCatalogEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.DISABLE_CATALOG, event.operationType());+ Assertions.assertEquals(OperationStatus.SUCCESS, event.operationStatus());++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(identifier, preEvent.identifier());+ Assertions.assertEquals(DisableCatalogPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.DISABLE_CATALOG, preEvent.operationType());+ Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());+ }+@Testvoid testCreateCatalogFailureEvent() {NameIdentifier identifier = NameIdentifier.of("metalake", catalog.name());@@ -254,6 +288,36 @@ public class TestCatalogEvent {Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());}+ @Test+ void testEnableCatalogFailureEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake", catalog.name());+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class, () -> failureDispatcher.enableCatalog(identifier));+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(EnableCatalogFailureEvent.class, event.getClass());+ Assertions.assertEquals(+ GravitinoRuntimeException.class,+ ((EnableCatalogFailureEvent) event).exception().getClass());+ Assertions.assertEquals(OperationType.ENABLE_CATALOG, event.operationType());+ Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());+ }++ @Test+ void testDisableCatalogFailureEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake", catalog.name());+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class, () -> failureDispatcher.disableCatalog(identifier));+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(DisableCatalogFailureEvent.class, event.getClass());+ Assertions.assertEquals(+ GravitinoRuntimeException.class,+ ((DisableCatalogFailureEvent) event).exception().getClass());+ Assertions.assertEquals(OperationType.DISABLE_CATALOG, event.operationType());+ Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());+ }+@Testvoid testListCatalogFailureEvent() {Namespace namespace = Namespace.of("metalake", "catalog");diff --git a/core/src/test/java/org/apache/gravitino/listener/api/event/TestMetalakeEvent.java b/core/src/test/java/org/apache/gravitino/listener/api/event/TestMetalakeEvent.javaindex 0eafd111b9..1a45ed9363 100644--- a/core/src/test/java/org/apache/gravitino/listener/api/event/TestMetalakeEvent.java+++ b/core/src/test/java/org/apache/gravitino/listener/api/event/TestMetalakeEvent.java@@ -160,6 +160,40 @@ public class TestMetalakeEvent {Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());}+ @Test+ void testEnableMetalakeEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake");+ dispatcher.enableMetalake(identifier);+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(EnableMetalakeEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.ENABLE_METALAKE, event.operationType());+ Assertions.assertEquals(OperationStatus.SUCCESS, event.operationStatus());++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(identifier, preEvent.identifier());+ Assertions.assertEquals(EnableMetalakePreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.ENABLE_METALAKE, preEvent.operationType());+ Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());+ }++ @Test+ void testDisableMetalakeEvent() {+ NameIdentifier identifier = NameIdentifier.of("metalake");+ dispatcher.disableMetalake(identifier);+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(DisableMetalakeEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.DISABLE_METALAKE, event.operationType());+ Assertions.assertEquals(OperationStatus.SUCCESS, event.operationStatus());++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(identifier, preEvent.identifier());+ Assertions.assertEquals(DisableMetalakePreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.DISABLE_METALAKE, preEvent.operationType());+ Assertions.assertEquals(OperationStatus.UNPROCESSED, preEvent.operationStatus());+ }+@Testvoid testCreateMetalakeFailureEvent() {NameIdentifier identifier = NameIdentifier.of(metalake.name());@@ -227,6 +261,36 @@ public class TestMetalakeEvent {Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());}+ @Test+ void testEnableMetalakeFailureEvent() {+ NameIdentifier identifier = NameIdentifier.of(metalake.name());+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class, () -> failureDispatcher.enableMetalake(identifier));+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(EnableMetalakeFailureEvent.class, event.getClass());+ Assertions.assertEquals(+ GravitinoRuntimeException.class,+ ((EnableMetalakeFailureEvent) event).exception().getClass());+ Assertions.assertEquals(OperationType.ENABLE_METALAKE, event.operationType());+ Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());+ }++ @Test+ void testDisableMetalakeFailureEvent() {+ NameIdentifier identifier = NameIdentifier.of(metalake.name());+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class, () -> failureDispatcher.disableMetalake(identifier));+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(identifier, event.identifier());+ Assertions.assertEquals(DisableMetalakeFailureEvent.class, event.getClass());+ Assertions.assertEquals(+ GravitinoRuntimeException.class,+ ((DisableMetalakeFailureEvent) event).exception().getClass());+ Assertions.assertEquals(OperationType.DISABLE_METALAKE, event.operationType());+ Assertions.assertEquals(OperationStatus.FAILURE, event.operationStatus());+ }+@Testvoid testListMetalakeFailureEvent() {Assertions.assertThrowsExactly(