Example usage for org.apache.wicket.mock MockApplication MockApplication

List of usage examples for org.apache.wicket.mock MockApplication MockApplication

Introduction

In this page you can find the example usage for org.apache.wicket.mock MockApplication MockApplication.

Prototype

public MockApplication() 

Source Link

Document

Construct.

Usage

From source file:com.aplombee.navigator.AjaxItemsNavigatorTest.java

License:Apache License

private static WebApplication createMockApplication() {
    WebApplication app = new MockApplication();
    return app;
}

From source file:de.htw.berlin.portal.panel.TopPanelTest.java

License:Apache License

@Before
public void setUp() {
    tester = new WicketTester(new MockApplication() {

        @Override//from w w  w  . j a  v a  2s . c  o  m
        public Session newSession(Request request, Response response) {
            return new PortalSession(request);
        }
    });
    enhanced = new EnhancedWicketTester(tester);
}

From source file:nl.mpi.lamus.web.AbstractLamusWicketTest.java

License:Open Source License

@Before
public void setUp() throws Exception {

    applicationContextMock = new ApplicationContextMock();

    tester = new WicketTester(new MockApplication() {

        @Override/*from www.  ja  v  a  2  s  . c  o m*/
        public Session newSession(Request request, Response response) {
            return AbstractLamusWicketTest.this.getSessionFactory().createSession(this, request, response);
        }

    });
    tester.getApplication().getComponentInstantiationListeners()
            .add(new SpringComponentInjector(tester.getApplication(), applicationContextMock));
    setUpTest();
}

From source file:org.cdlflex.ui.AbstractWicketTest.java

License:Apache License

@Before
public void setUpWicketTestEnvironment() throws Exception {
    wicketTester = new WicketTester(new MockApplication());
}

From source file:org.opensingular.form.wicket.panel.SingularFormPanelTest.java

License:Apache License

@Before
public void setUp() {
    springContext = new GenericApplicationContext();
    springContext.getBeanFactory().registerSingleton("formConfig", new MockFormConfig());
    springContext.getBeanFactory().registerSingleton(MyTestService.class.getName(), new MyTestService());
    springContext.refresh();//from  www  .ja  v a 2s  . c o  m

    MockApplication wicketApplication = new MockApplication();

    wicketApplication.getComponentInstantiationListeners()
            .add(new SpringComponentInjector(wicketApplication, springContext, true));

    tester = new SingularWicketTester(wicketApplication);
}

From source file:org.wicketstuff.console.examples.TestPagesTest.java

License:Apache License

@Before
public void setUp() {
    tester = new WicketTester(new MockApplication());
}

From source file:org.wicketstuff.rest.utils.http.HttpUtilsTest.java

License:Apache License

@Test
public void readRequestString() throws Exception {
    String xmlText = "<?xml version='1.0' encoding='UTF-8'?>\n" + "<html>\n" + "   <body>\n" + "      <p >\n"
            + "      </p>\n" + "   </body>\n" + "</html>";

    MockApplication mockApplication = new MockApplication();
    MockServletContext servletContext = new MockServletContext(mockApplication, "/");
    BufferedMockRequest mockedRequest = new BufferedMockRequest(mockApplication,
            new MockHttpSession(servletContext), servletContext, "POST");

    mockedRequest.setTextAsRequestBody(xmlText);

    WebRequest webRequest = mock(WebRequest.class);
    when(webRequest.getContainerRequest()).thenReturn(mockedRequest);

    String stringFromRequest = HttpUtils.readStringFromRequest(webRequest);
    Assert.assertEquals(xmlText, stringFromRequest);
}

From source file:org.wicketstuff.springreference.AbstractSpringDependenciesTest.java

License:Apache License

@Before
public void before() {
    Application application = new MockApplication();
    ThreadContext.setApplication(application);

    SpringReferenceSupporter.register(application, new SpringReferenceSupporter(applicationContext));

    deps = new Deps();
}

From source file:org.wicketstuff.springreference.SpringReferenceTest.java

License:Apache License

@Before
public void before() {
    Application application = new MockApplication();
    ThreadContext.setApplication(application);

    SpringReferenceSupporter.register(application, new SpringReferenceSupporter(applicationContext));
}

From source file:sf.wicklet.ext.test.auth.TestWxSignInPanel01.java

License:Apache License

@Before
public void setup() {
    // make sure no leaked threadlocals are present
    ThreadContext.detach();/*from   w  w  w  .  j a  v  a  2  s.  c  o  m*/
    final WebApplication application = new MockApplication() {
        @Override
        public Session newSession(final Request request, final Response response) {
            return new TestSession(request);
        }
    };
    tester = new WicketTester(application);
}