From b38935a45065d67a90d94b531b128f008d0f64d9 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Fri, 19 Jul 2024 11:44:23 +0000 Subject: [PATCH] add test; fb --- .../druid/sql/calcite/run/DruidHook.java | 3 ++ .../druid/sql/calcite/run/DruidHookTest.java | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 sql/src/test/java/org/apache/druid/sql/calcite/run/DruidHookTest.java diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java b/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java index c502e08ced4..e23d7a2c3a3 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java @@ -21,6 +21,8 @@ package org.apache.druid.sql.calcite.run; import com.google.errorprone.annotations.Immutable; import org.apache.calcite.rel.RelNode; +import org.apache.druid.annotations.SuppressFBWarnings; + import java.io.Closeable; import java.util.ArrayList; import java.util.HashMap; @@ -74,6 +76,7 @@ public interface DruidHook void invoke(HookKey key, T object); + @SuppressFBWarnings({"MS_OOI_PKGPROTECT"}) Map, List>> GLOBAL = new HashMap<>(); static void register(HookKey label, DruidHook hook) diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/run/DruidHookTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/run/DruidHookTest.java new file mode 100644 index 00000000000..f8bfb7bdfe0 --- /dev/null +++ b/sql/src/test/java/org/apache/druid/sql/calcite/run/DruidHookTest.java @@ -0,0 +1,35 @@ +/* + * 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.druid.sql.calcite.run; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.junit.Test; + +public class DruidHookTest +{ + @Test + public void testHookKeyEquals() + { + EqualsVerifier.forClass(DruidHook.HookKey.class) + .withNonnullFields("label", "type") + .usingGetClass() + .verify(); + } +}