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);
}
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);
}
Aggregations