Search in sources :

Example 31 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class WebSocketTesterProcessorTest method before.

@Before
public void before() {
    tester = new WicketTester(application);
    application.getWicketFilter().setFilterPath("");
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 32 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class WebSocketTesterRequestCycleListenerTest method before.

@Before
public void before() {
    tester = new WicketTester();
    tester.getApplication().getRequestCycleListeners().add(new IRequestCycleListener() {

        @Override
        public void onBeginRequest(RequestCycle cycle) {
            beginRequestCalled.set(true);
        }

        @Override
        public void onEndRequest(RequestCycle cycle) {
            endRequestCalled.set(true);
        }

        @Override
        public void onDetach(RequestCycle cycle) {
            detachCalled.set(true);
        }
    });
}
Also used : IRequestCycleListener(org.apache.wicket.request.cycle.IRequestCycleListener) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 33 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class SpringBeanWithGenericsTest method before.

/**
 * @throws Exception
 */
@Before
public void before() throws Exception {
    tester = new WicketTester();
    ctx = new AnnotationConfigApplicationContext();
    ctx.register(ConfigContextWithGenerics.class);
    ctx.refresh();
    SpringComponentInjector springInjector = new SpringComponentInjector(tester.getApplication(), ctx);
    tester.getApplication().getComponentInstantiationListeners().add(springInjector);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 34 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class CdiConfigurationTest method testApplicationLevelConfiguration.

@Test
public void testApplicationLevelConfiguration() {
    WicketTester tester = new WicketTester();
    CdiConfiguration config = new CdiConfiguration();
    for (ConversationPropagation cp : ConversationPropagation.values()) {
        config.setPropagation(cp);
        assertEquals(cp, config.getPropagation());
    }
    config.configure(tester.getApplication());
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 35 with WicketTester

use of org.apache.wicket.util.tester.WicketTester 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)

Aggregations

WicketTester (org.apache.wicket.util.tester.WicketTester)89 Test (org.junit.Test)54 Before (org.junit.Before)26 FormTester (org.apache.wicket.util.tester.FormTester)14 WebApplication (org.apache.wicket.protocol.http.WebApplication)9 MockApplication (org.apache.wicket.mock.MockApplication)6 AbstractDeploymentTest (org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest)5 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)5 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)4 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)4 DummyApplication (org.apache.wicket.resource.DummyApplication)4 Component (org.apache.wicket.Component)3 Response (org.apache.wicket.request.Response)3 WicketApplication (sandbox.WicketApplication)3 TestWicketJavaEEApplication (org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication)2 IAuthorizationStrategy (org.apache.wicket.authorization.IAuthorizationStrategy)2 RoleAuthorizationStrategy (org.apache.wicket.authroles.authorization.strategies.role.RoleAuthorizationStrategy)2 MockPageManager (org.apache.wicket.mock.MockPageManager)2 IManageablePage (org.apache.wicket.page.IManageablePage)2 IPageManager (org.apache.wicket.page.IPageManager)2