You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/08/30 03:16:48 UTC
svn commit: r438320 - in /tapestry/tapestry5/tapestry-core/trunk/src:
main/java/org/apache/tapestry/dom/
main/java/org/apache/tapestry/internal/services/
main/java/org/apache/tapestry/runtime/ site/ site/apt/guide/
test/java/org/apache/tapestry/dom/ te...
Author: hlship
Date: Tue Aug 29 18:16:47 2006
New Revision: 438320
URL: http://svn.apache.org/viewvc?rev=438320&view=rev
Log:
Add MarkupModel interface and DefaultMarkupModel implementation.
Rename ComponentLifeycleEvent.getAbort() to isAborted().
Add initial documentation about creating component classes.
Added:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/DefaultMarkupModel.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/MarkupModel.java
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/Border.java
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Comment.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Document.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Element.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Node.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Text.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/TemplateParserImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/runtime/LifecycleEvent.java
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/dom/DOMTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/runtime/LifecycleEventTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Start.html
tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/cdata.html
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Comment.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Comment.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Comment.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Comment.java Tue Aug 29 18:16:47 2006
@@ -21,7 +21,7 @@
*
* @author Howard M. Lewis Ship
*/
-public class Comment extends Node
+public final class Comment extends Node
{
private String _comment;
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/DefaultMarkupModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/DefaultMarkupModel.java?rev=438320&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/DefaultMarkupModel.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/DefaultMarkupModel.java Tue Aug 29 18:16:47 2006
@@ -0,0 +1,51 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.dom;
+
+/**
+ * Default implementation of {@link org.apache.tapestry.dom.MarkupModel}.
+ *
+ * @author Howard M. Lewis Ship
+ */
+public class DefaultMarkupModel implements MarkupModel
+{
+ /** Passes all characters but '<', '>' and '&' through unchanged. */
+ public void encode(String content, StringBuilder buffer)
+ {
+ char[] array = content.toCharArray();
+
+ for (char ch : array)
+ {
+ switch (ch)
+ {
+ case '<':
+ buffer.append("<");
+ continue;
+
+ case '>':
+ buffer.append(">");
+ continue;
+
+ case '&':
+ buffer.append("&");
+ continue;
+
+ default:
+ buffer.append(ch);
+ }
+ }
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Document.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Document.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Document.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Document.java Tue Aug 29 18:16:47 2006
@@ -21,13 +21,32 @@
*
* @author Howard M. Lewis Ship
*/
-public class Document extends Node
+public final class Document extends Node
{
private Element _rootElement;
- public Document()
+ private final MarkupModel _model;
+
+ public Document(MarkupModel model)
{
super(null);
+ _model = model;
+ }
+
+ public Document getDocument()
+ {
+ return this;
+ }
+
+ /** Builds with an instance of {@link DefaultMarkupModel}. */
+ public Document()
+ {
+ this(new DefaultMarkupModel());
+ }
+
+ public MarkupModel getMarkupModel()
+ {
+ return _model;
}
/** Creates the root element for this document, replacing any previous root element. */
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Element.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Element.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Element.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Element.java Tue Aug 29 18:16:47 2006
@@ -32,7 +32,7 @@
*
* @author Howard M. Lewis Ship
*/
-public class Element extends Node
+public final class Element extends Node
{
private String _name;
Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/MarkupModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/MarkupModel.java?rev=438320&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/MarkupModel.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/MarkupModel.java Tue Aug 29 18:16:47 2006
@@ -0,0 +1,35 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.dom;
+
+/**
+ * Used by a the DOM to determine how to produce markup. Delegates details about converted entities
+ * and some formatting details.
+ *
+ * @author Howard M. Lewis Ship
+ */
+public interface MarkupModel
+{
+ /**
+ * Encodes the characters into the buffer, converting control characters (such as '<') into
+ * corresponding entities (such as &lt;).
+ *
+ * @param content
+ * to be filtered
+ * @param buffer
+ * to recieve the filtered content
+ */
+ void encode(String content, StringBuilder buffer);
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Node.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Node.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Node.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Node.java Tue Aug 29 18:16:47 2006
@@ -72,6 +72,11 @@
child.toXML(writer);
}
+ public Document getDocument()
+ {
+ return _container.getDocument();
+ }
+
/**
* Invokes {@link #toXML(PrintWriter)}, collecting output in a string, which is returned.
*/
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Text.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Text.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Text.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/dom/Text.java Tue Aug 29 18:16:47 2006
@@ -15,38 +15,38 @@
package org.apache.tapestry.dom;
import java.io.PrintWriter;
-import java.util.Formatter;
/**
* A type of node that contains text.
*
* @author Howard M. Lewis Ship
*/
-public class Text extends Node
+public final class Text extends Node
{
private final StringBuilder _buffer;
- private Formatter _formatter;
+ private MarkupModel _model;
Text(Node container, String text)
{
super(container);
- _buffer = new StringBuilder(text);
+ _buffer = new StringBuilder();
+
+ _model = getDocument().getMarkupModel();
+
+ write(text);
}
/** Writes additional text into the node, appending it to any existing text. */
public void write(String text)
{
- _buffer.append(text);
+ _model.encode(text, _buffer);
}
public void writef(String format, Object... args)
{
- if (_formatter == null)
- _formatter = new Formatter(_buffer);
-
- _formatter.format(format, args);
+ write(String.format(format, args));
}
@Override
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java Tue Aug 29 18:16:47 2006
@@ -35,7 +35,7 @@
*/
public class ComponentLifecycleMethodWorker implements ComponentClassTransformWorker
{
- private static final String CHECK_ABORT_FLAG = "if ($2.getAbort()) return;";
+ private static final String CHECK_ABORT_FLAG = "if ($2.isAborted()) return;";
private final Class<? extends Annotation> _methodAnnotation;
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/TemplateParserImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/TemplateParserImpl.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/TemplateParserImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/TemplateParserImpl.java Tue Aug 29 18:16:47 2006
@@ -198,36 +198,7 @@
if (_textBuffer.length() == 0)
_textStartLocation = getCurrentLocation();
- if (_textIsCData)
- {
- _textBuffer.append(ch, start, length);
- return;
- }
-
- // The parser will have converted XML entities into normal characters.
- // What we want in the TextToken is the raw characters to send to the
- // client ... which means we have to revert those characters back
- // into XML entities.
-
- for (int i = 0; i < length; i++)
- {
- char c = ch[start + i];
-
- switch (c)
- {
- case '<':
- _textBuffer.append("<");
- break;
- case '>':
- _textBuffer.append(">");
- break;
- case '&':
- _textBuffer.append("&");
- break;
- default:
- _textBuffer.append(c);
- }
- }
+ _textBuffer.append(ch, start, length);
}
/** Adds a text token, if the text buffer is non-empty. Clears the text buffer. */
@@ -443,8 +414,7 @@
addTextToken();
// Because CDATA doesn't mix with any other SAX/lexical events, we can simply turn on a flag
- // here,
- // and turn it off when we see the end.
+ // here and turn it off when we see the end.
_textIsCData = true;
}
@@ -462,6 +432,5 @@
{
}
-
-
+
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/runtime/LifecycleEvent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/runtime/LifecycleEvent.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/runtime/LifecycleEvent.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/runtime/LifecycleEvent.java Tue Aug 29 18:16:47 2006
@@ -31,7 +31,7 @@
private final Class<T> _expectedType;
- private boolean _abort;
+ private boolean _aborted;
private T _result;
@@ -48,9 +48,9 @@
*
* @return
*/
- public boolean getAbort()
+ public boolean isAborted()
{
- return _abort;
+ return _aborted;
}
public T getResult()
@@ -62,7 +62,7 @@
* Stores a result obtained from a method. If the provided result is null, nothing happens. If
* the provided result is not of the correct type (remember: generics is a compiler illusion, so
* there's no guarantee that code actually returns) then an error is logged. Otherwise, the
- * result is stored, and {@link #getAbort() abort flag} is set.
+ * result is stored, and {@link #isAborted() abort flag} is set.
*
* @param result
* the provided result, or null if the method did not provide a result
@@ -84,6 +84,6 @@
}
_result = result;
- _abort = true;
+ _aborted = true;
}
}
Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt?rev=438320&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt Tue Aug 29 18:16:47 2006
@@ -0,0 +1,52 @@
+ ---
+ Writing Component Classes
+ ----
+
+Writing Component Classes
+
+* Component Class Basics
+
+ Creating page and component classes in Tapestry 5 is a breeze.
+
+ Unlike Tapestry 4, in Tapestry 5, component classes are not <abstract>, nor do
+ they extend from framework base classes. They are pure POJOs (Plain Old Java Objects).
+
+ There are only two constraints:
+
+ * The classes must be in the correct package, as per the {{{conf.html}application configuration}}.
+
+ * The classes must be annotated with the
+ {{{../apidocs/org/apache/tapestry/annotations/ComponentClass.html}ComponentClass}} annotation.
+
+ []
+
+ Here's a very basic component:
+
+
++----+
+package org.example.myapp.components;
+
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.annotations.ComponentClass;
+import org.apache.tapestry.annotations.RenderTag;
+
+@ComponentClass
+public class HelloWorld
+{
+ @RenderTag
+ void renderMessage(MarkupWriter writer)
+ {
+ writer.write("Bonjour from HelloWorld component.");
+ }
+}
++----+
+
+ This component's only job is to write out a fixed message. The
+ {{{../apidocs/org/apache/tapestry/annotations/RenderTag.html}RenderTag}} annotation is
+ a type of <component lifecycle annotation>, a method annotation that instructs
+ Tapestry when and under what circumstances to invoke methods of your class.
+
+ In another departure from Tapestry 4, these methods are not necessarily public; they
+ can be protected, package private, or private.
+
+
\ No newline at end of file
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt Tue Aug 29 18:16:47 2006
@@ -132,9 +132,10 @@
* write()
- The write() method writes text inside the current element.
-
- <<TODO: write() will eventually filter character data, converting certain characters into XML entities. This is not yet implemented.>>
+ The write() method writes text inside the current element. It scans the provided text for XML control characters
+ ('<', '>', and '&') and converts them to their XML entity equivalents ('<', '>', and '&'). The result is correct, safe,
+ HTML/XML output even when the content (which may come from a template, or from an external source such as a database)
+ contains such problematic characters.
* writeln()
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Tue Aug 29 18:16:47 2006
@@ -39,12 +39,12 @@
<item name="Tapestry" href="http://tapestry.apache.org/" />
<item name="Apache" href="http://www.apache.org/" />
</links>
-
+ <!--
<head>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">_uacct = "UA-400821-1"; urchinTracker();</script>
</head>
-
+ -->
<menu name="Tapestry Core">
<item name="Introduction" href="/index.html"/>
<item name="Upgrade from Tapestry 4" href="/upgrade.html"/>
@@ -64,14 +64,15 @@
<item name="Shadow Services" href="ioc/shadow.html"/>
</menu>
- <menu name="Internals Guide">
+ <menu name="User Guide">
+ <item name="Component Classes" href="guide/component-classes.html"/>
<item name="Configuration" href="guide/conf.html"/>
<item name="Request Processing" href="guide/request.html"/>
<item name="DOM" href="guide/dom.html"/>
<item name="Class Reloading" href="guide/reload.html"/>
</menu>
- ${reports}
+ <menu ref="reports"/>
</body>
</project>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/dom/DOMTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/dom/DOMTest.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/dom/DOMTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/dom/DOMTest.java Tue Aug 29 18:16:47 2006
@@ -181,6 +181,18 @@
}
@Test
+ public void text_with_control_characters()
+ {
+ Document d = new Document();
+
+ Element e = d.newRootElement("root");
+
+ e.text("<this> & <that>");
+
+ assertEquals(d.toString(), "<root><this> & <that></root>");
+ }
+
+ @Test
public void writef_with_text()
{
Document d = new Document();
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/Border.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/Border.java?rev=438320&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/Border.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/Border.java Tue Aug 29 18:16:47 2006
@@ -0,0 +1,28 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.app1.components;
+
+import org.apache.tapestry.annotations.ComponentClass;
+
+/**
+ * Here's a component with a template, including a t:body element.
+ *
+ * @author Howard M. Lewis Ship
+ */
+@ComponentClass
+public class Border
+{
+
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java Tue Aug 29 18:16:47 2006
@@ -66,7 +66,7 @@
trainFindMethodsWithAnnotation(tf, sigs);
- String expectedBody = join("{", " if ($2.getAbort()) return;", " aMethod();", "}");
+ String expectedBody = join("{", " if ($2.isAborted()) return;", " aMethod();", "}");
tf.extendMethod(TransformConstants.BEFORE_RENDER_SIGNATURE, expectedBody);
@@ -93,7 +93,7 @@
trainFindMethodsWithAnnotation(tf, sigs);
- String expectedBody = join("{", " if ($2.getAbort()) return;", " aMethod($1);", "}");
+ String expectedBody = join("{", " if ($2.isAborted()) return;", " aMethod($1);", "}");
tf.extendMethod(TransformConstants.BEFORE_RENDER_SIGNATURE, expectedBody);
@@ -122,9 +122,9 @@
String expectedBody = join(
"{",
- " if ($2.getAbort()) return;",
+ " if ($2.isAborted()) return;",
" $2.storeResult(($w) aMethod(), \"protected boolean aMethod()\");",
- " if ($2.getAbort()) return;",
+ " if ($2.isAborted()) return;",
"}");
tf.extendMethod(TransformConstants.BEFORE_RENDER_SIGNATURE, expectedBody);
@@ -155,9 +155,9 @@
String expectedBody = join(
"{",
- " if ($2.getAbort()) return;",
+ " if ($2.isAborted()) return;",
" $2.storeResult(($w) aMethod(), \"protected boolean aMethod()\");",
- " if ($2.getAbort()) return;",
+ " if ($2.isAborted()) return;",
" bMethod($1);",
"}");
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java Tue Aug 29 18:16:47 2006
@@ -162,7 +162,9 @@
TextToken t = get(tokens, 1);
- assertEquals(t.getText().trim(), "lt:< gt:> amp:&");
+ // This is OK because the org.apache.tapestry.dom.Text will convert the characters back into XML entities.
+
+ assertEquals(t.getText().trim(), "lt:< gt:> amp:&");
}
@Test
@@ -176,7 +178,7 @@
CDATAToken t = get(tokens, 2);
- assertEquals(t.getText(), "CDATA: <foo> & <bar>");
+ assertEquals(t.getText(), "CDATA: <foo> & <bar> and <baz>");
checkLine(t, 2);
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/runtime/LifecycleEventTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/runtime/LifecycleEventTest.java?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/runtime/LifecycleEventTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/runtime/LifecycleEventTest.java Tue Aug 29 18:16:47 2006
@@ -34,7 +34,7 @@
LifecycleEvent<Integer> event = new LifecycleEvent<Integer>(log, Integer.class, 99);
- assertEquals(false, event.getAbort());
+ assertEquals(false, event.isAborted());
assertEquals(99, (int) event.getResult());
verify();
@@ -51,7 +51,7 @@
event.storeResult(88, "some method");
- assertEquals(true, event.getAbort());
+ assertEquals(true, event.isAborted());
assertEquals(88, (int) event.getResult());
verify();
@@ -68,7 +68,7 @@
event.storeResult(null, "{some method}");
- assertEquals(false, event.getAbort());
+ assertEquals(false, event.isAborted());
assertEquals(99, (int) event.getResult());
verify();
@@ -89,7 +89,7 @@
event.storeResult("88", "{some method}");
- assertEquals(false, event.getAbort());
+ assertEquals(false, event.isAborted());
assertEquals(new Integer(99), event.getResult());
verify();
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html?rev=438320&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html Tue Aug 29 18:16:47 2006
@@ -0,0 +1,8 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+ <head>
+ <title>Tapestry Integration Test App 1</title>
+ </head>
+ <body>
+ <t:body/>
+ </body>
+</html>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Start.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Start.html?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Start.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/integration/app1/pages/Start.html Tue Aug 29 18:16:47 2006
@@ -1,13 +1,8 @@
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
- <head>
- <title>First Tapestry 5 Page</title>
- </head>
- <body>
- <p> This is the <span style="font-style: bold; color: blue;">First Tapestry 5 Page,
- ever!</span>. </p>
- <p> Here's some output from the HelloWorld component: <t:comp id="strong" type="Strong">
- <t:comp id="hello" type="HelloWorld"/>
- </t:comp>
- </p>
- </body>
-</html>
+<t:comp id="border" type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+ <p> This is the <span style="font-style: bold; color: blue;">First Tapestry 5 Page,
+ ever!</span>. </p>
+ <p> Here's some output from the HelloWorld component: <t:comp id="strong" type="Strong">
+ <t:comp id="hello" type="HelloWorld"/>
+ </t:comp>
+ </p>
+</t:comp>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/cdata.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/cdata.html?rev=438320&r1=438319&r2=438320&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/cdata.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/resources/org/apache/tapestry/internal/services/cdata.html Tue Aug 29 18:16:47 2006
@@ -1,3 +1,3 @@
<html>
-<![CDATA[CDATA: <foo> & <bar>]]>
+<![CDATA[CDATA: <foo> & <bar> and <baz>]]>
</html>