Skip to content

Commit f590255

Browse files
authored
Move TestPolarisEventListener to test fixtures (#2850)
1 parent b5f7e97 commit f590255

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
import org.apache.polaris.service.context.RealmContextResolver;
4545
import org.apache.polaris.service.context.TestRealmContextResolver;
4646
import org.apache.polaris.service.credentials.connection.AuthType;
47-
import org.apache.polaris.service.events.listeners.PolarisEventListener;
48-
import org.apache.polaris.service.events.listeners.TestPolarisEventListener;
4947
import org.apache.polaris.service.metrics.MetricsConfiguration;
5048
import org.apache.polaris.service.persistence.InMemoryPolarisMetaStoreManagerFactory;
5149
import org.eclipse.microprofile.config.Config;
@@ -222,18 +220,6 @@ public ProductionReadinessCheck checkRealmResolver(Config config, RealmContextRe
222220
return ProductionReadinessCheck.OK;
223221
}
224222

225-
@Produces
226-
public ProductionReadinessCheck checkPolarisEventListener(
227-
PolarisEventListener polarisEventListener) {
228-
if (polarisEventListener instanceof TestPolarisEventListener) {
229-
return ProductionReadinessCheck.of(
230-
Error.of(
231-
"TestPolarisEventListener is intended for tests only.",
232-
"polaris.event-listener.type"));
233-
}
234-
return ProductionReadinessCheck.OK;
235-
}
236-
237223
private static String authRealmSegment(String realm) {
238224
return realm.equals(AuthenticationConfiguration.DEFAULT_REALM_KEY) ? "" : realm + ".";
239225
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.polaris.service.events.listeners;
21+
22+
import io.smallrye.common.annotation.Identifier;
23+
import jakarta.enterprise.context.ApplicationScoped;
24+
25+
@ApplicationScoped
26+
@Identifier("test")
27+
public class QuarkusTestPolarisEventListener extends TestPolarisEventListener {}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.polaris.service.events.listeners;
2020

21-
import io.smallrye.common.annotation.Identifier;
22-
import jakarta.enterprise.context.ApplicationScoped;
2321
import java.util.Map;
2422
import java.util.concurrent.ConcurrentHashMap;
2523
import org.apache.polaris.service.events.AfterAttemptTaskEvent;
@@ -33,9 +31,7 @@
3331
import org.apache.polaris.service.events.PrincipalRolesServiceEvents;
3432
import org.apache.polaris.service.events.PrincipalsServiceEvents;
3533

36-
/** Event listener that stores all emitted events forever. Not recommended for use in production. */
37-
@ApplicationScoped
38-
@Identifier("test")
34+
/** Test event listener that stores all emitted events forever. */
3935
public class TestPolarisEventListener implements PolarisEventListener {
4036
private final Map<Class<? extends PolarisEvent>, PolarisEvent> latestEvents =
4137
new ConcurrentHashMap<>();

0 commit comments

Comments
 (0)