This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new f37ff2e88e6 Add AuditSQLExecutionCheckerTest (#37483)
f37ff2e88e6 is described below
commit f37ff2e88e6813f94bc3f0869f347d07c02bea20
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 23 23:34:02 2025 +0800
Add AuditSQLExecutionCheckerTest (#37483)
---
.../checker/AuditSQLExecutionCheckerTest.java | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionCheckerTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionCheckerTest.java
new file mode 100644
index 00000000000..8226d94044c
--- /dev/null
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionCheckerTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.shardingsphere.proxy.backend.handler.checker;
+
+import org.apache.shardingsphere.infra.executor.audit.SQLAuditEngine;
+import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+
+class AuditSQLExecutionCheckerTest {
+
+ @Test
+ void assertCheck() {
+ QueryContext queryContext = mock(QueryContext.class);
+ ShardingSphereDatabase database = mock(ShardingSphereDatabase.class);
+ try (MockedStatic<SQLAuditEngine> sqlAuditEngine =
mockStatic(SQLAuditEngine.class)) {
+ new AuditSQLExecutionChecker().check(mock(), queryContext,
database);
+ sqlAuditEngine.verify(() -> SQLAuditEngine.audit(queryContext,
database));
+ sqlAuditEngine.verifyNoMoreInteractions();
+ }
+ }
+}