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/04/21 19:20:06 UTC
svn commit: r531068 [3/7] - in /tapestry/tapestry5:
tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/
tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/
tapestry-core/trunk/src/main/java/org/apache/tapestry/serv...
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/model/MutableComponentModelImplTest.java Sat Apr 21 10:19:58 2007
@@ -39,8 +39,8 @@
@Test
public void root_class_vs_sub_class()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -58,8 +58,8 @@
@Test
public void add_new_parameter()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -93,8 +93,8 @@
@Test
public void parameter_names_are_sorted()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -112,9 +112,9 @@
@Test
public void declared_parameter_names_does_not_include_superclass_parameters()
{
- Resource r = newResource();
- Log log = newLog();
- ComponentModel parent = newComponentModel();
+ Resource r = mockResource();
+ Log log = mockLog();
+ ComponentModel parent = mockComponentModel();
train_getPersistentFieldNames(parent);
train_getParameterNames(parent, "betty");
@@ -136,8 +136,8 @@
@Test
public void add_duplicate_parameter()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -165,8 +165,8 @@
@Test
public void get_parameter_by_name_with_no_parameters_defined()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -180,8 +180,8 @@
@Test
public void get_unknown_parameter()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -196,8 +196,8 @@
@Test
public void add_embedded()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -239,8 +239,8 @@
@Test
public void add_embedded_component_with_duplicate_id()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -266,8 +266,8 @@
@Test
public void add_embedded_is_case_insensitive()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -293,8 +293,8 @@
@Test
public void add_parameters_to_embedded()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -320,8 +320,8 @@
@Test
public void add_duplicate_parameters_to_embedded()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -352,8 +352,8 @@
@Test
public void mixin_names_is_initially_empty_list()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -372,8 +372,8 @@
@Test
public void mixin_class_names_remembered_in_order_added()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -395,8 +395,8 @@
@Test
public void mixin_name_conflict()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -431,8 +431,8 @@
@Test
public void get_persistent_field_names_when_none_defined()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -446,8 +446,8 @@
@Test
public void get_persistent_field_names_are_sorted()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -464,8 +464,8 @@
@Test
public void persistent_field_names_have_punctuation_stripped()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -482,8 +482,8 @@
@Test
public void get_persistent_field_names_reflects_parent_model()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -504,8 +504,8 @@
@Test
public void persistent_field_names_allocated_in_subclasses_are_unique()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -524,8 +524,8 @@
@Test
public void get_persistent_field_defined_in_model()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -543,8 +543,8 @@
@Test
public void no_persistence_defined_for_field()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -569,8 +569,8 @@
@Test
public void get_persistent_field_defined_in_parent()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -589,8 +589,8 @@
@Test
public void default_for_supports_informal_parameters_is_false()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -608,8 +608,8 @@
@Test
public void get_mixin_class_names_with_no_mixins()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
ComponentModel model = new MutableComponentModelImpl(CLASS_NAME, log, r, null);
@@ -622,8 +622,8 @@
@Test
public void get_mixin_class_names_mixes_with_parent_model()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -644,8 +644,8 @@
@Test
public void get_parent_from_subclass()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -661,8 +661,8 @@
@Test
public void set_and_get_meta()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -686,8 +686,8 @@
@Test
public void get_meta_from_parent()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -704,8 +704,8 @@
@Test
public void parent_does_not_have_meta()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
@@ -722,8 +722,8 @@
@Test
public void child_meta_overrides_parent_meta()
{
- Resource r = newResource();
- Log log = newLog();
+ Resource r = mockResource();
+ Log log = mockLog();
replay();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java Sat Apr 21 10:19:58 2007
@@ -36,8 +36,8 @@
{
AliasManager manager = newAliasManager();
AliasManager overridesManager = newAliasManager();
- ServiceLocator locator = newServiceLocator();
- AnnotationProvider annotationProvider = newAnnotationProvider();
+ ServiceLocator locator = mockServiceLocator();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
replay();
@@ -73,16 +73,16 @@
AliasManager manager = newAliasManager();
AliasManager overridesManager = newAliasManager();
- AnnotationProvider annotationProvider = newAnnotationProvider();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
- ServiceLocator locator = newServiceLocator();
- Runnable r = newRunnable();
+ ServiceLocator locator = mockServiceLocator();
+ Runnable r = mockRunnable();
Map<Class, Object> configuration = newMap();
configuration.put(Runnable.class, r);
- getAliasesForMode(manager, mode, configuration);
- getAliasesForMode(overridesManager, mode, _emptyMap);
+ train_getAliasesForMode(manager, mode, configuration);
+ train_getAliasesForMode(overridesManager, mode, _emptyMap);
replay();
@@ -113,21 +113,21 @@
AliasManager manager = newAliasManager();
AliasManager overridesManager = newAliasManager();
- AnnotationProvider annotationProvider = newAnnotationProvider();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
- ServiceLocator locator = newServiceLocator();
- Runnable r = newRunnable();
- Runnable override = newRunnable();
+ ServiceLocator locator = mockServiceLocator();
+ Runnable r = mockRunnable();
+ Runnable override = mockRunnable();
Map<Class, Object> configuration = newMap();
configuration.put(Runnable.class, r);
- getAliasesForMode(manager, mode, configuration);
+ train_getAliasesForMode(manager, mode, configuration);
Map<Class, Object> overrideConfiguration = newMap();
configuration.put(Runnable.class, override);
- getAliasesForMode(overridesManager, mode, overrideConfiguration);
+ train_getAliasesForMode(overridesManager, mode, overrideConfiguration);
replay();
@@ -151,12 +151,12 @@
AliasManager manager = newAliasManager();
AliasManager overridesManager = newAliasManager();
- AnnotationProvider annotationProvider = newAnnotationProvider();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
- ServiceLocator locator = newServiceLocator();
+ ServiceLocator locator = mockServiceLocator();
- getAliasesForMode(manager, mode, _emptyMap);
- getAliasesForMode(overridesManager, mode, _emptyMap);
+ train_getAliasesForMode(manager, mode, _emptyMap);
+ train_getAliasesForMode(overridesManager, mode, _emptyMap);
replay();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java Sat Apr 21 10:19:58 2007
@@ -29,8 +29,8 @@
@Test
public void no_conflict()
{
- Log log = newLog();
- Runnable r = newRunnable();
+ Log log = mockLog();
+ Runnable r = mockRunnable();
replay();
@@ -53,8 +53,8 @@
@Test
public void first_entry_wins_on_conflict()
{
- Log log = newLog();
- Runnable r = newRunnable();
+ Log log = mockLog();
+ Runnable r = mockRunnable();
log
.error("Contribution FRED-CONFLICT (for type java.lang.String) conflicts with existing contribution FRED and has been ignored.");
@@ -81,8 +81,8 @@
@Test
public void contributions_to_other_modes_are_ignored()
{
- Log log = newLog();
- Runnable r = newRunnable();
+ Log log = mockLog();
+ Runnable r = mockRunnable();
replay();
@@ -106,8 +106,8 @@
@Test
public void mode_specific_contribution_overrides_general_contribution()
{
- Log log = newLog();
- Runnable r = newRunnable();
+ Log log = mockLog();
+ Runnable r = mockRunnable();
replay();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateManagerImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateManagerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateManagerImplTest.java Sat Apr 21 10:19:58 2007
@@ -38,10 +38,10 @@
public void get_from_configured_aso()
{
String strategyName = "ethereal";
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
- ApplicationStatePersistenceStrategySource source = newApplicationStatePersistenceStrategySource();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
- ApplicationStateCreator<ReadOnlyBean> creator = newApplicationStateCreator();
+ ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
ReadOnlyBean aso = new ReadOnlyBean();
Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(
@@ -66,10 +66,10 @@
public void check_exists_when_null()
{
String strategyName = "ethereal";
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
- ApplicationStatePersistenceStrategySource source = newApplicationStatePersistenceStrategySource();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
- ApplicationStateCreator<ReadOnlyBean> creator = newApplicationStateCreator();
+ ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(
asoClass,
@@ -92,10 +92,10 @@
public void check_exists_when_true()
{
String strategyName = "ethereal";
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
- ApplicationStatePersistenceStrategySource source = newApplicationStatePersistenceStrategySource();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
- ApplicationStateCreator<ReadOnlyBean> creator = newApplicationStateCreator();
+ ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(
asoClass,
@@ -118,8 +118,8 @@
public void set_configured_aso()
{
String strategyName = "ethereal";
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
- ApplicationStatePersistenceStrategySource source = newApplicationStatePersistenceStrategySource();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
Object aso = new ReadOnlyBean();
@@ -144,8 +144,8 @@
@Test
public void get_from_unconfigured_aso()
{
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
- ApplicationStatePersistenceStrategySource source = newApplicationStatePersistenceStrategySource();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategySource source = mockApplicationStatePersistenceStrategySource();
Class asoClass = ReadOnlyBean.class;
final Holder holder = new Holder();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStatePersistenceStrategySourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStatePersistenceStrategySourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStatePersistenceStrategySourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStatePersistenceStrategySourceImplTest.java Sat Apr 21 10:19:58 2007
@@ -29,7 +29,7 @@
@Test
public void strategy_found()
{
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
Map<String, ApplicationStatePersistenceStrategy> configuration = Collections.singletonMap(
"session",
@@ -48,7 +48,7 @@
@Test
public void not_found()
{
- ApplicationStatePersistenceStrategy strategy = newApplicationStatePersistenceStrategy();
+ ApplicationStatePersistenceStrategy strategy = mockApplicationStatePersistenceStrategy();
Map<String, ApplicationStatePersistenceStrategy> configuration = newMap();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java Sat Apr 21 10:19:58 2007
@@ -48,8 +48,8 @@
public void no_fields_with_annotation()
{
ApplicationStateManager manager = newApplicationStateManager();
- ClassTransformation ct = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation ct = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
train_findFieldsWithAnnotation(ct, ApplicationState.class);
@@ -67,9 +67,9 @@
public void field_read_and_write() throws Exception
{
ApplicationStateManager manager = newApplicationStateManager();
- Log log = newLog();
- MutableComponentModel model = newMutableComponentModel();
- InternalComponentResources resources = newInternalComponentResources();
+ Log log = mockLog();
+ MutableComponentModel model = mockMutableComponentModel();
+ InternalComponentResources resources = mockInternalComponentResources();
String componentClassName = StateHolder.class.getName();
Class asoClass = ReadOnlyBean.class;
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetDispatcherTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetDispatcherTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetDispatcherTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetDispatcherTest.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.
@@ -40,7 +40,7 @@
@Test
public void not_an_asset_request() throws Exception
{
- Request request = newRequest();
+ Request request = mockRequest();
train_getPath(request, "/foo/bar/Baz.gif");
@@ -56,11 +56,11 @@
@Test
public void unprotected_asset() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
train_getPath(request, SMILEY_CLIENT_URL);
@@ -84,11 +84,11 @@
@Test
public void protected_asset_without_an_extension() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
String clientURL = "/assets/app1/pages/smiley_png";
String resourcePath = "org/apache/tapestry/integration/app1/pages/smiley_png";
@@ -113,11 +113,11 @@
@Test
public void protected_asset_with_incorrect_digest_in_url() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
String clientURL = "/assets/app1/pages/smiley.WRONG.png";
String resourcePath = "org/apache/tapestry/integration/app1/pages/smiley.WRONG.png";
@@ -144,11 +144,11 @@
@Test
public void protected_asset_wth_correct_digest_in_url() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
String clientURL = TapestryConstants.ASSET_PATH_PREFIX + "app1/pages/smiley.RIGHT.png";
String resourcePath = "org/apache/tapestry/integration/app1/pages/smiley.RIGHT.png";
@@ -182,11 +182,11 @@
@Test
public void protected_asset_without_digest() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
train_getPath(request, SMILEY_CLIENT_URL);
@@ -208,11 +208,11 @@
@Test
public void client_cache_upto_date() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
long now = System.currentTimeMillis();
train_getPath(request, SMILEY_CLIENT_URL);
@@ -239,11 +239,11 @@
@Test
public void client_cache_out_of_date() throws Exception
{
- Request request = newRequest();
- Response response = newResponse();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
- ResourceCache cache = newResourceCache();
- ResourceStreamer streamer = newResourceStreamer();
+ Request request = mockRequest();
+ Response response = mockResponse();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ResourceStreamer streamer = mockResourceStreamer();
long now = System.currentTimeMillis();
train_getPath(request, SMILEY_CLIENT_URL);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectionProviderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectionProviderTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectionProviderTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectionProviderTest.java Sat Apr 21 10:19:58 2007
@@ -29,11 +29,11 @@
@Test
public void no_path_annotation()
{
- SymbolSource symbolSource = newSymbolSource();
- AssetSource assetSource = newAssetSource();
- ServiceLocator locator = newServiceLocator();
- ClassTransformation ct = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ SymbolSource symbolSource = mockSymbolSource();
+ AssetSource assetSource = mockAssetSource();
+ ServiceLocator locator = mockServiceLocator();
+ ClassTransformation ct = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
String fieldName = "myField";
String fieldType = "java.lang.String";
@@ -52,12 +52,12 @@
@Test
public void path_annotation_present()
{
- SymbolSource symbolSource = newSymbolSource();
- AssetSource assetSource = newAssetSource();
- ServiceLocator locator = newServiceLocator();
- ClassTransformation ct = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
- Path annotation = newPath();
+ SymbolSource symbolSource = mockSymbolSource();
+ AssetSource assetSource = mockAssetSource();
+ ServiceLocator locator = mockServiceLocator();
+ ClassTransformation ct = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
+ Path annotation = mockPath();
String fieldName = "myField";
String fieldType = "java.lang.Object";
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetObjectProviderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetObjectProviderTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetObjectProviderTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetObjectProviderTest.java Sat Apr 21 10:19:58 2007
@@ -31,11 +31,11 @@
@Test
public void no_path_annotation()
{
- AssetSource source = newAssetSource();
- ServiceLocator locator = newServiceLocator();
- AnnotationProvider annotationProvider = newAnnotationProvider();
- TypeCoercer typeCoercer = newTypeCoercer();
- SymbolSource symbolSource = newSymbolSource();
+ AssetSource source = mockAssetSource();
+ ServiceLocator locator = mockServiceLocator();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
+ TypeCoercer typeCoercer = mockTypeCoercer();
+ SymbolSource symbolSource = mockSymbolSource();
train_getAnnotation(annotationProvider, Path.class, null);
@@ -51,15 +51,15 @@
@Test
public void normal_conversion()
{
- AssetSource source = newAssetSource();
- ServiceLocator locator = newServiceLocator();
- Asset asset = newAsset();
+ AssetSource source = mockAssetSource();
+ ServiceLocator locator = mockServiceLocator();
+ Asset asset = mockAsset();
String path = "${foo}";
String expanded = "foo/bar/baz.gif";
- AnnotationProvider annotationProvider = newAnnotationProvider();
- TypeCoercer typeCoercer = newTypeCoercer();
- Path pathAnnotation = newPath();
- SymbolSource symbolSource = newSymbolSource();
+ AnnotationProvider annotationProvider = mockAnnotationProvider();
+ TypeCoercer typeCoercer = mockTypeCoercer();
+ Path pathAnnotation = mockPath();
+ SymbolSource symbolSource = mockSymbolSource();
train_getAnnotation(annotationProvider, Path.class, pathAnnotation);
train_value(pathAnnotation, path);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetSourceImplTest.java Sat Apr 21 10:19:58 2007
@@ -37,9 +37,9 @@
@Test
public void relative_asset()
{
- AssetFactory factory = newAssetFactory();
- ThreadLocale threadLocale = newThreadLocale();
- Asset asset = newAsset();
+ AssetFactory factory = mockAssetFactory();
+ ThreadLocale threadLocale = mockThreadLocale();
+ Asset asset = mockAsset();
Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");
@@ -67,9 +67,9 @@
@Test
public void get_classpath_asset()
{
- AssetFactory factory = newAssetFactory();
- ThreadLocale threadLocale = newThreadLocale();
- Asset asset = newAsset();
+ AssetFactory factory = mockAssetFactory();
+ ThreadLocale threadLocale = mockThreadLocale();
+ Asset asset = mockAsset();
Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");
@@ -95,9 +95,9 @@
@Test
public void get_classpath_asset_for_unspecified_locale()
{
- AssetFactory factory = newAssetFactory();
- ThreadLocale threadLocale = newThreadLocale();
- Asset asset = newAsset();
+ AssetFactory factory = mockAssetFactory();
+ ThreadLocale threadLocale = mockThreadLocale();
+ Asset asset = mockAsset();
Locale locale = Locale.UK;
Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");
@@ -125,9 +125,9 @@
@Test
public void absolute_asset_with_known_prefix()
{
- AssetFactory factory = newAssetFactory();
- ThreadLocale threadLocale = newThreadLocale();
- Asset asset = newAsset();
+ AssetFactory factory = mockAssetFactory();
+ ThreadLocale threadLocale = mockThreadLocale();
+ Asset asset = mockAsset();
Resource expectedResource = _rootResource
.forFile("org/apache/tapestry/internal/services/SimpleComponent_en_GB.properties");
@@ -160,7 +160,7 @@
@Test
public void unknown_asset_prefix()
{
- ThreadLocale threadLocale = newThreadLocale();
+ ThreadLocale threadLocale = mockThreadLocale();
Map<String, AssetFactory> configuration = Collections.emptyMap();
@@ -189,7 +189,7 @@
@Test
public void missing_resource()
{
- ThreadLocale threadLocale = newThreadLocale();
+ ThreadLocale threadLocale = mockThreadLocale();
Map<String, AssetFactory> configuration = Collections.emptyMap();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java Sat Apr 21 10:19:58 2007
@@ -49,8 +49,8 @@
@Test
public void default_model_for_bean()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -103,8 +103,8 @@
@Test
public void filtering_out_read_only_properties()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -125,8 +125,8 @@
@Test
public void non_text_property()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -145,8 +145,8 @@
@Test
public void add_duplicate_property_name_is_failure()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -173,8 +173,8 @@
@Test
public void unknown_property_name()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -202,8 +202,8 @@
@Test
public void order_via_annotation()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -220,8 +220,8 @@
@Test
public void edit_property_label()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -239,8 +239,8 @@
@Test
public void label_from_component_messages()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -260,8 +260,8 @@
@Test
public void array_type_bean()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -295,8 +295,8 @@
@Test
public void composite_bean()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -339,8 +339,8 @@
@Test
public void default_properties_exclude_write_only()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -357,8 +357,8 @@
@Test
public void add_synthetic_property()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -380,8 +380,8 @@
@Test
public void remove_property()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -400,8 +400,8 @@
@Test
public void remove_unknown_property_is_noop()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
@@ -420,8 +420,8 @@
@Test
public void nonvisual_properties_are_excluded()
{
- ComponentResources resources = newComponentResources();
- Messages messages = newMessages();
+ ComponentResources resources = mockComponentResources();
+ Messages messages = mockMessages();
train_getMessages(resources, messages);
stub_contains(messages, false);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.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.
@@ -32,11 +32,11 @@
@Test
public void expression_has_no_prefix()
{
- BindingFactory factory = newBindingFactory();
- Binding binding = newBinding();
- ComponentResources container = newComponentResources();
- ComponentResources component = newComponentResources();
- Location l = newLocation();
+ BindingFactory factory = mockBindingFactory();
+ Binding binding = mockBinding();
+ ComponentResources container = mockComponentResources();
+ ComponentResources component = mockComponentResources();
+ Location l = mockLocation();
String defaultPrefix = "def";
String description = "descrip";
@@ -68,11 +68,11 @@
@Test
public void expression_prefix_not_in_configuration()
{
- BindingFactory factory = newBindingFactory();
- Binding binding = newBinding();
- ComponentResources container = newComponentResources();
- ComponentResources component = newComponentResources();
- Location l = newLocation();
+ BindingFactory factory = mockBindingFactory();
+ Binding binding = mockBinding();
+ ComponentResources container = mockComponentResources();
+ ComponentResources component = mockComponentResources();
+ Location l = mockLocation();
String defaultPrefix = "def";
String description = "descrip";
@@ -104,11 +104,11 @@
@Test
public void known_prefix()
{
- BindingFactory factory = newBindingFactory();
- Binding binding = newBinding();
- ComponentResources container = newComponentResources();
- ComponentResources component = newComponentResources();
- Location l = newLocation();
+ BindingFactory factory = mockBindingFactory();
+ Binding binding = mockBinding();
+ ComponentResources container = mockComponentResources();
+ ComponentResources component = mockComponentResources();
+ Location l = mockLocation();
String defaultPrefix = "literal";
String description = "descrip";
@@ -140,10 +140,10 @@
@Test
public void factory_throws_exception()
{
- BindingFactory factory = newBindingFactory();
- ComponentResources container = newComponentResources();
- ComponentResources component = newComponentResources();
- Location l = newLocation();
+ BindingFactory factory = mockBindingFactory();
+ ComponentResources container = mockComponentResources();
+ ComponentResources component = mockComponentResources();
+ Location l = mockLocation();
Throwable t = new RuntimeException("Simulated failure.");
String defaultPrefix = "def";
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetAliasManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetAliasManagerImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetAliasManagerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetAliasManagerImplTest.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(dataProvider = "to_client_url_data")
public void to_client_url(String resourcePath, String expectedClientURL)
{
- Request request = newRequest();
+ Request request = mockRequest();
train_getContextPath(request, "/ctx");
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.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.
@@ -27,11 +27,11 @@
@Test
public void asset_client_URL_is_cached()
{
- ResourceCache cache = newResourceCache();
+ ResourceCache cache = mockResourceCache();
Resource r = new ClasspathResource("foo/Bar.txt");
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
train_requiresDigest(cache, r, false);
@@ -70,8 +70,8 @@
@Test
public void simple_asset_client_URL()
{
- ResourceCache cache = newResourceCache();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
Resource r = new ClasspathResource("foo/Bar.txt");
@@ -97,8 +97,8 @@
@Test
public void protected_asset_client_URL()
{
- ResourceCache cache = newResourceCache();
- ClasspathAssetAliasManager aliasManager = newClasspathAssetAliasManager();
+ ResourceCache cache = mockResourceCache();
+ ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
Resource r = new ClasspathResource("foo/Bar.txt");
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentActionDispatcherTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentActionDispatcherTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentActionDispatcherTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentActionDispatcherTest.java Sat Apr 21 10:19:58 2007
@@ -34,8 +34,8 @@
public void no_dot_or_colon_in_path() throws Exception
{
ActionLinkHandler handler = newActionLinkHandler();
- Request request = newRequest();
- Response response = newResponse();
+ Request request = mockRequest();
+ Response response = mockResponse();
train_getPath(request, "/foo/bar/baz");
@@ -126,8 +126,8 @@
public void page_activation_context_in_request() throws Exception
{
ActionLinkHandler handler = newActionLinkHandler();
- Request request = newRequest();
- Response response = newResponse();
+ Request request = mockRequest();
+ Response response = mockResponse();
ActionResponseGenerator generator = newMock(ActionResponseGenerator.class);
train_getPath(request, "/mypage:eventname");
@@ -158,8 +158,8 @@
String eventType, String... context) throws IOException
{
ActionLinkHandler handler = newActionLinkHandler();
- Request request = newRequest();
- Response response = newResponse();
+ Request request = mockRequest();
+ Response response = mockResponse();
ActionResponseGenerator generator = newMock(ActionResponseGenerator.class);
train_getPath(request, requestPath);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java Sat Apr 21 10:19:58 2007
@@ -53,7 +53,7 @@
@Test
public void simple_page_name()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -72,9 +72,95 @@
}
@Test
+ public void page_name_in_subfolder()
+ {
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+ ClassNameLocator locator = newClassNameLocator();
+
+ train_for_app_packages(source);
+
+ String className = APP_ROOT_PACKAGE + ".pages.subfolder.NestedPage";
+
+ train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", className);
+
+ replay();
+
+ ComponentClassResolver resolver = create(source, locator);
+
+ assertEquals(resolver.resolvePageNameToClassName("subfolder/NestedPage"), className);
+
+ verify();
+ }
+
+ @Test
+ public void lots_of_prefixes_and_suffixes_stripped()
+ {
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+ ClassNameLocator locator = newClassNameLocator();
+
+ train_for_app_packages(source);
+
+ String className = APP_ROOT_PACKAGE + ".pages.admin.edit.AdminUserEdit";
+
+ train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", className);
+
+ replay();
+
+ ComponentClassResolver resolver = create(source, locator);
+
+ assertEquals(resolver.resolvePageNameToClassName("admin/edit/User"), className);
+
+ verify();
+ }
+
+ @Test
+ public void page_in_subfolder()
+ {
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+ ClassNameLocator locator = newClassNameLocator();
+
+ train_for_app_packages(source);
+
+ String className = APP_ROOT_PACKAGE + ".pages.subfolder.NestedPage";
+
+ train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", className);
+
+ replay();
+
+ ComponentClassResolver resolver = create(source, locator);
+
+ assertEquals(resolver.resolvePageNameToClassName("subfolder/NestedPage"), className);
+
+ verify();
+
+ }
+
+ @Test
+ public void subfolder_name_as_classname_prefix_is_stripped()
+ {
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+ ClassNameLocator locator = newClassNameLocator();
+
+ train_for_app_packages(source);
+
+ String className = APP_ROOT_PACKAGE + ".pages.foo.FooBar";
+
+ train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", className);
+
+ replay();
+
+ ComponentClassResolver resolver = create(source, locator);
+
+ assertEquals(resolver.resolvePageNameToClassName("foo/Bar"), className);
+
+ verify();
+
+ }
+
+ @Test
public void is_page_name()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -97,7 +183,7 @@
@Test
public void is_page_name_for_core_page()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -152,7 +238,7 @@
{
String className = APP_ROOT_PACKAGE + ".pages.SimplePage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -175,7 +261,7 @@
String pageClassName = APP_ROOT_PACKAGE + ".pages.SimplePage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -217,7 +303,7 @@
{
String className = CORE_ROOT_PACKAGE + ".pages.CorePage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
@@ -240,7 +326,7 @@
{
String className = CORE_ROOT_PACKAGE + ".pages.CorePage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
@@ -263,7 +349,7 @@
{
String className = LIB_ROOT_PACKAGE + ".pages.LibPage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, LIB_ROOT_PACKAGE);
@@ -287,7 +373,7 @@
{
String className = LIB_ROOT_PACKAGE + ".pages.LibPage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, LIB_ROOT_PACKAGE);
@@ -310,7 +396,7 @@
@Test
public void class_name_does_not_resolve_to_page_name()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
@@ -340,7 +426,7 @@
@Test
public void class_name_not_in_a_pages_package()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
@@ -373,7 +459,7 @@
String secondaryLibPackage = "org.examples.addon.lib";
String className = secondaryLibPackage + ".pages.LibPage";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, LIB_ROOT_PACKAGE);
@@ -402,7 +488,7 @@
{
String deepPackage = "org.deep";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, deepPackage);
@@ -449,7 +535,7 @@
{
String className = APP_ROOT_PACKAGE + ".components.SimpleComponent";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -474,7 +560,7 @@
{
String expectedClassName = APP_ROOT_PACKAGE + ".mixins.SimpleMixin";
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_app_packages(source);
@@ -493,7 +579,7 @@
@Test
public void mixin_type_not_found()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
@@ -522,7 +608,7 @@
@Test
public void component_type_not_found()
{
- ComponentInstantiatorSource source = newComponentInstantiatorSource();
+ ComponentInstantiatorSource source = mockComponentInstantiatorSource();
ClassNameLocator locator = newClassNameLocator();
train_for_packages(source, CORE_ROOT_PACKAGE);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java Sat Apr 21 10:19:58 2007
@@ -42,7 +42,7 @@
@Test
public void matches_on_event_type()
{
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
@@ -60,7 +60,7 @@
@Test
public void event_type_match_is_case_insensitive()
{
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
@@ -76,7 +76,7 @@
@Test
public void matches_on_component_id()
{
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler,
@@ -93,7 +93,7 @@
@Test
public void component_id_matches_are_case_insensitive()
{
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler,
@@ -108,7 +108,7 @@
@Test
public void coerce_context()
{
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
@@ -123,8 +123,8 @@
@Test
public void coerce_when_not_enough_context()
{
- ComponentEventHandler handler = newComponentEventHandler();
- Component component = newComponent();
+ ComponentEventHandler handler = mockComponentEventHandler();
+ Component component = mockComponent();
replay();
@@ -150,8 +150,8 @@
@Test
public void unable_to_coerce()
{
- ComponentEventHandler handler = newComponentEventHandler();
- Component component = newComponent();
+ ComponentEventHandler handler = mockComponentEventHandler();
+ Component component = mockComponent();
replay();
@@ -182,9 +182,9 @@
{
Object result = new Object();
String methodDescription = "foo.Bar.baz()";
- Component component = newComponent();
+ Component component = mockComponent();
- ComponentEventHandler handler = newComponentEventHandler();
+ ComponentEventHandler handler = mockComponentEventHandler();
train_handleResult(handler, result, component, methodDescription, true);
@@ -209,8 +209,8 @@
{
Object result = new Object();
String methodDescription = "foo.Bar.baz()";
- Component component = newComponent();
- ComponentEventHandler handler = newComponentEventHandler();
+ Component component = mockComponent();
+ ComponentEventHandler handler = mockComponentEventHandler();
train_handleResult(handler, result, component, methodDescription, false);
@@ -231,8 +231,8 @@
@Test
public void store_null_result_does_not_abort_or_invoke_handler()
{
- Component component = newComponent();
- ComponentEventHandler handler = newComponentEventHandler();
+ Component component = mockComponent();
+ ComponentEventHandler handler = mockComponentEventHandler();
replay();
@@ -253,8 +253,8 @@
public void store_result_when_aborted_is_failure()
{
Object result = new Object();
- ComponentEventHandler handler = newComponentEventHandler();
- Component component = newComponent();
+ ComponentEventHandler handler = mockComponentEventHandler();
+ Component component = mockComponent();
expect(handler.handleResult(result, component, "foo.Bar.baz()")).andReturn(true);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.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.
@@ -35,15 +35,15 @@
@Test
public void result_is_root_component() throws Exception
{
- Component result = newComponent();
- Component source = newComponent();
- ComponentResources resources = newComponentResources();
- Log log = newLog();
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
- LinkFactory factory = newLinkFactory();
- Response response = newResponse();
- Link link = newLink();
+ Component result = mockComponent();
+ Component source = mockComponent();
+ ComponentResources resources = mockComponentResources();
+ Log log = mockLog();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
+ LinkFactory factory = mockLinkFactory();
+ Response response = mockResponse();
+ Link link = mockLink();
train_getComponentResources(result, resources);
train_getContainer(resources, null);
@@ -70,19 +70,19 @@
@Test
public void warning_for_component_is_not_root_component() throws Exception
{
- Component child = newComponent();
- Component source = newComponent();
- Component root = newComponent();
- Component container = newComponent();
- ComponentResources rootResources = newComponentResources();
- ComponentResources childResources = newComponentResources();
- ComponentResources sourceResources = newComponentResources();
- Log log = newLog();
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
- LinkFactory factory = newLinkFactory();
- Response response = newResponse();
- Link link = newLink();
+ Component child = mockComponent();
+ Component source = mockComponent();
+ Component root = mockComponent();
+ Component container = mockComponent();
+ ComponentResources rootResources = mockComponentResources();
+ ComponentResources childResources = mockComponentResources();
+ ComponentResources sourceResources = mockComponentResources();
+ Log log = mockLog();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
+ LinkFactory factory = mockLinkFactory();
+ Response response = mockResponse();
+ Link link = mockLink();
train_getComponentResources(child, childResources);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstantiatorSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstantiatorSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstantiatorSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentInstantiatorSourceImplTest.java Sat Apr 21 10:19:58 2007
@@ -72,7 +72,7 @@
public void controlled_packages() throws Exception
{
ComponentClassTransformer transformer = newMock(ComponentClassTransformer.class);
- Log log = newLog();
+ Log log = mockLog();
replay();
@@ -239,7 +239,7 @@
private Component createComponent(String classname)
{
- InternalComponentResources resources = newInternalComponentResources();
+ InternalComponentResources resources = mockInternalComponentResources();
replay();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java Sat Apr 21 10:19:58 2007
@@ -36,8 +36,8 @@
@Test
public void no_methods_with_annotation()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
MethodSignature sig = new MethodSignature("someRandomMethod");
@@ -58,8 +58,8 @@
@Test
public void added_lifecycle_method_is_ignored()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
train_findMethods(tf, TransformConstants.SETUP_RENDER_SIGNATURE);
@@ -76,8 +76,8 @@
@Test
public void void_method()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature sig = new MethodSignature("aMethod");
@@ -106,8 +106,8 @@
@Test
public void match_on_method_name()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
MethodSignature sig = new MethodSignature("setupRender");
@@ -138,8 +138,8 @@
@Test
public void multiple_methods_reverse_order()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature siga = new MethodSignature("aMethod");
@@ -170,8 +170,8 @@
@Test
public void multiple_methods_parent_class_reverse_order()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature siga = new MethodSignature("aMethod");
@@ -200,8 +200,8 @@
@Test
public void method_in_base_class()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature sig = new MethodSignature("aMethod");
@@ -228,8 +228,8 @@
@Test
public void method_with_markup_writer_parameter()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature sig = new MethodSignature(Modifier.PUBLIC, "void", "aMethod", new String[]
@@ -260,8 +260,8 @@
@Test
public void nonvoid_method()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature sig = new MethodSignature(Modifier.PROTECTED, "boolean", "aMethod", null,
@@ -297,8 +297,8 @@
@Test
public void multiple_methods()
{
- ClassTransformation tf = newClassTransformation();
- MutableComponentModel model = newMutableComponentModel();
+ ClassTransformation tf = mockClassTransformation();
+ MutableComponentModel model = mockMutableComponentModel();
SetupRender annotation = newSetupRender();
MethodSignature siga = new MethodSignature(Modifier.PROTECTED, "boolean", "aMethod", null,
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImplTest.java Sat Apr 21 10:19:58 2007
@@ -45,7 +45,7 @@
@Test
public void simple_component()
{
- ComponentModel model = newComponentModel();
+ ComponentModel model = mockComponentModel();
train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);
@@ -91,7 +91,7 @@
@Test
public void per_language_messages_override()
{
- ComponentModel model = newComponentModel();
+ ComponentModel model = mockComponentModel();
train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);
@@ -114,7 +114,7 @@
@Test
public void messages_keys_are_case_insensitive()
{
- ComponentModel model = newComponentModel();
+ ComponentModel model = mockComponentModel();
train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);
@@ -137,8 +137,8 @@
@Test
public void subclass_inherits_base_class_messages()
{
- ComponentModel model = newComponentModel();
- ComponentModel parent = newComponentModel();
+ ComponentModel model = mockComponentModel();
+ ComponentModel parent = mockComponentModel();
train_getComponentClassName(
model,
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.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.
@@ -31,9 +31,9 @@
@Test
public void root_element_of_page()
{
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
- Component component = newComponent();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
+ Component component = mockComponent();
train_getByClassName(cache, PAGE_NAME, page);
@@ -51,10 +51,10 @@
@Test
public void nested_element_within_page()
{
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
- ComponentPageElement element = newComponentPageElement();
- Component component = newComponent();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
+ ComponentPageElement element = mockComponentPageElement();
+ Component component = mockComponent();
train_getByClassName(cache, PAGE_NAME, page);
@@ -74,9 +74,9 @@
@Test
public void get_page_by_logical_name()
{
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
- Component component = newComponent();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
+ Component component = mockComponent();
train_get(cache, PAGE_NAME, page);
train_getRootComponent(page, component);
@@ -93,8 +93,8 @@
@Test
public void get_page_by_class()
{
- RequestPageCache cache = newRequestPageCache();
- Page page = newPage();
+ RequestPageCache cache = mockRequestPageCache();
+ Page page = mockPage();
Component component = new DefaultComponent();
train_getByClassName(cache, DefaultComponent.class.getName(), page);
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImplTest.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.
@@ -73,9 +73,9 @@
{
Resource baseResource = newResource("Fred.class");
- TemplateParser parser = newTemplateParser();
- ComponentTemplate template = newComponentTemplate();
- ComponentModel model = newComponentModel();
+ TemplateParser parser = mockTemplateParser();
+ ComponentTemplate template = mockComponentTemplate();
+ ComponentModel model = mockComponentModel();
train_getComponentClassName(model, PACKAGE + ".Fred");
@@ -104,7 +104,7 @@
{
File rootDir = createClasspathRoot();
URLClassLoader loader = newLoaderWithClasspathRoot(rootDir);
- ComponentModel model = newComponentModel();
+ ComponentModel model = mockComponentModel();
File packageDir = new File(rootDir, "baz");
packageDir.mkdirs();
@@ -116,9 +116,9 @@
Resource baseResource = new ClasspathResource(loader, "baz/Biff.class");
Resource localized = baseResource.withExtension(InternalConstants.TEMPLATE_EXTENSION);
- TemplateParser parser = newTemplateParser();
- ComponentTemplate template = newComponentTemplate();
- InvalidationListener listener = newInvalidationListener();
+ TemplateParser parser = mockTemplateParser();
+ ComponentTemplate template = mockComponentTemplate();
+ InvalidationListener listener = mockInvalidationListener();
train_getComponentClassName(model, "baz.Biff");
@@ -177,9 +177,9 @@
{
Resource baseResource = newResource("Fred.class");
- TemplateParser parser = newTemplateParser();
- ComponentTemplate template = newComponentTemplate();
- ComponentModel model = newComponentModel();
+ TemplateParser parser = mockTemplateParser();
+ ComponentTemplate template = mockComponentTemplate();
+ ComponentModel model = mockComponentModel();
train_getComponentClassName(model, PACKAGE + ".Fred");
@@ -215,10 +215,10 @@
Resource contextTemplateResource = newResource("Fred.html");
- TemplateParser parser = newTemplateParser();
- ComponentTemplate template = newComponentTemplate();
- ComponentModel model = newComponentModel();
- PageTemplateLocator locator = newPageTemplateLocator();
+ TemplateParser parser = mockTemplateParser();
+ ComponentTemplate template = mockComponentTemplate();
+ ComponentModel model = mockComponentModel();
+ PageTemplateLocator locator = mockPageTemplateLocator();
Locale locale = Locale.FRENCH;
train_getComponentClassName(model, PACKAGE + ".NotInClasspath");
@@ -241,9 +241,9 @@
@Test
public void no_template_found()
{
- TemplateParser parser = newTemplateParser();
- ComponentModel model = newComponentModel();
- PageTemplateLocator locator = newPageTemplateLocator();
+ TemplateParser parser = mockTemplateParser();
+ ComponentModel model = mockComponentModel();
+ PageTemplateLocator locator = mockPageTemplateLocator();
Resource baseResource = newResource("Barney.class");
@@ -271,12 +271,12 @@
{
Resource baseFred = newResource("Fred.class");
Resource baseBarney = baseFred.forFile("Barney.class");
- PageTemplateLocator locator = newPageTemplateLocator();
+ PageTemplateLocator locator = mockPageTemplateLocator();
- TemplateParser parser = newTemplateParser();
- ComponentTemplate template = newComponentTemplate();
- ComponentModel model = newComponentModel();
- ComponentModel parentModel = newComponentModel();
+ TemplateParser parser = mockTemplateParser();
+ ComponentTemplate template = mockComponentTemplate();
+ ComponentModel model = mockComponentModel();
+ ComponentModel parentModel = mockComponentModel();
train_getComponentClassName(model, PACKAGE + ".Barney");
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextAssetFactoryTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextAssetFactoryTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextAssetFactoryTest.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.
@@ -27,8 +27,8 @@
@Test
public void root_resource()
{
- Context context = newContext();
- Request request = newRequest();
+ Context context = mockContext();
+ Request request = mockRequest();
replay();
@@ -42,8 +42,8 @@
@Test
public void asset_client_URL()
{
- Context context = newContext();
- Request request = newRequest();
+ Context context = mockContext();
+ Request request = mockRequest();
Resource r = new ContextResource(context, "foo/Bar.txt");
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextResourceTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextResourceTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextResourceTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ContextResourceTest.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.
@@ -28,7 +28,7 @@
{
URL url = getClass().getResource("ContextResourceTest.class");
- Context context = newContext();
+ Context context = mockContext();
expect(context.getResource("/foo/Bar.txt")).andReturn(url);
@@ -44,7 +44,7 @@
@Test
public void to_string()
{
- Context context = newContext();
+ Context context = mockContext();
replay();
@@ -58,8 +58,8 @@
@Test
public void hash_code()
{
- Context context1 = newContext();
- Context context2 = newContext();
+ Context context1 = mockContext();
+ Context context2 = mockContext();
replay();
@@ -78,9 +78,9 @@
@Test
public void equals()
{
- Context context1 = newContext();
- Context context2 = newContext();
- Resource r = newResource();
+ Context context1 = mockContext();
+ Context context2 = mockContext();
+ Resource r = mockResource();
replay();