Search in sources :

Example 6 with MockApplication

use of org.apache.wicket.mock.MockApplication in project wicket by apache.

the class ApplicationSettingsTest method testUseDefaultOnMissingResourceDefaultValue.

/**
 * @throws Exception
 */
@Test
public void testUseDefaultOnMissingResourceDefaultValue() throws Exception {
    ResourceSettings settings = new ResourceSettings(new MockApplication());
    Assert.assertTrue("useDefaultOnMissingResource should default to true", settings.getUseDefaultOnMissingResource());
}
Also used : MockApplication(org.apache.wicket.mock.MockApplication) ResourceSettings(org.apache.wicket.settings.ResourceSettings) Test(org.junit.Test)

Example 7 with MockApplication

use of org.apache.wicket.mock.MockApplication in project wicket by apache.

the class ApplicationSettingsTest method testUseDefaultOnMissingResourceSetsCorrectly.

/**
 * @throws Exception
 */
@Test
public void testUseDefaultOnMissingResourceSetsCorrectly() throws Exception {
    ResourceSettings settings = new ResourceSettings(new MockApplication());
    settings.setUseDefaultOnMissingResource(false);
    Assert.assertFalse("useDefaultOnMissingResource should have been set to false", settings.getUseDefaultOnMissingResource());
}
Also used : MockApplication(org.apache.wicket.mock.MockApplication) ResourceSettings(org.apache.wicket.settings.ResourceSettings) Test(org.junit.Test)

Example 8 with MockApplication

use of org.apache.wicket.mock.MockApplication in project wicket by apache.

the class EnclosureTest method testRenderPage13.

/**
 * @throws Exception
 */
@Test
public void testRenderPage13() throws Exception {
    tester = new WicketTester(new MockApplication() {

        @Override
        protected void init() {
            super.init();
            // This should cause all SecuredContainer components to be hidden
            getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy.AllowAllAuthorizationStrategy() {

                @Override
                public boolean isActionAuthorized(Component component, Action action) {
                    return !(component instanceof SecuredContainer_13);
                }
            });
        }
    });
    executeTest(EnclosurePage_13.class, "EnclosurePageExpectedResult_13.html");
}
Also used : Action(org.apache.wicket.authorization.Action) MockApplication(org.apache.wicket.mock.MockApplication) WicketTester(org.apache.wicket.util.tester.WicketTester) IAuthorizationStrategy(org.apache.wicket.authorization.IAuthorizationStrategy) Component(org.apache.wicket.Component) Test(org.junit.Test)

Example 9 with MockApplication

use of org.apache.wicket.mock.MockApplication in project wicket by apache.

the class CssPackageResourceTest method newApplication.

@Override
protected WebApplication newApplication() {
    return new MockApplication() {

        @Override
        protected void init() {
            super.init();
            getResourceSettings().setCssCompressor(new ICssCompressor() {

                @Override
                public String compress(String original) {
                    return APP_COMPRESSED;
                }
            });
        }
    };
}
Also used : ICssCompressor(org.apache.wicket.css.ICssCompressor) MockApplication(org.apache.wicket.mock.MockApplication)

Example 10 with MockApplication

use of org.apache.wicket.mock.MockApplication in project wicket by apache.

the class CompressBundlesTest method newApplication.

@Override
protected WebApplication newApplication() {
    return new MockApplication() {

        @Override
        protected void init() {
            super.init();
            // remove that setting to see the original (non-compressed) version of the bundle
            getResourceSettings().setJavaScriptCompressor(new DefaultJavaScriptCompressor());
            getResourceBundles().addJavaScriptBundle(CompressBundlesTest.class, "bundle.js", new JavaScriptResourceReference(CompressBundlesTest.class, "two.js"), new JavaScriptResourceReference(CompressBundlesTest.class, "one.js"));
        }
    };
}
Also used : MockApplication(org.apache.wicket.mock.MockApplication) JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) DefaultJavaScriptCompressor(org.apache.wicket.javascript.DefaultJavaScriptCompressor)

Aggregations

MockApplication (org.apache.wicket.mock.MockApplication)32 Test (org.junit.Test)14 ResourceSettings (org.apache.wicket.settings.ResourceSettings)6 WicketTester (org.apache.wicket.util.tester.WicketTester)6 Request (org.apache.wicket.request.Request)4 Response (org.apache.wicket.request.Response)4 Before (org.junit.Before)4 FilterChain (javax.servlet.FilterChain)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Session (org.apache.wicket.Session)3 IAuthorizationStrategy (org.apache.wicket.authorization.IAuthorizationStrategy)3 WebApplication (org.apache.wicket.protocol.http.WebApplication)3 MockHttpServletRequest (org.apache.wicket.protocol.http.mock.MockHttpServletRequest)3 IOException (java.io.IOException)2 Locale (java.util.Locale)2 ServletException (javax.servlet.ServletException)2 ServletRequest (javax.servlet.ServletRequest)2 ServletResponse (javax.servlet.ServletResponse)2 Application (org.apache.wicket.Application)2