Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents


Profile Flow Unit Tests

The idp-conf Maven module, which includes most of the as-delivered configuration files that end up in the distribution, includes TestNG unit tests that exercise many of the webflows, but without using a browser (so just programmatically with mock objects).

The tests extend AbstractFlowTest, which is responsible for :

  • Creating mock objects such as HttpServletRequest, HttpServletResponse, and the Spring Web Flow ExternalContext

  • Overriding flows to return the OpenSAML ProfileRequestContext as a Spring Web Flow output attribute

Tests of SAML flows extract the SAML Response from the OpenSAML ProfileRequestContext and validate the Response using a validator, for example the SAML2TestResponseValidator.

...

A very simple mock SP included in the testbed simply displays the messages it receives for diagnostic purposes and it can initiate SAML profiles in various ways.

The testbed provides :

  • an IdP configured by idp-conf from the classpath (by setting the idp.home and idp.webflows system properties)

  • a mock SAML SP

  • a test in-memory LDAP directory server

How to Run the Testbed in Eclipse with Jetty 9.4

...

Logging

Jetty will log to ${workspace_loc:idp-jetty-base}/src/main/resources/jetty-base/logs

The IdP will log to ${workspace_loc:idp-jetty-base}/src/main/resources/jetty-base/classpath/logs

To log to the Eclipse console :

  • comment out --module=logging in ${workspace_loc:idp-jetty-base}/src/main/resources/jetty-base/start.ini

  • add

    <include

    <include resource="conf/logback-include-console.xml" />

     to

     to the end of ${workspace_loc:idp-conf}/src/main/resources/conf/logback.xml (this includes ${workspace_loc:idp-conf}/src/test/resources/conf/logback-include-console.xml)

Storage

To interact with IdP storage services via HTTP, add the following to idp-war/src/main/webapp/WEB-INF/web.xml :

...

web.xml
collapsetrue
Expand
titleweb.xml
Code Block
language
xml
<!-- The /storage app space. Interact with storage services via HTTP. -->
<servlet>
    <servlet-name>storage</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:/system/conf/storage-context.xml</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>storage</servlet-name>
    <url-pattern>/storage/*</url-pattern>
</servlet-mapping>

See the Javadoc for the testbed StorageServiceWrapperController for usage.

Troubleshooting Eclipse Testbed

...

make sure that the version of Jetty specified via jetty.home and the testbed POM match.

-Djetty.home=/opt/jetty/jetty-distribution-9.3.16.v20170120

...

<jetty.version>9.3.16.

...

v20170120</jetty.

...

version>

Integration Tests

The java-idp-integration-tests project exercises profile flows using a browser via Selenium.

...