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 2007/04/11 17:44:59 UTC
svn commit: r527536 [3/4] - in /tiles/framework/trunk: ./ tiles-api/
tiles-api/src/main/java/org/apache/tiles/
tiles-api/src/main/java/org/apache/tiles/access/
tiles-api/src/main/java/org/apache/tiles/mgmt/
tiles-api/src/main/java/org/apache/tiles/web/...
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitions.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitions.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitions.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitions.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
@@ -26,21 +25,17 @@
import java.util.Locale;
import java.util.Map;
-import org.apache.tiles.definition.Definitions;
-import org.apache.tiles.definition.NoSuchDefinitionException;
-import org.apache.tiles.definition.Definition;
-
/**
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date$
*/
public class MockDefinitions implements Definitions {
-
+
/**
* Hokey way to verify that this was created.
*/
private static int instanceCount = 0;
-
+
/**
* Hokey way to verify that this class was created.
*
@@ -49,15 +44,15 @@
public static int getInstanceCount() {
return instanceCount;
}
-
- /** Creates a new instance of MockDefinitions */
+
+ /** Creates a new instance of MockDefinitions. */
public MockDefinitions() {
instanceCount++;
}
/**
* Returns a Definition object that matches the given name.
- *
+ *
* @param name The name of the Definition to return.
* @return the Definition matching the given name or null if none
* is found.
@@ -67,9 +62,9 @@
}
/**
- * Adds new locale-specific Definition objects to the internal
+ * Adds new locale-specific Definition objects to the internal
* collection and resolves inheritance attraibutes.
- *
+ *
* @param defsMap The new definitions to add.
* @param locale The locale to add the definitions to.
*/
@@ -79,7 +74,7 @@
/**
* Returns a Definition object that matches the given name and locale.
- *
+ *
* @param name The name of the Definition to return.
* @param locale The locale to use to resolve the definition.
* @return the Definition matching the given name or null if none
@@ -90,9 +85,9 @@
}
/**
- * Adds new Definition objects to the internal collection and
+ * Adds new Definition objects to the internal collection and
* resolves inheritance attraibutes.
- *
+ *
* @param defsMap The new definitions to add.
*/
public void addDefinitions(Map<String, Definition> defsMap) {
@@ -116,5 +111,5 @@
public Map<String, Definition> getBaseDefinitions() {
return null;
}
-
+
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitionsReader.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitionsReader.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitionsReader.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockDefinitionsReader.java Wed Apr 11 08:44:51 2007
@@ -17,48 +17,44 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
-import org.apache.tiles.definition.DefinitionsReader;
-import org.apache.tiles.definition.DefinitionsFactoryException;
-
import java.util.Collections;
import java.util.Map;
/**
* Mock Defintions Reader implementation. Stubs out all functionality.
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date$
*/
public class MockDefinitionsReader implements DefinitionsReader {
-
+
/**
* Hokey way to verify that this was created.
*/
private static int instanceCount = 0;
-
+
/**
* Hokey way to verify that this class was created.
*
- * @return The number of created instances.
+ * @return The number of created instances.
*/
public static int getInstanceCount() {
return instanceCount;
}
-
- /** Creates a new instance of MockDefinitionsReader */
+
+ /** Creates a new instance of MockDefinitionsReader. */
public MockDefinitionsReader() {
instanceCount++;
}
/**
* Reads <code>{@link org.apache.tiles.definition.Definition}</code> objects from a source.
- *
+ *
* Implementations should publish what type of source object is expected.
- *
+ *
* @param source The source from which definitions will be read.
* @return a Map of <code>Definition</code> objects read from
* the source.
@@ -72,14 +68,14 @@
/**
* Initializes the <code>DefinitionsReader</code> object.
- *
+ *
* This method must be called before the {@link #read} method is called.
- *
+ *
* @param params A map of properties used to set up the reader.
* @throws org.apache.tiles.definition.DefinitionsFactoryException if required properties are not
* passed in or the initialization fails.
*/
public void init(Map<String, String> params) throws DefinitionsFactoryException {
}
-
+
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockOnlyLocaleTilesContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockOnlyLocaleTilesContext.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockOnlyLocaleTilesContext.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockOnlyLocaleTilesContext.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
@@ -29,8 +28,8 @@
import org.apache.tiles.context.TilesRequestContext;
/**
- * Creates a TilesApplicationContext that contains only a Locale
- *
+ * Creates a TilesApplicationContext that contains only a Locale.
+ *
* @version $Rev$ $Date$
*/
public class MockOnlyLocaleTilesContext implements TilesRequestContext {
@@ -41,7 +40,7 @@
private Locale locale;
/** Creates a new instance of MockOnlyLocaleTilesContext.
- *
+ *
* @param locale The locale object to use.
*/
public MockOnlyLocaleTilesContext(Locale locale) {
@@ -50,7 +49,8 @@
/**
* Returns the locale specified in the constructor.
- *
+ *
+ * @return The locale of the request.
* @see org.apache.tiles.context.TilesRequestContext#getRequestLocale()
*/
public Locale getRequestLocale() {
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockPublicUrlDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockPublicUrlDefinitionsFactory.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockPublicUrlDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/MockPublicUrlDefinitionsFactory.java Wed Apr 11 08:44:51 2007
@@ -17,28 +17,28 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
-import org.apache.tiles.definition.Definitions;
-import org.apache.tiles.definition.DefinitionsFactoryException;
import org.apache.tiles.context.TilesRequestContext;
-import org.apache.tiles.definition.UrlDefinitionsFactory;
/**
* Mock implementation of UrlDefinitionsFactory that exposes two of its methods
* as public instead of protected.
- *
+ *
* @version $Rev$ $Date$
*/
public class MockPublicUrlDefinitionsFactory extends UrlDefinitionsFactory {
/**
* Exposes the <code>addDefinitions</code> method of
- * <code>UrlDefinitionsFactory</code>
- *
+ * <code>UrlDefinitionsFactory</code>.
+ *
+ * @param definitions The definitions to add.
+ * @param tilesContext The request context to use.
+ * @throws DefinitionsFactoryException If something goes wrong during the
+ * addition.
* @see org.apache.tiles.definition.UrlDefinitionsFactory#addDefinitions(org.apache.tiles.definition.Definitions,
*org.apache.tiles.context.TilesRequestContext)
*/
@@ -48,11 +48,13 @@
}
/**
- *
* Exposes the <code>isLocaleProcessed</code> method of
- * <code>UrlDefinitionsFactory</code>
- *
- * @see org.apache.tiles.definition.UrlDefinitionsFactory#isContextProcessed(org.apache.tiles.context.TilesRequestContext)
+ * <code>UrlDefinitionsFactory</code>.
+ *
+ * @param tilesContext The request context to use.
+ * @return <code>true</code> if the context has been already processed.
+ * @see org.apache.tiles.definition.UrlDefinitionsFactory
+ * #isContextProcessed(org.apache.tiles.context.TilesRequestContext)
*/
public boolean isContextProcessed(TilesRequestContext tilesContext) {
return super.isContextProcessed(tilesContext);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinition.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinition.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinition.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinition.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
@@ -25,24 +24,23 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.tiles.definition.Definition;
/**
* Tests the Definition class.
*
* @version $Rev$ $Date$
*/
-public class TestDefinition extends TestCase{
-
+public class TestDefinition extends TestCase {
+
/**
- * Creates a new instance of TestDefinition
+ * Creates a new instance of TestDefinition.
*
* @param name The name of the test.
*/
public TestDefinition(String name) {
super(name);
}
-
+
/**
* Start the tests.
*
@@ -60,7 +58,7 @@
public static Test suite() {
return new TestSuite(TestDefinition.class);
}
-
+
/**
* Verifies the put Attribute functionality.
*
@@ -71,11 +69,11 @@
def.setName("test1");
def.setTemplate("/page1.jsp");
def.put("attr1", new Definition(), "definition", null);
-
+
Object attr1 = def.getAttribute("attr1");
assertNotNull("Null attribute.", attr1);
assertTrue("Wrong attribute type", attr1 instanceof Definition);
}
-
-
+
+
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinitions.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinitions.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinitions.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestDefinitions.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
@@ -28,28 +27,24 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.tiles.definition.DefinitionsImpl;
-import org.apache.tiles.definition.Definitions;
-import org.apache.tiles.definition.NoSuchDefinitionException;
-import org.apache.tiles.definition.Definition;
import org.apache.tiles.Attribute;
/**
* Tests the DefinitionsImpl class.
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date$
*/
public class TestDefinitions extends TestCase {
-
+
/**
- * Creates a new instance of TestDefinitions
+ * Creates a new instance of TestDefinitions.
*
* @param name The name of the test.
*/
public TestDefinitions(String name) {
super(name);
}
-
+
/**
* Start the tests.
*
@@ -73,7 +68,7 @@
*/
public void testResolveInheritances() {
Map<String, Definition> defs = new HashMap<String, Definition>();
-
+
Definition def = new Definition();
def.setName("parent.def1");
def.setTemplate("/test1.jsp");
@@ -82,7 +77,7 @@
attr.setValue("value1");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
def = new Definition();
def.setName("child.def1");
def.setExtends("parent.def1");
@@ -91,29 +86,29 @@
attr.setValue("New value");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
Definitions definitions = new DefinitionsImpl();
try {
definitions.addDefinitions(defs);
} catch (NoSuchDefinitionException e) {
fail("Test failure: " + e);
}
-
- assertNotNull("Couldn't get parent.",
+
+ assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("parent.def1").getTemplate());
assertEquals("Incorrect attr1 value", "value1",
definitions.getDefinition("parent.def1").getAttribute("attr1"));
-
- assertNotNull("Couldn't get child.",
+
+ assertNotNull("Couldn't get child.",
definitions.getDefinition("child.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("child.def1").getTemplate());
assertEquals("Incorrect attr1 value", "New value",
definitions.getDefinition("child.def1").getAttribute("attr1"));
}
-
+
/**
* Tests the inheritance with localized definitions.
*/
@@ -127,7 +122,7 @@
attr.setValue("value1");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
def = new Definition();
def.setName("child.def1");
def.setExtends("parent.def1");
@@ -154,42 +149,42 @@
} catch (NoSuchDefinitionException e) {
fail("Test failure: " + e);
}
-
- assertNotNull("Couldn't get parent.",
+
+ assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("parent.def1").getTemplate());
assertEquals("Incorrect attr1 value", "value1",
definitions.getDefinition("parent.def1").getAttribute("attr1"));
-
- assertNotNull("Couldn't get child.",
+
+ assertNotNull("Couldn't get child.",
definitions.getDefinition("child.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("child.def1").getTemplate());
assertEquals("Incorrect attr1 value", "New value",
definitions.getDefinition("child.def1").getAttribute("attr1"));
-
- assertNotNull("Couldn't get parent.",
+
+ assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1", Locale.US));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("parent.def1", Locale.US).getTemplate());
assertEquals("Incorrect attr1 value", "value1",
definitions.getDefinition("parent.def1", Locale.US).getAttribute("attr1"));
-
- assertNotNull("Couldn't get child.",
+
+ assertNotNull("Couldn't get child.",
definitions.getDefinition("child.def1", Locale.US));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("child.def1", Locale.US).getTemplate());
assertEquals("Incorrect attr1 value", "US Value",
definitions.getDefinition("child.def1", Locale.US).getAttribute("attr1"));
}
-
+
/**
* Tests the reset method.
*/
public void testReset() {
Map<String, Definition> defs = new HashMap<String, Definition>();
-
+
Definition def = new Definition();
def.setName("parent.def1");
def.setTemplate("/test1.jsp");
@@ -198,7 +193,7 @@
attr.setValue("value1");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
def = new Definition();
def.setName("child.def1");
def.setExtends("parent.def1");
@@ -207,22 +202,22 @@
attr.setValue("New value");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
Definitions definitions = new DefinitionsImpl();
try {
definitions.addDefinitions(defs);
} catch (NoSuchDefinitionException e) {
fail("Test failure: " + e);
}
-
- assertNotNull("Couldn't get parent.",
+
+ assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1"));
-
+
definitions.reset();
- assertNull("Definitions should be null.",
+ assertNull("Definitions should be null.",
definitions.getDefinition("parent.def1"));
}
-
+
/**
* Verifies that attribute dependencies are resolved.
*
@@ -232,7 +227,7 @@
*/
public void testResolveAttributeDependencies() {
Map<String, Definition> defs = new HashMap<String, Definition>();
-
+
Definition def = new Definition();
def.setName("parent.def1");
def.setTemplate("/test1.jsp");
@@ -242,7 +237,7 @@
attr.setType("definition");
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
def = new Definition();
def.setName("parent.notype.def1");
def.setTemplate("/test1.jsp");
@@ -252,11 +247,11 @@
// Don't set the type
def.addAttribute(attr);
defs.put(def.getName(), def);
-
+
def = new Definition();
def.setName("tiles.def2");
defs.put(def.getName(), def);
-
+
Definitions definitions = new DefinitionsImpl();
try {
definitions.addDefinitions(defs);
@@ -264,36 +259,36 @@
} catch (NoSuchDefinitionException e) {
fail("Test failure: " + e);
}
-
+
Definition newDef = definitions.getDefinition("parent.def1");
assertNotNull("Parent definition not found.", newDef);
-
+
Object newAttr = newDef.getAttribute("attr1");
assertNotNull("Dependent attribute not found.", newAttr);
-
+
newDef = definitions.getDefinition("parent.notype.def1");
assertNotNull("Parent definition not found.", newDef);
-
+
newAttr = newDef.getAttribute("attr1");
assertNotNull("Dependent attribute not found.", newAttr);
-
+
assertEquals("Incorrect dependent attribute name.", "tiles.def2",
newAttr);
-
+
// Part of the test for locale-specific definitions.
newDef = definitions.getDefinition("parent.def1", Locale.ITALIAN);
assertNotNull("Parent definition not found.", newDef);
-
+
newAttr = newDef.getAttribute("attr1");
assertNotNull("Dependent attribute not found.", newAttr);
-
+
newDef = definitions.getDefinition("parent.notype.def1",
- Locale.ITALIAN);
+ Locale.ITALIAN);
assertNotNull("Parent definition not found.", newDef);
-
+
newAttr = newDef.getAttribute("attr1");
assertNotNull("Dependent attribute not found.", newAttr);
-
+
assertEquals("Incorrect dependent attribute name.", "tiles.def2",
newAttr);
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java Wed Apr 11 08:44:51 2007
@@ -17,12 +17,14 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -31,10 +33,6 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.tiles.definition.UrlDefinitionsFactory;
-import org.apache.tiles.definition.Definitions;
-import org.apache.tiles.definition.DefinitionsFactory;
-import org.apache.tiles.definition.ReloadableDefinitionsFactory;
/**
* Tests the reloadable definitions impl.
@@ -44,7 +42,13 @@
public class TestReloadableDefinitionsFactory extends TestCase {
/**
- * Creates a new instance of TestReloadableDefinitionsFactory
+ * The time (in milliseconds) to wait to be sure that the system updates the
+ * modify date of a file.
+ */
+ private static final int SLEEP_MILLIS = 30000;
+
+ /**
+ * Creates a new instance of TestReloadableDefinitionsFactory.
*
* @param name The name of the test.
*/
@@ -108,15 +112,15 @@
uri = new URI(urlPath.replaceAll(" ", "%20"));
}
- String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" +
- "<!DOCTYPE tiles-definitions PUBLIC " +
- "\"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN\" " +
- "\"http://tiles.apache.org/dtds/tiles-config_2_0.dtd\">\n\n" +
- "<tiles-definitions>" +
- "<definition name=\"rewrite.test\" template=\"/test.jsp\">" +
- "<put-attribute name=\"testparm\" value=\"testval\"/>" +
- "</definition>" +
- "</tiles-definitions>";
+ String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
+ + "<!DOCTYPE tiles-definitions PUBLIC "
+ + "\"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN\" "
+ + "\"http://tiles.apache.org/dtds/tiles-config_2_0.dtd\">\n\n"
+ + "<tiles-definitions>"
+ + "<definition name=\"rewrite.test\" template=\"/test.jsp\">"
+ + "<put-attribute name=\"testparm\" value=\"testval\"/>"
+ + "</definition>"
+ + "</tiles-definitions>";
File file = new File(uri);
FileOutputStream fileOut = new FileOutputStream(file);
@@ -141,18 +145,18 @@
reloadable.refreshRequired());
// Make sure the system actually updates the timestamp.
- Thread.sleep(30000);
+ Thread.sleep(SLEEP_MILLIS);
// Set up multiple data sources.
- xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" +
- "<!DOCTYPE tiles-definitions PUBLIC " +
- "\"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN\" " +
- "\"http://tiles.apache.org/dtds/tiles-config_2_0.dtd\">\n\n" +
- "<tiles-definitions>" +
- "<definition name=\"rewrite.test\" template=\"/newtest.jsp\">" +
- "<put-attribute name=\"testparm\" value=\"testval\"/>" +
- "</definition>" +
- "</tiles-definitions>";
+ xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"
+ + "<!DOCTYPE tiles-definitions PUBLIC "
+ + "\"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN\" "
+ + "\"http://tiles.apache.org/dtds/tiles-config_2_0.dtd\">\n\n"
+ + "<tiles-definitions>"
+ + "<definition name=\"rewrite.test\" template=\"/newtest.jsp\">"
+ + "<put-attribute name=\"testparm\" value=\"testval\"/>"
+ + "</definition>"
+ + "</tiles-definitions>";
file = new File(uri);
fileOut = new FileOutputStream(file);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition;
@@ -32,13 +31,9 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.tiles.definition.UrlDefinitionsFactory;
-import org.apache.tiles.definition.Definitions;
-import org.apache.tiles.definition.DefinitionsFactory;
-import org.apache.tiles.definition.DefinitionsFactoryException;
-import org.apache.tiles.definition.MockPublicUrlDefinitionsFactory;
-import org.apache.tiles.definition.MockDefinitionsReader;
-import org.apache.tiles.definition.MockOnlyLocaleTilesContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.tiles.context.TilesRequestContext;
/**
@@ -49,7 +44,18 @@
public class TestUrlDefinitionsFactory extends TestCase {
/**
- * Creates a new instance of TestUrlDefinitionsFactory
+ * The logging object.
+ */
+ private static final Log LOG =
+ LogFactory.getLog(TestUrlDefinitionsFactory.class);
+
+ /**
+ * The number of foreseen URLs with postfixes.
+ */
+ private static final int POSTFIX_COUNT = 3;
+
+ /**
+ * Creates a new instance of TestUrlDefinitionsFactory.
*
* @param name The name of the test.
*/
@@ -135,7 +141,7 @@
// Parse files.
factory.readDefinitions();
-
+
TilesRequestContext emptyContext = new MockOnlyLocaleTilesContext(null);
TilesRequestContext usContext = new MockOnlyLocaleTilesContext(Locale.US);
TilesRequestContext frenchContext = new MockOnlyLocaleTilesContext(Locale.FRENCH);
@@ -146,14 +152,27 @@
assertNotNull("test.def2 definition not found.", factory.getDefinition("test.def2", emptyContext));
assertNotNull("test.def3 definition not found.", factory.getDefinition("test.def3", emptyContext));
assertNotNull("test.common definition not found.", factory.getDefinition("test.common", emptyContext));
- assertNotNull("test.common definition in US locale not found.", factory.getDefinition("test.common", usContext));
- assertNotNull("test.common definition in FRENCH locale not found.", factory.getDefinition("test.common", frenchContext));
- assertNotNull("test.common definition in CHINA locale not found.", factory.getDefinition("test.common", chinaContext));
- assertNotNull("test.common.french definition in FRENCH locale not found.", factory.getDefinition("test.common.french", frenchContext));
- assertNotNull("test.common.french definition in CANADA_FRENCH locale not found.", factory.getDefinition("test.common.french", canadaFrenchContext));
- assertNotNull("test.def.toextend definition not found.", factory.getDefinition("test.def.toextend", emptyContext));
- assertNotNull("test.def.overridden definition not found.", factory.getDefinition("test.def.overridden", emptyContext));
- assertNotNull("test.def.overridden definition in FRENCH locale not found.", factory.getDefinition("test.def.overridden", frenchContext));
+ assertNotNull("test.common definition in US locale not found.", factory
+ .getDefinition("test.common", usContext));
+ assertNotNull("test.common definition in FRENCH locale not found.",
+ factory.getDefinition("test.common", frenchContext));
+ assertNotNull("test.common definition in CHINA locale not found.",
+ factory.getDefinition("test.common", chinaContext));
+ assertNotNull(
+ "test.common.french definition in FRENCH locale not found.",
+ factory.getDefinition("test.common.french", frenchContext));
+ assertNotNull(
+ "test.common.french definition in CANADA_FRENCH locale not found.",
+ factory
+ .getDefinition("test.common.french",
+ canadaFrenchContext));
+ assertNotNull("test.def.toextend definition not found.", factory
+ .getDefinition("test.def.toextend", emptyContext));
+ assertNotNull("test.def.overridden definition not found.", factory
+ .getDefinition("test.def.overridden", emptyContext));
+ assertNotNull(
+ "test.def.overridden definition in FRENCH locale not found.",
+ factory.getDefinition("test.def.overridden", frenchContext));
assertEquals("Incorrect default country value", "default",
factory.getDefinition("test.def1", emptyContext).getAttribute("country"));
@@ -188,6 +207,9 @@
fail("Should've thrown exception.");
} catch (DefinitionsFactoryException e) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Bad class name intercepted, it is ok", e);
+ }
// success.
}
}
@@ -303,7 +325,7 @@
Locale locale = Locale.US;
List<String> posts = UrlDefinitionsFactory.calculatePostfixes(locale);
- assertEquals(3, posts.size());
+ assertEquals(POSTFIX_COUNT, posts.size());
assertTrue(posts.contains("_en_US"));
assertTrue(posts.contains("_en"));
@@ -317,7 +339,7 @@
* Tests the concatPostfix method.
*/
public void testConcatPostfix() {
- UrlDefinitionsFactory factory = new UrlDefinitionsFactory();
+ UrlDefinitionsFactory factory = new UrlDefinitionsFactory();
String postfix = "_en_US";
assertEquals("a_en_US", factory.concatPostfix("a", postfix));
assertEquals("a_en_US.jsp", factory.concatPostfix("a.jsp", postfix));
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.definition.digester;
@@ -29,7 +28,9 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.tiles.definition.digester.DigesterDefinitionsReader;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.tiles.definition.DefinitionsFactoryException;
import org.apache.tiles.definition.DefinitionsReader;
import org.apache.tiles.definition.Definition;
@@ -37,19 +38,25 @@
/**
* Tests the <code>org.apache.tiles.definition.digester.DigesterDefinitionsReader</code> class.
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date$
*/
public class TestDigesterDefinitionsReader extends TestCase {
-
+
+ /**
+ * The logging object.
+ */
+ private static final Log LOG = LogFactory
+ .getLog(TestDigesterDefinitionsReader.class);
+
/**
- * Creates a new instance of TestDigesterDefinitionsReader
+ * Creates a new instance of TestDigesterDefinitionsReader.
*
* @param name The name of the test.
*/
public TestDigesterDefinitionsReader(String name) {
super(name);
}
-
+
/**
* Start the tests.
*
@@ -75,53 +82,56 @@
try {
DefinitionsReader reader = new DigesterDefinitionsReader();
reader.init(new HashMap<String, String>());
-
+
URL configFile = this.getClass().getClassLoader().getResource(
"org/apache/tiles/config/tiles-defs.xml");
assertNotNull("Config file not found", configFile);
-
+
InputStream source = configFile.openStream();
Map<String, Definition> definitions = reader.read(source);
-
+
assertNotNull("Definitions not returned.", definitions);
- assertNotNull("Couldn't find doc.mainLayout tile.",
+ assertNotNull("Couldn't find doc.mainLayout tile.",
definitions.get("doc.mainLayout"));
assertNotNull("Couldn't Find title attribute.", definitions.get(
"doc.mainLayout").getAttribute("title"));
assertEquals("Incorrect Find title attribute.",
"Tiles Library Documentation", definitions.get(
"doc.mainLayout").getAttribute("title"));
-
+
} catch (Exception e) {
fail("Exception reading configuration." + e);
}
}
-
+
/**
* Tests calling read without calling init.
*/
public void testNoInit() {
try {
DefinitionsReader reader = new DigesterDefinitionsReader();
-
+
// What happens if we don't call init?
// reader.init(new HashMap());
-
+
URL configFile = this.getClass().getClassLoader().getResource(
"org/apache/tiles/config/tiles-defs.xml");
assertNotNull("Config file not found", configFile);
-
+
InputStream source = configFile.openStream();
reader.read(source);
-
+
fail("Should've thrown exception.");
} catch (DefinitionsFactoryException e) {
// correct.
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception caught, it is OK", e);
+ }
} catch (Exception e) {
fail("Exception reading configuration." + e);
}
}
-
+
/**
* Tests read with bad input source.
*/
@@ -139,11 +149,14 @@
fail("Should've thrown an exception.");
} catch (DefinitionsFactoryException e) {
// correct.
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception caught, it is OK", e);
+ }
} catch (Exception e) {
fail("Exception reading configuration." + e);
}
}
-
+
/**
* Tests read with bad XML source.
*/
@@ -151,25 +164,28 @@
try {
DefinitionsReader reader = new DigesterDefinitionsReader();
reader.init(new HashMap<String, String>());
-
+
URL configFile = this.getClass().getClassLoader().getResource(
"org/apache/tiles/config/malformed-defs.xml");
assertNotNull("Config file not found", configFile);
-
+
InputStream source = configFile.openStream();
reader.read(source);
fail("Should've thrown an exception.");
} catch (DefinitionsFactoryException e) {
// correct.
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception caught, it is OK", e);
+ }
} catch (Exception e) {
fail("Exception reading configuration." + e);
}
}
-
+
/**
* Tests the validating input parameter.
*
- * This test case enables Digester's validating property then passes in a
+ * This test case enables Digester's validating property then passes in a
* configuration file with invalid XML.
*/
public void testValidatingParameter() {
@@ -177,7 +193,7 @@
* For some reason this test doesn't work. It throws a SAXParseException
* but then the test failes saying "Should've thrown an exception.
*
- * I don't know why DigesterDefinitionsReader doesn't catch the
+ * I don't know why DigesterDefinitionsReader doesn't catch the
* SAXParseException or how it makes it to the "fail" statement below.
*
try {
@@ -186,11 +202,11 @@
params.put(DigesterDefinitionsReader.PARSER_VALIDATE_PARAMETER_NAME,
"true");
reader.init(params);
-
+
URL configFile = this.getClass().getClassLoader().getResource(
"org/apache/tiles/config/invalid-defs.xml");
assertNotNull("Config file not found", configFile);
-
+
InputStream source = configFile.openStream();
Map definitions = reader.read(source);
fail("Should've thrown an exception.");
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactoryTest.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.factory;
@@ -47,7 +46,7 @@
* The servlet context.
*/
private ServletContext context;
-
+
/**
* Default configuration parameters.
*/
@@ -124,8 +123,7 @@
try {
container.init(new HashMap<String, String>());
fail("Container should have already been initialized");
- }
- catch (IllegalStateException te) {
+ } catch (IllegalStateException te) {
}
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.factory;
@@ -26,6 +25,8 @@
import javax.servlet.ServletContext;
import org.easymock.EasyMock;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
@@ -42,6 +43,12 @@
public class TilesContainerFactoryTest extends TestCase {
/**
+ * The logging object.
+ */
+ private static final Log LOG = LogFactory
+ .getLog(TilesContainerFactoryTest.class);
+
+ /**
* The servlet context.
*/
private ServletContext context;
@@ -71,7 +78,9 @@
EasyMock.reset(context);
EasyMock.expect(context.getInitParameterNames()).andReturn(v.elements());
- EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(TestFactory.class.getName());
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .CONTAINER_FACTORY_INIT_PARAM)).andReturn(
+ TestFactory.class.getName());
EasyMock.replay(context);
factory = TilesContainerFactory.getFactory(context);
assertNotNull(factory);
@@ -90,21 +99,24 @@
EasyMock.reset(context);
EasyMock.expect(context.getInitParameterNames()).andReturn(v.elements());
- EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn("org.missing.Class");
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .CONTAINER_FACTORY_INIT_PARAM)).andReturn("org.missing.Class");
EasyMock.replay(context);
try {
TilesContainerFactory.getFactory(context);
fail("Invalid classname. Exception should have been thrown.");
- }
- catch (TilesException e) {
+ } catch (TilesException e) {
}
}
/**
- * Tests
- * @throws TilesException
- * @throws MalformedURLException
+ * Tests the creation of a container.
+ *
+ * @throws TilesException If something goes wrong during execution of
+ * Tiles-specific code.
+ * @throws MalformedURLException If something goes wrong when obtaining URL
+ * resources.
*/
public void testCreateContainer() throws TilesException, MalformedURLException {
URL url = getClass().getResource("test-defs.xml");
@@ -125,8 +137,10 @@
try {
container.init(new HashMap<String, String>());
fail("Container should have already been initialized");
- }
- catch (IllegalStateException te) {
+ } catch (IllegalStateException te) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Intercepted an exception, it is OK", te);
+ }
}
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.impl;
@@ -38,7 +37,7 @@
* @version $Rev$ $Date$
*/
public class BasicTilesContainerTest extends TestCase {
-
+
/**
* The container.
*/
@@ -49,7 +48,7 @@
public void setUp() {
ServletContext context = EasyMock.createMock(ServletContext.class);
URL url = getClass().getResource("/org/apache/tiles/factory/test-defs.xml");
-
+
Vector<String> v = new Vector<String>();
EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(null);
@@ -71,7 +70,7 @@
throw new RuntimeException("Error initializing factory", e);
}
}
-
+
/**
* Tests basic Tiles container initialization.
*/
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.impl;
@@ -47,12 +46,12 @@
* @version $Rev$ $Date$
*/
public class KeyedDefinitionsFactoryTilesContainerTest extends TestCase {
-
+
/**
* The Tiles container.
*/
private KeyedDefinitionsFactoryTilesContainer container;
-
+
/**
* Default configuration parameters.
*/
@@ -64,9 +63,9 @@
defaults = new HashMap<String, String>();
defaults.put(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
KeyedDefinitionsFactoryTilesContainerFactory.class.getName());
-
+
ServletContext context = EasyMock.createMock(ServletContext.class);
-
+
Vector<String> v = new Vector<String>();
v.add(KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM);
v.add(BasicTilesContainer.DEFINITIONS_CONFIG + "@one");
@@ -103,7 +102,7 @@
throw new RuntimeException("Error initializing factory", e);
}
}
-
+
/**
* Tests container initialization.
*/
@@ -115,7 +114,7 @@
assertNotNull(container.getProperDefinitionsFactory("one"));
assertNotNull(container.getProperDefinitionsFactory("two"));
}
-
+
/**
* Tests initialization for postponed definitions factories.
*
@@ -126,7 +125,7 @@
public void testPostponedDefinitionsFactoryInitialization() throws MalformedURLException, TilesException {
KeyedDefinitionsFactoryTilesContainer container;
ServletContext context = EasyMock.createMock(ServletContext.class);
-
+
Vector<String> v = new Vector<String>();
EasyMock.reset(context);
@@ -135,7 +134,8 @@
EasyMock.expect(context.getInitParameter(TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG)).andReturn(null);
EasyMock.expect(context.getInitParameter("definitions-config")).andReturn(null);
- EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_MUTABLE_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .CONTAINER_FACTORY_MUTABLE_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(
KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM))
.andReturn(null);
@@ -151,12 +151,12 @@
(KeyedDefinitionsFactoryTilesContainerFactory)
TilesContainerFactory.getFactory(context, defaults);
container = (KeyedDefinitionsFactoryTilesContainer) factory.createContainer(context);
-
+
assertNotNull(container);
assertNotNull(container.getDefinitionsFactory());
assertNull(container.getProperDefinitionsFactory("one"));
assertNull(container.getProperDefinitionsFactory("two"));
-
+
Map<String, String> initParams = new HashMap<String, String>();
initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
"/WEB-INF/tiles-one.xml");
@@ -169,7 +169,7 @@
assertNotNull(container.getProperDefinitionsFactory("one"));
assertNotNull(container.getProperDefinitionsFactory("two"));
}
-
+
/**
* Tests if the definitions factory has been used.
*/
@@ -179,7 +179,7 @@
HttpSession session = EasyMock.createMock(HttpSession.class);
HttpServletResponse response = EasyMock.createMock(
HttpServletResponse.class);
-
+
EasyMock.reset(request);
EasyMock.reset(session);
EasyMock.reset(response);
@@ -195,7 +195,7 @@
assertTrue(container.isValidDefinition("test.def1", request, response));
assertFalse(container.isValidDefinition("test.def.one", request, response));
assertFalse(container.isValidDefinition("test.def.two", request, response));
-
+
EasyMock.reset(request);
EasyMock.reset(session);
EasyMock.reset(response);
@@ -211,7 +211,7 @@
assertTrue(container.isValidDefinition("test.def1", request, response));
assertTrue(container.isValidDefinition("test.def.one", request, response));
assertFalse(container.isValidDefinition("test.def.two", request, response));
-
+
EasyMock.reset(request);
EasyMock.reset(session);
EasyMock.reset(response);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/preparer/BasicPreparerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/preparer/BasicPreparerFactoryTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/preparer/BasicPreparerFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/preparer/BasicPreparerFactoryTest.java Wed Apr 11 08:44:51 2007
@@ -17,13 +17,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.preparer;
import junit.framework.TestCase;
-import org.apache.tiles.preparer.ViewPreparerSupport;
-import org.apache.tiles.preparer.ViewPreparer;
import org.apache.tiles.TilesException;
/**
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/servlet/ServletContextAdapterTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/servlet/ServletContextAdapterTest.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/servlet/ServletContextAdapterTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/servlet/ServletContextAdapterTest.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.servlet;
@@ -40,7 +39,7 @@
/**
* The context to test.
*/
- ServletContextAdapter context;
+ private ServletContextAdapter context;
/** {@inheritDoc} */
@Override
@@ -62,7 +61,7 @@
assertEquals(context.getInitParameter("initParameter1"), "newParameterValue1");
assertEquals(context.getInitParameter("initParameter2"), "parameterValue2");
assertEquals(context.getInitParameter("newInitParameter"), "newParameterValue2");
-
+
Set<String> paramSet = new HashSet<String>();
paramSet.add("initParameter1");
paramSet.add("initParameter2");
@@ -73,7 +72,7 @@
assertTrue(paramSet.contains(name));
paramSet.remove(name);
}
-
+
assertTrue(paramSet.isEmpty());
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/RollingVectorEnumeration.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/RollingVectorEnumeration.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/RollingVectorEnumeration.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/RollingVectorEnumeration.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.util;
@@ -29,21 +28,21 @@
* It represents an vector-based enumeration when, when it has finished
* enumerating items, it starts from the beginning.
*
- * @param <E> The type of the element of this enumeration.
+ * @param <E> The type of the element of this enumeration.
* @version $Rev$ $Date$
*/
public class RollingVectorEnumeration<E> implements Enumeration<E> {
-
+
/**
* The vector.
*/
private Vector<E> vector;
-
+
/**
* The elements.
*/
private Enumeration<E> elements;
-
+
/**
* Constructor.
*
@@ -65,11 +64,11 @@
/** {@inheritDoc} */
public E nextElement() {
E retValue = elements.nextElement();
-
+
if (!elements.hasMoreElements()) {
elements = null;
}
-
+
return retValue;
}
Modified: tiles/framework/trunk/tiles-jsp/pom.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/pom.xml?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/pom.xml (original)
+++ tiles/framework/trunk/tiles-jsp/pom.xml Wed Apr 11 08:44:51 2007
@@ -19,7 +19,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.context;
@@ -26,7 +25,6 @@
import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.context.servlet.ServletTilesApplicationContext;
-import org.apache.tiles.jsp.context.JspTilesRequestContext;
import javax.servlet.ServletContext;
import javax.servlet.jsp.PageContext;
@@ -49,7 +47,7 @@
ServletContext servletContext = (ServletContext) context;
return new ServletTilesApplicationContext(servletContext);
}
-
+
return null;
}
@@ -62,7 +60,7 @@
return new JspTilesRequestContext(servletContext, (PageContext) requestItems[0]);
}
}
-
+
return null;
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContext.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContext.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContext.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.context;
@@ -76,6 +75,7 @@
* Dispatches a path. In fact it "includes" it!
*
* @param path The path to dispatch to.
+ * @throws IOException If something goes wrong during dispatching.
* @see org.apache.tiles.context.servlet.ServletTilesRequestContext#dispatch(java.lang.String)
*/
public void dispatch(String path) throws IOException {
@@ -87,14 +87,15 @@
try {
JspUtil.doInclude(pageContext, path, false);
} catch (JspException e) {
- LOG.error("JSPException while including path '"+path+"'. ", e);
- throw new IOException("JSPException while including path '"+path+"'. "+e.getMessage());
+ LOG.error("JSPException while including path '" + path + "'. ", e);
+ throw new IOException("JSPException while including path '" + path
+ + "'. " + e.getMessage());
}
}
/** {@inheritDoc} */
public HttpServletResponse getResponse() {
- if(response == null) {
+ if (response == null) {
response = new JspWriterResponse(pageContext);
}
return response;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspUtil.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspUtil.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspUtil.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspUtil.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.context;
@@ -36,7 +35,13 @@
*
* @version $Rev$ $Date$
*/
-public class JspUtil {
+public final class JspUtil {
+
+ /**
+ * Constructor, private to avoid instantiation.
+ */
+ private JspUtil() {
+ }
/**
* The logging object.
@@ -59,8 +64,8 @@
Class<?>[] args = new Class<?>[]{String.class, boolean.class};
include = PageContext.class.getMethod("include", args);
} catch (NoSuchMethodException e) {
- LOG.debug("Could not find JSP 2.0 include method. Using old one that doesn't support " +
- "configurable flushing.", e);
+ LOG.debug("Could not find JSP 2.0 include method. Using old one that doesn't support "
+ + "configurable flushing.", e);
}
}
@@ -91,8 +96,7 @@
try {
pageContext.include(uri);
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new JspException("IOException while including page.", e);
} catch (ServletException e) {
throw new JspException("ServletException while including page.", e);
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspWriterResponse.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspWriterResponse.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspWriterResponse.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspWriterResponse.java Wed Apr 11 08:44:51 2007
@@ -17,22 +17,20 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.context;
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import java.io.PrintWriter;
import java.io.IOException;
/**
- * It works as an {@link HttpServletResponse} by wrapping a {@link JspWriter}
- * around a {@link PrintWriter}.
- *
+ * It works as an {@link HttpServletResponse} by wrapping a
+ * {@link javax.servlet.jsp.JspWriter} around a {@link PrintWriter}.
+ *
* @version $Rev$ $Date$
*/
public class JspWriterResponse extends HttpServletResponseWrapper {
@@ -53,14 +51,14 @@
* @param pageContext The page context to use.
*/
public JspWriterResponse(PageContext pageContext) {
- super((HttpServletResponse)pageContext.getResponse());
+ super((HttpServletResponse) pageContext.getResponse());
this.context = pageContext;
}
/** {@inheritDoc} */
public PrintWriter getWriter() throws IOException {
- if(writer == null) {
+ if (writer == null) {
writer = new PrintWriter(context.getOut());
}
return writer;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -31,10 +30,10 @@
/**
* <p><strong>Adds an attribute in enclosing attribute container tag.</strong></p>
- * <p>Enclosing attribute container tag can be :
+ * <p>Enclosing attribute container tag can be :
* <ul>
- * <li><putListAttribute></li>
- * <li><putAttribute></li>
+ * <li><putListAttribute></li>
+ * <li><putAttribute></li>
* </ul>
* (or any other tag which implements the <code>{@link AddAttributeTagParent}</code> interface.
* Exception is thrown if no appropriate tag can be found.</p>
@@ -145,7 +144,7 @@
}
/**
- * Save the body content of this tag (if any)
+ * Save the body content of this tag (if any).
*
* @return It returns <code>SKIP_BODY</code>.
* @throws JspException if a JSP exception has occurred
@@ -166,7 +165,8 @@
if (parent == null) {
String message = "Error: enclosing tag '"
- +getParent().getClass().getName()+" doesn't accept 'put' tag.";
+ + getParent().getClass().getName()
+ + " doesn't accept 'put' tag.";
LOG.error(message);
throw new JspException(message);
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTagParent.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTagParent.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTagParent.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTagParent.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddListAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddListAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddListAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddListAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -41,7 +40,7 @@
/**
* Get list defined in tag.
*
- * @return The list of attributes.
+ * @return The list of attributes.
*/
@SuppressWarnings("unchecked")
public List<Attribute> getValue() {
@@ -57,7 +56,7 @@
/** {@inheritDoc} */
public int doStartTag() throws JspException {
super.setValue(new ArrayList<Attribute>());
- return super.doStartTag();
+ return super.doStartTag();
}
/**
@@ -69,7 +68,7 @@
public int doAfterBody() throws JspException {
return (SKIP_BODY);
}
-
+
/**
* Release the state of this put list by
* clearing the contents of the list.
@@ -95,15 +94,15 @@
nestedTag.getValue(), nestedTag.getRole(),
nestedTag.getType());
- this.addValue(attribute);
+ this.addValue(attribute);
}
- /**
+ /**
* Adds a value in this list.
*
- * @param attribute The attribute to add.
- */
- private void addValue( Attribute attribute ) {
- this.getValue().add(attribute);
- }
+ * @param attribute The attribute to add.
+ */
+ private void addValue(Attribute attribute) {
+ this.getValue().add(attribute);
+ }
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AttributeTagSupport.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AttributeTagSupport.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AttributeTagSupport.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AttributeTagSupport.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -44,14 +43,14 @@
/**
* Maps scope names to their constants.
*/
- private static final Map<String, Integer> scopes =
+ private static final Map<String, Integer> SCOPES =
new HashMap<String, Integer>();
static {
- scopes.put("page", PageContext.PAGE_SCOPE);
- scopes.put("request", PageContext.REQUEST_SCOPE);
- scopes.put("session", PageContext.SESSION_SCOPE);
- scopes.put("application", PageContext.APPLICATION_SCOPE);
+ SCOPES.put("page", PageContext.PAGE_SCOPE);
+ SCOPES.put("request", PageContext.REQUEST_SCOPE);
+ SCOPES.put("session", PageContext.SESSION_SCOPE);
+ SCOPES.put("application", PageContext.APPLICATION_SCOPE);
}
@@ -163,7 +162,7 @@
}
/**
- * Get scope value from string value
+ * Get scope value from string value.
*
* @return Scope as an <code>int</code>, or <code>defaultValue</code> if scope is <code>null</code>.
* @throws javax.servlet.jsp.JspException Scope name is not recognized as a valid scope.
@@ -185,7 +184,7 @@
* @throws JspException if the scopeName is not a valid name.
*/
public static int getScope(String scopeName) throws JspException {
- Integer scope = scopes.get(scopeName.toLowerCase());
+ Integer scope = SCOPES.get(scopeName.toLowerCase());
if (scope == null) {
throw new JspException("Unable to retrieve the scope " + scopeName);
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ContainerTagSupport.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ContainerTagSupport.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ContainerTagSupport.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ContainerTagSupport.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -34,13 +33,12 @@
* Base tag for the tiles tags which interact with the container.
* Provides standard support for security, and provides access
* to the container and attribute context.
- * </p>
*
* @since Tiles 2.0
* @version $Rev$ $Date$
*/
public abstract class ContainerTagSupport extends RoleSecurityTagSupport {
-
+
/**
* The log instance for this tag.
*/
@@ -74,7 +72,7 @@
throw new JspException("TilesContainer not initialized");
}
}
-
+
/** {@inheritDoc} */
public int doEndTag() throws JspException {
@@ -93,7 +91,7 @@
this.container = null;
this.attributeContext = null;
}
-
+
/**
* Starts the context when entering the tag.
*
@@ -104,7 +102,7 @@
attributeContext = container.startContext(pageContext);
}
}
-
+
/**
* Ends the context when exiting the tag.
*
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/GetAsStringTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/GetAsStringTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/GetAsStringTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/GetAsStringTag.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ImportAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ImportAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ImportAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ImportAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,12 +17,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
import org.apache.tiles.Attribute;
-import org.apache.tiles.jsp.taglib.AttributeTagSupport;
import javax.servlet.jsp.JspException;
import java.util.Iterator;
@@ -38,23 +36,23 @@
*/
public class ImportAttributeTag extends AttributeTagSupport {
- /**
- * The destination attribute name.
- */
- private String toName;
+ /**
+ * The destination attribute name.
+ */
+ private String toName;
/**
* <p>
* Returns the name of the destination attribute. If not specified, the name
* will be the same as specified in <code>name</code> attribute
* </p>
- *
+ *
* @return The destination attribute name.
*/
public String getToName() {
return toName;
}
-
+
/**
* <p>
* Sets the name of the destination attribute. If not specified, the name
@@ -63,7 +61,7 @@
*
* @param toName The destination attribute name.
*/
- public void setToName(String toName) {
+ public void setToName(String toName) {
this.toName = toName;
}
@@ -74,7 +72,7 @@
*/
public void execute() throws JspException {
if (attribute != null) {
- pageContext.setAttribute(toName != null? toName : name,
+ pageContext.setAttribute(toName != null ? toName : name,
attribute.getValue(), scope);
} else {
Iterator<String> names = attributeContext.getAttributeNames();
@@ -82,18 +80,18 @@
String name = names.next();
if (name == null && !ignore) {
- throw new JspException("Error importing attributes. " +
- "Attribute with null key found.");
+ throw new JspException("Error importing attributes. "
+ + "Attribute with null key found.");
} else if (name == null) {
continue;
}
Attribute attr = attributeContext.getAttribute(name);
- if ( (attr == null || attr.getValue() == null) && !ignore) {
- throw new JspException("Error importing attributes. "+
- "Attribute '"+name+"' has a null value ");
- } else if( attr == null || attr.getValue() == null) {
+ if ((attr == null || attr.getValue() == null) && !ignore) {
+ throw new JspException("Error importing attributes. "
+ + "Attribute '" + name + "' has a null value ");
+ } else if (attr == null || attr.getValue() == null) {
continue;
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -44,12 +43,12 @@
* Name to insert.
*/
protected String name;
-
+
/**
* The value of the attribute.
*/
protected Object value = null;
-
+
/**
* The context used to evaluate the attribute.
*/
@@ -121,13 +120,13 @@
/** {@inheritDoc} */
@Override
protected void startContext(PageContext context) {
-
+
if (container != null) {
evaluatingContext = container.getAttributeContext(context);
}
super.startContext(context);
}
-
+
/**
* Renders an attribute for real.
*
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java Wed Apr 11 08:44:51 2007
@@ -17,12 +17,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
-import org.apache.tiles.jsp.taglib.RenderTagSupport;
import org.apache.tiles.TilesException;
import javax.servlet.jsp.JspException;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertTemplateTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertTemplateTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertTemplateTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertTemplateTag.java Wed Apr 11 08:44:51 2007
@@ -17,14 +17,11 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
import org.apache.tiles.jsp.context.JspUtil;
-import org.apache.tiles.jsp.taglib.PutAttributeTagParent;
-import org.apache.tiles.jsp.taglib.RenderTagSupport;
import javax.servlet.jsp.JspException;
@@ -37,7 +34,6 @@
public class InsertTemplateTag extends RenderTagSupport
implements PutAttributeTagParent {
-
/**
* A string representing the URI of a template (for example, a JSP page).
*/
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,13 +17,11 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
import org.apache.tiles.Constants;
-import org.apache.tiles.jsp.taglib.PutAttributeTagParent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -32,11 +30,11 @@
/**
* <p><strong>Put an attribute in enclosing attribute container tag.</strong></p>
- * <p>Enclosing attribute container tag can be :
+ * <p>Enclosing attribute container tag can be :
* <ul>
- * <li><initContainer></li>
- * <li><definition></li>
- * <li><insertAttribute></li>
+ * <li><initContainer></li>
+ * <li><definition></li>
+ * <li><insertAttribute></li>
* <li><insertDefinition></li>
* <li><putList></li>
* </ul>
@@ -184,7 +182,7 @@
}
/**
- * Save the body content of this tag (if any)
+ * Save the body content of this tag (if any).
*
* @return <code>SKIP_BODY</code>.
* @throws JspException if a JSP exception has occurred
@@ -205,7 +203,8 @@
if (parent == null) {
String message = "Error: enclosing tag '"
- +getParent().getClass().getName()+" doesn't accept 'put' tag.";
+ + getParent().getClass().getName()
+ + " doesn't accept 'put' tag.";
LOG.error(message);
throw new JspException(message);
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTagParent.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTagParent.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTagParent.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTagParent.java Wed Apr 11 08:44:51 2007
@@ -17,13 +17,10 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
-
-import org.apache.tiles.jsp.taglib.PutAttributeTag;
import javax.servlet.jsp.JspException;
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutListAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutListAttributeTag.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutListAttributeTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutListAttributeTag.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -58,7 +57,7 @@
@Override
public int doStartTag() throws JspException {
super.setValue(new ArrayList<Attribute>());
- return super.doStartTag();
+ return super.doStartTag();
}
/**
@@ -70,7 +69,7 @@
public int doAfterBody() throws JspException {
return (SKIP_BODY);
}
-
+
/**
* Release the state of this put list by
* clearing the contents of the list.
@@ -96,15 +95,15 @@
nestedTag.getValue(), nestedTag.getRole(),
nestedTag.getType());
- this.addValue(attribute);
+ this.addValue(attribute);
}
- /**
+ /**
* Adds an attribute value to the list.
*
- * @param attribute The attribute to add.
- */
- private void addValue( Attribute attribute ) {
- this.getValue().add(attribute);
- }
+ * @param attribute The attribute to add.
+ */
+ private void addValue(Attribute attribute) {
+ this.getValue().add(attribute);
+ }
}
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/RenderTagSupport.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/RenderTagSupport.java?view=diff&rev=527536&r1=527535&r2=527536
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/RenderTagSupport.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/RenderTagSupport.java Wed Apr 11 08:44:51 2007
@@ -17,7 +17,6 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
package org.apache.tiles.jsp.taglib;
@@ -25,38 +24,37 @@
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesException;
-import org.apache.tiles.jsp.taglib.PutAttributeTag;
-import org.apache.tiles.jsp.taglib.PutAttributeTagParent;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TryCatchFinally;
import java.io.IOException;
/**
+ * <p>
* Support for all tags which render (a template, or definition).
* </p>
- * Properly invokes the defined preparer and invokes the abstract
- * render method upon completion.
+ * <p>
+ * Properly invokes the defined preparer and invokes the abstract render method
+ * upon completion.
* </p>
- * This tag takes special care to ensure that the attribute context is
- * reset to it's original state after the execution of the tag is
- * complete. This ensures that all all included attributes in subsequent
- * tiles are scoped properly and do not bleed outside their intended
- * scope.
+ * This tag takes special care to ensure that the attribute context is reset to
+ * it's original state after the execution of the tag is complete. This ensures
+ * that all all included attributes in subsequent tiles are scoped properly and
+ * do not bleed outside their intended scope.
*
* @since Tiles 2.0
* @version $Rev$ $Date$
*/
public abstract class RenderTagSupport extends ContainerTagSupport
implements TryCatchFinally, PutAttributeTagParent {
-
+
/**
* The logging object.
*/
- private static Log LOG = LogFactory.getLog(RenderTagSupport.class);
+ private static final Log LOG = LogFactory.getLog(RenderTagSupport.class);
/**
- * The view preparer to use before the rendering.
+ * The view preparer to use before the rendering.
*/
protected String preparer;
@@ -74,7 +72,7 @@
/**
* Returns the preparer name.
*
- * @return The preparer name.
+ * @return The preparer name.
*/
public String getPreparer() {
return preparer;
@@ -83,7 +81,7 @@
/**
* Sets the preparer name.
*
- * @param preparer The preparer name.
+ * @param preparer The preparer name.
*/
public void setPreparer(String preparer) {
this.preparer = preparer;
@@ -182,8 +180,10 @@
protected abstract void render() throws JspException, TilesException, IOException;
/**
+ * <p>
* Process nested ≶put> tag.
* <p/>
+ * <p>
* Places the value of the nested tag within the
* {@link org.apache.tiles.AttributeContext}.It is the responsibility
* of the descendent to check security. Tags extending