use of org.apache.kafka.common.config.ConfigData in project kafka by apache.
the class DirectoryConfigProviderTest method testNullPathWithKey.
@Test
public void testNullPathWithKey() {
ConfigData configData = provider.get(null, Collections.singleton("foo"));
assertTrue(configData.data().isEmpty());
assertNull(configData.ttl());
}
use of org.apache.kafka.common.config.ConfigData in project kafka by apache.
the class DirectoryConfigProviderTest method testNoSubdirs.
@Test
public void testNoSubdirs() {
// Only regular files directly in the path directory are allowed, not in subdirs
Set<String> keys = toSet(asList(subdir.getName(), String.join(File.separator, subdir.getName(), subdirFile.getName())));
ConfigData configData = provider.get(dir.getAbsolutePath(), keys);
assertTrue(configData.data().isEmpty());
assertNull(configData.ttl());
}
use of org.apache.kafka.common.config.ConfigData in project kafka by apache.
the class DirectoryConfigProviderTest method testGetAllKeysAtPath.
@Test
public void testGetAllKeysAtPath() throws IOException {
ConfigData configData = provider.get(dir.getAbsolutePath());
assertEquals(toSet(asList(foo.getName(), bar.getName())), configData.data().keySet());
assertEquals("FOO", configData.data().get(foo.getName()));
assertEquals("BAR", configData.data().get(bar.getName()));
assertNull(configData.ttl());
}
use of org.apache.kafka.common.config.ConfigData in project kafka by apache.
the class DirectoryConfigProviderTest method testEmptyPath.
@Test
public void testEmptyPath() {
ConfigData configData = provider.get("");
assertTrue(configData.data().isEmpty());
assertNull(configData.ttl());
}
use of org.apache.kafka.common.config.ConfigData in project kafka by apache.
the class DirectoryConfigProviderTest method testNoTraversal.
@Test
public void testNoTraversal() {
// Check we can't escape outside the path directory
Set<String> keys = toSet(asList(String.join(File.separator, "..", siblingFile.getName()), String.join(File.separator, "..", siblingDir.getName()), String.join(File.separator, "..", siblingDir.getName(), siblingDirFile.getName())));
ConfigData configData = provider.get(dir.getAbsolutePath(), keys);
assertTrue(configData.data().isEmpty());
assertNull(configData.ttl());
}
Aggregations