Search in sources :

Example 11 with ExtensionsConfig

use of org.apache.druid.guice.ExtensionsConfig in project druid by druid-io.

the class InitializationTest method testGetExtensionFilesToLoad_with_load_list.

/**
 * druid.extension.load is specified, Initialization.getExtensionFilesToLoad is supposed to return all the extension
 * folders appeared in the load list.
 */
@Test
public void testGetExtensionFilesToLoad_with_load_list() throws IOException {
    final File extensionsDir = temporaryFolder.newFolder();
    final File absolutePathExtension = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public LinkedHashSet<String> getLoadList() {
            return Sets.newLinkedHashSet(Arrays.asList("mysql-metadata-storage", absolutePathExtension.getAbsolutePath()));
        }

        @Override
        public String getDirectory() {
            return extensionsDir.getAbsolutePath();
        }
    };
    final File mysql_metadata_storage = new File(extensionsDir, "mysql-metadata-storage");
    final File random_extension = new File(extensionsDir, "random-extensions");
    mysql_metadata_storage.mkdir();
    random_extension.mkdir();
    final File[] expectedFileList = new File[] { mysql_metadata_storage, absolutePathExtension };
    final File[] actualFileList = Initialization.getExtensionFilesToLoad(config);
    Assert.assertArrayEquals(expectedFileList, actualFileList);
}
Also used : ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) File(java.io.File) Test(org.junit.Test)

Example 12 with ExtensionsConfig

use of org.apache.druid.guice.ExtensionsConfig in project druid by druid-io.

the class InitializationTest method testGetExtensionFilesToLoad_with_non_exist_item_in_load_list.

/**
 * druid.extension.load is specified, but contains an extension that is not prepared under root extension directory.
 * Initialization.getExtensionFilesToLoad is supposed to throw ISE.
 */
@Test(expected = ISE.class)
public void testGetExtensionFilesToLoad_with_non_exist_item_in_load_list() throws IOException {
    final File extensionsDir = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public LinkedHashSet<String> getLoadList() {
            return Sets.newLinkedHashSet(ImmutableList.of("mysql-metadata-storage"));
        }

        @Override
        public String getDirectory() {
            return extensionsDir.getAbsolutePath();
        }
    };
    final File random_extension = new File(extensionsDir, "random-extensions");
    random_extension.mkdir();
    Initialization.getExtensionFilesToLoad(config);
}
Also used : ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) File(java.io.File) Test(org.junit.Test)

Aggregations

ExtensionsConfig (org.apache.druid.guice.ExtensionsConfig)12 File (java.io.File)10 Test (org.junit.Test)10 Help (com.github.rvesse.airline.help.Help)1 ParseException (com.github.rvesse.airline.parser.errors.ParseException)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 SuppressForbidden (io.netty.util.SuppressForbidden)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 CuratorModule (org.apache.druid.curator.CuratorModule)1 DiscoveryModule (org.apache.druid.curator.discovery.DiscoveryModule)1 AnnouncerModule (org.apache.druid.guice.AnnouncerModule)1 CoordinatorDiscoveryModule (org.apache.druid.guice.CoordinatorDiscoveryModule)1 DruidProcessingConfigModule (org.apache.druid.guice.DruidProcessingConfigModule)1 DruidSecondaryModule (org.apache.druid.guice.DruidSecondaryModule)1 ExpressionModule (org.apache.druid.guice.ExpressionModule)1 FirehoseModule (org.apache.druid.guice.FirehoseModule)1