This is an automated email from the ASF dual-hosted git repository.
adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new f59025592 Move TestPolarisEventListener to test fixtures (#2850)
f59025592 is described below
commit f59025592d58755cf3aecc75c4f93a4caa81a0cd
Author: Alexandre Dutra <[email protected]>
AuthorDate: Wed Oct 22 11:02:28 2025 +0200
Move TestPolarisEventListener to test fixtures (#2850)
---
.../service/config/ProductionReadinessChecks.java | 14 -----------
.../listeners/QuarkusTestPolarisEventListener.java | 27 ++++++++++++++++++++++
.../events/listeners/TestPolarisEventListener.java | 6 +----
3 files changed, 28 insertions(+), 19 deletions(-)
diff --git
a/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
b/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
index 51a1e1008..c1a03a7ab 100644
---
a/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
+++
b/runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java
@@ -44,8 +44,6 @@ import
org.apache.polaris.service.context.DefaultRealmContextResolver;
import org.apache.polaris.service.context.RealmContextResolver;
import org.apache.polaris.service.context.TestRealmContextResolver;
import org.apache.polaris.service.credentials.connection.AuthType;
-import org.apache.polaris.service.events.listeners.PolarisEventListener;
-import org.apache.polaris.service.events.listeners.TestPolarisEventListener;
import org.apache.polaris.service.metrics.MetricsConfiguration;
import
org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory;
import org.eclipse.microprofile.config.Config;
@@ -222,18 +220,6 @@ public class ProductionReadinessChecks {
return ProductionReadinessCheck.OK;
}
- @Produces
- public ProductionReadinessCheck checkPolarisEventListener(
- PolarisEventListener polarisEventListener) {
- if (polarisEventListener instanceof TestPolarisEventListener) {
- return ProductionReadinessCheck.of(
- Error.of(
- "TestPolarisEventListener is intended for tests only.",
- "polaris.event-listener.type"));
- }
- return ProductionReadinessCheck.OK;
- }
-
private static String authRealmSegment(String realm) {
return realm.equals(AuthenticationConfiguration.DEFAULT_REALM_KEY) ? "" :
realm + ".";
}
diff --git
a/runtime/service/src/test/java/org/apache/polaris/service/events/listeners/QuarkusTestPolarisEventListener.java
b/runtime/service/src/test/java/org/apache/polaris/service/events/listeners/QuarkusTestPolarisEventListener.java
new file mode 100644
index 000000000..8cf6b89dd
--- /dev/null
+++
b/runtime/service/src/test/java/org/apache/polaris/service/events/listeners/QuarkusTestPolarisEventListener.java
@@ -0,0 +1,27 @@
+/*
+ * 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.polaris.service.events.listeners;
+
+import io.smallrye.common.annotation.Identifier;
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+@Identifier("test")
+public class QuarkusTestPolarisEventListener extends TestPolarisEventListener
{}
diff --git
a/runtime/service/src/main/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
b/runtime/service/src/testFixtures/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
similarity index 98%
rename from
runtime/service/src/main/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
rename to
runtime/service/src/testFixtures/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
index 2bf500967..a10abcbb1 100644
---
a/runtime/service/src/main/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
+++
b/runtime/service/src/testFixtures/java/org/apache/polaris/service/events/listeners/TestPolarisEventListener.java
@@ -18,8 +18,6 @@
*/
package org.apache.polaris.service.events.listeners;
-import io.smallrye.common.annotation.Identifier;
-import jakarta.enterprise.context.ApplicationScoped;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.polaris.service.events.AfterAttemptTaskEvent;
@@ -33,9 +31,7 @@ import org.apache.polaris.service.events.PolarisEvent;
import org.apache.polaris.service.events.PrincipalRolesServiceEvents;
import org.apache.polaris.service.events.PrincipalsServiceEvents;
-/** Event listener that stores all emitted events forever. Not recommended for
use in production. */
-@ApplicationScoped
-@Identifier("test")
+/** Test event listener that stores all emitted events forever. */
public class TestPolarisEventListener implements PolarisEventListener {
private final Map<Class<? extends PolarisEvent>, PolarisEvent> latestEvents =
new ConcurrentHashMap<>();