adutra commented on code in PR #3293: URL: https://github.com/apache/polaris/pull/3293#discussion_r2676902523
########## runtime/service/src/test/java/org/apache/polaris/service/events/AttributeKeyTest.java: ########## @@ -0,0 +1,112 @@ +/* + * 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; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.reflect.TypeToken; +import org.junit.jupiter.api.Test; + +class AttributeKeyTest { + + private static final String TEST_KEY = "test_key"; + private static final String OTHER_KEY = "other_key"; + + @Test + void testCreateAndAccessors() { + AttributeKey<String> key = new AttributeKey<>(TEST_KEY, String.class); + + assertThat(key.name()).isEqualTo(TEST_KEY); + assertThat(key.type()).isEqualTo(TypeToken.of(String.class)); + } + + @Test + void testEqualsAndHashCode() { Review Comment: Some of the tests here are not useful anymore since the class is now a record. ########## runtime/service/src/main/java/org/apache/polaris/service/ratelimiter/RateLimiterFilter.java: ########## @@ -28,13 +28,15 @@ import jakarta.ws.rs.ext.Provider; import java.io.IOException; import org.apache.polaris.service.config.FilterPriorities; -import org.apache.polaris.service.events.BeforeLimitRequestRateEvent; +import org.apache.polaris.service.events.AttributeMap; +import org.apache.polaris.service.events.EventAttributes; +import org.apache.polaris.service.events.PolarisEvent; import org.apache.polaris.service.events.PolarisEventMetadataFactory; +import org.apache.polaris.service.events.PolarisEventType; import org.apache.polaris.service.events.listeners.PolarisEventListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** Request filter that returns a 429 Too Many Requests if the rate limiter says so */ Review Comment: Why remove the javadocs? ########## runtime/service/src/test/java/org/apache/polaris/service/events/PolarisEventTest.java: ########## @@ -0,0 +1,116 @@ +/* + * 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; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class PolarisEventTest { + + private static final String TEST_REALM = "test-realm"; + private static final String TEST_CATALOG = "my-catalog"; + private static final String TEST_TABLE = "my-table"; + + private static final PolarisEventMetadata TEST_METADATA = + ImmutablePolarisEventMetadata.builder().realmId(TEST_REALM).build(); + + @Test + void testBuilderCreatesEvent() { Review Comment: Same here, this test is not very useful anymore since the class is a record. Others below aren't useful either because they are testing `AttributeMap`: they should be moved to `AttributeMapTest`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
