[TEST] Use valid file extension for mapping tests

Original commit: elastic/x-pack-elasticsearch@080699aeb8
This commit is contained in:
Simon Willnauer 2016-07-13 10:37:08 +02:00
parent 691bdfcf14
commit 89f98c60dc
2 changed files with 2 additions and 3 deletions

View File

@ -137,9 +137,7 @@ public class DnRoleMapper {
if (dnToRoles.isEmpty()) { if (dnToRoles.isEmpty()) {
logger.warn("no mappings found in role mappings file [{}] for realm [{}/{}]", path.toAbsolutePath(), realmType, realmName); logger.warn("no mappings found in role mappings file [{}] for realm [{}/{}]", path.toAbsolutePath(), realmType, realmName);
} }
return unmodifiableMap(dnToRoles); return unmodifiableMap(dnToRoles);
} catch (IOException e) { } catch (IOException e) {
throw new ElasticsearchException("could not read realm [" + realmType + "/" + realmName + "] role mappings file [" + throw new ElasticsearchException("could not read realm [" + realmType + "/" + realmName + "] role mappings file [" +
path.toAbsolutePath() + "]", e); path.toAbsolutePath() + "]", e);

View File

@ -190,7 +190,8 @@ public class DnRoleMapperTests extends ESTestCase {
} }
public void testParseFile_Empty() throws Exception { public void testParseFile_Empty() throws Exception {
Path file = createTempFile(); Path file = createTempDir().resolve("foo.yaml");
Files.createFile(file);
CapturingLogger logger = new CapturingLogger(CapturingLogger.Level.INFO); CapturingLogger logger = new CapturingLogger(CapturingLogger.Level.INFO);
Map<DN, Set<String>> mappings = DnRoleMapper.parseFile(file, logger, "_type", "_name"); Map<DN, Set<String>> mappings = DnRoleMapper.parseFile(file, logger, "_type", "_name");
assertThat(mappings, notNullValue()); assertThat(mappings, notNullValue());