use of org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache in project nifi-minifi by apache.
the class FileSystemConfigurationCacheTest method getConfigurationTest.
@Test
public void getConfigurationTest() throws IOException, ConfigurationProviderException {
final String pathRoot = "files";
final String pathPattern = "config";
FileSystemConfigurationCache cache = new FileSystemConfigurationCache(pathRoot, pathPattern);
Map<String, List<String>> parameters = new HashMap<>();
ConfigurationCacheFileInfo info = cache.getCacheFileInfo("text/yaml", parameters);
WriteableConfiguration configuration = info.getConfiguration(1);
assertEquals("config.text.yaml.v1", configuration.getName());
assertEquals("1", configuration.getVersion());
assertTrue(configuration.exists());
}
use of org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache in project nifi-minifi by apache.
the class FileSystemConfigurationCacheTest method getConfigurationInvalidParametersTest.
@Test(expected = InvalidParameterException.class)
public void getConfigurationInvalidParametersTest() throws IOException, InvalidParameterException {
final String pathRoot = "files";
final String pathPattern = "${test}/config";
FileSystemConfigurationCache cache = new FileSystemConfigurationCache(pathRoot, pathPattern);
Map<String, List<String>> parameters = new HashMap<>();
cache.getCacheFileInfo("test/contenttype", parameters);
}
use of org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache in project nifi-minifi by apache.
the class FileSystemConfigurationCacheTest method getCachedConfigurationsTest.
@Test
public void getCachedConfigurationsTest() throws IOException, ConfigurationProviderException {
final String pathRoot = "files";
final String pathPattern = "config";
FileSystemConfigurationCache cache = new FileSystemConfigurationCache(pathRoot, pathPattern);
Map<String, List<String>> parameters = new HashMap<>();
ConfigurationCacheFileInfo info = cache.getCacheFileInfo("text/yaml", parameters);
Stream<WriteableConfiguration> configs = info.getCachedConfigurations();
assertEquals(1, configs.count());
}
use of org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache in project nifi-minifi by apache.
the class FileSystemConfigurationCacheTest method getNonexistantConfigurationTest.
@Test
public void getNonexistantConfigurationTest() throws IOException, ConfigurationProviderException {
final String pathRoot = "files";
final String pathPattern = "config";
FileSystemConfigurationCache cache = new FileSystemConfigurationCache(pathRoot, pathPattern);
Map<String, List<String>> parameters = new HashMap<>();
ConfigurationCacheFileInfo info = cache.getCacheFileInfo("test/contenttype", parameters);
WriteableConfiguration configuration = info.getConfiguration(1);
assertEquals("config.test.contenttype.v1", configuration.getName());
assertEquals("1", configuration.getVersion());
assertFalse(configuration.exists());
}
Aggregations