You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2009/04/16 23:43:02 UTC
svn commit: r765774 [2/5] - in /tiles/framework/trunk:
tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/
tiles-freemarker/src/test/java/org/apache/tiles/freemarker/context/
tiles-freemarker/src/test/java/org/apache/tiles/freemarker/i...
Modified: tiles/framework/trunk/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/TilesFMModelRepositoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/TilesFMModelRepositoryTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/TilesFMModelRepositoryTest.java (original)
+++ tiles/framework/trunk/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/TilesFMModelRepositoryTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.freemarker.template;
import static org.junit.Assert.*;
@@ -8,8 +26,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link TilesFMModelRepository}.
*
+ * @version $Rev$ $Date$
*/
public class TilesFMModelRepositoryTest {
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -31,13 +31,13 @@
* <strong>Add an element to the surrounding list. Equivalent to 'putAttribute',
* but for list element.</strong>
* </p>
- *
+ *
* <p>
* Add an element to the surrounding list. This tag can only be used inside
* 'putListAttribute' or 'addListAttribute' tags. Value can come from a direct
* assignment (value="aValue")
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -45,7 +45,7 @@
/**
* Starts the operation..
- *
+ *
* @param composeStack The composing stack.
* @since 2.2.0
*/
@@ -56,7 +56,7 @@
/**
* Ends the operation.
- *
+ *
* @param composeStack The composing stack.
* @param value The value of the attribute. Use this parameter, or
* expression, or body.
@@ -78,7 +78,7 @@
/**
* Executes the operation.
- *
+ *
* @param composeStack The composing stack.
* @param value The value of the attribute. Use this parameter, or
* expression, or body.
@@ -99,7 +99,7 @@
/**
* Adds the attribute to the containing list attribute.
- *
+ *
* @param attribute The attribute to add to the list attribute.
* @param composeStack The composing stack.
* @param value The value of the attribute. Use this parameter, or
@@ -118,7 +118,7 @@
String body, String role, String type) {
ListAttribute listAttribute = (ListAttribute) ComposeStackUtil
.findAncestorWithClass(composeStack, ListAttribute.class);
-
+
if (listAttribute == null) {
throw new NullPointerException("There is no ListAttribute in the stack");
}
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddListAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddListAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddListAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AddListAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -34,7 +34,7 @@
* using the tag 'addAttribute' or 'addListAttribute'. This tag can only be used
* inside 'insertTemplate', 'insertDefinition' or 'definition' tag.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -56,7 +56,7 @@
/**
* Ends the operation.
- *
+ *
* @param composeStack The composing stack.
* @since 2.2.0
*/
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AttributeResolver.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AttributeResolver.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AttributeResolver.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/AttributeResolver.java Thu Apr 16 21:43:00 2009
@@ -26,7 +26,7 @@
/**
* Resolves an attribute, depending on the given parameters.
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -34,7 +34,7 @@
/**
* Computes the attribute.
- *
+ *
* @param container The Tiles container to use.
* @param attribute The attribute to return immediately, if not null.
* @param name The name of the attribute.
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ComposeStackUtil.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ComposeStackUtil.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ComposeStackUtil.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ComposeStackUtil.java Thu Apr 16 21:43:00 2009
@@ -25,22 +25,22 @@
/**
* Utilities to work with compose stacks.
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
-public class ComposeStackUtil {
+public final class ComposeStackUtil {
/**
* Private constructor to avoid instantiation.
*/
private ComposeStackUtil() {
-
+
}
/**
* Finds the first ancestor in the stack, that is assignable to the given class.
- *
+ *
* @param composeStack The compose stack to evaluate.
* @param clazz The class to check.
* @return The first ancestor that is assignable to the class, or null if not found.
@@ -54,7 +54,7 @@
retValue = obj;
}
}
-
+
return retValue;
}
}
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefaultAttributeResolver.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefaultAttributeResolver.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefaultAttributeResolver.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefaultAttributeResolver.java Thu Apr 16 21:43:00 2009
@@ -27,7 +27,7 @@
/**
* The default implementation of AttributeResolver.
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java Thu Apr 16 21:43:00 2009
@@ -35,7 +35,7 @@
* Create a new definition at runtime. Newly created definition will be
* available across the entire request.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -43,7 +43,7 @@
/**
* Starts the operation.
- *
+ *
* @param composeStack The compose stack,
* @param name The name of the definition to create. If not specified, an anonymous definition will be created.
* @param template The template of this definition.
@@ -62,7 +62,7 @@
/**
* Ends the operation.
- *
+ *
* @param container The Tiles container to use. It must be "mutable".
* @param composeStack The compose stack.
* @param requestItems The request objects.
@@ -76,7 +76,7 @@
/**
* Executes the operation.
- *
+ *
* @param container The Tiles container to use. It must be "mutable".
* @param composeStack The compose stack.
* @param name The name of the definition to create. If not specified, an anonymous definition will be created.
@@ -99,7 +99,7 @@
/**
* Creates the definition to store.
- *
+ *
* @param name The name of the definition to create. If not specified, an anonymous definition will be created.
* @param template The template of this definition.
* @param role A comma-separated list of roles. If present, the definition
@@ -123,9 +123,9 @@
/**
* Registers a definition in the container.
- *
+ *
* @param definition The definition to register.
- * @param container The container into which the definition will be registered.
+ * @param container The container into which the definition will be registered.
* @param composeStack The compose stack,
* @param requestItems The request object.
*/
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java Thu Apr 16 21:43:00 2009
@@ -35,13 +35,13 @@
* <strong> Render the value of the specified template attribute to the current
* Writer</strong>
* </p>
- *
+ *
* <p>
* Retrieve the value of the specified template attribute property, and render
* it to the current Writer as a String. The usual toString() conversions is
* applied on found value.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -59,7 +59,7 @@
/**
* Constructor.
- *
+ *
* @param attributeResolver The attribute resolver to use.
* @since 2.2.0
*/
@@ -69,16 +69,20 @@
/**
* Starts the operation.
- *
+ *
* @param composeStack The compose stack,
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -96,11 +100,12 @@
/**
* Ends the operation.
- *
+ *
* @param composeStack The compose stack,
* @param container The Tiles container to use.
* @param writer The writer into which the attribute will be written.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param requestItems The request objects.
* @throws IOException If an I/O error happens during rendering.
*/
@@ -113,16 +118,20 @@
/**
* Executes the operation.
- *
+ *
* @param container The Tiles container to use.
* @param writer The writer into which the attribute will be written.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -141,15 +150,19 @@
/**
* Resolves the attribute. and starts the context.
- *
+ *
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -171,11 +184,12 @@
/**
* Renders the attribute as a string.
- *
- * @param attribute The attribute to use, previously resolved.
+ *
+ * @param attribute The attribute to use, previously resolved.
* @param container The Tiles container to use.
* @param writer The writer into which the attribute will be written.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param requestItems The request objects.
* @throws IOException If an I/O error happens during rendering.
*/
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ImportAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ImportAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ImportAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/ImportAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -40,7 +40,7 @@
* optional. If not specified, all attributes are imported in page scope. Once
* imported, an attribute can be used as any other beans from jsp contexts.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -52,14 +52,19 @@
private Log log = LogFactory.getLog(getClass());
/**
- * Retuns a Map that contains the attributes to be imported. The importing code must be done by the caller.
- *
+ * Retuns a Map that contains the attributes to be imported. The importing
+ * code must be done by the caller.
+ *
* @param container The Tiles container to use.
- * @param name The attribute to import. If null, all the attributes will be imported.
- * @param toName The destination name of the attribute to import. Valid only if <code>name</code> is specified.
- * @param ignore If <code>true</code> and the attribute is not found, or an exception happens, the problem will be ignored.
+ * @param name The attribute to import. If null, all the attributes will be
+ * imported.
+ * @param toName The destination name of the attribute to import. Valid only
+ * if <code>name</code> is specified.
+ * @param ignore If <code>true</code> and the attribute is not found, or an
+ * exception happens, the problem will be ignored.
* @param requestItems The request objects.
- * @return A Map of the attributes to be imported: the key is the name of an attribute, the value is the value of that attribute.
+ * @return A Map of the attributes to be imported: the key is the name of an
+ * attribute, the value is the value of that attribute.
* @since 2.2.0
*/
public Map<String, Object> getImportedAttributes(TilesContainer container,
@@ -83,12 +88,15 @@
/**
* Imports a single attribute.
- *
+ *
* @param container The Tiles container to use.
- * @param attributeContext The context from which the attributes will be got.
+ * @param attributeContext The context from which the attributes will be
+ * got.
* @param name The name of the attribute.
- * @param toName The name of the destination attribute. If null, <code>name</code> will be used.
- * @param ignore If <code>true</code> and the attribute is not found, or an exception happens, the problem will be ignored.
+ * @param toName The name of the destination attribute. If null,
+ * <code>name</code> will be used.
+ * @param ignore If <code>true</code> and the attribute is not found, or an
+ * exception happens, the problem will be ignored.
* @param attributes The map of the attributes to fill.
* @param requestItems The request objects.
*/
@@ -132,12 +140,14 @@
/**
* Imports all the attributes.
- *
+ *
* @param names The names of the attributes to be imported.
* @param container The Tiles container to use.
- * @param attributeContext The context from which the attributes will be got.
+ * @param attributeContext The context from which the attributes will be
+ * got.
* @param attributes The map of the attributes to fill.
- * @param ignore If <code>true</code> and the attribute is not found, or an exception happens, the problem will be ignored.
+ * @param ignore If <code>true</code> and the attribute is not found, or an
+ * exception happens, the problem will be ignored.
* @param requestItems The request objects.
*/
private void importAttributes(Collection<String> names,
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -43,17 +43,17 @@
* assigned a type, it will be treated as a String and included without any
* special handling.
* </p>
- *
+ *
* <p>
* <strong>Example : </strong>
* </p>
- *
+ *
* <pre>
* <code>
* <tiles:insertAttribute name="body" />
* </code>
* </pre>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -71,7 +71,7 @@
/**
* Constructor.
- *
+ *
* @param attributeResolver The attribute resolver to use.
* @since 2.2.0
*/
@@ -81,16 +81,20 @@
/**
* Starts the operation.
- *
+ *
* @param composeStack The compose stack,
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -108,10 +112,11 @@
/**
* Ends the operation.
- *
+ *
* @param composeStack The compose stack,
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param requestItems The request objects.
* @throws IOException If an I/O error happens during rendering.
*/
@@ -123,15 +128,19 @@
/**
* Executes the operation.
- *
+ *
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -150,15 +159,19 @@
/**
* Resolves the attribute. and starts the context.
- *
+ *
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param preparer The preparer to invoke before rendering the attribute.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param defaultValue The default value of the attribute. To use only if the attribute was not computed.
- * @param defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed.
- * @param defaultValueType The default type of the attribute. To use only if the attribute was not computed.
+ * @param defaultValue The default value of the attribute. To use only if
+ * the attribute was not computed.
+ * @param defaultValueRole The default comma-separated list of roles. To use
+ * only if the attribute was not computed.
+ * @param defaultValueType The default type of the attribute. To use only if
+ * the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
* @param requestItems The request objects.
@@ -180,10 +193,11 @@
/**
* Renders the attribute as a string.
- *
- * @param attribute The attribute to use, previously resolved.
+ *
+ * @param attribute The attribute to use, previously resolved.
* @param container The Tiles container to use.
- * @param ignore If <code>true</code>, if an exception happens during rendering, of if the attribute is null, the problem will be ignored.
+ * @param ignore If <code>true</code>, if an exception happens during
+ * rendering, of if the attribute is null, the problem will be ignored.
* @param requestItems The request objects.
* @throws IOException If an I/O error happens during rendering.
*/
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java Thu Apr 16 21:43:00 2009
@@ -45,7 +45,7 @@
* <p>
* <strong>Example : </strong>
* </p>
- *
+ *
* <pre>
* <code>
* <tiles:insertDefinition name=".my.tiles.defininition flush="true">
@@ -57,7 +57,7 @@
* </tiles:insertDefinition>
* </code>
* </pre>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -65,7 +65,7 @@
/**
* Starts the operation.
- *
+ *
* @param container The Tiles container.
* @param requestItems The request objects.
* @since 2.2.0
@@ -76,7 +76,7 @@
/**
* Ends the operation.
- *
+ *
* @param container The Tiles container.
* @param definitionName The name of the definition to render.
* @param template If specified, this template will be used instead of the
@@ -108,7 +108,7 @@
/**
* Executes the operation.
- *
+ *
* @param container The Tiles container.
* @param definitionName The name of the definition to render.
* @param template If specified, this template will be used instead of the
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java Thu Apr 16 21:43:00 2009
@@ -41,11 +41,11 @@
* <p>
* You must specify <code>template</code> attribute, for inserting a template
* </p>
- *
+ *
* <p>
* <strong>Example : </strong>
* </p>
- *
+ *
* <pre>
* <code>
* <tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
@@ -57,7 +57,7 @@
* </tiles:insertTemplate>
* </code>
* </pre>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -65,7 +65,7 @@
/**
* Starts the operation.
- *
+ *
* @param container The Tiles container.
* @param requestItems The request objects.
* @since 2.2.0
@@ -76,7 +76,7 @@
/**
* Ends the operation.
- *
+ *
* @param container The Tiles container.
* @param template The template to render.
* @param role A comma-separated list of roles. If present, the template
@@ -105,7 +105,7 @@
/**
* Executes the operation.
- *
+ *
* @param container The Tiles container.
* @param template The template to render.
* @param role A comma-separated list of roles. If present, the template
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -59,7 +59,7 @@
* value is not set by one of the tag attributes. In this case Attribute type is
* "string", unless tag body define another type.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -67,7 +67,7 @@
/**
* Starts the operation.
- *
+ *
* @param composeStack The compose stack.
* @since 2.2.0
*/
@@ -131,7 +131,7 @@
/**
* Determines the parent and puts the attribute inside it.
- *
+ *
* @param attribute The attribute to put;
* @param container The Tiles container to use.
* @param composeStack The composing stack.
Modified: tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java (original)
+++ tiles/framework/trunk/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java Thu Apr 16 21:43:00 2009
@@ -37,7 +37,7 @@
* added using the tags 'addAttribute' or 'addListAttribute'. This tag can only
* be used inside 'insertTemplate', 'insertDefinition', 'definition' tags.
* </p>
- *
+ *
* @version $Rev$ $Date$
* @since 2.2.0
*/
@@ -49,7 +49,8 @@
* @param composeStack The composing stack.
* @param role A comma-separated list of roles. If present, the attribute
* will be rendered only if the current user belongs to one of the roles.
- * @param inherit If <code>true</code> the list contained in the in the same attribute of the parent definition will be extended.
+ * @param inherit If <code>true</code> the list contained in the in the same
+ * attribute of the parent definition will be extended.
* @since 2.2.0
*/
public void start(Stack<Object> composeStack, String role, boolean inherit) {
@@ -61,7 +62,7 @@
/**
* Ends the operation.
- *
+ *
* @param container The Tiles container to use.
* @param composeStack The composing stack.
* @param name The name of the attribute to put.
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java Thu Apr 16 21:43:00 2009
@@ -36,7 +36,6 @@
* Tests {@link AddAttributeModel}.
*
* @version $Rev$ $Date$
- * @since 2.2.0
*/
public class AddAttributeModelTest {
@@ -44,13 +43,13 @@
* The model to test.
*/
private AddAttributeModel model;
-
+
/** Sets up the test. */
@Before
public void setUp() {
model = new AddAttributeModel();
}
-
+
/**
* Test method for {@link org.apache.tiles.template.AddAttributeModel#start(java.util.Stack)}.
*/
@@ -59,16 +58,19 @@
public void testStart() {
Stack<Object> composeStack = createMock(Stack.class);
Attribute attribute = new Attribute();
-
+
expect(composeStack.push(isA(Attribute.class))).andReturn(attribute);
-
+
replay(composeStack);
model.start(composeStack);
verify(composeStack);
}
/**
- * Test method for {@link org.apache.tiles.template.AddAttributeModel#end(java.util.Stack, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ * Test method for
+ * {@link org.apache.tiles.template.AddAttributeModel
+ * #end(java.util.Stack, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
+ * .
*/
@SuppressWarnings("unchecked")
@Test
@@ -78,9 +80,9 @@
Attribute attribute = new Attribute();
composeStack.push(listAttribute);
composeStack.push(attribute);
-
+
model.end(composeStack, "myValue", "myExpression", "myBody", "myRole", "myType");
- assertEquals(1, ((List<Attribute>)listAttribute.getValue()).size());
+ assertEquals(1, ((List<Attribute>) listAttribute.getValue()).size());
assertEquals("myValue", attribute.getValue());
assertEquals("myExpression", attribute.getExpression());
assertEquals("myRole", attribute.getRole());
@@ -91,9 +93,9 @@
attribute = new Attribute();
composeStack.push(listAttribute);
composeStack.push(attribute);
-
+
model.end(composeStack, null, "myExpression", "myBody", "myRole", "myType");
- assertEquals(1, ((List<Attribute>)listAttribute.getValue()).size());
+ assertEquals(1, ((List<Attribute>) listAttribute.getValue()).size());
assertEquals("myBody", attribute.getValue());
assertEquals("myExpression", attribute.getExpression());
assertEquals("myRole", attribute.getRole());
@@ -101,7 +103,9 @@
}
/**
- * Test method for {@link org.apache.tiles.template.AddAttributeModel#execute(java.util.Stack, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ * Test method for {@link org.apache.tiles.template.AddAttributeModel
+ * #execute(java.util.Stack, java.lang.Object, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.String)}.
*/
@SuppressWarnings("unchecked")
@Test
@@ -110,9 +114,9 @@
ListAttribute listAttribute = new ListAttribute();
Attribute attribute;
composeStack.push(listAttribute);
-
+
model.execute(composeStack, "myValue", "myExpression", "myBody", "myRole", "myType");
- List<Attribute> attributes = (List<Attribute>)listAttribute.getValue();
+ List<Attribute> attributes = (List<Attribute>) listAttribute.getValue();
assertEquals(1, attributes.size());
attribute = attributes.iterator().next();
assertEquals("myValue", attribute.getValue());
@@ -125,9 +129,9 @@
attribute = new Attribute();
composeStack.push(listAttribute);
composeStack.push(attribute);
-
+
model.execute(composeStack, null, "myExpression", "myBody", "myRole", "myType");
- attributes = (List<Attribute>)listAttribute.getValue();
+ attributes = (List<Attribute>) listAttribute.getValue();
assertEquals(1, attributes.size());
attribute = attributes.iterator().next();
assertEquals("myBody", attribute.getValue());
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddListAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddListAttributeModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddListAttributeModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/AddListAttributeModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -14,8 +32,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link AddListAttributeModel}.
*
+ * @version $Rev$ $Date$
*/
public class AddListAttributeModelTest {
@@ -23,12 +42,12 @@
* The model to test.
*/
private AddListAttributeModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
model = new AddListAttributeModel();
}
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ComposeStackUtilTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ComposeStackUtilTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ComposeStackUtilTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ComposeStackUtilTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -10,21 +28,33 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link ComposeStackUtil}.
*
+ * @version $Rev$ $Date$
*/
public class ComposeStackUtilTest {
/**
- * Test method for {@link org.apache.tiles.template.ComposeStackUtil#findAncestorWithClass(java.util.Stack, java.lang.Class)}.
+ * An integer value.
+ */
+ private static final int INT_VALUE = 3;
+
+ /**
+ * A long value.
+ */
+ private static final long LONG_VALUE = 2L;
+
+ /**
+ * Test method for {@link org.apache.tiles.template.ComposeStackUtil
+ * #findAncestorWithClass(java.util.Stack, java.lang.Class)}.
*/
@Test
public void testFindAncestorWithClass() {
Stack<Object> composeStack = new Stack<Object>();
Integer integerValue = new Integer(1);
- Long longValue = new Long(2l);
+ Long longValue = new Long(LONG_VALUE);
String stringValue = "my value";
- Integer integerValue2 = new Integer(3);
+ Integer integerValue2 = new Integer(INT_VALUE);
composeStack.push(integerValue);
composeStack.push(longValue);
composeStack.push(stringValue);
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefaultAttributeResolverTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefaultAttributeResolverTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefaultAttributeResolverTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefaultAttributeResolverTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -13,8 +31,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link DefaultAttributeResolver}.
*
+ * @version $Rev$ $Date$
*/
public class DefaultAttributeResolverTest {
@@ -22,17 +41,20 @@
* The resolver to test.
*/
private DefaultAttributeResolver resolver;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
resolver = new DefaultAttributeResolver();
}
/**
- * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver#computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute, java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver
+ * #computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute,
+ * java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.Object[])}.
*/
@Test
public void testComputeAttributeInContext() {
@@ -40,10 +62,10 @@
AttributeContext attributeContext = createMock(AttributeContext.class);
Attribute attribute = new Attribute("myValue", "myExpression", "myRole", "myRenderer");
Integer requestItem = new Integer(1);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(attribute);
-
+
replay(container, attributeContext);
assertEquals(attribute, resolver.computeAttribute(container, null,
"myName", null, false, null, null, null, requestItem));
@@ -51,14 +73,17 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver#computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute, java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver
+ * #computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute,
+ * java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.Object[])}.
*/
@Test
public void testComputeAttributeInCall() {
TilesContainer container = createMock(TilesContainer.class);
Attribute attribute = new Attribute("myValue", "myExpression", "myRole", "myRenderer");
Integer requestItem = new Integer(1);
-
+
replay(container);
assertEquals(attribute, resolver.computeAttribute(container, attribute,
null, null, false, null, null, null, requestItem));
@@ -66,17 +91,20 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver#computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute, java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver
+ * #computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute,
+ * java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.Object[])}.
*/
@Test
public void testComputeAttributeDefault() {
TilesContainer container = createMock(TilesContainer.class);
AttributeContext attributeContext = createMock(AttributeContext.class);
Integer requestItem = new Integer(1);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(null);
-
+
replay(container, attributeContext);
Attribute attribute = resolver.computeAttribute(container, null,
"myName", null, false, "defaultValue", "defaultRole",
@@ -88,17 +116,20 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver#computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute, java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver
+ * #computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute,
+ * java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.Object[])}.
*/
@Test(expected = NoSuchAttributeException.class)
public void testComputeAttributeException() {
TilesContainer container = createMock(TilesContainer.class);
AttributeContext attributeContext = createMock(AttributeContext.class);
Integer requestItem = new Integer(1);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(null);
-
+
replay(container, attributeContext);
resolver.computeAttribute(container, null, "myName", null, false, null,
"defaultRole", "defaultType", requestItem);
@@ -106,17 +137,20 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver#computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute, java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefaultAttributeResolver
+ * #computeAttribute(org.apache.tiles.TilesContainer, org.apache.tiles.Attribute,
+ * java.lang.String, java.lang.String, boolean, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.Object[])}.
*/
@Test
public void testComputeAttributeIgnore() {
TilesContainer container = createMock(TilesContainer.class);
AttributeContext attributeContext = createMock(AttributeContext.class);
Integer requestItem = new Integer(1);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(null);
-
+
replay(container, attributeContext);
assertNull(resolver.computeAttribute(container, null, "myName", null, true, null,
"defaultRole", "defaultType", requestItem));
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefinitionModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefinitionModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefinitionModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/DefinitionModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -15,8 +33,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link DefinitionModel}.
*
+ * @version $Rev$ $Date$
*/
public class DefinitionModelTest {
@@ -24,17 +43,19 @@
* The model to test.
*/
private DefinitionModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
model = new DefinitionModel();
}
/**
- * Test method for {@link org.apache.tiles.template.DefinitionModel#start(java.util.Stack, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ * Test method for {@link org.apache.tiles.template.DefinitionModel
+ * #start(java.util.Stack, java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.String)}.
*/
@Test
public void testStart() {
@@ -49,7 +70,8 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefinitionModel#end(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefinitionModel
+ * #end(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack, java.lang.Object[])}.
*/
@Test
public void testEnd() {
@@ -58,16 +80,17 @@
Definition definition = new Definition();
composeStack.push(definition);
Integer requestItem = new Integer(1);
-
+
container.register(definition, requestItem);
-
+
replay(container);
model.end(container, composeStack, requestItem);
verify(container);
}
/**
- * Test method for {@link org.apache.tiles.template.DefinitionModel#end(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefinitionModel
+ * #end(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack, java.lang.Object[])}.
*/
@Test
public void testEndInAttribute() {
@@ -78,9 +101,9 @@
Definition definition = new Definition();
composeStack.push(definition);
Integer requestItem = new Integer(1);
-
+
container.register(definition, requestItem);
-
+
replay(container);
model.end(container, composeStack, requestItem);
assertEquals(1, composeStack.size());
@@ -91,7 +114,9 @@
}
/**
- * Test method for {@link org.apache.tiles.template.DefinitionModel#execute(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.DefinitionModel
+ * #execute(org.apache.tiles.mgmt.MutableTilesContainer, java.util.Stack,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[])}.
*/
@Test
public void testExecute() {
@@ -100,11 +125,12 @@
Attribute attribute = new Attribute();
composeStack.push(attribute);
Integer requestItem = new Integer(1);
-
+
container.register((Definition) notNull(), eq(requestItem));
-
+
replay(container);
- model.execute(container, composeStack, "myName", "myTemplate", "myRole", "myExtends", "myPreparer", requestItem);
+ model.execute(container, composeStack, "myName", "myTemplate",
+ "myRole", "myExtends", "myPreparer", requestItem);
assertEquals(1, composeStack.size());
attribute = (Attribute) composeStack.peek();
assertEquals("definition", attribute.getRenderer());
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -17,8 +35,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link GetAsStringModel}.
*
+ * @version $Rev$ $Date$
*/
public class GetAsStringModelTest {
@@ -26,23 +45,26 @@
* The mock resolver.
*/
private AttributeResolver resolver;
-
+
/**
* The model to test.
*/
private GetAsStringModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
resolver = createMock(AttributeResolver.class);
model = new GetAsStringModel(resolver);
}
/**
- * Test method for {@link org.apache.tiles.template.GetAsStringModel#start(java.util.Stack, org.apache.tiles.TilesContainer, boolean, java.lang.String, java.lang.String, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, org.apache.tiles.Attribute, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.GetAsStringModel
+ * #start(java.util.Stack, org.apache.tiles.TilesContainer, boolean, java.lang.String,
+ * java.lang.String, java.lang.Object, java.lang.String, java.lang.String, java.lang.String,
+ * org.apache.tiles.Attribute, java.lang.Object[])}.
*/
@Test
public void testStart() {
@@ -51,12 +73,12 @@
Integer requestItem = new Integer(1);
Attribute attribute = new Attribute();
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
container.prepare("myPreparer", requestItem);
expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue",
"myDefaultValueRole", "myDefaultValueType", requestItem)).andReturn(attribute);
expect(container.startContext(requestItem)).andReturn(attributeContext);
-
+
replay(resolver, container, attributeContext);
model.start(composeStack, container, false, "myPreparer", "myRole", "myDefaultValue",
"myDefaultValueRole", "myDefaultValueType", "myName", attribute, requestItem);
@@ -66,7 +88,9 @@
}
/**
- * Test method for {@link org.apache.tiles.template.GetAsStringModel#end(java.util.Stack, org.apache.tiles.TilesContainer, java.io.Writer, boolean, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.GetAsStringModel
+ * #end(java.util.Stack, org.apache.tiles.TilesContainer, java.io.Writer,
+ * boolean, java.lang.Object[])}.
* @throws IOException If something goes wrong.
*/
@Test
@@ -77,17 +101,20 @@
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
Writer writer = createMock(Writer.class);
-
+
writer.write("myValue");
container.endContext(requestItem);
-
+
replay(resolver, container, writer);
model.end(composeStack, container, writer, false, requestItem);
verify(resolver, container, writer);
}
/**
- * Test method for {@link org.apache.tiles.template.GetAsStringModel#execute(org.apache.tiles.TilesContainer, java.io.Writer, boolean, java.lang.String, java.lang.String, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, org.apache.tiles.Attribute, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.GetAsStringModel
+ * #execute(org.apache.tiles.TilesContainer, java.io.Writer, boolean,
+ * java.lang.String, java.lang.String, java.lang.Object, java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.tiles.Attribute, java.lang.Object[])}.
* @throws IOException If something goes wrong.
*/
@Test
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ImportAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ImportAttributeModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ImportAttributeModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/ImportAttributeModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -17,26 +35,34 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link ImportAttributeModel}.
*
+ * @version $Rev$ $Date$
*/
public class ImportAttributeModelTest {
/**
+ * The size of the attributes collection.
+ */
+ private static final int ATTRIBUTES_SIZE = 3;
+
+ /**
* The model to test.
*/
private ImportAttributeModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
model = new ImportAttributeModel();
}
/**
- * Test method for {@link org.apache.tiles.template.ImportAttributeModel#getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String, boolean, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.ImportAttributeModel
+ * #getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String,
+ * java.lang.String, boolean, java.lang.Object[])}.
*/
@Test
public void testGetImportedAttributesSingle() {
@@ -44,11 +70,11 @@
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
Attribute attribute = new Attribute();
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(attribute);
expect(container.evaluate(attribute, requestItem)).andReturn("myEvaluatedValue");
-
+
replay(container, attributeContext);
Map<String, Object> attributes = model.getImportedAttributes(container, "myName", null, false, requestItem);
assertEquals(1, attributes.size());
@@ -57,7 +83,9 @@
}
/**
- * Test method for {@link org.apache.tiles.template.ImportAttributeModel#getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String, boolean, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.ImportAttributeModel
+ * #getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String,
+ * java.lang.String, boolean, java.lang.Object[])}.
*/
@Test
public void testGetImportedAttributesSingleToName() {
@@ -65,20 +93,23 @@
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
Attribute attribute = new Attribute();
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getAttribute("myName")).andReturn(attribute);
expect(container.evaluate(attribute, requestItem)).andReturn("myEvaluatedValue");
-
+
replay(container, attributeContext);
- Map<String, Object> attributes = model.getImportedAttributes(container, "myName", "myToName", false, requestItem);
+ Map<String, Object> attributes = model.getImportedAttributes(container,
+ "myName", "myToName", false, requestItem);
assertEquals(1, attributes.size());
assertEquals("myEvaluatedValue", attributes.get("myToName"));
verify(container, attributeContext);
}
/**
- * Test method for {@link org.apache.tiles.template.ImportAttributeModel#getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String, boolean, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.ImportAttributeModel
+ * #getImportedAttributes(org.apache.tiles.TilesContainer, java.lang.String,
+ * java.lang.String, boolean, java.lang.Object[])}.
*/
@Test
public void testGetImportedAttributesAll() {
@@ -94,7 +125,7 @@
Set<String> localNames = new HashSet<String>();
localNames.add("myName1");
localNames.add("myName3");
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
expect(attributeContext.getCascadedAttributeNames()).andReturn(cascadedNames);
expect(attributeContext.getLocalAttributeNames()).andReturn(localNames);
@@ -104,10 +135,10 @@
expect(container.evaluate(attribute1, requestItem)).andReturn("myEvaluatedValue1").times(2);
expect(container.evaluate(attribute2, requestItem)).andReturn("myEvaluatedValue2");
expect(container.evaluate(attribute3, requestItem)).andReturn("myEvaluatedValue3");
-
+
replay(container, attributeContext);
Map<String, Object> attributes = model.getImportedAttributes(container, null, null, false, requestItem);
- assertEquals(3, attributes.size());
+ assertEquals(ATTRIBUTES_SIZE, attributes.size());
assertEquals("myEvaluatedValue1", attributes.get("myName1"));
assertEquals("myEvaluatedValue2", attributes.get("myName2"));
assertEquals("myEvaluatedValue3", attributes.get("myName3"));
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.junit.Assert.*;
@@ -16,8 +34,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link InsertAttributeModel}.
*
+ * @version $Rev$ $Date$
*/
public class InsertAttributeModelTest {
@@ -25,23 +44,25 @@
* The mock resolver.
*/
private AttributeResolver resolver;
-
+
/**
* The model to test.
*/
private InsertAttributeModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
resolver = createMock(AttributeResolver.class);
model = new InsertAttributeModel(resolver);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertAttributeModel#start(Stack, TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}.
+ * Test method for {@link org.apache.tiles.template.InsertAttributeModel
+ * #start(Stack, TilesContainer, boolean, String, String, Object, String,
+ * String, String, Attribute, Object...)}.
*/
@Test
public void testStart() {
@@ -50,12 +71,12 @@
Integer requestItem = new Integer(1);
Attribute attribute = new Attribute();
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
container.prepare("myPreparer", requestItem);
expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue",
"myDefaultValueRole", "myDefaultValueType", requestItem)).andReturn(attribute);
expect(container.startContext(requestItem)).andReturn(attributeContext);
-
+
replay(resolver, container, attributeContext);
model.start(composeStack, container, false, "myPreparer", "myRole", "myDefaultValue",
"myDefaultValueRole", "myDefaultValueType", "myName", attribute, requestItem);
@@ -65,7 +86,8 @@
}
/**
- * Test method for {@link org.apache.tiles.template.InsertAttributeModel#end(Stack, TilesContainer, boolean, Object...)}.
+ * Test method for {@link org.apache.tiles.template.InsertAttributeModel
+ * #end(Stack, TilesContainer, boolean, Object...)}.
* @throws IOException If something goes wrong.
*/
@Test
@@ -75,17 +97,19 @@
composeStack.push(attribute);
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
-
+
container.endContext(requestItem);
container.render(attribute, requestItem);
-
+
replay(resolver, container);
model.end(composeStack, container, false, requestItem);
verify(resolver, container);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertAttributeModel#execute(TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}.
+ * Test method for {@link org.apache.tiles.template.InsertAttributeModel
+ * #execute(TilesContainer, boolean, String, String, Object, String, String,
+ * String, Attribute, Object...)}.
* @throws IOException If something goes wrong.
*/
@Test
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.easymock.EasyMock.*;
@@ -12,8 +30,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link InsertDefinitionModel}.
*
+ * @version $Rev$ $Date$
*/
public class InsertDefinitionModelTest {
@@ -21,67 +40,72 @@
* The model to test.
*/
private InsertDefinitionModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
model = new InsertDefinitionModel();
}
/**
- * Test method for {@link org.apache.tiles.template.InsertDefinitionModel#start(org.apache.tiles.TilesContainer, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.InsertDefinitionModel
+ * #start(org.apache.tiles.TilesContainer, java.lang.Object[])}.
*/
@Test
public void testStart() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.startContext(requestItem)).andReturn(attributeContext);
-
+
replay(container, attributeContext);
model.start(container, requestItem);
verify(container, attributeContext);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertDefinitionModel#end(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.InsertDefinitionModel
+ * #end(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Object[])}.
*/
@Test
public void testEnd() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
container.endContext(requestItem);
attributeContext.setPreparer("myPreparer");
attributeContext.setTemplateAttribute((Attribute) notNull());
container.render("myDefinitionName", requestItem);
-
+
replay(container, attributeContext);
model.end(container, "myDefinitionName", "myTemplate", "myRole", "myPreparer", requestItem);
verify(container, attributeContext);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertDefinitionModel#execute(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.InsertDefinitionModel
+ * #execute(org.apache.tiles.TilesContainer, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Object[])}.
*/
@Test
public void testExecute() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.startContext(requestItem)).andReturn(attributeContext);
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
container.endContext(requestItem);
attributeContext.setPreparer("myPreparer");
attributeContext.setTemplateAttribute((Attribute) notNull());
container.render("myDefinitionName", requestItem);
-
+
replay(container, attributeContext);
model.execute(container, "myDefinitionName", "myTemplate", "myRole", "myPreparer", requestItem);
verify(container, attributeContext);
Modified: tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java?rev=765774&r1=765773&r2=765774&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java (original)
+++ tiles/framework/trunk/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java Thu Apr 16 21:43:00 2009
@@ -1,6 +1,24 @@
-/**
- *
+/*
+ * $Id$
+ *
+ * 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.tiles.template;
import static org.easymock.EasyMock.*;
@@ -12,8 +30,9 @@
import org.junit.Test;
/**
- * @author antonio
+ * Tests {@link InsertTemplateModel}.
*
+ * @version $Rev$ $Date$
*/
public class InsertTemplateModelTest {
@@ -21,67 +40,70 @@
* The model to test.
*/
private InsertTemplateModel model;
-
+
/**
- * @throws java.lang.Exception
+ * Sets up the test.
*/
@Before
- public void setUp() throws Exception {
+ public void setUp() {
model = new InsertTemplateModel();
}
/**
- * Test method for {@link org.apache.tiles.template.InsertTemplateModel#start(org.apache.tiles.TilesContainer, java.lang.Object[])}.
+ * Test method for {@link org.apache.tiles.template.InsertTemplateModel
+ * #start(org.apache.tiles.TilesContainer, java.lang.Object[])}.
*/
@Test
public void testStart() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.startContext(requestItem)).andReturn(attributeContext);
-
+
replay(container, attributeContext);
model.start(container, requestItem);
verify(container, attributeContext);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertTemplateModel#end(TilesContainer, String, String, String, Object...)}.
+ * Test method for {@link org.apache.tiles.template.InsertTemplateModel
+ * #end(TilesContainer, String, String, String, Object...)}.
*/
@Test
public void testEnd() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
container.endContext(requestItem);
attributeContext.setPreparer("myPreparer");
attributeContext.setTemplateAttribute((Attribute) notNull());
container.renderContext(requestItem);
-
+
replay(container, attributeContext);
model.end(container, "myTemplate", "myRole", "myPreparer", requestItem);
verify(container, attributeContext);
}
/**
- * Test method for {@link org.apache.tiles.template.InsertTemplateModel#execute(TilesContainer, String, String, String, Object...)}.
+ * Test method for {@link org.apache.tiles.template.InsertTemplateModel
+ * #execute(TilesContainer, String, String, String, Object...)}.
*/
@Test
public void testExecute() {
TilesContainer container = createMock(TilesContainer.class);
Integer requestItem = new Integer(1);
AttributeContext attributeContext = createMock(AttributeContext.class);
-
+
expect(container.startContext(requestItem)).andReturn(attributeContext);
expect(container.getAttributeContext(requestItem)).andReturn(attributeContext);
container.endContext(requestItem);
attributeContext.setPreparer("myPreparer");
attributeContext.setTemplateAttribute((Attribute) notNull());
container.renderContext(requestItem);
-
+
replay(container, attributeContext);
model.execute(container, "myTemplate", "myRole", "myPreparer", requestItem);
verify(container, attributeContext);