Example usage for org.apache.wicket.protocol.http WebApplication getName

List of usage examples for org.apache.wicket.protocol.http WebApplication getName

Introduction

In this page you can find the example usage for org.apache.wicket.protocol.http WebApplication getName.

Prototype

public final String getName() 

Source Link

Document

Gets the name of this application.

Usage

From source file:org.dcm4chee.web.war.WASPTestUtil.java

License:LGPL

public static WicketTester getWicketTester(WebApplication testApplicaton) throws URISyntaxException {
    if (actionKey != null) {
        HiveMind.unregisterHive(hiveKey);
        Actions.unregisterActionFactory(actionKey);
        actionKey = hiveKey = null;/*from  www.  j a  v a 2s  .co  m*/
    }
    String contextPath = new java.io.File(WASPTestUtil.class.getResource("WASPTestUtil.class").toURI())
            .getParent();
    WicketTester wicketTester = new WicketTester(testApplicaton, contextPath);
    if (actionKey == null) {
        hiveKey = "hive_" + testApplicaton.getName();
        actionKey = testApplicaton.getClass().getName() + ":" + hiveKey;
    }
    MockServletContext ctx = (MockServletContext) wicketTester.getApplication().getServletContext();

    ctx.addInitParameter("securityDomainName", "dcm4chee");
    ctx.addInitParameter("rolesGroupName", "Roles");
    URL url = WASPTestUtil.class.getResource("/wicket.login.file");
    //Set login configuration file! '=' means: overwrite other login configuration given in Java security properties file.
    System.setProperty("java.security.auth.login.config", "=" + url.getPath());
    return wicketTester;
}