001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.util.tester; 018 019import org.apache.wicket.Page; 020import org.apache.wicket.markup.html.WebPage; 021import org.apache.wicket.markup.html.link.Link; 022 023/** 024 * A dummy home page, as required by <code>WicketTester</code>. 025 * 026 * @author Ingram Chen 027 * @since 1.2.6 028 */ 029public class DummyHomePage extends WebPage 030{ 031 private static final long serialVersionUID = 1L; 032 033 private final Link<?> testPageLink; 034 035 /** 036 * Constructor. 037 * 038 */ 039 public DummyHomePage() 040 { 041 testPageLink = new TestLink("testPage"); 042 add(testPageLink); 043 } 044 045 /** 046 * Retrieves the test page <code>Link</code>. 047 * 048 * @return the test page <code>Link</code> 049 */ 050 public Link<?> getTestPageLink() 051 { 052 return testPageLink; 053 } 054 055 protected Page getTestPage() { 056 throw new UnsupportedOperationException("To use DummyHomePage.TestLink you need to implement DummyHomePage#getTestPage() method."); 057 } 058 059 /** 060 * <code>TestLink</code> class. 061 */ 062 public class TestLink extends Link<Void> 063 { 064 private static final long serialVersionUID = 1L; 065 066 /** 067 * Constructor. 068 * 069 * @param id 070 * <code>Component</code> id of the <code>TestLink</code> 071 */ 072 public TestLink(String id) 073 { 074 super(id); 075 } 076 077 @Override 078 public void onClick() 079 { 080 setResponsePage(getTestPage()); 081 } 082 } 083}