From 89f98c60dcae34049f92f495a24bfe1a5e339311 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 13 Jul 2016 10:37:08 +0200 Subject: [PATCH] [TEST] Use valid file extension for mapping tests Original commit: elastic/x-pack-elasticsearch@080699aeb8312707f728a30ffc45d2463c7f4ed0 --- .../xpack/security/authc/support/DnRoleMapper.java | 2 -- .../xpack/security/authc/support/DnRoleMapperTests.java | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapper.java b/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapper.java index 2eefccdc2db..cb15f785ab4 100644 --- a/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapper.java +++ b/elasticsearch/x-pack/security/src/main/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapper.java @@ -137,9 +137,7 @@ public class DnRoleMapper { if (dnToRoles.isEmpty()) { logger.warn("no mappings found in role mappings file [{}] for realm [{}/{}]", path.toAbsolutePath(), realmType, realmName); } - return unmodifiableMap(dnToRoles); - } catch (IOException e) { throw new ElasticsearchException("could not read realm [" + realmType + "/" + realmName + "] role mappings file [" + path.toAbsolutePath() + "]", e); diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapperTests.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapperTests.java index 6d95614ade5..ae5703611a2 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapperTests.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authc/support/DnRoleMapperTests.java @@ -190,7 +190,8 @@ public class DnRoleMapperTests extends ESTestCase { } 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); Map> mappings = DnRoleMapper.parseFile(file, logger, "_type", "_name"); assertThat(mappings, notNullValue());