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 2011/09/28 01:38:31 UTC
svn commit: r1176661 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/internal/model/
main/java/org/apache/tapestry5/model/
main/resources/org/apache/tapestry5/internal/model/ test/app1/
test/groovy/org/apache/tapestry5/...
Author: hlship
Date: Tue Sep 27 23:38:30 2011
New Revision: 1176661
URL: http://svn.apache.org/viewvc?rev=1176661&view=rev
Log:
TAP5-1675: Tapestry 5.3 allows a subcomponent to define a parameter with the same name as a base component
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/base/ParameterBaseClass.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/ParameterSubClass.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.tml
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ModelMessages.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ParameterModelImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ParameterModel.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/model/ModelStrings.properties
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/model/MutableComponentModelImplTest.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ModelMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ModelMessages.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ModelMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ModelMessages.java Tue Sep 27 23:38:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2011 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.
@@ -25,11 +25,6 @@ class ModelMessages
{
}
- static String duplicateParameter(String parameterName, String componentName)
- {
- return MESSAGES.format("duplicate-parameter", parameterName, componentName);
- }
-
static String duplicateParameterValue(String parameterName, String componentId, String componentClassName)
{
return MESSAGES.format("duplicate-parameter-value", parameterName, componentId, componentClassName);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java Tue Sep 27 23:38:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -14,23 +14,19 @@
package org.apache.tapestry5.internal.model;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.tapestry5.ioc.Location;
import org.apache.tapestry5.ioc.Resource;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.ioc.util.IdAllocator;
-import org.apache.tapestry5.model.ComponentModel;
-import org.apache.tapestry5.model.EmbeddedComponentModel;
-import org.apache.tapestry5.model.MutableComponentModel;
-import org.apache.tapestry5.model.MutableEmbeddedComponentModel;
-import org.apache.tapestry5.model.ParameterModel;
+import org.apache.tapestry5.model.*;
import org.slf4j.Logger;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* Internal implementation of {@link org.apache.tapestry5.model.MutableComponentModel}.
*/
@@ -72,7 +68,7 @@ public final class MutableComponentModel
private Map<String, Boolean> handledEvents;
public MutableComponentModelImpl(String componentClassName, Logger logger, Resource baseResource,
- ComponentModel parentModel, boolean pageClass)
+ ComponentModel parentModel, boolean pageClass)
{
this.componentClassName = componentClassName;
this.logger = logger;
@@ -113,17 +109,30 @@ public final class MutableComponentModel
}
public void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix,
- boolean cached)
+ boolean cached)
{
assert InternalUtils.isNonBlank(name);
assert InternalUtils.isNonBlank(defaultBindingPrefix);
+
if (parameters == null)
+ {
parameters = CollectionFactory.newCaseInsensitiveMap();
+ }
if (parameters.containsKey(name))
- throw new IllegalArgumentException(ModelMessages.duplicateParameter(name, componentClassName));
+ {
+ throw new IllegalArgumentException(String.format("Parameter '%s' of component class %s is already defined.", name, componentClassName));
+ }
+
+ ParameterModel existingModel = getParameterModel(name);
+
+ if (existingModel != null)
+ {
+ throw new IllegalArgumentException(String.format("Parameter '%s' of component class %s conflicts with the parameter defined by the %s base class.",
+ name, componentClassName, existingModel.getComponentModel().getComponentClassName()));
+ }
- parameters.put(name, new ParameterModelImpl(name, required, allowNull, defaultBindingPrefix, cached));
+ parameters.put(name, new ParameterModelImpl(this, name, required, allowNull, defaultBindingPrefix, cached));
}
public void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix)
@@ -138,7 +147,7 @@ public final class MutableComponentModel
public ParameterModel getParameterModel(String parameterName)
{
- ParameterModel result = InternalUtils.get(parameters, parameterName.toLowerCase());
+ ParameterModel result = InternalUtils.get(parameters, parameterName);
if (result == null && parentModel != null)
result = parentModel.getParameterModel(parameterName);
@@ -172,7 +181,7 @@ public final class MutableComponentModel
}
public MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName,
- boolean inheritInformalParameters, Location location)
+ boolean inheritInformalParameters, Location location)
{
// TODO: Parent compent model? Or would we simply override the parent?
@@ -367,7 +376,7 @@ public final class MutableComponentModel
{
final String[] orders = InternalUtils.get(mixinOrders, mixinClassName);
- if ( orders == null && parentModel != null )
+ if (orders == null && parentModel != null)
return parentModel.getOrderForMixin(mixinClassName);
return orders;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ParameterModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ParameterModelImpl.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ParameterModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/ParameterModelImpl.java Tue Sep 27 23:38:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2008, 2009, 2011 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.
@@ -14,10 +14,13 @@
package org.apache.tapestry5.internal.model;
+import org.apache.tapestry5.model.ComponentModel;
import org.apache.tapestry5.model.ParameterModel;
public class ParameterModelImpl implements ParameterModel
{
+ private final ComponentModel componentModel;
+
private final String name;
private final boolean required;
@@ -28,13 +31,9 @@ public class ParameterModelImpl implemen
private final boolean cached;
- public ParameterModelImpl(
- String name,
- boolean required,
- boolean allowNull,
- String defaultBindingPrefix,
- boolean cached)
+ public ParameterModelImpl(ComponentModel componentModel, String name, boolean required, boolean allowNull, String defaultBindingPrefix, boolean cached)
{
+ this.componentModel = componentModel;
this.name = name;
this.required = required;
this.allowNull = allowNull;
@@ -66,4 +65,9 @@ public class ParameterModelImpl implemen
{
return cached;
}
+
+ public ComponentModel getComponentModel()
+ {
+ return componentModel;
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java Tue Sep 27 23:38:30 2011
@@ -34,12 +34,12 @@ public interface ComponentModel
{
/**
* Is this a model of a page (rather than a component, mixin, or base-class)?
- *
+ *
* @return true if a page
* @since 5.3
*/
boolean isPage();
-
+
/**
* Returns the resource corresponding to the class file for this component. This is used to find related resources,
* such as the component's template and message catalog.
@@ -87,20 +87,22 @@ public interface ComponentModel
List<String> getMixinClassNames();
/**
- * Return a single parameter model by parameter name, or null if the parameter is not defined (is not
- * a formal parameter).
+ * Return a single parameter model by parameter name, or null if the parameter is not defined (is not
+ * a formal parameter). This may be a parameter defined by this component, or from a base class.
*
* @param parameterName the name of the parameter (case is ignored)
+ * @return the parameter model if found in this model or a parent model, or null if not found
*/
ParameterModel getParameterModel(String parameterName);
/**
* Returns true if the named parameter is formally defined (there's a ParameterModel).
+ *
* @param parameterName name of the parameter (case is ignored)
* @since 5.2.0
*/
boolean isFormalParameter(String parameterName);
-
+
/**
* Returns an alphabetically sorted list of the names of all formal parameters. This includes parameters defined by
* a base class.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ParameterModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ParameterModel.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ParameterModel.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/model/ParameterModel.java Tue Sep 27 23:38:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2008, 2009, 2011 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.
@@ -48,4 +48,12 @@ public interface ParameterModel
* @since 5.2.0.0
*/
boolean isCached();
+
+ /**
+ * Identifies the component model in which the parameter is defined.
+ *
+ * @return component model defining the parameter
+ * @since 5.3
+ */
+ ComponentModel getComponentModel();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/model/ModelStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/model/ModelStrings.properties?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/model/ModelStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/model/ModelStrings.properties Tue Sep 27 23:38:30 2011
@@ -1,4 +1,4 @@
-# Copyright 2006 The Apache Software Foundation
+# Copyright 2006, 2011 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.
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-duplicate-parameter=Parameter '%s' of component %s is already defined.
duplicate-parameter-value=A value for parameter '%s' of embedded component %s (of component class %s) has already been provided.
duplicate-component-id=Embedded component '%s' has already been defined for component class %s.
duplicate-mixin=Mixin %s (for component %s) has already been defined.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml Tue Sep 27 23:38:30 2011
@@ -190,6 +190,10 @@
<li>
<a href="lib/alpha/root">Alpha Library Root</a> -- demonstrates libraries contributed with a slash in the name
</li>
+ <li>
+ <a href="parameterconflictdemo">Parameter Conflict Demo</a> -- checks for subclass parameters conflicting with
+ base class parameters
+ </li>
</ul>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/ParameterTests.groovy Tue Sep 27 23:38:30 2011
@@ -20,27 +20,41 @@ import org.testng.annotations.Test
/**
* @since 5.3
*/
-class ParameterTests extends TapestryCoreTestCase {
+class ParameterTests extends TapestryCoreTestCase
+{
/**
* https://issues.apache.org/jira/browse/TAP5-1227
*/
@Test
- void null_bound_to_primitive_field_is_an_error() {
+ void null_bound_to_primitive_field_is_an_error()
+ {
openLinks "Null Bound to Primitive Demo"
assertTextPresent "Parameter 'value' of component NullBindingToPrimitive:showint is bound to null. This parameter is not allowed to be null."
}
- /**
+ /**
* https://issues.apache.org/jira/browse/TAP5-1428
*/
@Test
- void parameter_specified_with_component_annotation_must_match_a_formal_parameter() {
+ void parameter_specified_with_component_annotation_must_match_a_formal_parameter()
+ {
openLinks "Unmatched Formal Parameter with @Component"
assertTextPresent "Component InvalidFormalParameterDemo:counter does not include a formal parameter 'step' (and does not support informal parameters).",
"Formal parameters", "end", "start", "value"
}
+
+ /**
+ * https://issues.apache.org/jira/browse/TAP5-1675
+ */
+ @Test
+ void parameter_conflict_with_base_class_is_error()
+ {
+ openLinks "Parameter Conflict Demo"
+
+ assertTextPresent "Parameter 'value' of component class org.apache.tapestry5.integration.app1.components.ParameterSubClass conflicts with the parameter defined by the org.apache.tapestry5.integration.app1.base.ParameterBaseClass base class."
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/base/ParameterBaseClass.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/base/ParameterBaseClass.java?rev=1176661&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/base/ParameterBaseClass.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/base/ParameterBaseClass.java Tue Sep 27 23:38:30 2011
@@ -0,0 +1,9 @@
+package org.apache.tapestry5.integration.app1.base;
+
+import org.apache.tapestry5.annotations.Parameter;
+
+public abstract class ParameterBaseClass
+{
+ @Parameter
+ private String value;
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/ParameterSubClass.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/ParameterSubClass.java?rev=1176661&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/ParameterSubClass.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/ParameterSubClass.java Tue Sep 27 23:38:30 2011
@@ -0,0 +1,11 @@
+package org.apache.tapestry5.integration.app1.components;
+
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.integration.app1.base.ParameterBaseClass;
+
+public class ParameterSubClass extends ParameterBaseClass
+{
+ // This conflicts with value parameter defined in ParameterBaseClass
+ @Parameter
+ private String value;
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.java?rev=1176661&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.java Tue Sep 27 23:38:30 2011
@@ -0,0 +1,5 @@
+package org.apache.tapestry5.integration.app1.pages;
+
+public class ParameterConflictDemo
+{
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/model/MutableComponentModelImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/model/MutableComponentModelImplTest.java?rev=1176661&r1=1176660&r2=1176661&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/model/MutableComponentModelImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/model/MutableComponentModelImplTest.java Tue Sep 27 23:38:30 2011
@@ -121,6 +121,10 @@ public class MutableComponentModelImplTe
train_getPersistentFieldNames(parent);
train_getParameterNames(parent, "betty");
+ expect(parent.getParameterModel("fred")).andReturn(null);
+ expect(parent.getParameterModel("wilma")).andReturn(null);
+ expect(parent.getParameterModel("barney")).andReturn(null);
+
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false);
@@ -153,11 +157,10 @@ public class MutableComponentModelImplTe
model.addParameter("Fred", true, true, BindingConstants.PROP);
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(),
- "Parameter 'Fred' of component org.example.components.Foo is already defined.");
+ "Parameter 'Fred' of component class org.example.components.Foo is already defined.");
}
verify();
@@ -215,7 +218,7 @@ public class MutableComponentModelImplTe
assertSame(fred.getLocation(), l);
MutableEmbeddedComponentModel barney = model.addEmbeddedComponent("barney", "Barney", COMPONENT_CLASS_NAME,
- false, null);
+ false, null);
assertEquals(model.getEmbeddedComponentIds(), Arrays.asList("barney", "fred"));
@@ -228,7 +231,7 @@ public class MutableComponentModelImplTe
assertSame(model.getEmbeddedComponentModel("BARNEY"), barney);
assertEquals(fred.toString(),
- "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=false]");
+ "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=false]");
verify();
}
@@ -249,11 +252,10 @@ public class MutableComponentModelImplTe
{
model.addEmbeddedComponent("fred", "Fred2", COMPONENT_CLASS_NAME, false, null);
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(),
- "Embedded component 'fred' has already been defined for component class org.example.components.Foo.");
+ "Embedded component 'fred' has already been defined for component class org.example.components.Foo.");
}
verify();
@@ -277,7 +279,7 @@ public class MutableComponentModelImplTe
assertTrue(fred.getInheritInformalParameters());
assertEquals(fred.toString(),
- "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=true]");
+ "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=true]");
verify();
}
@@ -299,11 +301,10 @@ public class MutableComponentModelImplTe
{
model.addEmbeddedComponent("FRED", "Fred2", COMPONENT_CLASS_NAME, false, null);
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(),
- "Embedded component 'FRED' has already been defined for component class org.example.components.Foo.");
+ "Embedded component 'FRED' has already been defined for component class org.example.components.Foo.");
}
verify();
@@ -320,7 +321,7 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
assertTrue(fred.getParameterNames().isEmpty());
@@ -345,7 +346,7 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
fred.addParameter("city", "bedrock");
@@ -353,11 +354,10 @@ public class MutableComponentModelImplTe
{
fred.addParameter("city", "slateville");
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(),
- "A value for parameter 'city' of embedded component fred (of component class org.example.components.Foo) has already been provided.");
+ "A value for parameter 'city' of embedded component fred (of component class org.example.components.Foo) has already been provided.");
}
verify();
@@ -374,7 +374,7 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
assertTrue(fred.getMixinClassNames().isEmpty());
@@ -392,7 +392,7 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
fred.addMixin("zip.zop.Zoom");
fred.addMixin("foo.bar.Baz");
@@ -413,12 +413,12 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
fred.addMixin("zip.zop.Zoom", "before:*", "after:foo.bar.Baz");
fred.addMixin("foo.bar.Baz");
- assertEquals(fred.getConstraintsForMixin("zip.zop.Zoom"), new String[] {"before:*", "after:foo.bar.Baz"});
+ assertEquals(fred.getConstraintsForMixin("zip.zop.Zoom"), new String[]{"before:*", "after:foo.bar.Baz"});
assertEquals(fred.getConstraintsForMixin("foo.bar.Baz"), new String[0]);
verify();
@@ -435,7 +435,7 @@ public class MutableComponentModelImplTe
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);
MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
- null);
+ null);
fred.addMixin("zip.zop.Zoom");
@@ -443,8 +443,7 @@ public class MutableComponentModelImplTe
{
fred.addMixin("zip.zop.Zoom");
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(), "Mixin zip.zop.Zoom (for component fred) has already been defined.");
}
@@ -564,8 +563,7 @@ public class MutableComponentModelImplTe
{
model.getFieldPersistenceStrategy("someField");
unreachable();
- }
- catch (IllegalArgumentException ex)
+ } catch (IllegalArgumentException ex)
{
assertEquals(ex.getMessage(), "No field persistence strategy has been defined for field \'someField\'.");
}
@@ -665,8 +663,8 @@ public class MutableComponentModelImplTe
child.addMixinClassName("Fred", "after:Barney");
child.addMixinClassName("Barney");
- assertEquals(child.getOrderForMixin("Wilma"), new String[] {"before:Fred"});
- assertEquals(child.getOrderForMixin("Fred"), new String[] {"after:Barney"});
+ assertEquals(child.getOrderForMixin("Wilma"), new String[]{"before:Fred"});
+ assertEquals(child.getOrderForMixin("Fred"), new String[]{"after:Barney"});
assertEquals(child.getOrderForMixin("Barney"), null);
verify();
@@ -690,8 +688,8 @@ public class MutableComponentModelImplTe
child.addMixinClassName("Fred", "after:Barney");
child.addMixinClassName("Barney");
- assertEquals(child.getOrderForMixin("Wilma"), new String[] {"before:*"});
- assertEquals(child.getOrderForMixin("Fred"), new String[] {"after:Barney"});
+ assertEquals(child.getOrderForMixin("Wilma"), new String[]{"before:*"});
+ assertEquals(child.getOrderForMixin("Fred"), new String[]{"after:Barney"});
assertEquals(child.getOrderForMixin("Barney"), null);
verify();
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.tml?rev=1176661&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/ParameterConflictDemo.tml Tue Sep 27 23:38:30 2011
@@ -0,0 +1,9 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+
+<p>If you see this, the test is broken.</p>
+
+
+<t:parameterSubClass value="null"/>
+
+</html>