[java-identity-provider COMMIT] in /trunk: idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesAp...

noreply at shibboleth.net noreply at shibboleth.net
Mon Nov 16 12:46:52 EST 2015


Author: tzeller
Date: Mon Nov 16 12:46:52 2015
New Revision: 7997

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7997&view=rev
Log:
IDP-812 - Update Javadoc and tests.

Modified:
    trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesApplicationContextInitializerTest.java
    trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdPPropertiesApplicationContextInitializer.java

Modified: trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesApplicationContextInitializerTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesApplicationContextInitializerTest.java?rev=7997&r1=7996&r2=7997&view=diff
==============================================================================
--- trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesApplicationContextInitializerTest.java	(original)
+++ trunk/idp-conf/src/test/java/net/shibboleth/idp/test/flows/paths/IdPPropertiesApplicationContextInitializerTest.java	Mon Nov 16 12:46:52 2015
@@ -26,53 +26,63 @@
 import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
 import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
 
-/**
- * TODO
- */
+/** {@link IdPPropertiesApplicationContextInitializer} unit test. */
 public class IdPPropertiesApplicationContextInitializerTest {
 
+    private MockServletContext sc;
+
+    private ContextLoaderListener listener;
+
+    @BeforeMethod public void setUp() {
+        sc = new MockServletContext("");
+        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:/system/conf/global-system.xml");
+        sc.addInitParameter(ContextLoader.CONTEXT_INITIALIZER_CLASSES_PARAM,
+                IdPPropertiesApplicationContextInitializer.class.getName());
+        listener = new ContextLoaderListener();
+    }
+
     @Test(expectedExceptions = BeanDefinitionStoreException.class) public void testNoInitializer() {
-        final MockServletContext sc = new MockServletContext("");
+        sc = new MockServletContext("");
         sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:/system/conf/global-system.xml");
-        final ContextLoaderListener listener = new ContextLoaderListener();
+        listener = new ContextLoaderListener();
         listener.contextInitialized(new ServletContextEvent(sc));
         WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
     }
 
     @Test(expectedExceptions = ConstraintViolationException.class) public void testNotFound() {
-        final MockServletContext sc = new MockServletContext("");
-        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:/system/conf/global-system.xml");
-        sc.addInitParameter(ContextLoader.CONTEXT_INITIALIZER_CLASSES_PARAM,
-                IdPPropertiesApplicationContextInitializer.class.getName());
-        final ContextLoaderListener listener = new ContextLoaderListener();
+        listener.contextInitialized(new ServletContextEvent(sc));
+        WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
+    }
+
+    @Test(expectedExceptions = {BeanDefinitionStoreException.class}) public void testNotFoundFalseFailFast() {
+        sc.addInitParameter("idp.initializer.failFast", "false");
         listener.contextInitialized(new ServletContextEvent(sc));
         WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
     }
 
     @Test(expectedExceptions = ConstraintViolationException.class) public void testUserDefinedNotFound() {
-        final MockServletContext sc = new MockServletContext("");
-        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:/system/conf/global-system.xml");
-        sc.addInitParameter(ContextLoader.CONTEXT_INITIALIZER_CLASSES_PARAM,
-                IdPPropertiesApplicationContextInitializer.class.getName());
         sc.addInitParameter("idp.home", "foo");
-        final ContextLoaderListener listener = new ContextLoaderListener();
+        listener.contextInitialized(new ServletContextEvent(sc));
+        final WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
+        Assert.assertTrue(wac.getEnvironment().containsProperty("idp.home"));
+    }
+
+    @Test(expectedExceptions = BeanDefinitionStoreException.class) public void testUserDefinedNotFoundFalseFailFast() {
+        sc.addInitParameter("idp.home", "foo");
+        sc.addInitParameter("idp.initializer.failFast", "false");
         listener.contextInitialized(new ServletContextEvent(sc));
         final WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
         Assert.assertTrue(wac.getEnvironment().containsProperty("idp.home"));
     }
 

[... 106 lines stripped ...]


More information about the commits mailing list