rfscholte commented on code in PR #13930: URL: https://github.com/apache/pinot/pull/13930#discussion_r1766488788
########## pinot-spi/src/test/java/org/apache/pinot/spi/plugin/ClassLoaderTest.java: ########## @@ -0,0 +1,226 @@ +/** + * 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.pinot.spi.plugin; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.regex.Pattern; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import static org.apache.pinot.spi.plugin.PluginManager.PLUGINS_DIR_PROPERTY_NAME; + + +/** + * IMPORTANT READ + * + * To avoid (huge) jars in the codebase just for testing, we let Maven download the jars required for these tests. + * In the pom.xml the maven-dependency-plugin is configured to download (and sometimes unpack) + * artifacts during the generate-test-resources phase. They will be put in _pluginsDirectory + * + * As this is the target/test-classes/plugins, it will contain the static files under src/test/resoources/plugins, + * most of the time just the pinot-plugin.properties for that plugin. + */ +public class ClassLoaderTest { + + private static final String ORIGINAL_PLUGIN_DIR = System.getProperty(PLUGINS_DIR_PROPERTY_NAME); + + // relative to pinot-spi/pom.xml + private final Path _pluginsDirectory = Path.of("target/test-classes/plugins").toAbsolutePath(); + + // MathUtils is only used in pinot framework, should not be available in limited plugins + private final String _commonsMathUtils = "org.apache.commons.math3.util.MathUtils"; + + // IOUtils exists in all realms, they should use their own version + private final String _commonsIOUtils = "org.apache.commons.io.IOUtils"; + + // TimeUtils exists in all realms, they should be imported from pinot classloader + private final String _spiTimeUtils = "org.apache.pinot.spi.utils.TimeUtils"; + + public final String _yammerMetricsRegistry = "org.apache.pinot.plugin.metrics.yammer.YammerMetricsRegistry"; + + public final String _dropwizardMetricsRegistry = + "org.apache.pinot.plugin.metrics.dropwizard.DropwizardMetricsRegistry"; Review Comment: this has already been merged, so I'll leave this up to you -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org