Search in sources :

Example 6 with ExtensionsConfig

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

the class InitializationTest method testGetExtensionFilesToLoad_null_load_list.

/**
 * If druid.extension.load is not specified, Initialization.getExtensionFilesToLoad is supposed to return all the
 * extension folders under root extensions directory.
 */
@Test
public void testGetExtensionFilesToLoad_null_load_list() throws IOException {
    final File extensionsDir = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

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

Example 7 with ExtensionsConfig

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

the class InitializationTest method testGetHadoopDependencyFilesToLoad_wrong_type_root_hadoop_depenencies_dir.

@Test(expected = ISE.class)
public void testGetHadoopDependencyFilesToLoad_wrong_type_root_hadoop_depenencies_dir() throws IOException {
    final File rootHadoopDependenciesDir = temporaryFolder.newFile();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public String getHadoopDependenciesDir() {
            return rootHadoopDependenciesDir.getAbsolutePath();
        }
    };
    Initialization.getHadoopDependencyFilesToLoad(ImmutableList.of(), config);
}
Also used : ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) File(java.io.File) Test(org.junit.Test)

Example 8 with ExtensionsConfig

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

the class InitializationTest method testGetHadoopDependencyFilesToLoad_non_exist_version_dir.

@Test(expected = ISE.class)
public void testGetHadoopDependencyFilesToLoad_non_exist_version_dir() throws IOException {
    final File rootHadoopDependenciesDir = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public String getHadoopDependenciesDir() {
            return rootHadoopDependenciesDir.getAbsolutePath();
        }
    };
    final File hadoopClient = new File(rootHadoopDependenciesDir, "hadoop-client");
    hadoopClient.mkdir();
    Initialization.getHadoopDependencyFilesToLoad(ImmutableList.of("org.apache.hadoop:hadoop-client:2.3.0"), config);
}
Also used : ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) File(java.io.File) Test(org.junit.Test)

Example 9 with ExtensionsConfig

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

the class InitializationTest method testGetHadoopDependencyFilesToLoad_with_hadoop_coordinates.

@Test
public void testGetHadoopDependencyFilesToLoad_with_hadoop_coordinates() throws IOException {
    final File rootHadoopDependenciesDir = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public String getHadoopDependenciesDir() {
            return rootHadoopDependenciesDir.getAbsolutePath();
        }
    };
    final File hadoopClient = new File(rootHadoopDependenciesDir, "hadoop-client");
    final File versionDir = new File(hadoopClient, "2.3.0");
    hadoopClient.mkdir();
    versionDir.mkdir();
    final File[] expectedFileList = new File[] { versionDir };
    final File[] actualFileList = Initialization.getHadoopDependencyFilesToLoad(ImmutableList.of("org.apache.hadoop:hadoop-client:2.3.0"), config);
    Assert.assertArrayEquals(expectedFileList, actualFileList);
}
Also used : ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) File(java.io.File) Test(org.junit.Test)

Example 10 with ExtensionsConfig

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

the class InitializationTest method testGetExtensionFilesToLoad_empty_extensions_dir.

@Test
public void testGetExtensionFilesToLoad_empty_extensions_dir() throws IOException {
    final File extensionsDir = temporaryFolder.newFolder();
    final ExtensionsConfig config = new ExtensionsConfig() {

        @Override
        public String getDirectory() {
            return extensionsDir.getAbsolutePath();
        }
    };
    Assert.assertArrayEquals("Empty root extensionsDir should return an empty array of File", new File[] {}, 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