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 2007/03/11 03:00:26 UTC
svn commit: r516840 [4/4] - in /tapestry/tapestry5/tapestry-ioc/trunk:
.settings/ src/main/java/org/apache/tapestry/ioc/
src/main/java/org/apache/tapestry/ioc/annotations/
src/main/java/org/apache/tapestry/ioc/def/
src/main/java/org/apache/tapestry/ioc...
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ServiceIdConflictMethodModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ServiceIdConflictMethodModule.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ServiceIdConflictMethodModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ServiceIdConflictMethodModule.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,26 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import org.apache.tapestry.ioc.annotations.Id;
-
-/**
- * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
- *
- *
- */
-@Id("ioc")
-public class ServiceIdConflictMethodModule
-{
- public FieService buildFred()
- {
- return null;
- }
-
- public FieService buildFred(Object param)
- {
- return null;
- }
-
-}
+package org.apache.tapestry.ioc.internal;
+
+/**
+ * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
+ */
+public class ServiceIdConflictMethodModule
+{
+ public FieService buildFred()
+ {
+ return null;
+ }
+
+ public FieService buildFred(Object param)
+ {
+ return null;
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,56 +12,50 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.annotations.EagerLoad;
-import org.apache.tapestry.ioc.annotations.Id;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
-import org.apache.tapestry.ioc.annotations.Private;
-
-/**
- * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
- *
- *
- */
-@Id("ioc")
-public class SimpleModule
-{
- public FieService buildFred()
- {
- return null;
- }
-
- @Lifecycle("threaded")
- @Private
- public FoeService buildBarney()
- {
- return null;
- }
-
- @EagerLoad
- public FoeService buildWilma()
- {
- return null;
- }
-
- public void ignoredMethod()
- {
- }
-
- /**
- * Minimal decorator method that uses generics to qualify the delegate passed in and the object
- * returned.
- */
- public <T> T decorateLogging(Class<T> serviceInterace, T delegate)
- {
- return null;
- }
-
- /** Minimal contribution method. */
- public void contributeBarney(Configuration configuration)
- {
-
- }
-}
+package org.apache.tapestry.ioc.internal;
+
+import org.apache.tapestry.ioc.Configuration;
+import org.apache.tapestry.ioc.annotations.EagerLoad;
+import org.apache.tapestry.ioc.annotations.Lifecycle;
+
+/**
+ * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
+ */
+public class SimpleModule
+{
+ @Lifecycle("threaded")
+ public FoeService buildBarney()
+ {
+ return null;
+ }
+
+ public FieService buildFred()
+ {
+ return null;
+ }
+
+ @EagerLoad
+ public FoeService buildWilma()
+ {
+ return null;
+ }
+
+ public void ignoredMethod()
+ {
+ }
+
+ /**
+ * Minimal decorator method that uses generics to qualify the delegate passed in and the object
+ * returned.
+ */
+ public <T> T decorateLogging(Class<T> serviceInterace, T delegate)
+ {
+ return null;
+ }
+
+ /** Minimal contribution method. */
+ public void contributeBarney(Configuration configuration)
+ {
+
+ }
+}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/TooManyContributionParametersModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/TooManyContributionParametersModule.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/TooManyContributionParametersModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/TooManyContributionParametersModule.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,24 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.annotations.Id;
-
-/**
- * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImpl}.
- *
- *
- */
-@Id("ioc.test")
-public class TooManyContributionParametersModule
-{
-
- public void contributeTooMany(Configuration configuration1, OrderedConfiguration configuration2)
- {
-
- }
-
-}
+package org.apache.tapestry.ioc.internal;
+
+import org.apache.tapestry.ioc.Configuration;
+import org.apache.tapestry.ioc.OrderedConfiguration;
+
+/**
+ * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImpl}.
+ */
+public class TooManyContributionParametersModule
+{
+
+ public void contributeTooMany(Configuration configuration1, OrderedConfiguration configuration2)
+ {
+
+ }
+}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -31,14 +31,14 @@
OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
Runnable contribution = newRunnable();
- configuration.add("fred.id", contribution, "after:fred.pre", "before:fred.post");
+ configuration.add("id", contribution, "after:pre", "before:post");
replay();
OrderedConfiguration<Runnable> wrapper = new ValidatingOrderedConfigurationWrapper<Runnable>(
- "barney.Service", "fred", def, log, Runnable.class, configuration);
+ "Service", def, log, Runnable.class, configuration);
- wrapper.add("id", contribution, "after:fred.pre", "before:fred.post");
+ wrapper.add("id", contribution, "after:pre", "before:post");
verify();
}
@@ -51,12 +51,12 @@
OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
Runnable contribution = newRunnable();
- configuration.add("fred.id", contribution);
+ configuration.add("id", contribution);
replay();
OrderedConfiguration<Runnable> wrapper = new ValidatingOrderedConfigurationWrapper<Runnable>(
- "barney.Service", "fred", def, log, Runnable.class, configuration);
+ "Service", def, log, Runnable.class, configuration);
wrapper.add("id", contribution);
@@ -70,12 +70,12 @@
Log log = newLog();
OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
- configuration.add("fred.id", null);
+ configuration.add("id", null);
replay();
OrderedConfiguration<Runnable> wrapper = new ValidatingOrderedConfigurationWrapper<Runnable>(
- "barney.Service", "fred", def, log, Runnable.class, configuration);
+ "Service", def, log, Runnable.class, configuration);
wrapper.add("id", null);
@@ -88,22 +88,22 @@
{
Method method = findMethod("contributeBarneyService");
- ContributionDef def = new ContributionDefImpl("barney.Service", method);
+ ContributionDef def = new ContributionDefImpl("Service", method);
Log log = newLog();
OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
log.warn(IOCMessages.contributionWrongValueType(
- "barney.Service",
+ "Service",
def,
String.class,
Runnable.class));
- configuration.add("fred.id", null);
+ configuration.add("id", null);
replay();
- OrderedConfiguration wrapper = new ValidatingOrderedConfigurationWrapper("barney.Service",
- "fred", def, log, Runnable.class, configuration);
+ OrderedConfiguration wrapper = new ValidatingOrderedConfigurationWrapper("Service", def,
+ log, Runnable.class, configuration);
wrapper.add("id", "string");
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImplTest.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -27,9 +27,7 @@
@BeforeClass
public void setup_builder()
{
- _builder = getService(
- "tapestry.ioc.DefaultImplementationBuilder",
- DefaultImplementationBuilder.class);
+ _builder = getService("DefaultImplementationBuilder", DefaultImplementationBuilder.class);
}
@AfterClass
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImplTest.java Sat Mar 10 18:00:22 2007
@@ -33,7 +33,7 @@
@BeforeClass
public void setup_analyzer()
{
- _analyzer = getService("tapestry.ioc.ExceptionAnalyzer", ExceptionAnalyzer.class);
+ _analyzer = getService("ExceptionAnalyzer", ExceptionAnalyzer.class);
}
@AfterClass
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -41,7 +41,7 @@
public void setup_builder()
{
_registry = buildRegistry();
- _builder = _registry.getService("tapestry.ioc.PipelineBuilder", PipelineBuilder.class);
+ _builder = _registry.getService("PipelineBuilder", PipelineBuilder.class);
}
@AfterClass
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java Sat Mar 10 18:00:22 2007
@@ -173,9 +173,9 @@
b.setValue(value);
- assertEquals(_access.get(b, "VALUE"), value);
+ assertEquals(_access.get(b, "VALUE"), value);
}
-
+
@Test
public void simple_write_access()
{
@@ -187,7 +187,7 @@
assertEquals(b.getValue(), value);
}
-
+
@Test
public void property_name_case_is_ignored_on_write()
{
@@ -197,7 +197,7 @@
_access.set(b, "VALUE", value);
- assertEquals(b.getValue(), value);
+ assertEquals(b.getValue(), value);
}
@Test
@@ -395,8 +395,7 @@
{
Registry registry = buildRegistry();
- PropertyAccess pa = registry
- .getService("tapestry.ioc.PropertyAccess", PropertyAccess.class);
+ PropertyAccess pa = registry.getService("PropertyAccess", PropertyAccess.class);
Bean b = new Bean();
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java Sat Mar 10 18:00:22 2007
@@ -128,6 +128,7 @@
assertEquals(actual, expected);
}
+ @SuppressWarnings("unchecked")
@DataProvider(name = "coercions_inputs")
public Object[][] coercions_inputs()
{
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java Sat Mar 10 18:00:22 2007
@@ -7,7 +7,6 @@
// 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
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/OrdererTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/OrdererTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/OrdererTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/OrdererTest.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -50,16 +50,16 @@
{
Log log = newLog();
- log.warn(UtilMessages.constraintFormat("fred", "foo.barney"));
+ log.warn(UtilMessages.constraintFormat("fred", "barney"));
replay();
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED");
- o.add("foo.barney", "BARNEY", "fred");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY");
+ o.add("fred", "FRED");
+ o.add("barney", "BARNEY", "fred");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -73,16 +73,16 @@
{
Log log = newLog();
- log.warn(UtilMessages.constraintFormat("nearby:fred", "foo.barney"));
+ log.warn(UtilMessages.constraintFormat("nearby:fred", "barney"));
replay();
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED");
- o.add("foo.barney", "BARNEY", "nearby:fred");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY");
+ o.add("fred", "FRED");
+ o.add("barney", "BARNEY", "nearby:fred");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -123,23 +123,23 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED");
- o.add("foo.barney", "BARNEY");
- o.add("foo.wilma", "WILMA");
+ o.add("fred", "FRED");
+ o.add("barney", "BARNEY");
+ o.add("wilma", "WILMA");
verify();
- log.warn(UtilMessages.duplicateOrderer("foo.fred"), null);
+ log.warn(UtilMessages.duplicateOrderer("fred"), null);
replay();
- o.add("foo.fred", "FRED2");
+ o.add("fred", "FRED2");
verify();
replay();
- o.add("foo.betty", "BETTY");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -157,10 +157,10 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED");
- o.add("foo.barney", "BARNEY", "before:*.*");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY");
+ o.add("fred", "FRED");
+ o.add("barney", "BARNEY", "before:*");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -178,10 +178,10 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED");
- o.add("foo.barney", "BARNEY", "after:*");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY");
+ o.add("fred", "FRED");
+ o.add("barney", "BARNEY", "after:*");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -199,10 +199,10 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED", "after:wilma");
- o.add("foo.barney", "BARNEY", "after:fred,betty");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY");
+ o.add("fred", "FRED", "after:wilma");
+ o.add("barney", "BARNEY", "after:fred,betty");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY");
List<String> ordered = o.getOrdered();
@@ -220,10 +220,10 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED", "after:wilma");
- o.add("foo.barney", "BARNEY", "after:fred,betty");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY", "before:wilma");
+ o.add("fred", "FRED", "after:wilma");
+ o.add("barney", "BARNEY", "after:fred,betty");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY", "before:wilma");
List<String> ordered = o.getOrdered();
@@ -241,10 +241,10 @@
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED", "after:Wilma");
- o.add("foo.barney", "BARNEY", "after:Fred,BETTY");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY", "before:Foo.Wilma");
+ o.add("fred", "FRED", "after:Wilma");
+ o.add("barney", "BARNEY", "after:Fred,BETTY");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY", "before:Wilma");
List<String> ordered = o.getOrdered();
@@ -253,44 +253,24 @@
verify();
}
- @Test
- public void cross_module()
- {
- Log log = newLog();
-
- replay();
-
- Orderer<String> o = new Orderer<String>(log);
-
- o.add("foo.fred", "FRED", "after:*.wilma");
- o.add("bar.barney", "BARNEY", "after:*.fred,*.betty");
- o.add("baz.wilma", "WILMA");
- o.add("biff.betty", "BETTY", "before:baz.*");
-
- List<String> ordered = o.getOrdered();
-
- assertEquals(ordered, Arrays.asList("BETTY", "WILMA", "FRED", "BARNEY"));
-
- verify();
- }
@Test
public void dependency_cycle()
{
Log log = newLog();
- log.warn("Unable to add 'foo.barney' as a dependency of 'foo.betty', as that forms a "
- + "dependency cycle ('foo.betty' depends on itself via 'foo.barney'). "
+ log.warn("Unable to add 'barney' as a dependency of 'betty', as that forms a "
+ + "dependency cycle ('betty' depends on itself via 'barney'). "
+ "The dependency has been ignored.", null);
replay();
Orderer<String> o = new Orderer<String>(log);
- o.add("foo.fred", "FRED", "after:wilma");
- o.add("foo.barney", "BARNEY", "after:fred,betty");
- o.add("foo.wilma", "WILMA");
- o.add("foo.betty", "BETTY", "after:barney", "before:wilma");
+ o.add("fred", "FRED", "after:wilma");
+ o.add("barney", "BARNEY", "after:fred,betty");
+ o.add("wilma", "WILMA");
+ o.add("betty", "BETTY", "after:barney", "before:wilma");
List<String> ordered = o.getOrdered();
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java Sat Mar 10 18:00:22 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,148 +12,146 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.services;
-
+package org.apache.tapestry.ioc.services;
+
import java.util.Map;
import org.apache.tapestry.ioc.Registry;
import org.apache.tapestry.ioc.internal.IOCInternalTestCase;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-
-public class PropertyShadowBuilderImplTest extends IOCInternalTestCase
-{
- private PropertyShadowBuilder _builder;
-
- private final String CLASS_NAME = getClass().getName();
-
- @BeforeClass
- public void setupBuilder()
- {
- Registry registry = buildRegistry();
-
- _builder = registry.getService(
- "tapestry.ioc.PropertyShadowBuilder",
- PropertyShadowBuilder.class);
- }
-
- public class FooHolder
- {
- private Foo _foo;
-
- private int _count = 0;
-
- public Foo getFoo()
- {
- _count++;
-
- return _foo;
- }
-
- public int getCount()
- {
- return _count;
- }
-
- public void setFoo(Foo foo)
- {
- _foo = foo;
- }
-
- @Override
- public String toString()
- {
- return "[FooHolder]";
- }
-
- public void setWriteOnly(Foo foo)
- {
-
- }
- }
-
- public interface Foo
- {
- void foo();
- }
-
- @Test
- public void basic_delegation()
- {
- Foo foo = newMock(Foo.class);
- FooHolder holder = new FooHolder();
-
- holder.setFoo(foo);
-
- Foo shadow = _builder.build(holder, "foo", Foo.class);
-
- for (int i = 0; i < 3; i++)
- {
- foo.foo();
-
- replay();
-
- shadow.foo();
-
- verify();
-
- assertEquals(holder.getCount(), i + 1);
- }
-
- assertEquals(shadow.toString(), "<Shadow: property foo of [FooHolder]>");
- }
-
- @Test
- public void property_does_not_exist()
- {
- FooHolder holder = new FooHolder();
-
- try
- {
- _builder.build(holder, "bar", Foo.class);
- unreachable();
- }
- catch (RuntimeException ex)
- {
- assertEquals(ex.getMessage(), "Class " + CLASS_NAME
- + "$FooHolder does not contain a property named 'bar'.");
- }
- }
-
- @Test
- public void property_type_mismatch()
- {
- FooHolder holder = new FooHolder();
-
- try
- {
- _builder.build(holder, "count", Map.class);
- unreachable();
- }
- catch (RuntimeException ex)
- {
- assertEquals(ex.getMessage(), "Property 'count' of class " + CLASS_NAME
- + "$FooHolder is of type int, which is not assignable to type java.util.Map.");
- }
- }
-
- @Test
- public void property_write_only()
- {
- FooHolder holder = new FooHolder();
-
- try
- {
- _builder.build(holder, "writeOnly", Foo.class);
- unreachable();
- }
- catch (RuntimeException ex)
- {
- assertEquals(
- ex.getMessage(),
- "Class "
- + CLASS_NAME
- + "$FooHolder does not provide an accessor ('getter') method for property 'writeOnly'.");
- }
- }
-}
+
+public class PropertyShadowBuilderImplTest extends IOCInternalTestCase
+{
+ private PropertyShadowBuilder _builder;
+
+ private final String CLASS_NAME = getClass().getName();
+
+ @BeforeClass
+ public void setupBuilder()
+ {
+ Registry registry = buildRegistry();
+
+ _builder = registry.getService("PropertyShadowBuilder", PropertyShadowBuilder.class);
+ }
+
+ public class FooHolder
+ {
+ private Foo _foo;
+
+ private int _count = 0;
+
+ public Foo getFoo()
+ {
+ _count++;
+
+ return _foo;
+ }
+
+ public int getCount()
+ {
+ return _count;
+ }
+
+ public void setFoo(Foo foo)
+ {
+ _foo = foo;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "[FooHolder]";
+ }
+
+ public void setWriteOnly(Foo foo)
+ {
+
+ }
+ }
+
+ public interface Foo
+ {
+ void foo();
+ }
+
+ @Test
+ public void basic_delegation()
+ {
+ Foo foo = newMock(Foo.class);
+ FooHolder holder = new FooHolder();
+
+ holder.setFoo(foo);
+
+ Foo shadow = _builder.build(holder, "foo", Foo.class);
+
+ for (int i = 0; i < 3; i++)
+ {
+ foo.foo();
+
+ replay();
+
+ shadow.foo();
+
+ verify();
+
+ assertEquals(holder.getCount(), i + 1);
+ }
+
+ assertEquals(shadow.toString(), "<Shadow: property foo of [FooHolder]>");
+ }
+
+ @Test
+ public void property_does_not_exist()
+ {
+ FooHolder holder = new FooHolder();
+
+ try
+ {
+ _builder.build(holder, "bar", Foo.class);
+ unreachable();
+ }
+ catch (RuntimeException ex)
+ {
+ assertEquals(ex.getMessage(), "Class " + CLASS_NAME
+ + "$FooHolder does not contain a property named 'bar'.");
+ }
+ }
+
+ @Test
+ public void property_type_mismatch()
+ {
+ FooHolder holder = new FooHolder();
+
+ try
+ {
+ _builder.build(holder, "count", Map.class);
+ unreachable();
+ }
+ catch (RuntimeException ex)
+ {
+ assertEquals(ex.getMessage(), "Property 'count' of class " + CLASS_NAME
+ + "$FooHolder is of type int, which is not assignable to type java.util.Map.");
+ }
+ }
+
+ @Test
+ public void property_write_only()
+ {
+ FooHolder holder = new FooHolder();
+
+ try
+ {
+ _builder.build(holder, "writeOnly", Foo.class);
+ unreachable();
+ }
+ catch (RuntimeException ex)
+ {
+ assertEquals(
+ ex.getMessage(),
+ "Class "
+ + CLASS_NAME
+ + "$FooHolder does not provide an accessor ('getter') method for property 'writeOnly'.");
+ }
+ }
+}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java?view=diff&rev=516840&r1=516839&r2=516840
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java Sat Mar 10 18:00:22 2007
@@ -315,6 +315,7 @@
assertEquals(keys, Arrays.asList("barney", "betty", "fred", "wilma"));
}
+ @SuppressWarnings("unchecked")
@Test
public void serialize_deserialize() throws Exception
{