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/05/16 15:35:56 UTC

svn commit: r538584 - /incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/

Author: jcompagner
Date: Wed May 16 06:35:47 2007
New Revision: 538584

URL: http://svn.apache.org/viewvc?view=rev&rev=538584
Log:
some extra test for bookmarkable pages and restart on intercept

Added:
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html   (with props)
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java   (with props)

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java Wed May 16 06:35:47 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.markup.html.link;
+
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * @author jcompagner
+ */
+public class BookmarkableContinueToPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct.
+	 */
+	public BookmarkableContinueToPage()
+	{
+		getPageMap().continueToOriginalDestination();
+	}
+
+}
\ No newline at end of file

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java Wed May 16 06:35:47 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.markup.html.link;
+
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.protocol.http.WebRequestCycle;
+import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
+
+/**
+ * @author jcompagner
+ */
+public class BookmarkablePageLinkTest extends WicketTestCase
+{
+
+	/**
+	 * Construct.
+	 * 
+	 * @param name
+	 */
+	public BookmarkablePageLinkTest(String name)
+	{
+		super(name);
+	}
+
+	/**
+	 * @throws Exception
+	 */
+	public void testBookmarkableRequest() throws Exception
+	{
+		tester.setupRequestAndResponse();
+		
+		WebRequestCycle cycle = tester.createRequestCycle();
+		
+		String url = cycle.urlFor(new BookmarkablePageRequestTarget(BookmarkableHomePageLinksPage.class,null)).toString();
+
+		tester.setupRequestAndResponse();
+		tester.getServletRequest().setURL("/WicketTester$DummyWebApplication/WicketTester$DummyWebApplication/" + url);
+		
+		tester.processRequestCycle();
+		
+		assertEquals(tester.getLastRenderedPage().getClass(), BookmarkableHomePageLinksPage.class);
+
+	}
+	
+	/**
+	 * @throws Exception
+	 */
+	public void testBookmarkableRequestWithIntercept() throws Exception
+	{
+		tester.setupRequestAndResponse();
+		
+		WebRequestCycle cycle = tester.createRequestCycle();
+		
+		String url = cycle.urlFor(new BookmarkablePageRequestTarget(BookmarkableThrowsInterceptPage.class,null)).toString();
+		String url2 = cycle.urlFor(new BookmarkablePageRequestTarget(BookmarkableContinueToPage.class,null)).toString();
+
+		tester.setupRequestAndResponse();
+		tester.getServletRequest().setURL("/WicketTester$DummyWebApplication/WicketTester$DummyWebApplication/" + url);
+		tester.processRequestCycle();
+		
+		assertEquals(tester.getLastRenderedPage().getClass(), BookmarkableSetSecurityPage.class);
+		
+		tester.setupRequestAndResponse();
+		tester.getServletRequest().setURL("/WicketTester$DummyWebApplication/WicketTester$DummyWebApplication/" + url2);
+		tester.processRequestCycle();
+		assertEquals(tester.getLastRenderedPage().getClass(), BookmarkableThrowsInterceptPage.class);
+
+	}
+
+
+}

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html Wed May 16 06:35:47 2007
@@ -0,0 +1,18 @@
+<!--
+    ====================================================================
+    Licensed 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.
+-->
+<html xmlns:wicket>
+<body>
+</body>
+</html>

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java Wed May 16 06:35:47 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.markup.html.link;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * @author jcompagner
+ */
+public class BookmarkableSetSecurityPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct.
+	 */
+	public BookmarkableSetSecurityPage()
+	{
+		Application.get().setMetaData(BookmarkableThrowsInterceptPage.SECURITY, Boolean.TRUE);
+	}
+
+}

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableSetSecurityPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html Wed May 16 06:35:47 2007
@@ -0,0 +1,18 @@
+<!--
+    ====================================================================
+    Licensed 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.
+-->
+<html xmlns:wicket>
+<body>
+</body>
+</html>

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java?view=auto&rev=538584
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java (added)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java Wed May 16 06:35:47 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.markup.html.link;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.RestartResponseAtInterceptPageException;
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * @author jcompagner
+ */
+public class BookmarkableThrowsInterceptPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	private static class SecurityMetaDataKey extends MetaDataKey
+	{
+		/**
+		 * Construct.
+		 * @param type
+		 */
+		public SecurityMetaDataKey(Class type)
+		{
+			super(type);
+		}
+
+		private static final long serialVersionUID = 1L;
+		
+	}
+	
+	/**
+	 * 
+	 */
+	public static final SecurityMetaDataKey SECURITY = new SecurityMetaDataKey(Boolean.class);
+
+	/**
+	 * Construct.
+	 */
+	public BookmarkableThrowsInterceptPage()
+	{
+		if (Application.get().getMetaData(SECURITY) == null)
+		{
+			throw new RestartResponseAtInterceptPageException(BookmarkableSetSecurityPage.class);
+		}
+	}
+
+}

Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableThrowsInterceptPage.java
------------------------------------------------------------------------------
    svn:eol-style = native