You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/10/20 20:15:50 UTC
svn commit: r1186971 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/beaneditor/
main/java/org/apache/tapestry5/corelib/pages/
main/java/org/apache/tapestry5/internal/beaneditor/
main/java/org/apache/tapestry5/internal/...
Author: hlship
Date: Thu Oct 20 18:15:50 2011
New Revision: 1186971
URL: http://svn.apache.org/viewvc?rev=1186971&view=rev
Log:
Sneak in some improvements to BeanModel for creating properties that use expressions
Create a Page.Stats object to contain page construction statistics, modify PageCatalog to extract from it
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/beaneditor/BeanModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtils.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PageCatalog.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AddedGridColumnsDemo.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtilsTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/BeanModelSourceImplTest.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/beaneditor/BeanModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/beaneditor/BeanModel.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/beaneditor/BeanModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/beaneditor/BeanModel.java Thu Oct 20 18:15:50 2011
@@ -80,6 +80,29 @@ public interface BeanModel<T>
*/
PropertyModel add(String propertyName);
+
+ /**
+ * Adds a new synthetic property to the model, returning its mutable model for further refinement. The property is added to
+ * the <em>end</em> of the list of properties.
+ *
+ * @param propertyName name of property to add
+ * @param expression expression for the property
+ * @return the new property model (for further configuration)
+ * @throws RuntimeException if the property already exists
+ * @since 5.3
+ */
+ PropertyModel addExpression(String propertyName, String expression);
+
+ /**
+ * Adds an empty property (one with no property conduit).
+ *
+ * @param propertyName name of property to add
+ * @return the new property model (for further configuration)
+ * @throws RuntimeException if the property already exists
+ * @since 5.3
+ */
+ PropertyModel addEmpty(String propertyName);
+
/**
* Adds a new property to the model (as with {@link #add(String)}), ordered before or after an existing property.
*
@@ -110,9 +133,10 @@ public interface BeanModel<T>
*
* @param propertyName name of property to add
* @param conduit the conduit used to read or update the property; this may be null for a synthetic or
- * placeholder property
+ * placeholder property. Instead of passing null, please invoke {@link #addEmpty(String)}.
* @return the model for the property
* @throws RuntimeException if the property already exists
+ * @see #addExpression(String, String)
*/
PropertyModel add(String propertyName, PropertyConduit conduit);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java Thu Oct 20 18:15:50 2011
@@ -16,28 +16,22 @@ package org.apache.tapestry5.corelib.pag
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.alerts.AlertManager;
-import org.apache.tapestry5.annotations.Cached;
-import org.apache.tapestry5.annotations.ContentType;
-import org.apache.tapestry5.annotations.InjectComponent;
-import org.apache.tapestry5.annotations.Persist;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.annotations.WhitelistAccessOnly;
+import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.beaneditor.ReorderProperties;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.corelib.components.Zone;
-import org.apache.tapestry5.func.F;
-import org.apache.tapestry5.func.Flow;
-import org.apache.tapestry5.func.Mapper;
-import org.apache.tapestry5.func.Predicate;
-import org.apache.tapestry5.func.Reducer;
+import org.apache.tapestry5.func.*;
import org.apache.tapestry5.internal.services.ComponentInstantiatorSource;
import org.apache.tapestry5.internal.services.PageSource;
import org.apache.tapestry5.internal.structure.Page;
+import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.OperationTracker;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.services.BeanModelSource;
import org.apache.tapestry5.services.ComponentClassResolver;
import org.apache.tapestry5.services.pageload.ComponentResourceSelector;
@@ -117,6 +111,26 @@ public class PageCatalog
@Inject
private ComponentInstantiatorSource componentInstantiatorSource;
+ @Inject
+ private BeanModelSource beanModelSource;
+
+ @Inject
+ private Messages messages;
+
+ public BeanModel<Page> getModel()
+ {
+
+ BeanModel<Page> model = beanModelSource.createDisplayModel(Page.class, messages);
+
+ model.addExpression("selector", "selector.toString()");
+ model.addExpression("assemblyTime", "stats.assemblyTime");
+ model.addExpression("componentCount", "stats.componentCount");
+
+ model.reorder("name", "selector", "assemblyTime", "componentCount", "selector");
+
+ return model;
+ }
+
@Cached
public Totals getTotals()
{
@@ -139,7 +153,7 @@ public class PageCatalog
{
public Integer reduce(Integer accumulator, Page element)
{
- return accumulator + element.getComponentCount();
+ return accumulator + element.getStats().componentCount;
}
}, 0);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java Thu Oct 20 18:15:50 2011
@@ -66,7 +66,7 @@ public class ServiceStatus
{
model = source.createDisplayModel(ServiceActivity.class, messages);
- model.add("serviceInterface", null);
+ model.addEmpty("serviceInterface");
// There's no line number information for interfaces, so we'll reorder the
// proprieties manually.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java Thu Oct 20 18:15:50 2011
@@ -50,8 +50,10 @@ public class BeanModelImpl<T> implements
private final List<String> propertyNames = CollectionFactory.newList();
+ private static PropertyConduit NULL_PROPERTY_CONDUIT = null;
+
public BeanModelImpl(Class<T> beanType, PropertyConduitSource propertyConduitSource, TypeCoercer typeCoercer,
- Messages messages, ObjectLocator locator)
+ Messages messages, ObjectLocator locator)
{
this.beanType = beanType;
@@ -73,9 +75,20 @@ public class BeanModelImpl<T> implements
public PropertyModel add(String propertyName)
{
- PropertyConduit conduit = createConduit(propertyName);
+ return addExpression(propertyName, propertyName);
+ }
+
+ public PropertyModel addEmpty(String propertyName)
+ {
+ return add(propertyName, NULL_PROPERTY_CONDUIT);
+ }
+
+ public PropertyModel addExpression(String propertyName, String expression)
+ {
+ PropertyConduit conduit = createConduit(expression);
return add(propertyName, conduit);
+
}
private void validateNewPropertyName(String propertyName)
@@ -88,7 +101,7 @@ public class BeanModelImpl<T> implements
}
public PropertyModel add(RelativePosition position, String existingPropertyName, String propertyName,
- PropertyConduit conduit)
+ PropertyConduit conduit)
{
assert position != null;
validateNewPropertyName(propertyName);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtils.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtils.java Thu Oct 20 18:15:50 2011
@@ -28,20 +28,15 @@ public final class BeanModelUtils
* Performs standard set of modifications to a {@link org.apache.tapestry5.beaneditor.BeanModel}
* . First new
* properties may be added, then properties removed, then properties reordered.
- *
- * @param model
- * to modifiy
- * @param addPropertyNames
- * comma seperated list of property names to add, or null
- * @param includePropertyNames
- * comma seperated list of property names to include
- * @param excludePropertyNames
- * comma seperated list of property names to exclude, or null
- * @param reorderPropertyNames
- * comma seperated list of property names to reorder, or null
+ *
+ * @param model to modifiy
+ * @param addPropertyNames comma seperated list of property names to add, or null
+ * @param includePropertyNames comma seperated list of property names to include
+ * @param excludePropertyNames comma seperated list of property names to exclude, or null
+ * @param reorderPropertyNames comma seperated list of property names to reorder, or null
*/
public static void modify(BeanModel model, String addPropertyNames,
- String includePropertyNames, String excludePropertyNames, String reorderPropertyNames)
+ String includePropertyNames, String excludePropertyNames, String reorderPropertyNames)
{
if (addPropertyNames != null)
add(model, addPropertyNames);
@@ -67,26 +62,24 @@ public final class BeanModelUtils
/**
* Adds empty properties to the bean model. New properties are added with a <em>null</em>
* {@link org.apache.tapestry5.PropertyConduit}. `
- *
- * @param model
- * to be modified
- * @param propertyNames
- * comma-separated list of property names
+ *
+ * @param model to be modified
+ * @param propertyNames comma-separated list of property names
+ * @see BeanModel#addEmpty(String)
*/
public static void add(BeanModel model, String propertyNames)
{
for (String name : split(propertyNames))
{
- model.add(name, null);
+ model.addEmpty(name);
}
}
/**
* Removes properties from the bean model.
- *
+ *
* @param model
- * @param propertyNames
- * comma-separated list of property names
+ * @param propertyNames comma-separated list of property names
* @see BeanModel#exclude(String...)
*/
public static void exclude(BeanModel model, String propertyNames)
@@ -104,10 +97,9 @@ public final class BeanModelUtils
/**
* Reorders properties within the bean model.
- *
+ *
* @param model
- * @param propertyNames
- * comma-separated list of property names
+ * @param propertyNames comma-separated list of property names
* @see BeanModel#reorder(String...)
*/
public static void reorder(BeanModel model, String propertyNames)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java Thu Oct 20 18:15:50 2011
@@ -126,7 +126,7 @@ class ComponentAssemblerImpl implements
action.execute(pageAssembly);
}
- page.setStats(System.currentTimeMillis() - startTime, pageAssembly.componentCount);
+ page.setStats(new Page.Stats(System.currentTimeMillis() - startTime, pageAssembly.componentCount, 0));
return pageAssembly.createdElement.peek();
} catch (RuntimeException ex)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java Thu Oct 20 18:15:50 2011
@@ -41,6 +41,39 @@ import org.slf4j.Logger;
public interface Page
{
/**
+ * Page construction statistics for the page.
+ *
+ * @since 5.3
+ */
+ public final class Stats
+ {
+ /**
+ * Time, in milliseconds, to construct the page. This includes time to construct components inside the page,
+ * as well as hooking everything together. You'll often see that the first page is expensive to construct,
+ * and later pages that use a similar mix of components are very cheap.
+ */
+ public final long assemblyTime;
+
+ /**
+ * The total number of components in the page, including the root component. This does not include the number of mixins.
+ */
+ public final int componentCount;
+
+ /**
+ * The "weight" of the page is an arbitrary number that factors the number of components, mixins, component template elements,
+ * bindings, and other factors.
+ */
+ public final int weight;
+
+ public Stats(long assemblyTime, int componentCount, int weight)
+ {
+ this.assemblyTime = assemblyTime;
+ this.componentCount = componentCount;
+ this.weight = weight;
+ }
+ }
+
+ /**
* Returns the short, logical name for the page. This is the page name as it might included in
* an action or page
* render URL (though it will be converted to lower case when it is included).
@@ -189,22 +222,12 @@ public interface Page
*
* @since 5.3
*/
- void setStats(long assemblyTime, int componentCount);
-
- /**
- * Returns the time, in milliseconds, to construct the page.
- *
- * @since 5.3
- */
- long getAssemblyTime();
+ void setStats(Stats stats);
/**
- * Returns the number of components on the page, including the root component. This is a rough
- * measure of complexity.
- *
- * @since 5.3
+ * Returns the page construction statistics for this page.
*/
- int getComponentCount();
+ Stats getStats();
/**
* Returns the number of times the page has been attached to a request. This is a rough measure
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java Thu Oct 20 18:15:50 2011
@@ -51,12 +51,7 @@ public class PageImpl implements Page
private final Map<String, ComponentPageElement> idToComponent = CollectionFactory.newCaseInsensitiveMap();
- // TODO: loadComplete, assemblyTime, and componentCount are each set once without thread semantics,
- // but before the instance is published to other threads ... is that enough?
-
- private long assemblyTime;
-
- private int componentCount;
+ private Stats stats;
private final AtomicInteger attachCount = new AtomicInteger();
@@ -85,10 +80,14 @@ public class PageImpl implements Page
fieldBundle = perThreadManager.createValue();
}
- public void setStats(long assemblyTime, int componentCount)
+ public void setStats(Stats stats)
+ {
+ this.stats = stats;
+ }
+
+ public Stats getStats()
{
- this.assemblyTime = assemblyTime;
- this.componentCount = componentCount;
+ return stats;
}
@Override
@@ -251,16 +250,6 @@ public class PageImpl implements Page
return !resetListeners.isEmpty();
}
- public long getAssemblyTime()
- {
- return assemblyTime;
- }
-
- public int getComponentCount()
- {
- return componentCount;
- }
-
public int getAttachCount()
{
return attachCount.get();
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PageCatalog.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PageCatalog.tml?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PageCatalog.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PageCatalog.tml Thu Oct 20 18:15:50 2011
@@ -35,9 +35,9 @@
<t:beandisplay object="totals"/>
- <t:grid source="pages" row="page" add="selector" reorder="name,selector">
+ <t:grid source="pages" row="page" model="model">
<p:assemblyTimeCell>
- ${formatElapsed(page.assemblyTime)}
+ ${formatElapsed(page.stats.assemblyTime)}
</p:assemblyTimeCell>
<p:selectorCell>
${page.selector.toShortString()}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AddedGridColumnsDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AddedGridColumnsDemo.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AddedGridColumnsDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AddedGridColumnsDemo.java Thu Oct 20 18:15:50 2011
@@ -48,13 +48,13 @@ public class AddedGridColumnsDemo
model.exclude("album", "artist", "genre", "playcount", "rating");
- model.add("viewlink", null);
+ model.addEmpty("viewlink");
model.add("title.length()").label("Title Length");
// This is to test the case where there's no property conduit or override block.
- model.add("dummy", null);
+ model.addEmpty("dummy");
}
public Track getTrack()
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtilsTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtilsTest.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtilsTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/beaneditor/BeanModelUtilsTest.java Thu Oct 20 18:15:50 2011
@@ -32,17 +32,17 @@ public class BeanModelUtilsTest extends
private Object[] build(String propertyNames, String... expected)
{
return new Object[]
- { propertyNames, expected };
+ {propertyNames, expected};
}
@DataProvider
public Object[][] split_inputs()
{
return new Object[][]
- { build("fred", "fred"), build("fred,barney", "fred", "barney"),
+ {build("fred", "fred"), build("fred,barney", "fred", "barney"),
build(" fred, barney, wilma, betty ", "fred", "barney", "wilma", "betty"),
new Object[]
- { " ", new String[0] } };
+ {" ", new String[0]}};
}
@Test
@@ -80,8 +80,8 @@ public class BeanModelUtilsTest extends
PropertyModel fred = mockPropertyModel();
PropertyModel barney = mockPropertyModel();
- expect(model.add("fred", null)).andReturn(fred);
- expect(model.add("barney", null)).andReturn(barney);
+ expect(model.addEmpty("fred")).andReturn(fred);
+ expect(model.addEmpty("barney")).andReturn(barney);
replay();
@@ -101,7 +101,7 @@ public class BeanModelUtilsTest extends
EasyMock.checkOrder(model, true);
- expect(model.add("fred", null)).andReturn(fred);
+ expect(model.addEmpty("fred")).andReturn(fred);
expect(model.include("sam", "fred")).andReturn(model);
@@ -131,8 +131,8 @@ public class BeanModelUtilsTest extends
PropertyModel fred = mockPropertyModel();
PropertyModel barney = mockPropertyModel();
- expect(model.add("fred", null)).andReturn(fred);
- expect(model.add("barney", null)).andReturn(barney);
+ expect(model.addEmpty("fred")).andReturn(fred);
+ expect(model.addEmpty("barney")).andReturn(barney);
expect(model.exclude("pebbles", "bambam")).andReturn(model);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/BeanModelSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/BeanModelSourceImplTest.java?rev=1186971&r1=1186970&r2=1186971&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/BeanModelSourceImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/BeanModelSourceImplTest.java Thu Oct 20 18:15:50 2011
@@ -293,8 +293,7 @@ public class BeanModelSourceImplTest ext
{
model.add("age");
unreachable();
- }
- catch (RuntimeException ex)
+ } catch (RuntimeException ex)
{
assertEquals(
ex.getMessage(),
@@ -319,8 +318,7 @@ public class BeanModelSourceImplTest ext
{
model.get("frobozz");
unreachable();
- }
- catch (UnknownValueException ex)
+ } catch (UnknownValueException ex)
{
assertEquals(
ex.getMessage(),
@@ -343,14 +341,13 @@ public class BeanModelSourceImplTest ext
BeanModel model = source.create(SimpleBean.class, true, messages);
- model.add("shrub.foo()", null);
+ model.addEmpty("shrub.foo()");
try
{
model.getById("frobozz");
unreachable();
- }
- catch (UnknownValueException ex)
+ } catch (UnknownValueException ex)
{
assertEquals(
ex.getMessage(),
@@ -373,7 +370,7 @@ public class BeanModelSourceImplTest ext
BeanModel model = source.create(SimpleBean.class, true, messages);
- PropertyModel pm = model.add("shrub.foo()", null);
+ PropertyModel pm = model.addEmpty("shrub.foo()");
assertSame(model.get("Shrub.Foo()"), pm);
@@ -391,7 +388,7 @@ public class BeanModelSourceImplTest ext
BeanModel model = source.create(SimpleBean.class, true, messages);
- PropertyModel pm = model.add("shrub.foo()", null);
+ PropertyModel pm = model.addEmpty("shrub.foo()");
assertSame(model.getById("ShrubFoo"), pm);
@@ -468,7 +465,7 @@ public class BeanModelSourceImplTest ext
assertSame(propertyModel.getPropertyType(), String[].class);
String[] value =
- { "foo", "bar" };
+ {"foo", "bar"};
StringArrayBean bean = new StringArrayBean();
@@ -552,7 +549,7 @@ public class BeanModelSourceImplTest ext
BeanModel model = source.create(SimpleBean.class, true, messages);
- PropertyModel property = model.add("placeholder", null);
+ PropertyModel property = model.addEmpty("placeholder");
assertFalse(property.isSortable());
assertSame(property.getPropertyType(), Object.class);
@@ -576,8 +573,7 @@ public class BeanModelSourceImplTest ext
{
model.add("doesNotExist");
unreachable();
- }
- catch (PropertyExpressionException ex)
+ } catch (PropertyExpressionException ex)
{
assertMessageContains(ex, "does not contain", "doesNotExist");
}