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/12 03:01:06 UTC
svn commit: r517073 [2/2] - in /tapestry/tapestry5:
tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/
tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/
tapestry-core/trunk/src/main/java/org/apache/tapestry/services/...
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java Sun Mar 11 19:01:04 2007
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 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.
@@ -58,5 +58,13 @@
*/
ClassLoader getClassLoader();
- int getMethodLineNumber(Method method);
+ /**
+ * Converts a method to a {@link MethodLocation}, which includes information about the source
+ * file name and line number.
+ *
+ * @param method
+ * to look up
+ * @return the location, or null if the necessary information is not available
+ */
+ MethodLocation getMethodLocation(Method method);
}
Added: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/MethodLocation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/MethodLocation.java?view=auto&rev=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/MethodLocation.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/MethodLocation.java Sun Mar 11 19:01:04 2007
@@ -0,0 +1,66 @@
+// Copyright 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.
+// 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.ioc.services;
+
+import java.lang.reflect.Method;
+
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
+
+/**
+ * Enapsulates a method and its location (source file and line number) when the latter information
+ * is available.
+ *
+ * @see ClassFactory#getMethodLocation(Method)
+ */
+public final class MethodLocation
+{
+ private final Method _method;
+
+ private final String _sourceFile;
+
+ private final int _lineNumber;
+
+ public MethodLocation(Method method, final String sourceFile, final int lineNumber)
+ {
+ _method = method;
+ _sourceFile = sourceFile;
+ _lineNumber = lineNumber;
+ }
+
+ /**
+ * Creates a user presentable string identifying the method (class name, method name, and
+ * parameter list), plus the source file and line number, i.e.:
+ * "org.example.myapp.MyClass.myMethod(String, List) (at MyClass.java:23)".
+ */
+ @Override
+ public String toString()
+ {
+ return String.format(
+ "%s (at %s:%d)",
+ InternalUtils.asString(_method),
+ _sourceFile,
+ _lineNumber);
+ }
+
+ public int getLineNumber()
+ {
+ return _lineNumber;
+ }
+
+ public String getSourceFile()
+ {
+ return _sourceFile;
+ }
+}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/TestBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/TestBase.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/TestBase.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/TestBase.java Sun Mar 11 19:01:04 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.
@@ -132,5 +132,21 @@
// andReturn() or etc. calls
return getMocksControl();
+ }
+
+ /**
+ * Asserts that the message property of the throwable contains each of the provided substrings.
+ *
+ * @param t
+ * throwable to check
+ * @param substrings
+ * some number of expected substrings
+ */
+ protected final void assertMessageContains(Throwable t, String... substrings)
+ {
+ String message = t.getMessage();
+
+ for (String substring : substrings)
+ assertTrue(message.contains(substring));
}
}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java Sun Mar 11 19:01:04 2007
@@ -222,11 +222,10 @@
}
catch (Exception ex)
{
- assertEquals(
- ex.getMessage(),
- "Error building service proxy for service 'UnknownLifecycle' "
- + "(at org.apache.tapestry.ioc.UnknownLifecycleModule.buildUnknownLifecycle()): "
- + "Unknown service lifecycle 'magic'.");
+ assertMessageContains(
+ ex,
+ "Error building service proxy for service 'UnknownLifecycle'",
+ "Unknown service lifecycle 'magic'");
}
}
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java Sun Mar 11 19:01:04 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.
@@ -48,7 +48,7 @@
replay();
Method m = findMethod("contributeUnordered");
- ContributionDef def = new ContributionDefImpl("foo.Bar", m);
+ ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);
def.contribute(this, locator, configuration);
@@ -70,7 +70,7 @@
replay();
Method m = findMethod("contributeUnorderedParameter");
- ContributionDef def = new ContributionDefImpl("foo.Bar", m);
+ ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);
def.contribute(this, locator, configuration);
@@ -90,7 +90,7 @@
replay();
Method m = findMethod("contributeUnorderedWrongParameter");
- ContributionDef def = new ContributionDefImpl("foo.Bar", m);
+ ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);
try
{
@@ -125,7 +125,7 @@
replay();
Method m = findMethod("contributeOrderedParameter");
- ContributionDef def = new ContributionDefImpl("foo.Bar", m);
+ ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);
def.contribute(this, locator, configuration);
@@ -147,7 +147,7 @@
replay();
Method m = findMethod("contributeMappedParameter");
- ContributionDef def = new ContributionDefImpl("foo.Bar", m);
+ ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);
def.contribute(this, locator, configuration);
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java Sun Mar 11 19:01:04 2007
@@ -25,12 +25,30 @@
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ModuleDef;
import org.apache.tapestry.ioc.def.ServiceDef;
+import org.apache.tapestry.ioc.internal.services.ClassFactoryImpl;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.test.IOCTestCase;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class DefaultModuleDefImplTest extends IOCTestCase
{
+ private ClassFactory _classFactory;
+
+ @BeforeClass
+ public void setup()
+ {
+ _classFactory = new ClassFactoryImpl();
+ }
+
+ @AfterClass
+ public void cleanup()
+ {
+ _classFactory = null;
+ }
+
@Test
public void simple_module() throws Exception
{
@@ -42,7 +60,7 @@
// BigDecimal is arbitrary, any class would do.
- ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, log);
+ ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, log, _classFactory);
assertEquals(md.toString(), "ModuleDef[" + className + " Barney, Fred, Wilma]");
@@ -59,7 +77,7 @@
assertEquals(sd.getServiceInterface(), FieService.class);
- assertEquals(sd.toString(), className + ".buildFred()");
+ assertTrue(sd.toString().contains(className + ".buildFred()"));
assertEquals(sd.getServiceLifeycle(), IOCConstants.DEFAULT_LIFECYCLE);
assertEquals(sd.isEagerLoad(), false);
@@ -75,7 +93,7 @@
DecoratorDef dd = defs.iterator().next();
assertEquals(dd.getDecoratorId(), "Logging");
- assertEquals(dd.toString(), className + ".decorateLogging(Class, Object)");
+ assertTrue(dd.toString().contains(className + ".decorateLogging(Class, Object)"));
verify();
}
@@ -87,7 +105,7 @@
replay();
- ModuleDef def = new DefaultModuleDefImpl(DefaultServiceIdModule.class, log);
+ ModuleDef def = new DefaultModuleDefImpl(DefaultServiceIdModule.class, log, null);
assertEquals(def.getServiceIds().size(), 1);
@@ -104,7 +122,7 @@
{
Method conflictMethod = ServiceIdConflictMethodModule.class.getMethod("buildFred");
String expectedMethod = InternalUtils.asString(ServiceIdConflictMethodModule.class
- .getMethod("buildFred", Object.class));
+ .getMethod("buildFred", Object.class), _classFactory);
Log log = newLog();
@@ -114,7 +132,8 @@
// BigDecimal is arbitrary, any class would do.
- ModuleDef md = new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, log);
+ ModuleDef md = new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, log,
+ _classFactory);
Set<String> ids = md.getServiceIds();
@@ -147,7 +166,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(VoidBuilderMethodModule.class, log);
+ ModuleDef md = new DefaultModuleDefImpl(VoidBuilderMethodModule.class, log, null);
assertTrue(md.getServiceIds().isEmpty());
@@ -171,7 +190,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, log);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, log, null);
assertTrue(md.getDecoratorDefs().isEmpty());
@@ -202,7 +221,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, log);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, log, null);
assertTrue(md.getDecoratorDefs().isEmpty());
@@ -240,7 +259,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, log);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, log, _classFactory);
Set<ContributionDef> defs = md.getContributionDefs();
@@ -251,7 +270,11 @@
// The target service id is derived from the method name
assertEquals(cd.getServiceId(), expectedServiceId);
- assertEquals(cd.toString(), moduleClass.getName() + "." + expectedMethodSignature);
+
+ // Can't be exact, because the source file & line number are probably attached (and those
+ // can change)
+
+ assertTrue(cd.toString().contains(moduleClass.getName() + "." + expectedMethodSignature));
verify();
}
@@ -267,7 +290,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, log);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, log, null);
assertTrue(md.getContributionDefs().isEmpty());
@@ -285,7 +308,7 @@
replay();
- ModuleDef md = new DefaultModuleDefImpl(moduleClass, log);
+ ModuleDef md = new DefaultModuleDefImpl(moduleClass, log, null);
assertTrue(md.getContributionDefs().isEmpty());
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java Sun Mar 11 19:01:04 2007
@@ -41,7 +41,7 @@
Log log = newLog();
ClassFactory factory = new ClassFactoryImpl();
- ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log);
+ ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log, null);
Module module = new ModuleImpl(registry, moduleDef, log);
@@ -81,7 +81,7 @@
InternalRegistry registry = newInternalRegistry();
Log log = newLog();
- ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log);
+ ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log, null);
Module module = new ModuleImpl(registry, moduleDef, log);
@@ -133,7 +133,7 @@
{
InternalRegistry registry = newInternalRegistry();
Log log = newLog();
- ModuleDef def = new DefaultModuleDefImpl(PrivateConstructorModule.class, log);
+ ModuleDef def = new DefaultModuleDefImpl(PrivateConstructorModule.class, log, null);
replay();
@@ -161,7 +161,7 @@
{
InternalRegistry registry = newInternalRegistry();
Log log = newLog();
- ModuleDef def = new DefaultModuleDefImpl(ExtraPublicConstructorsModule.class, log);
+ ModuleDef def = new DefaultModuleDefImpl(ExtraPublicConstructorsModule.class, log, null);
ClassFactory factory = newMock(ClassFactory.class);
Module module = new ModuleImpl(registry, def, log);
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java Sun Mar 11 19:01:04 2007
@@ -19,6 +19,8 @@
import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.def.ServiceDef;
+import org.apache.tapestry.ioc.services.ClassFactory;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class OneShotServiceCreatorTest extends IOCInternalTestCase
@@ -33,7 +35,7 @@
ObjectCreator delegate = newObjectCreator();
Object service = new Object();
- ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false);
+ ServiceDef def = new ServiceDefImpl("Bar", "singleton", method, false, getClassFactory());
train_createObject(delegate, service);
@@ -50,11 +52,11 @@
}
catch (IllegalStateException ex)
{
- assertEquals(
- ex.getMessage(),
- "Construction of service 'foo.Bar' has failed due to recursion: the service depends on itself in some way. Please check "
- + getClass().getName()
- + ".buildMyService() for references to another service that is itself dependent on service 'foo.Bar'.");
+ assertMessageContains(
+ ex,
+ "Construction of service 'Bar' has failed due to recursion: the service depends on itself in some way.",
+ getClass().getName() + ".buildMyService() ",
+ "for references to another service that is itself dependent on service 'Bar'.");
}
verify();
@@ -70,7 +72,7 @@
ObjectCreator delegate = newObjectCreator();
Object service = new Object();
- ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false);
+ ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false, null);
expect(delegate.createObject()).andThrow(failure);
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapperTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapperTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapperTest.java Sun Mar 11 19:01:04 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.
@@ -48,15 +48,15 @@
{
Log log = newLog();
Configuration configuration = newConfiguration();
- ContributionDef def = new ContributionDefImpl("foo.Bar",
- findMethod("contributeUnorderedNull"));
+ ContributionDef def = new ContributionDefImpl("Bar", findMethod("contributeUnorderedNull"),
+ getClassFactory());
- log.warn(IOCMessages.contributionWasNull("foo.Bar", def));
+ log.warn(IOCMessages.contributionWasNull("Bar", def));
replay();
- Configuration wrapper = new ValidatingConfigurationWrapper("foo.Bar", log, Runnable.class,
- def, configuration);
+ Configuration wrapper = new ValidatingConfigurationWrapper("Bar", log, Runnable.class, def,
+ configuration);
wrapper.add(null);
@@ -69,19 +69,15 @@
{
Log log = newLog();
Configuration configuration = newConfiguration();
- ContributionDef def = new ContributionDefImpl("foo.Bar",
- findMethod("contributeUnorderedNull"));
+ ContributionDef def = new ContributionDefImpl("Bar", findMethod("contributeUnorderedNull"),
+ getClassFactory());
- log.warn(IOCMessages.contributionWrongValueType(
- "foo.Bar",
- def,
- String.class,
- Runnable.class));
+ log.warn(IOCMessages.contributionWrongValueType("Bar", def, String.class, Runnable.class));
replay();
- Configuration wrapper = new ValidatingConfigurationWrapper("foo.Bar", log, Runnable.class,
- def, configuration);
+ Configuration wrapper = new ValidatingConfigurationWrapper("Bar", log, Runnable.class, def,
+ configuration);
wrapper.add("runnable");
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapperTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapperTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapperTest.java Sun Mar 11 19:01:04 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.
@@ -26,7 +26,7 @@
public class ValidatingMappedConfigurationWrapperTest extends IOCInternalTestCase
{
- private static final String SERVICE_ID = "foo.bar.Baz";
+ private static final String SERVICE_ID = "Baz";
@Test
public void proper_key_and_value()
@@ -173,7 +173,7 @@
private ContributionDef newContributionDef(String methodName)
{
- return new ContributionDefImpl(SERVICE_ID, findMethod(methodName));
+ return new ContributionDefImpl(SERVICE_ID, findMethod(methodName), getClassFactory());
}
public void contributionPlaceholder1()
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=517073&r1=517072&r2=517073
==============================================================================
--- 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 Sun Mar 11 19:01:04 2007
@@ -88,7 +88,7 @@
{
Method method = findMethod("contributeBarneyService");
- ContributionDef def = new ContributionDefImpl("Service", method);
+ ContributionDef def = new ContributionDefImpl("Service", method, getClassFactory());
Log log = newLog();
OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImplTest.java?view=diff&rev=517073&r1=517072&r2=517073
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImplTest.java Sun Mar 11 19:01:04 2007
@@ -84,7 +84,7 @@
}
@Test
- public void get_method_line_number() throws Exception
+ public void get_method_location() throws Exception
{
ClassFactory factory = new ClassFactoryImpl();
@@ -94,17 +94,23 @@
// 21 is the line containing the close brace
- assertEquals(factory.getMethodLineNumber(m), 21);
+ assertEquals(
+ factory.getMethodLocation(m).toString(),
+ "org.apache.tapestry.ioc.internal.services.LineNumberBean.fred() (at LineNumberBean.java:21)");
m = target.getMethod("betty", String.class, int.class);
// 25 is the line of the return statement
- assertEquals(factory.getMethodLineNumber(m), 25);
+ assertEquals(
+ factory.getMethodLocation(m).toString(),
+ "org.apache.tapestry.ioc.internal.services.LineNumberBean.betty(String, int) (at LineNumberBean.java:25)");
m = target.getDeclaredMethod("wilma", int[].class, Double[][][].class);
- assertEquals(factory.getMethodLineNumber(m), 30);
+ assertEquals(
+ factory.getMethodLocation(m).toString(),
+ "org.apache.tapestry.ioc.internal.services.LineNumberBean.wilma(int[], Double[][][]) (at LineNumberBean.java:30)");
}
private void addRunMethod(ClassFab cf)