[java-idp-testbed COMMIT] in /trunk: pom.xml src/test/java/idp/AbstractFlowTest.java src/test/java/idp/saml1/SAML1Uns...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 22 15:49:24 EST 2014


Author: tzeller
Date: Wed Jan 22 15:49:23 2014
New Revision: 124

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=124&view=rev
Log:
Make tests pass when running with Maven. Unpack idp-conf before tests are run. Set idp.home and app.home via maven-surefire-plugin. Start and stop in-memory directory server in abstract flow test rather than via Spring.

Added:
    trunk/src/test/java/idp/AbstractFlowTest.java   (with props)
Modified:
    trunk/pom.xml
    trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java
    trunk/src/test/java/idp/saml2/SAML2UnsolicitedFlowTest.java

Modified: trunk/pom.xml
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/pom.xml?rev=124&r1=123&r2=124&view=diff
==============================================================================
--- trunk/pom.xml (original)
+++ trunk/pom.xml Wed Jan 22 15:49:23 2014
@@ -210,6 +210,17 @@
 
     <build>
         <plugins>
+            <!-- Set idp.home and app.home system properties to assembly directory for tests. -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemPropertyVariables>
+                        <idp.home>${assembly-directory}</idp.home>
+                        <app.home>${assembly-directory}</app.home>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
             <!-- mvn:jetty run -->
             <plugin>
                 <groupId>org.eclipse.jetty</groupId>
@@ -309,7 +320,7 @@
                     <!-- Unpack idp-conf dependency to assembly directory. -->
                     <execution>
                         <id>unpack</id>
-                        <phase>package</phase>
+                        <phase>generate-resources</phase>
                         <goals>
                             <goal>unpack</goal>
                         </goals>

Modified: trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java?rev=124&r1=123&r2=124&view=diff
==============================================================================
--- trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java (original)
+++ trunk/src/test/java/idp/saml1/SAML1UnsolicitedFlowTest.java Wed Jan 22 15:49:23 2014
@@ -17,6 +17,8 @@
 
 package idp.saml1;
 
+import idp.AbstractFlowTest;
+
 import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -27,10 +29,6 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
-import org.springframework.test.context.web.WebAppConfiguration;
 import org.springframework.webflow.execution.FlowExecutionOutcome;
 import org.springframework.webflow.executor.FlowExecutionResult;
 import org.springframework.webflow.executor.FlowExecutor;
@@ -39,20 +37,15 @@
 import org.testng.annotations.Test;
 
 /**
- * Stub integration test for SAML1 flow.
+ * Test for SAML1 flow.
  */
-// TODO context hierarchies ? more annotations ?
- at ActiveProfiles("dev")
- at WebAppConfiguration
- at ContextConfiguration({"/system/conf/testbed-ldap.xml", "/system/conf/global-system.xml", "/conf/global-user.xml",
-        "/system/conf/mvc-beans.xml", "/conf/webflow-config.xml"})
-public class SAML1UnsolicitedFlowTest extends AbstractTestNGSpringContextTests {
-
-    /** Flow id. */
-    @Nonnull public final static String flowId = "Shibboleth/SSO";
+public class SAML1UnsolicitedFlowTest extends AbstractFlowTest {
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(SAML1UnsolicitedFlowTest.class);
+    
+    /** Flow id. */
+    @Nonnull public final static String FLOW_ID = "Shibboleth/SSO";
 
     @Test public void testFlow() {
         try {
@@ -71,8 +64,8 @@
 
             FlowExecutor flowExecutor = applicationContext.getBean("flowExecutor", FlowExecutor.class);
 
-            FlowExecutionResult result = flowExecutor.launchExecution(flowId, null, mockCtx);
-            Assert.assertEquals(result.getFlowId(), flowId);
+            FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, mockCtx);
+            Assert.assertEquals(result.getFlowId(), FLOW_ID);
 
             FlowExecutionOutcome outcome = result.getOutcome();
             log.debug("flow outcome {}", outcome);
@@ -87,4 +80,5 @@
             HttpServletRequestResponseContext.clearCurrent();
         }
     }
+
 }

Modified: trunk/src/test/java/idp/saml2/SAML2UnsolicitedFlowTest.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/test/java/idp/saml2/SAML2UnsolicitedFlowTest.java?rev=124&r1=123&r2=124&view=diff

[... 63 lines stripped ...]


More information about the commits mailing list