You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/11/03 21:38:36 UTC

svn commit: r591680 - in /wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket: LoginPage.html LoginPage.java ProtectedPage.html ProtectedPage.java RestartWithMountedPageTest.java

Author: jcompagner
Date: Sat Nov  3 13:38:36 2007
New Revision: 591680

URL: http://svn.apache.org/viewvc?rev=591680&view=rev
Log:
unit test from WICKET-702

Added:
    wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.html
    wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.java
    wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.html
    wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.java
    wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java

Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.html?rev=591680&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.html (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.html Sat Nov  3 13:38:36 2007
@@ -0,0 +1,5 @@
+<html>
+<body>
+
+</body>
+</html>
\ No newline at end of file

Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.java?rev=591680&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.java (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/LoginPage.java Sat Nov  3 13:38:36 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * @author jcompagner
+ */
+public class LoginPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct.
+	 */
+	public LoginPage()
+	{
+	}
+
+}

Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.html?rev=591680&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.html (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.html Sat Nov  3 13:38:36 2007
@@ -0,0 +1,5 @@
+<html>
+<body>
+
+</body>
+</html>
\ No newline at end of file

Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.java?rev=591680&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.java (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/ProtectedPage.java Sat Nov  3 13:38:36 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * The page that is protected and needs to redirect to the login page.
+ */
+public class ProtectedPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct.
+	 */
+	public ProtectedPage()
+	{
+		throw new RestartResponseAtInterceptPageException(LoginPage.class);
+	}
+
+}

Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java?rev=591680&view=auto
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java Sat Nov  3 13:38:36 2007
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import org.apache.wicket.util.lang.PackageName;
+
+/**
+ * @author jcompagner
+ */
+public class RestartWithMountedPageTest extends WicketTestCase
+{
+
+	/**
+	 * Construct.
+	 */
+	public RestartWithMountedPageTest()
+	{
+		super();
+	}
+
+	/**
+	 * Construct.
+	 * 
+	 * @param name
+	 */
+	public RestartWithMountedPageTest(String name)
+	{
+		super(name);
+	}
+
+
+	/**
+	 * Tests that a protected page can redirect to a login page from a mounted package.
+	 */
+	public void testWithMountedPackage()
+	{
+		tester.getApplication().mount("/test",
+			PackageName.forPackage(ProtectedPage.class.getPackage()));
+		tester.startPage(ProtectedPage.class);
+		tester.assertRenderedPage(LoginPage.class);
+	}
+
+	/**
+	 * Tests that a protected page can redirect to a login page from mounted pages.
+	 */
+	public void testWithMountedLoginPage()
+	{
+		tester.getApplication().mountBookmarkablePage("/login", LoginPage.class);
+		tester.startPage(ProtectedPage.class);
+		tester.assertRenderedPage(LoginPage.class);
+	}
+
+}