diff options
author | Tomek Kaminski <tomasz.kaminski@nokia.com> | 2019-04-11 10:31:12 +0200 |
---|---|---|
committer | Tomek Kaminski <tomasz.kaminski@nokia.com> | 2019-04-11 12:14:38 +0200 |
commit | 974ca909fd004351024e36d6e91169d90b3419e7 (patch) | |
tree | 8a20be7c2f847c701249db55e46055ee49066e78 /src/test/java | |
parent | 0654d98f69b80b8d932dd33a5dcc56dbecc6a64e (diff) |
Fix for loading cadi properties
Change-Id: I5b6115b8bf7dc0b9cde67e2983f2aad6781bd475
Issue-ID: DMAAP-1158
Signed-off-by: Tomek Kaminski <tomasz.kaminski@nokia.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java index d5ae5fd..53c8021 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java @@ -118,10 +118,25 @@ public class AAFAuthenticationFilterTest { } @Test - public void init_shouldInitializeCADI_whenAafIsUsed_andCadiPropertiesSet() throws Exception { + public void init_shouldFail_whenAafIsUsed_andInvalidCadiPropertiesSet() throws Exception { //given + String invalidFilePath = "src/test/resources/notExisting.properties"; doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); - doReturn("cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + doReturn(invalidFilePath).when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + + //then + thrown.expect(ServletException.class); + thrown.expectMessage("Could not load CADI properties file: "+invalidFilePath); + + //when + filter.init(filterConfig); + } + + @Test + public void init_shouldInitializeCADI_whenAafIsUsed_andValidCadiPropertiesSet() throws Exception { + //given + doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); + doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); //when filter.init(filterConfig); @@ -170,7 +185,7 @@ public class AAFAuthenticationFilterTest { private void initCADIFilter() throws Exception{ doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); - doReturn("cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); filter.init(filterConfig); filter.setCadiFilter(cadiFilterMock); } |