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 2010/07/29 20:10:29 UTC
svn commit: r980530 - in /tapestry/tapestry5/trunk/tapestry-ioc/src:
main/java/org/apache/tapestry5/ioc/internal/
test/java/org/apache/tapestry5/ioc/
Author: hlship
Date: Thu Jul 29 18:10:28 2010
New Revision: 980530
URL: http://svn.apache.org/viewvc?rev=980530&view=rev
Log:
TAP5-1224: When contributing to a service using a "contribute" method, the service id from the method name now matches case-sensitively to the service id (it should be case insensitive)
Added:
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java (with props)
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java?rev=980530&r1=980529&r2=980530&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java Thu Jul 29 18:10:28 2010
@@ -475,8 +475,8 @@ public class ModuleImpl implements Modul
return createProxyInstance(creator, serviceId, serviceInterface, resources.getImplementationClass(), toString);
}
- private Object createProxyInstance(ObjectCreator creator, String serviceId, Class serviceInterface, Class serviceImplementation,
- String description)
+ private Object createProxyInstance(ObjectCreator creator, String serviceId, Class serviceInterface,
+ Class serviceImplementation, String description)
{
ServiceProxyToken token = SerializationSupport.createToken(serviceId);
@@ -508,11 +508,11 @@ public class ModuleImpl implements Modul
classFab.addMethod(Modifier.PRIVATE, sig, body);
classFab.proxyMethodsToDelegate(serviceInterface, "delegate()", description);
-
- if(serviceImplementation != null)
+
+ if (serviceImplementation != null)
{
classFab.copyClassAnnotationsFromDelegate(serviceImplementation);
-
+
classFab.copyMethodAnnotationsFromDelegate(serviceInterface, serviceImplementation);
}
@@ -539,7 +539,7 @@ public class ModuleImpl implements Modul
{
ContributionDef2 def = InternalUtils.toContributionDef2(next);
- if (serviceDef.getServiceId().equals(def.getServiceId()))
+ if (serviceDef.getServiceId().equalsIgnoreCase(def.getServiceId()))
{
result.add(def);
}
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java?rev=980530&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java Thu Jul 29 18:10:28 2010
@@ -0,0 +1,23 @@
+// Copyright 2010 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.tapestry5.ioc;
+
+public class CaseInsensitiveContributeMethodModule
+{
+ public void contributeapplicationdefaults(MappedConfiguration<String, String> configuration)
+ {
+ configuration.add("it", "works");
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CaseInsensitiveContributeMethodModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java?rev=980530&r1=980529&r2=980530&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/IntegrationTest.java Thu Jul 29 18:10:28 2010
@@ -38,6 +38,7 @@ import org.apache.tapestry5.ioc.services
import org.apache.tapestry5.ioc.services.ServiceActivity;
import org.apache.tapestry5.ioc.services.ServiceActivityScoreboard;
import org.apache.tapestry5.ioc.services.Status;
+import org.apache.tapestry5.ioc.services.SymbolSource;
import org.apache.tapestry5.ioc.services.TypeCoercer;
import org.apache.tapestry5.ioc.util.NonmatchingMappedConfigurationOverrideModule;
import org.easymock.EasyMock;
@@ -411,20 +412,20 @@ public class IntegrationTest extends IOC
r.shutdown();
}
-
+
@Test
public void proxy_annotations() throws Exception
{
Registry r = buildRegistry(AutobuildModule.class);
StringHolder sh = r.getService(StringHolder.class);
-
+
SimpleAnnotation annotation = sh.getClass().getAnnotation(SimpleAnnotation.class);
assertNotNull(annotation);
assertEquals(annotation.value(), "StringHolderImpl");
-
+
Method method = sh.getClass().getMethod("getValue");
-
+
annotation = method.getAnnotation(SimpleAnnotation.class);
assertNotNull(annotation);
assertEquals(annotation.value(), "StringHolderImpl#getValue()");
@@ -1531,6 +1532,17 @@ public class IntegrationTest extends IOC
assertTrue(StartupModule2.instanceStartupInvoked);
r.shutdown();
+ }
+ @Test
+ public void case_ignored_in_service_id_of_contribute_method()
+ {
+ Registry r = buildRegistry(CaseInsensitiveContributeMethodModule.class);
+
+ SymbolSource symbolSource = r.getService(SymbolSource.class);
+
+ assertEquals(symbolSource.valueForSymbol("it"), "works");
+
+ r.shutdown();
}
}