You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ad...@apache.org on 2018/06/21 21:29:13 UTC
wicket git commit: WICKET-6562 Remove from wicket-core all the
deprecated classes
Repository: wicket
Updated Branches:
refs/heads/master 175734dae -> 16c918044
WICKET-6562 Remove from wicket-core all the deprecated classes
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/16c91804
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/16c91804
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/16c91804
Branch: refs/heads/master
Commit: 16c918044fb75d8d97722c2ada572bf0adb0ea92
Parents: 175734d
Author: Andrea Del Bene <an...@gmail.com>
Authored: Wed Jun 20 21:04:58 2018 +0200
Committer: Andrea Del Bene <an...@gmail.com>
Committed: Thu Jun 21 23:28:01 2018 +0200
----------------------------------------------------------------------
.../apache/wicket/RequestListenerInterface.java | 278 ----------
.../apache/wicket/ajax/AjaxRequestTarget.java | 11 -
.../java/org/apache/wicket/markup/IMarkup.java | 102 ----
.../wicket/model/AbstractReadOnlyModel.java | 59 ---
.../org/apache/wicket/model/ChainingModel.java | 18 +-
.../org/apache/wicket/model/IChainingModel.java | 58 ---
.../http/documentvalidation/Comment.java | 62 ---
.../documentvalidation/DocumentElement.java | 28 -
.../documentvalidation/HtmlDocumentParser.java | 296 -----------
.../HtmlDocumentValidator.java | 516 -------------------
.../protocol/http/documentvalidation/Tag.java | 144 ------
.../http/documentvalidation/TextContent.java | 61 ---
.../http/documentvalidation/package.html | 27 -
.../cycle/AbstractRequestCycleListener.java | 77 ---
.../wicket/AttributeModifierComponentTest.java | 99 ----
...telessAjaxFallbackLinkDoNotRecreatePage.java | 18 +-
.../wicket/markup/html/list/PagedTableTest.java | 94 ----
.../apache/wicket/model/ModelToStringTest.java | 25 -
.../protocol/http/WicketTagPanelTest.java | 113 ----
19 files changed, 7 insertions(+), 2079 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/RequestListenerInterface.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/RequestListenerInterface.java b/wicket-core/src/main/java/org/apache/wicket/RequestListenerInterface.java
deleted file mode 100644
index 37f04f8..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/RequestListenerInterface.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * 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 java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException;
-import org.apache.wicket.request.component.IRequestableComponent;
-import org.apache.wicket.util.lang.Classes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Base class for request listener interfaces.
- *
- * @author Jonathan Locke
- * @deprecated This class is not used by the framework anymore. Will be removed in Wicket 9.0.0
- */
-@Deprecated
-public class RequestListenerInterface
-{
- /** Map from name to request listener interface */
- private static final Map<String, RequestListenerInterface> interfaces = Collections.synchronizedMap(new HashMap<String, RequestListenerInterface>());
-
- /** Log. */
- private static final Logger log = LoggerFactory.getLogger(RequestListenerInterface.class);
-
- /**
- * Looks up a request interface listener by name.
- *
- * @param interfaceName
- * The interface name
- * @return The RequestListenerInterface object, or null if none is found
- *
- */
- public static RequestListenerInterface forName(final String interfaceName)
- {
- return interfaces.get(interfaceName);
- }
-
- /** The name of this listener interface */
- private final String name;
-
- /**
- * Whether the render count should be included in URL. This should be true for every listener
- * interface URL that should only be active on last rendered page (links, etc) and false for
- * other (resources);
- */
- private boolean includeRenderCount = true;
-
- /**
- * Whether the page should be rendered by default after the invocation of this listener
- * interface. Applies only during non-ajax requests.
- */
- private boolean renderPageAfterInvocation = true;
-
- final Class<? extends IRequestListener> listenerInterfaceClass;
-
- /**
- * Constructor.
- *
- * @param listenerInterfaceClass
- * The interface class, which must extend IRequestListener.
- */
- public RequestListenerInterface(final Class<? extends IRequestListener> listenerInterfaceClass)
- {
- this.listenerInterfaceClass = listenerInterfaceClass;
-
- // Ensure that it extends IRequestListener
- if (!IRequestListener.class.isAssignableFrom(listenerInterfaceClass))
- {
- throw new IllegalArgumentException("Class " + listenerInterfaceClass +
- " must extend IRequestListener");
- }
-
- // Save short class name
- name = Classes.simpleName(listenerInterfaceClass);
-
- // Register this listener
- register();
- }
-
-
- /**
- * @return The interface class, which must extend IRequestListener.
- */
- public Class<? extends IRequestListener> getListenerInterfaceClass()
- {
- return listenerInterfaceClass;
- }
-
-
- /**
- * @param includeRenderCount
- * @return self
- */
- public RequestListenerInterface setIncludeRenderCount(boolean includeRenderCount)
- {
- this.includeRenderCount = includeRenderCount;
- return this;
- }
-
- /**
- * @return whether the render count should be included in url
- */
- public boolean isIncludeRenderCount()
- {
- return includeRenderCount;
- }
-
- /**
- * @param renderPageAfterInvocation
- * @return self
- */
- public RequestListenerInterface setRenderPageAfterInvocation(boolean renderPageAfterInvocation)
- {
- this.renderPageAfterInvocation = renderPageAfterInvocation;
- return this;
- }
-
- /**
- * @return whether the page should be rendered after invocation of this interface (during
- * non-ajax requests)
- */
- public boolean isRenderPageAfterInvocation()
- {
- return renderPageAfterInvocation;
- }
-
- /**
- * @return The name of this request listener interface
- */
- public final String getName()
- {
- return name;
- }
-
- /**
- * Invokes a given interface on a component.
- *
- * @param rcomponent
- * The component
- *
- * @throws ListenerInvocationNotAllowedException
- * when listener invocation attempted on a component that does not allow it
- */
- public final void invoke(final IRequestableComponent rcomponent)
- {
- // we are in Wicket core land
- final Component component = (Component)rcomponent;
-
- if (!component.canCallListener())
- {
- // just return so that we have a silent fail and just re-render the
- // page
- log.info("component not enabled or visible; ignoring call. Component: " + component);
- throw new ListenerInvocationNotAllowedException(component, null,
- "Component rejected interface invocation");
- }
-
- internalInvoke(component, component);
- }
-
- /**
- * Invokes a given interface on a component's behavior.
- *
- * @param rcomponent
- * The component
- * @param behavior
- * @throws ListenerInvocationNotAllowedException
- * when listener invocation attempted on a component that does not allow it
- */
- public final void invoke(final IRequestableComponent rcomponent, final Behavior behavior)
- {
- // we are in Wicket core land
- final Component component = (Component)rcomponent;
-
- if (!behavior.canCallListener(component))
- {
- log.warn("behavior not enabled; ignore call. Behavior {} at component {}", behavior,
- component);
- throw new ListenerInvocationNotAllowedException(component, behavior,
- "Behavior rejected interface invocation. ");
- }
-
- internalInvoke(component, behavior);
- }
-
- private void internalInvoke(final Component component, final Object target)
- {
- // save a reference to the page because the component can be removed
- // during the invocation of the listener and thus lose its parent
- Page page = component.getPage();
-
- // initialization is required for stateless pages
- if (!page.isInitialized())
- {
- page.internalInitialize();
- }
-
- ((IRequestListener)target).onRequest();
- }
-
- /**
- * Method to call to register this interface for use
- */
- public void register()
- {
- // Register this listener interface
- registerRequestListenerInterface(this);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- return "[RequestListenerInterface name=" + name + "]";
- }
-
-
- /**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- * <p>
- * In previous versions of Wicket, request listeners were manually registered by calling this
- * method. Now there is a first class RequestListenerInterface object which should be
- * constructed as a constant member of the interface to enable automatic interface registration.
- * <p>
- * Adds a request listener interface to the map of interfaces that can be invoked by outsiders.
- *
- * @param requestListenerInterface
- * The request listener interface object
- */
- private void registerRequestListenerInterface(final RequestListenerInterface requestListenerInterface)
- {
- // Check that a different interface method with the same name has not
- // already been registered
- final RequestListenerInterface existingInterface = RequestListenerInterface.forName(requestListenerInterface.getName());
- if (existingInterface == null)
- {
- // Save this interface method by the non-qualified class name
- interfaces.put(requestListenerInterface.getName(), requestListenerInterface);
-
- log.info("registered listener interface " + this);
- }
- }
-
- /**
- *
- * @return collection of all registered interfaces
- */
- public static Collection<RequestListenerInterface> getRegisteredInterfaces()
- {
- return Collections.unmodifiableCollection(interfaces.values());
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
index d668a92..8bf5707 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
@@ -80,17 +80,6 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable
}
/**
- * Empty implementation of an {@link IListener} useful as a starting point for your own
- * custom listener.
- *
- * @deprecated This class will be removed in Wicket 9.0.0. Use {@link IListener} instead
- */
- @Deprecated
- class AbstractListener implements IListener
- {
- }
-
- /**
* An ajax javascript response that allows users to add javascript to be executed on the client
* side
*
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/markup/IMarkup.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkup.java b/wicket-core/src/main/java/org/apache/wicket/markup/IMarkup.java
deleted file mode 100644
index 9e88f4c..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkup.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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;
-
-/**
- * Holds markup as a resource (the stream that the markup came from) and a list of MarkupElements
- * (the markup itself).
- *
- * @see MarkupElement
- * @see ComponentTag
- * @see org.apache.wicket.markup.RawMarkup
- *
- * @author Jonathan Locke
- * @author Juergen Donnerstag
- * @deprecated This class is not used by the framework anymore. Will be removed in Wicket 9.0.0
- */
-@Deprecated
-public interface IMarkup
-{
- /**
- * Find the markup element index of the component with 'path'
- *
- * @param path
- * The component path expression
- * @param id
- * The component's id to search for
- * @return -1, if not found
- */
- int findComponentIndex(final String path, final String id);
-
- /**
- * For Wicket it would be sufficient for this method to be package protected. However to allow
- * wicket-bench easy access to the information ...
- *
- * @param index
- * Index into markup list
- * @return Markup element
- */
- MarkupElement get(final int index);
-
- /**
- * Gets the markup encoding. A markup encoding may be specified in a markup file with an XML
- * encoding specifier of the form <?xml ... encoding="..." ?>.
- *
- * @return Encoding, or null if not found.
- */
- String getEncoding();
-
- /**
- * Gets the resource that contains this markup
- *
- * @return The resource where this markup came from
- */
- MarkupResourceStream getResource();
-
- /**
- * Get the wicket namespace valid for this specific markup
- *
- * @return wicket namespace
- */
- String getWicketNamespace();
-
- /**
- * Return the XML declaration string, in case if found in the markup.
- *
- * @return Null, if not found.
- */
- String getXmlDeclaration();
-
- /**
- * For Wicket it would be sufficient for this method to be package protected. However to allow
- * wicket-bench easy access to the information ...
- *
- * @return Number of markup elements
- */
- int size();
-
- /**
- * @return String representation of markup list
- */
- String toDebugString();
-
- /**
- * @return String representation of markup list
- */
- @Override
- String toString();
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/model/AbstractReadOnlyModel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/model/AbstractReadOnlyModel.java b/wicket-core/src/main/java/org/apache/wicket/model/AbstractReadOnlyModel.java
deleted file mode 100644
index 6491080..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/model/AbstractReadOnlyModel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.model;
-
-
-/**
- * AbstractReadOnlyModel is an adapter base class for implementing models which have no detach logic
- * and are read-only.
- *
- * @author Igor Vaynberg ( ivaynberg )
- *
- * @param <T>
- * The model object
- * @deprecated Use an anonymous instance of {@link IModel} instead. Since Wicket 8.0 {@link IModel}
- * doesn't require providing implementation of {@link IModel#setObject(Object)} method.
- */
-@Deprecated
-public abstract class AbstractReadOnlyModel<T> implements IModel<T>
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * This default implementation of setObject unconditionally throws an
- * UnsupportedOperationException. Since the method is final, any subclass is effectively a
- * read-only model.
- *
- * @param object
- * The object to set into the model
- * @throws UnsupportedOperationException
- */
- @Override
- public final void setObject(final T object)
- {
- throw new UnsupportedOperationException("Model " + getClass() +
- " does not support setObject(Object)");
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder("Model:classname=[");
- sb.append(getClass().getName()).append("]");
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java b/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
index 5d5a7fa..2f7db0d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
*
* @since 6.0.0
*/
-public class ChainingModel<T> implements IChainingModel<T>
+public class ChainingModel<T> implements IModel<T>
{
private static final Logger LOG = LoggerFactory.getLogger(ChainingModel.class);
@@ -97,22 +97,6 @@ public class ChainingModel<T> implements IChainingModel<T>
return (T)target;
}
- @Override
- public IModel<?> getChainedModel()
- {
- if (target instanceof IModel)
- {
- return (IModel<?>)target;
- }
- return null;
- }
-
- @Override
- public void setChainedModel(IModel<?> model)
- {
- target = model;
- }
-
/**
* @return The target - object or model
*/
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/model/IChainingModel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/model/IChainingModel.java b/wicket-core/src/main/java/org/apache/wicket/model/IChainingModel.java
deleted file mode 100644
index 27d2875..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/model/IChainingModel.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.model;
-
-/**
- * Models that implement this interface will support chaining of IModels. getObject() of a
- * IChainingModel should do something like:
- *
- * <pre>
- * if ( object instanceof IModel) { return ((IModel)object).getObject()}
- * else return object;
- * </pre>
- *
- * ChainingModels should also take care that the internal model detach is called when detach is
- * called on them.
- *
- * @author jcompagner
- * @author Igor Vaynberg (ivaynberg)
- *
- * @param <T>
- * The Model object type
- *
- * @see CompoundPropertyModel
- * @see AbstractPropertyModel
- * @deprecated This class is not used by the framework anymore. Will be removed in Wicket 9.0.0
- */
-@Deprecated
-public interface IChainingModel<T> extends IModel<T>
-{
- /**
- * Sets the model that is chained inside this model.
- *
- * @param model
- */
- void setChainedModel(IModel<?> model);
-
- /**
- * Returns the chained model if there is a chained model.
- *
- * @return The chained model
- */
- IModel<?> getChainedModel();
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Comment.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Comment.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Comment.java
deleted file mode 100644
index 76b4067..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Comment.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-/**
- * Class representing a comment in an HTML document.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0 together with {@link HtmlDocumentValidator}
- */
-@Deprecated
-public class Comment implements DocumentElement
-{
- /** The text for this HTML comment */
- private final String text;
-
- /**
- * Create the comment.
- *
- * @param text
- * The text for the comment
- */
- public Comment(final String text)
- {
- this.text = text;
- }
-
- /**
- * Get the comment text.
- *
- * @return The text
- */
- public String getText()
- {
- return text;
- }
-
- /**
- * Output a descriptive string.
- *
- * @return The string
- */
- @Override
- public String toString()
- {
- return "[comment = '" + text + "']";
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/DocumentElement.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/DocumentElement.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/DocumentElement.java
deleted file mode 100644
index 4c10d93..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/DocumentElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-/**
- * Marker interface indicating a document element.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0 together with {@link HtmlDocumentValidator}
- */
-@Deprecated
-public interface DocumentElement
-{
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentParser.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentParser.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentParser.java
deleted file mode 100644
index 86de0ec..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentParser.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.wicket.util.string.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Lightweight document parser for HTML. This parser is only intended to process well formed and
- * simple HTML of the kind that would generally be utilized during testing.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0 together with {@link HtmlDocumentValidator}
- */
-@Deprecated
-public class HtmlDocumentParser
-{
- private static final Logger log = LoggerFactory.getLogger(HtmlDocumentParser.class);
-
- /** Constant for close tag token. */
- public static final int CLOSE_TAG = 4;
-
- /** Constant for comment token. */
- public static final int COMMENT = 1;
-
- /** Constant for end token. */
- public static final int END = 0;
-
- /** Constant for open tag token. */
- public static final int OPEN_TAG = 2;
-
- /** Constant for open/close tag token. */
- public static final int OPENCLOSE_TAG = 3;
-
- /** Constant for text token. */
- public static final int TEXT = 5;
-
- /** constant for unknown token. */
- public static final int UNKNOWN = -1;
-
- private Map<String, String> attributes;
-
- /** Extracted content */
- private String comment;
-
- /** Document parse elements */
- private final String document;
-
- private int pos;
-
- private String tag;
-
- private String text;
-
- /**
- * Create the parser for the current document.
- *
- * @param document
- * The document to parse
- */
- public HtmlDocumentParser(final String document)
- {
- CharSequence tmp = Strings.replaceAll(document, "\n", "");
- tmp = Strings.replaceAll(tmp, "\r", "");
- this.document = Strings.replaceAll(tmp, "\t", " ").toString();
- pos = 0;
- }
-
- /**
- * Get the attributes of the tag.
- *
- * @return The attributes
- */
- public Map<String, String> getAttributes()
- {
- return attributes;
- }
-
- /**
- * Get the comment.
- *
- * @return The comment
- */
- public String getComment()
- {
- return comment;
- }
-
- /**
- * Iterates through the document searching for tokens. Returns the type of token that was found.
- * If an unexpected token was encountered then the parser writes this fact to the console and
- * continues
- *
- * @return The token that was found
- */
- public int getNextToken()
- {
- if (pos < document.length())
- {
- char ch = document.charAt(pos);
- if (ch == '<')
- {
- return processDirective();
- }
- else
- {
- return processText();
- }
- }
- return END;
- }
-
- /**
- * Get the tag name.
- *
- * @return The tag name
- */
- public String getTag()
- {
- return tag;
- }
-
- /**
- * Get the text.
- *
- * @return The text
- */
- public String getText()
- {
- return text;
- }
-
- /**
- * Extract attributes from the given string.
- *
- * @param attributeString
- * The string
- * @return The map of attributes
- */
- private Map<String, String> extractAttributes(String attributeString)
- {
- Map<String, String> m = new HashMap<String, String>();
- attributeString = Strings.replaceAll(attributeString.trim(), "\t", " ").toString();
- attributeString = Strings.replaceAll(attributeString, " = ", "=").toString();
- String[] attributeElements = Strings.split(attributeString, ' ');
- for (String attributeElement : attributeElements)
- {
- String[] bits = Strings.split(attributeElement, '=');
- if (bits.length == 1)
- {
- m.put(bits[0].trim().toLowerCase(), "");
- }
- else
- {
- bits[0] = bits[0].trim();
- StringBuilder value = new StringBuilder();
- for (int j = 1; j < bits.length; j++)
- {
- value.append(bits[j]);
- if (j < (bits.length - 1))
- {
- value.append('=');
- }
- }
- bits[1] = value.toString().trim();
- if (bits[1].startsWith("\""))
- {
- bits[1] = bits[1].substring(1);
- }
- if (bits[1].endsWith("\""))
- {
- bits[1] = bits[1].substring(0, bits[1].length() - 1);
- }
- m.put(bits[0].toLowerCase(), bits[1]);
- }
- }
- return m;
- }
-
- /**
- * Process a directive starting at the current position.
- *
- * @return The token found
- */
- private int processDirective()
- {
- String part = document.substring(pos);
- if (part.matches("<!--.*-->.*"))
- {
- // This is a comment
- comment = part.substring(4, part.indexOf("-->")).trim();
- pos += part.indexOf("-->") + 3;
- return COMMENT;
- }
- else if (part.matches("</.*>.*"))
- {
- // This is a closing tag
- tag = part.substring(2, part.indexOf('>')).trim().toLowerCase();
- pos += part.indexOf(">") + 1;
- return CLOSE_TAG;
- }
- else if (part.matches("<[^/]+[^>]*/>.*"))
- {
- // This is an openclose tag
- if (part.matches("<([a-zA-Z]+:)?[a-zA-Z]+/>.*"))
- {
- // No attributes
- tag = part.substring(1, part.indexOf("/>")).toLowerCase();
- attributes = new HashMap<String, String>();
- }
- else
- {
- // Attributes
- tag = part.substring(1, part.indexOf(' ')).toLowerCase();
- String attributeString = part.substring(part.indexOf(' '), part.indexOf("/>"));
- attributes = extractAttributes(attributeString);
- }
- pos += part.indexOf("/>") + 2;
- return OPENCLOSE_TAG;
- }
- else if (part.matches("<[^/>]+.*>.*"))
- {
- // This is an opening tag
- if (part.matches("<([a-zA-Z]+:)?[a-zA-Z0-9]*>.*"))
- {
- // No attributes
- tag = part.substring(1, part.indexOf('>')).toLowerCase();
- attributes = new HashMap<String, String>();
- }
- else
- {
- // Attributes
- tag = part.substring(1, part.indexOf(' ')).toLowerCase();
- String attributeString = part.substring(part.indexOf(' '), part.indexOf('>'));
- attributes = extractAttributes(attributeString);
- }
- pos += part.indexOf(">") + 1;
- return OPEN_TAG;
- }
- else
- {
- int size = (part.length() > 30) ? 30 : part.length();
- log.error("Unexpected markup found: " + part.substring(0, size) + "...");
- return UNKNOWN;
- }
- }
-
- /**
- * Process text up to the next token.
- *
- * @return The token code
- */
- private int processText()
- {
- StringBuilder buf = new StringBuilder();
- while (pos < document.length())
- {
- char ch = document.charAt(pos);
- if (ch == '<')
- {
- text = buf.toString();
- return TEXT;
- }
- else
- {
- buf.append(ch);
- }
- pos++;
- }
- if (buf.length() > 0)
- {
- text = buf.toString();
- return TEXT;
- }
- return END;
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentValidator.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentValidator.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentValidator.java
deleted file mode 100644
index 0006d4a..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/HtmlDocumentValidator.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.collections.ArrayListStack;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Simple class that provides a convenient programmatic way to define what an expected HTML document
- * should look like and then to validate a supplied document against this template. Note that this
- * validator expects very clean HTML (which should not be a problem during testing). In particular
- * it expects tags to be matched and that the following tags with optional close tags are actually
- * closed: p, td, th, li and option.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0. Use {@link org.apache.wicket.util.tester.TagTester} or
- * {@link org.apache.wicket.util.tester.WicketTestCase#executeTest(Class, PageParameters, String)} instead
- */
-@Deprecated
-public class HtmlDocumentValidator
-{
- private static final Logger log = LoggerFactory.getLogger(HtmlDocumentValidator.class);
-
- private final List<DocumentElement> elements = new ArrayList<DocumentElement>();
-
- private boolean skipComments = true;
-
- private Tag workingTag;
-
- /**
- * Create the validator.
- */
- public HtmlDocumentValidator()
- {
- }
-
- /**
- * Add a root element to the validator. This will generally be the HTML element to which all
- * children are added. However, it may also be other elements to represent comments or similar.
- *
- * @param e
- * The element to add
- */
- public void addRootElement(final DocumentElement e)
- {
- elements.add(e);
- }
-
- /**
- * Check whether the supplied document is valid against the spec that has been built up within
- * the validator.
- *
- * @param document
- * The document to validate
- * @return Whether the document is valid or not
- */
- public boolean isDocumentValid(final String document)
- {
- HtmlDocumentParser parser = new HtmlDocumentParser(document);
- Iterator<DocumentElement> expectedElements = elements.iterator();
- ArrayListStack<Iterator<DocumentElement>> iteratorStack = new ArrayListStack<Iterator<DocumentElement>>();
- ArrayListStack<String> tagNameStack = new ArrayListStack<String>();
-
- boolean end = false;
- boolean valid = true;
- while (!end)
- {
- int token = parser.getNextToken();
- switch (token)
- {
- case HtmlDocumentParser.UNKNOWN :
- // Error is already recorded by the parser
- return false;
- case HtmlDocumentParser.END :
- end = true;
- break;
- case HtmlDocumentParser.COMMENT :
- valid = validateComment(expectedElements, parser);
- if (!valid)
- {
- end = true;
- }
- break;
- case HtmlDocumentParser.OPEN_TAG :
- valid = validateTag(expectedElements, parser);
- if (!valid)
- {
- end = true;
- }
- else
- {
- expectedElements = saveOpenTagState(iteratorStack, expectedElements,
- tagNameStack);
- }
- break;
- case HtmlDocumentParser.OPENCLOSE_TAG :
- valid = validateTag(expectedElements, parser);
- if (valid)
- {
- valid = checkOpenCloseTag();
- }
- if (!valid)
- {
- end = true;
- }
- break;
- case HtmlDocumentParser.CLOSE_TAG :
- expectedElements = validateCloseTag(tagNameStack, parser, expectedElements,
- iteratorStack);
- if (expectedElements == null)
- {
- valid = false;
- end = true;
- }
- break;
- case HtmlDocumentParser.TEXT :
- valid = validateText(expectedElements, parser);
- if (!valid)
- {
- end = true;
- }
- break;
- }
- }
-
- // Return the valid result
- return valid;
- }
-
- /**
- * Set whether to skip comments of not when validating. The default is true. If this is set to
- * false then Comment elements must be added to represent each comment to be validated.
- *
- * @param skipComments
- * Whether to skip comments or not
- */
- public void setSkipComments(final boolean skipComments)
- {
- this.skipComments = skipComments;
- }
-
- /**
- * Check whether the open close tag was actually expected to have children.
- *
- * @return Whether valid or not
- */
- private boolean checkOpenCloseTag()
- {
- boolean valid = true;
- if (!workingTag.getExpectedChildren().isEmpty())
- {
- log.error("Found tag <" + workingTag.getTag() + "/> was expected to have " +
- workingTag.getExpectedChildren().size() + " child elements");
- valid = false;
- }
- return valid;
- }
-
- /**
- * Check if the supplied tag is one that expects to be closed or not.
- *
- * @param tag
- * The tag
- * @return Whether the tag requires closing or not
- */
- private boolean isNonClosedTag(String tag)
- {
- tag = workingTag.getTag().toLowerCase();
- if (tag.equals("area"))
- {
- return true;
- }
- if (tag.equals("base"))
- {
- return true;
- }
- if (tag.equals("basefont"))
- {
- return true;
- }
- if (tag.equals("bgsound"))
- {
- return true;
- }
- if (tag.equals("br"))
- {
- return true;
- }
- if (tag.equals("col"))
- {
- return true;
- }
- if (tag.equals("frame"))
- {
- return true;
- }
- if (tag.equals("hr"))
- {
- return true;
- }
- if (tag.equals("img"))
- {
- return true;
- }
- if (tag.equals("input"))
- {
- return true;
- }
- if (tag.equals("isindex"))
- {
- return true;
- }
- if (tag.equals("keygen"))
- {
- return true;
- }
- if (tag.equals("link"))
- {
- return true;
- }
- if (tag.equals("meta"))
- {
- return true;
- }
- if (tag.equals("param"))
- {
- return true;
- }
- if (tag.equals("spacer"))
- {
- return true;
- }
- if (tag.equals("wbr"))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Save the new open tag state and find the iterator to continue to use for processing.
- *
- * @param iteratorStack
- * The current stack of iterators
- * @param expectedElements
- * The current iterator of elements
- * @param tagNameStack
- * The stack of open tags
- * @return The iterator to continue to use
- */
- private Iterator<DocumentElement> saveOpenTagState(
- ArrayListStack<Iterator<DocumentElement>> iteratorStack,
- Iterator<DocumentElement> expectedElements, ArrayListStack<String> tagNameStack)
- {
- if (!isNonClosedTag(workingTag.getTag()))
- {
- iteratorStack.push(expectedElements);
- expectedElements = workingTag.getExpectedChildren().iterator();
- tagNameStack.push(workingTag.getTag());
- }
- return expectedElements;
- }
-
- /**
- * Validate the close tag that was found.
- *
- * @param tagNameStack
- * The stack of tag names
- * @param parser
- * The parser
- * @param expectedElements
- * The current iterator of expected elements
- * @param iteratorStack
- * The stack of previous iterators
- * @return The next iterator to use, or null
- */
- private Iterator<DocumentElement> validateCloseTag(ArrayListStack<String> tagNameStack,
- HtmlDocumentParser parser, Iterator<DocumentElement> expectedElements,
- ArrayListStack<Iterator<DocumentElement>> iteratorStack)
- {
- if (tagNameStack.isEmpty())
- {
- log.error("Found closing tag </" + parser.getTag() + "> when there are no " +
- "tags currently open");
- expectedElements = null;
- }
- else
- {
- String expectedTag = tagNameStack.pop();
- if (!expectedTag.equals(parser.getTag()))
- {
- log.error("Found closing tag </" + parser.getTag() + "> when we expecting " +
- "the closing tag </" + expectedTag + "> instead");
- expectedElements = null;
- }
- else
- {
- if (expectedElements.hasNext())
- {
- DocumentElement e = expectedElements.next();
- log.error("Found closing tag </" + parser.getTag() + "> but we were " +
- "expecting to find another child element: " + e.toString());
- expectedElements = null;
- }
- else
- {
- if (iteratorStack.isEmpty())
- {
- log.error("Unexpected parsing error");
- expectedElements = null;
- }
- else
- {
- expectedElements = iteratorStack.pop();
- }
- }
- }
- }
- return expectedElements;
- }
-
- /**
- * Validate the comment token that was found.
- *
- * @param expectedElements
- * The iterator of expected elements
- * @param parser
- * The parser
- * @return Whether the comment is valid or not
- */
- private boolean validateComment(Iterator<DocumentElement> expectedElements,
- HtmlDocumentParser parser)
- {
- boolean valid = true;
- if (!skipComments)
- {
- if (expectedElements.hasNext())
- {
- DocumentElement e = expectedElements.next();
- if (e instanceof Comment)
- {
- if (!((Comment)e).getText().equals(parser.getComment()))
- {
- log.error("Found comment '" + parser.getComment() + "' does not match " +
- "expected comment '" + ((Comment)e).getText() + "'");
- valid = false;
- }
- }
- else
- {
- log.error("Found comment '" + parser.getComment() + "' was not expected. " +
- "We were expecting: " + e.toString());
- valid = false;
- }
- }
- else
- {
- log.error("Found comment '" + parser.getComment() + "' was not expected. " +
- "We were not expecting any more elements within the current tag");
- valid = false;
- }
- }
- return valid;
- }
-
- /**
- * Validate the tag token that was found.
- *
- * @param expectedElements
- * The iterator of expected elements
- * @param parser
- * The parser
- * @return Whether the tag is valid or not
- */
- private boolean validateTag(Iterator<DocumentElement> expectedElements,
- HtmlDocumentParser parser)
- {
- boolean valid = true;
- if (expectedElements.hasNext())
- {
- DocumentElement e = expectedElements.next();
- if (e instanceof Tag)
- {
- workingTag = (Tag)e;
- if (!workingTag.getTag().equals(parser.getTag()))
- {
- log.error("Found tag <" + parser.getTag() + "> does not match " +
- "expected tag <" + workingTag.getTag() + ">");
- valid = false;
- }
- else
- {
- Map<String, String> actualAttributes = parser.getAttributes();
-
- Map<String, String> expectedAttributes = workingTag.getExpectedAttributes();
- for (Map.Entry<String, String> entry : expectedAttributes.entrySet())
- {
- String name = entry.getKey();
- String pattern = entry.getValue();
- if (!actualAttributes.containsKey(name))
- {
- log.error("Tag <" + workingTag.getTag() + "> was expected to have a '" +
- name + "' attribute " + "but this was not present");
- valid = false;
- }
-
- String value = actualAttributes.get(name);
- if (value == null)
- {
- log.error("Attribute " + name + " was expected but not found");
- valid = false;
- }
- else
- {
- if (!value.matches(pattern))
- {
- log.error("The value '" + value + "' of attribute '" + name +
- "' of tag <" + workingTag.getTag() +
- "> was expected to match the pattern '" + pattern +
- "' but it does not");
- valid = false;
- }
- }
- }
-
- for (String name : workingTag.getIllegalAttributes())
- {
- if (actualAttributes.containsKey(name))
- {
- log.error("Tag <" + workingTag.getTag() +
- "> should not have an attributed named '" + name + "'");
- valid = false;
- }
- }
- }
- }
- else
- {
- log.error("Found tag <" + parser.getTag() + "> was not expected. " +
- "We were expecting: " + e.toString());
- valid = false;
- }
- }
- else
- {
- log.error("Found tag <" + parser.getTag() + "> was not expected. " +
- "We were not expecting any more elements within the current tag");
- valid = false;
- }
- return valid;
- }
-
- /**
- * Validate the text token that was found.
- *
- * @param expectedElements
- * The iterator of expected elements
- * @param parser
- * The parser
- * @return Whether the text is valid or not
- */
- private boolean validateText(Iterator<DocumentElement> expectedElements,
- HtmlDocumentParser parser)
- {
- boolean valid = true;
- if (expectedElements.hasNext())
- {
- DocumentElement e = expectedElements.next();
- if (e instanceof TextContent)
- {
- if (!parser.getText().matches(((TextContent)e).getValue()))
- {
- log.error("Found text '" + parser.getText() + "' does not match " +
- "expected text '" + ((TextContent)e).getValue() + "'");
- valid = false;
- }
- }
- else
- {
- log.error("Found text '" + parser.getText() + "' was not expected. " +
- "We were expecting: " + e.toString());
- valid = false;
- }
- }
- else
- {
- log.error("Found text '" + parser.getText() + "' was not expected. " +
- "We were not expecting any more elements within the current tag");
- valid = false;
- }
- return valid;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Tag.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Tag.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Tag.java
deleted file mode 100644
index 3e6d46d..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/Tag.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Class representing an element in a document.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0 together with {@link HtmlDocumentValidator}
- */
-@Deprecated
-public class Tag implements DocumentElement
-{
- private final Map<String, String> expectedAttributes = new HashMap<String, String>();
-
- private final List<DocumentElement> expectedChildren = new ArrayList<DocumentElement>();
-
- private final Set<String> illegalAttributes = new HashSet<String>();
-
- private final String tag;
-
- /**
- * Create the tag element.
- *
- * @param tag
- * The tag name
- */
- public Tag(final String tag)
- {
- this.tag = tag.toLowerCase();
- }
-
- /**
- * Add an expected attribute to this tag. The second parameter is a regexp pattern on which to
- * match the value of the tag.
- *
- * @param name
- * The name of the attribute
- * @param pattern
- * The pattern to match
- */
- public void addExpectedAttribute(final String name, final String pattern)
- {
- expectedAttributes.put(name.toLowerCase(), pattern);
- }
-
- /**
- * Add an expected child to this tag. Children must be added in the order they are expected to
- * appear.
- *
- * @param e
- * The element to add
- * @return This
- */
- public Tag addExpectedChild(final DocumentElement e)
- {
- expectedChildren.add(e);
- return this;
- }
-
- /**
- * Add the name of an attribute that is NOT expected for this tag.
- *
- * @param name
- * The name of the attribute
- */
- public void addIllegalAttribute(final String name)
- {
- illegalAttributes.add(name.toLowerCase());
- }
-
- /**
- * Get the map of expected attributes.
- *
- * @return The expected attribute map
- */
- public Map<String, String> getExpectedAttributes()
- {
- return expectedAttributes;
- }
-
- /**
- * Get the list of expected children.
- *
- * @return The expected children
- */
- public List<DocumentElement> getExpectedChildren()
- {
- return expectedChildren;
- }
-
- /**
- * Get the set of illegal attributes.
- *
- * @return The illegal attributes
- */
- public Set<String> getIllegalAttributes()
- {
- return illegalAttributes;
- }
-
- /**
- * Get the tag that this element represents.
- *
- * @return The tag
- */
- public String getTag()
- {
- return tag;
- }
-
- /**
- * Output a descriptive string.
- *
- * @return The string
- */
- @Override
- public String toString()
- {
- return "[tag = '" + tag + "']";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/TextContent.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/TextContent.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/TextContent.java
deleted file mode 100644
index 971a4f5..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/TextContent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.protocol.http.documentvalidation;
-
-/**
- * Class representing text content that can appear within an element.
- *
- * @author Chris Turner
- * @deprecated Will be removed in Wicket 9.0 together with {@link HtmlDocumentValidator}
- */
-@Deprecated
-public class TextContent implements DocumentElement
-{
- private final String value;
-
- /**
- * Construct the text content with the expected value.
- *
- * @param value
- * The value
- */
- public TextContent(final String value)
- {
- this.value = value;
- }
-
- /**
- * Get the value of this text content.
- *
- * @return The value
- */
- public String getValue()
- {
- return value;
- }
-
- /**
- * Output a descriptive string.
- *
- * @return The string
- */
- @Override
- public String toString()
- {
- return "[text = '" + value + "']";
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/package.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/package.html b/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/package.html
deleted file mode 100644
index a47d991..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/documentvalidation/package.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
- 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.
--->
-<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 Final//NL">
-<html>
-<head>
-<title>wicket.protocol.http.documentvalidation package</title>
-</head>
-<body>
-<p>
-Test support for the HTTP implementation.
-</p>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
deleted file mode 100644
index 89ebc9c..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/AbstractRequestCycleListener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.request.cycle;
-
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.Url;
-
-/**
- * Empty implementation of an {@link IRequestCycleListener} useful as a starting point for your own
- * custom listener.
- *
- * @deprecated This class will be removed in Wicket 9.0.0. Use {@link IRequestCycleListener} instead.
- */
-@Deprecated
-public abstract class AbstractRequestCycleListener implements IRequestCycleListener
-{
- @Override
- public void onBeginRequest(RequestCycle cycle)
- {
- }
-
- @Override
- public void onEndRequest(RequestCycle cycle)
- {
- }
-
- @Override
- public void onDetach(RequestCycle cycle)
- {
- }
-
- @Override
- public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
- {
- }
-
- @Override
- public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
- {
- }
-
- @Override
- public IRequestHandler onException(RequestCycle cycle, Exception ex)
- {
- return null;
- }
-
- @Override
- public void onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler,
- Exception exception)
- {
- }
-
- @Override
- public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
- {
- }
-
- @Override
- public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/test/java/org/apache/wicket/AttributeModifierComponentTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/AttributeModifierComponentTest.java b/wicket-core/src/test/java/org/apache/wicket/AttributeModifierComponentTest.java
deleted file mode 100644
index 634202b..0000000
--- a/wicket-core/src/test/java/org/apache/wicket/AttributeModifierComponentTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.junit.Assert;
-import org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator;
-import org.apache.wicket.protocol.http.documentvalidation.Tag;
-import org.apache.wicket.protocol.http.documentvalidation.TextContent;
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * This set of tests builds a sample tester for testing the dynamic modicication of attributes in
- * both component tags and also in raw markup. The tests contained here represent testing on one
- * specific area of functionality of the Component class. It is expected that separate test cases
- * will be added to test other facets of Components.
- *
- * @author Chris Turner
- */
-public class AttributeModifierComponentTest extends WicketTestCase
-{
- private static final Logger log = LoggerFactory.getLogger(AttributeModifierComponentTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- tester.startPage(AttributeModifierComponentPage.class);
- }
-
- /**
- * @throws Exception
- */
- @Test
- public void componentTagAttributeModification() throws Exception
- {
- String document = tester.getLastResponseAsString();
- // log.info(document);
- Assert.assertTrue(document, validateDocument(document));
- }
-
- /**
- * Helper method to validate the returned XML document.
- *
- * @param document
- * The document
- * @return The validation result
- */
- private boolean validateDocument(String document)
- {
- HtmlDocumentValidator validator = new HtmlDocumentValidator();
- Tag html = new Tag("html");
- Tag head = new Tag("head");
- html.addExpectedChild(head);
- Tag title = new Tag("title");
- head.addExpectedChild(title);
- title.addExpectedChild(new TextContent("Attribute Modifier Test Page"));
- Tag body = new Tag("body");
- html.addExpectedChild(body);
-
- Tag label1 = new Tag("span");
- label1.addExpectedAttribute("class", "label");
- label1.addExpectedChild(new TextContent("Label 1"));
- body.addExpectedChild(label1);
-
- Tag label2 = new Tag("span");
- label2.addExpectedAttribute("class", "overrideLabel");
- label2.addExpectedChild(new TextContent("Label 2"));
- body.addExpectedChild(label2);
-
- Tag label3 = new Tag("span");
- label3.addExpectedAttribute("class", "insertLabel");
- label3.addExpectedChild(new TextContent("Label 3"));
- body.addExpectedChild(label3);
-
- validator.addRootElement(html);
- return validator.isDocumentValid(document);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/StatelessAjaxFallbackLinkDoNotRecreatePage.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/StatelessAjaxFallbackLinkDoNotRecreatePage.java b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/StatelessAjaxFallbackLinkDoNotRecreatePage.java
index 58b4e72..8f8a26f 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/StatelessAjaxFallbackLinkDoNotRecreatePage.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/StatelessAjaxFallbackLinkDoNotRecreatePage.java
@@ -22,7 +22,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;
@@ -43,17 +42,12 @@ public class StatelessAjaxFallbackLinkDoNotRecreatePage extends WebPage
super(parameters);
setStatelessHint(true);
- final Label incrementLabel = new Label("incrementLabel", new AbstractReadOnlyModel<Integer>()
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Integer getObject()
- {
- final String counter = getParameter(parameters, COUNTER_PARAM);
- return counter != null ? Integer.parseInt(counter) : 0;
- }
- });
+ final Label incrementLabel = new Label("incrementLabel", () ->
+ {
+ final String counter = getParameter(parameters, COUNTER_PARAM);
+ return counter != null ? Integer.parseInt(counter) : 0;
+ }
+ );
final Link<?> incrementLink = new AjaxFallbackLink<Void>("incrementLink")
{
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/test/java/org/apache/wicket/markup/html/list/PagedTableTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/list/PagedTableTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/list/PagedTableTest.java
deleted file mode 100644
index 14d0bd2..0000000
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/list/PagedTableTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.list;
-
-import java.util.Locale;
-
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator;
-import org.apache.wicket.protocol.http.documentvalidation.Tag;
-import org.apache.wicket.protocol.http.documentvalidation.TextContent;
-import org.apache.wicket.util.tester.DiffUtil;
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.Test;
-
-
-/**
- * Test for simple table behavior.
- */
-public class PagedTableTest extends WicketTestCase
-{
- /**
- * Test simple table behavior.
- *
- * @throws Exception
- */
- @Test
- public void pagedTable() throws Exception
- {
- tester.getSession().setLocale(Locale.ENGLISH);
- tester.startPage(PagedTablePage.class);
- PagedTablePage page = (PagedTablePage)tester.getLastRenderedPage();
- String document = tester.getLastResponseAsString();
- assertTrue(document, validatePage1(document));
-
- Link<?> link = (Link<?>)page.get("navigation:1:pageLink");
- tester.clickLink(link.getPageRelativePath());
- document = tester.getLastResponseAsString();
- DiffUtil.validatePage(document, this.getClass(), "PagedTablePageExpectedResult.html", true);
- }
-
- /**
- * Validates page 1 of paged table.
- *
- * @param document
- * The document
- * @return The validation result
- */
- private boolean validatePage1(String document)
- {
- HtmlDocumentValidator validator = new HtmlDocumentValidator();
- Tag html = new Tag("html");
- Tag head = new Tag("head");
- html.addExpectedChild(head);
- Tag title = new Tag("title");
- head.addExpectedChild(title);
- title.addExpectedChild(new TextContent("Paged Table Page"));
- Tag body = new Tag("body");
- html.addExpectedChild(body);
-
- Tag ulTable = new Tag("ul");
- ulTable.addExpectedChild(new Tag("li").addExpectedChild(new Tag("span").addExpectedChild(new TextContent(
- "one"))));
- ulTable.addExpectedChild(new Tag("li").addExpectedChild(new Tag("span").addExpectedChild(new TextContent(
- "two"))));
- // note that we DO NOT expect the third element as this is not on the current page
- body.addExpectedChild(ulTable);
-
- Tag ulNav = new Tag("ul");
- ulNav.addExpectedChild(new Tag("li").addExpectedChild(new Tag("a").addExpectedChild(new Tag(
- "span").addExpectedChild(new TextContent("1")))));
- ulNav.addExpectedChild(new Tag("li").addExpectedChild(new Tag("a").addExpectedChild(new Tag(
- "span").addExpectedChild(new TextContent("2")))));
-
- body.addExpectedChild(ulNav);
-
- validator.addRootElement(html);
-
- return validator.isDocumentValid(document);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/test/java/org/apache/wicket/model/ModelToStringTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/model/ModelToStringTest.java b/wicket-core/src/test/java/org/apache/wicket/model/ModelToStringTest.java
index 05d2d07..f248916 100644
--- a/wicket-core/src/test/java/org/apache/wicket/model/ModelToStringTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/model/ModelToStringTest.java
@@ -39,20 +39,6 @@ public class ModelToStringTest extends WicketTestCase
}
}
- /**
- * Test stub for testing AbstractReadOnlyModel.toString()
- */
- private static class MyAbstractReadOnlyModel extends AbstractReadOnlyModel<String>
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getObject()
- {
- return "FOO";
- }
- }
-
private static final class MyLoadableDetachableModel extends LoadableDetachableModel<String>
{
private static final long serialVersionUID = 1L;
@@ -65,17 +51,6 @@ public class ModelToStringTest extends WicketTestCase
}
/**
- * Tests AbstractReadOnlyModel.toString().
- */
- @Test
- public void abstractReadOnlyModel()
- {
- MyAbstractReadOnlyModel model = new MyAbstractReadOnlyModel();
- String expected = "Model:classname=[" + model.getClass().getName() + "]";
- assertEquals(expected, model.toString());
- }
-
- /**
* Tests the BoundCompoundPropertyModel.toString() method.
*/
@Test
http://git-wip-us.apache.org/repos/asf/wicket/blob/16c91804/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketTagPanelTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketTagPanelTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketTagPanelTest.java
deleted file mode 100644
index 7518b09..0000000
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketTagPanelTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.protocol.http;
-
-import org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator;
-import org.apache.wicket.protocol.http.documentvalidation.Tag;
-import org.apache.wicket.protocol.http.documentvalidation.TextContent;
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Simple application that demonstrates the mock http application code (and checks that it is
- * working)
- *
- * @author Chris Turner
- */
-public class WicketTagPanelTest extends WicketTestCase
-{
- private static final Logger log = LoggerFactory.getLogger(WicketTagPanelTest.class);
-
- /**
- * @throws Exception
- */
- @Test
- public void renderHomePage() throws Exception
- {
- tester.startPage(WicketPanelPage.class);
- String document = tester.getLastResponseAsString();
- // log.info(document);
- assertTrue(document, validatePage1(document));
- }
-
- /**
- * Validate page 2 of the paged table.
- *
- * @param document
- * The document
- * @return The validation result
- */
- private boolean validatePage1(String document)
- {
- HtmlDocumentValidator validator = new HtmlDocumentValidator();
- Tag html = new Tag("html");
- Tag body = new Tag("body");
- html.addExpectedChild(body);
- body.addExpectedChild(new TextContent("\\s+"));
- Tag span = new Tag("span");
- body.addExpectedChild(span);
- Tag wicket = new Tag("wicket:panel");
- span.addExpectedChild(wicket);
-
- wicket.addExpectedChild(new TextContent("\\s*Panel Content"));
-
- validator.addRootElement(html);
- return validator.isDocumentValid(document);
- }
-
- /**
- * @throws Exception
- */
- @Test
- public void renderHomePageWicketTagRemoved() throws Exception
- {
- // Remove wicket tags from output
- tester.getApplication().getMarkupSettings().setStripWicketTags(true);
- tester.startPage(WicketPanelPage.class);
-
- // Validate the document
- String document = tester.getLastResponseAsString();
- // log.info(document);
- assertTrue("Document with Wicket tags stripped did not match", validatePage2(document));
- }
-
- /**
- * Validate page 2 of the paged table.
- *
- * @param document
- * The document
- * @return The validation result
- */
- private boolean validatePage2(String document)
- {
- HtmlDocumentValidator validator = new HtmlDocumentValidator();
- Tag html = new Tag("html");
- Tag body = new Tag("body");
- body.addExpectedChild(new TextContent("\\s+"));
- html.addExpectedChild(body);
- Tag span = new Tag("span");
- body.addExpectedChild(span);
-
- span.addExpectedChild(new TextContent("\\s*Panel Content"));
-
- validator.addRootElement(html);
- return validator.isDocumentValid(document);
- }
-}