Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ServiceLoggerTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ServiceLoggerTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ServiceLoggerTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ServiceLoggerTest.java Sat Apr 21 10:19:58 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. @@ -25,8 +25,8 @@ { private void try_entry(String methodName, String expected, Object... arguments) { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); log.debug("[ENTER] " + expected); @@ -38,15 +38,15 @@ } - protected final ExceptionTracker newExceptionTracker() + protected final ExceptionTracker mockExceptionTracker() { return newMock(ExceptionTracker.class); } private void try_exit(String methodName, String expected, Object result) { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); log.debug("[ EXIT] " + expected); @@ -80,8 +80,8 @@ @Test public void void_exit_test() { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); log.debug("[ EXIT] wilma"); @@ -95,8 +95,8 @@ @Test public void fail_test_exception_not_already_logged() { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); RuntimeException t = new RuntimeException("Ouch!"); @@ -116,8 +116,8 @@ @Test public void fail_test_exception_previously_logged() { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); RuntimeException t = new RuntimeException("Ouch!"); @@ -137,8 +137,8 @@ @Test public void fail_debug_not_enabled() { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); RuntimeException t = new RuntimeException("Ouch!"); @@ -159,8 +159,8 @@ @Test public void debug_enabled() { - Log log = newLog(); - ExceptionTracker tracker = newExceptionTracker(); + Log log = mockLog(); + ExceptionTracker tracker = mockExceptionTracker(); train_isDebugEnabled(log, true); train_isDebugEnabled(log, false);
Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImplTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImplTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImplTest.java Sat Apr 21 10:19:58 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. @@ -42,7 +42,7 @@ @Test public void simple_expansions() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -64,7 +64,7 @@ public void undefined_symbol() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -90,7 +90,7 @@ @Test public void missing_brace() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -116,7 +116,7 @@ @Test public void indirect_expansions() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -139,7 +139,7 @@ public void undefined_symbol_in_path() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -170,7 +170,7 @@ public void missing_brace_in_path() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -200,8 +200,8 @@ @Test public void providers_searched_in_order() { - SymbolProvider provider1 = newSymbolProvider(); - SymbolProvider provider2 = newSymbolProvider(); + SymbolProvider provider1 = mockSymbolProvider(); + SymbolProvider provider2 = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider1, provider2); @@ -225,7 +225,7 @@ @Test public void symbols_are_cached() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -253,7 +253,7 @@ @Test public void recursive_symbols_fail() { - SymbolProvider provider = newSymbolProvider(); + SymbolProvider provider = mockSymbolProvider(); List<SymbolProvider> providers = Arrays.asList(provider); @@ -299,7 +299,7 @@ expect(provider.valueForSymbol(symbolName)).andReturn(value); } - protected final SymbolProvider newSymbolProvider() + protected final SymbolProvider mockSymbolProvider() { return newMock(SymbolProvider.class); } Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImplTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImplTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImplTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImplTest.java Sat Apr 21 10:19:58 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. @@ -24,7 +24,7 @@ @Test public void no_listeners() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -36,8 +36,8 @@ @Test public void listeners_are_one_shot() { - Log log = newLog(); - ThreadCleanupListener listener = newThreadCleanupListener(); + Log log = mockLog(); + ThreadCleanupListener listener = mockThreadCleanupListener(); listener.threadDidCleanup(); @@ -62,7 +62,7 @@ verify(); } - private ThreadCleanupListener newThreadCleanupListener() + private ThreadCleanupListener mockThreadCleanupListener() { return newMock(ThreadCleanupListener.class); } @@ -72,7 +72,7 @@ { final RuntimeException t = new RuntimeException("Boom!"); - Log log = newLog(); + Log log = mockLog(); ThreadCleanupListener listener = new ThreadCleanupListener() { Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java Sat Apr 21 10:19:58 2007 @@ -29,10 +29,10 @@ @Test public void no_value_annotation() { - SymbolSource symbolSource = newSymbolSource(); - TypeCoercer coercer = newTypeCoercer(); - AnnotationProvider annotationProvider = newAnnotationProvider(); - ServiceLocator locator = newServiceLocator(); + SymbolSource symbolSource = mockSymbolSource(); + TypeCoercer coercer = mockTypeCoercer(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); + ServiceLocator locator = mockServiceLocator(); train_getAnnotation(annotationProvider, Value.class, null); @@ -48,13 +48,13 @@ @Test public void value_annotation_present() { - SymbolSource symbolSource = newSymbolSource(); - TypeCoercer coercer = newTypeCoercer(); - AnnotationProvider annotationProvider = newAnnotationProvider(); - ServiceLocator locator = newServiceLocator(); + SymbolSource symbolSource = mockSymbolSource(); + TypeCoercer coercer = mockTypeCoercer(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); + ServiceLocator locator = mockServiceLocator(); String annotationValue = "${foo}"; String expanded = "Foo"; - Runnable coerced = newRunnable(); + Runnable coerced = mockRunnable(); Value annotation = newMock(Value.class); train_getAnnotation(annotationProvider, Value.class, annotation); Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/InternalUtilsTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/InternalUtilsTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/InternalUtilsTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/util/InternalUtilsTest.java Sat Apr 21 10:19:58 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. @@ -182,7 +182,7 @@ @Test public void location_of_location() { - Location l = newLocation(); + Location l = mockLocation(); replay(); @@ -194,7 +194,7 @@ @Test public void location_of_locatable() { - Location l = newLocation(); + Location l = mockLocation(); Locatable locatable = newMock(Locatable.class); expect(locatable.getLocation()).andReturn(l); 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=531068&r1=531067&r2=531068 ============================================================================== --- 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 Apr 21 10:19:58 2007 @@ -27,7 +27,7 @@ @Test public void no_dependencies() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -48,7 +48,7 @@ @Test public void missing_constraint_type() { - Log log = newLog(); + Log log = mockLog(); log.warn(UtilMessages.constraintFormat("fred", "barney")); @@ -71,7 +71,7 @@ @Test public void unknown_constraint_type() { - Log log = newLog(); + Log log = mockLog(); log.warn(UtilMessages.constraintFormat("nearby:fred", "barney")); @@ -94,7 +94,7 @@ @Test public void nulls_not_included_in_result() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -117,7 +117,7 @@ @Test public void duplicate_id() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -151,7 +151,7 @@ @Test public void leader() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -172,7 +172,7 @@ @Test public void trailer() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -193,7 +193,7 @@ @Test public void prereqs() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -214,7 +214,7 @@ @Test public void pre_and_post_reqs() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -235,7 +235,7 @@ @Test public void case_insensitivity() { - Log log = newLog(); + Log log = mockLog(); replay(); @@ -257,7 +257,7 @@ @Test public void dependency_cycle() { - Log log = newLog(); + Log log = mockLog(); log.warn("Unable to add 'barney' as a dependency of 'betty', as that forms a " + "dependency cycle ('betty' depends on itself via 'barney'). " @@ -296,7 +296,7 @@ @Test public void toString_DependencyNode() { - Log log = newLog(); + Log log = mockLog(); replay(); Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/StrategyRegistryTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/StrategyRegistryTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/StrategyRegistryTest.java (original) +++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/util/StrategyRegistryTest.java Sat Apr 21 10:19:58 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. @@ -29,8 +29,8 @@ @Test public void adapter_not_found() { - Runnable r1 = newRunnable(); - Runnable r2 = newRunnable(); + Runnable r1 = mockRunnable(); + Runnable r2 = mockRunnable(); replay(); @@ -59,8 +59,8 @@ @Test public void adapter_found() { - Runnable r1 = newRunnable(); - Runnable r2 = newRunnable(); + Runnable r1 = mockRunnable(); + Runnable r2 = mockRunnable(); replay(); @@ -92,8 +92,8 @@ @Test public void registration_map_is_copied_by_constructor() { - Runnable r1 = newRunnable(); - Runnable r2 = newRunnable(); + Runnable r1 = mockRunnable(); + Runnable r2 = mockRunnable(); replay(); @@ -114,8 +114,8 @@ @Test public void adapter_found_by_instance() { - Runnable r1 = newRunnable(); - Runnable r2 = newRunnable(); + Runnable r1 = mockRunnable(); + Runnable r2 = mockRunnable(); replay(); @@ -134,9 +134,9 @@ @Test public void null_instance_matches_class_void() { - Runnable r1 = newRunnable(); - Runnable r2 = newRunnable(); - Runnable r3 = newRunnable(); + Runnable r1 = mockRunnable(); + Runnable r2 = mockRunnable(); + Runnable r3 = mockRunnable(); replay(); Modified: tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java (original) +++ tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java Sat Apr 21 10:19:58 2007 @@ -34,6 +34,11 @@ * using a well-known name. The WebApplicationContext must be configured in the <a * href="http://static.springframework.org/spring/docs/1.2.x/reference/beans.html#context-create">standard * way</a> (which involves adding a listener to the web.xml deployment descriptor). + * <p> + * Because this service is needed by SpringObjectProvider, it can't use autowriting (which would + * create a circular dependency to SpringObjectProvider), and we have to use + * + * @InjectService. */ public static WebApplicationContext build(@InjectService("Context") Context context) Modified: tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringModuleTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringModuleTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringModuleTest.java (original) +++ tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringModuleTest.java Sat Apr 21 10:19:58 2007 @@ -25,7 +25,7 @@ @Test public void missing_spring_context() { - Context context = newContext(null); + Context context = mockContext(null); replay(); @@ -49,7 +49,7 @@ public void success() { WebApplicationContext webContext = newMock(WebApplicationContext.class); - Context context = newContext(webContext); + Context context = mockContext(webContext); replay(); @@ -58,9 +58,9 @@ verify(); } - protected final Context newContext(Object webApplicationContext) + protected final Context mockContext(Object webApplicationContext) { - Context context = newContext(); + Context context = mockContext(); expect(context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)) .andReturn(webApplicationContext); @@ -71,7 +71,7 @@ @Test public void error_getting_spring_context() { - Context context = newContext("[Placeholder]"); + Context context = mockContext("[Placeholder]"); replay(); Modified: tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java?view=diff&rev=531068&r1=531067&r2=531068 ============================================================================== --- tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java (original) +++ tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java Sat Apr 21 10:19:58 2007 @@ -31,11 +31,11 @@ @Test public void failure_getting_bean_from_context() { - Log log = newLog(); + Log log = mockLog(); WebApplicationContext webContext = newWebApplicationContext(); - ServiceLocator locator = newServiceLocator(); + ServiceLocator locator = mockServiceLocator(); Throwable t = new RuntimeException("Simulated failure."); - AnnotationProvider annotationProvider = newAnnotationProvider(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); SpringBean annotation = newSpringBean(BEAN_NAME); train_getBeanDefinitionNames(webContext, BEAN_NAME); @@ -78,10 +78,10 @@ @Test public void get_bean_from_context() { - Log log = newLog(); + Log log = mockLog(); WebApplicationContext webContext = newWebApplicationContext(); - ServiceLocator locator = newServiceLocator(); - AnnotationProvider annotationProvider = newAnnotationProvider(); + ServiceLocator locator = mockServiceLocator(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); SpringBean annotation = newSpringBean(BEAN_NAME); SampleBean bean = newMock(SampleBean.class); @@ -106,11 +106,11 @@ @Test public void bean_name_is_case_insensitive_if_in_bean_definitions() { - Log log = newLog(); + Log log = mockLog(); WebApplicationContext webContext = newWebApplicationContext(); - ServiceLocator locator = newServiceLocator(); + ServiceLocator locator = mockServiceLocator(); SampleBean bean = newMock(SampleBean.class); - AnnotationProvider annotationProvider = newAnnotationProvider(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); SpringBean annotation = newSpringBean(BEAN_NAME.toUpperCase()); train_getBeanDefinitionNames(webContext, "fred", "barney", BEAN_NAME); @@ -133,10 +133,10 @@ @Test public void bean_name_outside_of_bean_definitions_supported_with_provided_case() { - Log log = newLog(); + Log log = mockLog(); WebApplicationContext webContext = newWebApplicationContext(); - ServiceLocator locator = newServiceLocator(); - AnnotationProvider annotationProvider = newAnnotationProvider(); + ServiceLocator locator = mockServiceLocator(); + AnnotationProvider annotationProvider = mockAnnotationProvider(); SpringBean annotation = newSpringBean(BEAN_NAME); SampleBean bean = newMock(SampleBean.class);
