Examples of MockApplication


Examples of org.apache.wicket.mock.MockApplication

@Category(SlowTests.class)
public class ComponentQueueingPerformanceTest extends WicketTestCase
{
  private void run(Class<? extends Page> pageClass)
  {
    WicketTester tester = new WicketTester(new MockApplication());
    try
    {
      tester.startPage(pageClass);
    }
    finally
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

public class StartComponentInPageRedirectToRenderTest extends WicketTestCase
{
  @Override
  protected WebApplication newApplication()
  {
    return new MockApplication()
    {
      @Override
      protected void init()
      {
        super.init();
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

{

  @Override
  protected WebApplication newApplication()
  {
    return new MockApplication()
    {
      @Override
      protected void init()
      {
        getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy.AllowAllAuthorizationStrategy()
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

public class DontStoreNotRenderedPageOnePassRenderTest extends DontStoreNotRenderedPageTestCase
{
  @Override
  protected WebApplication newApplication()
  {
    return new MockApplication()
    {
      @Override
      protected void init()
      {
        super.init();
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

public class DontStoreNotRenderedPageRedirectToRenderTest extends DontStoreNotRenderedPageTestCase
{
  @Override
  protected WebApplication newApplication()
  {
    return new MockApplication()
    {
      @Override
      protected void init()
      {
        super.init();
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

public class DontStoreNotRenderedPageRedirectToBufferTest extends DontStoreNotRenderedPageTestCase
{
  @Override
  protected WebApplication newApplication()
  {
    return new MockApplication()
    {
      @Override
      protected void init()
      {
        super.init();
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

   * testInjectionAndSerialization()
   */
  @Test
  public void testInjectionAndSerialization()
  {
    MockApplication app = new MockApplication();
    app.setServletContext(new MockServletContext(app, null));
    try
    {
      ThreadContext.setApplication(app);

      app.setName(getClass().getName());
      app.initApplication();

      Session session = new WebSession(new MockWebRequest(Url.parse("/")));
      app.getSessionStore().bind(null, session);
      ThreadContext.setSession(session);

      GuiceComponentInjector injector = new GuiceComponentInjector(app, new Module()
      {

        public void configure(final Binder binder)
        {
          binder.bind(ITestService.class).to(TestService.class);
          binder.bind(ITestService.class)
            .annotatedWith(Red.class)
            .to(TestServiceRed.class);
          binder.bind(ITestService.class)
            .annotatedWith(Blue.class)
            .to(TestServiceBlue.class);
          binder.bind(new TypeLiteral<Map<String, String>>()
          {
          }).toProvider(new Provider<Map<String, String>>()
          {
            public Map<String, String> get()
            {
              Map<String, String> strings = new HashMap<String, String>();

              strings.put(ITestService.RESULT, ITestService.RESULT);

              return strings;
            }
          });
        }

      });
      app.getComponentInstantiationListeners().add(injector);

      // Create a new component, which should be automatically injected,
      // and test to make sure the injection has worked.
      TestComponentInterface testComponent = newTestComponent("id");
      doChecksForComponent(testComponent);

      // Serialize and deserialize the object, and check it still works.
      TestComponentInterface clonedComponent = (TestComponentInterface)WicketObjects.cloneObject(testComponent);
      doChecksForComponent(clonedComponent);

      // Test injection of a class that does not extend Component
      TestNoComponentInterface noncomponent = newTestNoComponent();
      doChecksForNoComponent(noncomponent);

    }
    finally
    {
      app.internalDestroy();
      ThreadContext.detach();
    }
  }
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

  public void notModifiedResponseIncludesExpiresHeader() throws IOException, ServletException,
    ParseException
  {
    try
    {
      application = new MockApplication();
      WicketFilter filter = new WicketFilter();
      filter.init(new FilterTestingConfig());
      ThreadContext.setApplication(application);
      DynamicImageResource resource = new DynamicImageResource()
      {
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

   * @throws Exception
   */
  @Test
  public void ignorePaths() throws Exception
  {
    application = spy(new MockApplication());
    WicketFilter filter = new WicketFilter();
    filter.init(new FilterTestingConfig());

    HttpServletRequest request = mock(HttpServletRequest.class);
    when(request.getLocale()).thenReturn(new Locale("bg", "BG"));
View Full Code Here

Examples of org.apache.wicket.mock.MockApplication

   * Creates <code>WicketTester</code> and automatically create a <code>WebApplication</code>, but
   * the tester will have no home page.
   */
  public BaseWicketTester()
  {
    this(new MockApplication());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.