You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/03/03 21:02:47 UTC

svn commit: r1076765 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ main/java/org/apache/tapestry5/test/ test/java/org/apache/tapestry5/internal/services/

Author: hlship
Date: Thu Mar  3 20:02:47 2011
New Revision: 1076765

URL: http://svn.apache.org/viewvc?rev=1076765&view=rev
Log:
TAP5-1464: Remove ClasspathAssetAliasManager.toResourcePath()

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetAliasManager.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImpl.java?rev=1076765&r1=1076764&r2=1076765&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImpl.java Thu Mar  3 20:02:47 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2009, 2011 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.
@@ -110,25 +110,9 @@ public class ClasspathAssetAliasManagerI
         // is too useful to pass up.
 
         throw new UnknownValueException(
-                String
-                        .format(
-                                "Unable to create a client URL for classpath resource %s: The resource path was not within an aliased path.",
-                                resourcePath), new AvailableValues("Aliased paths", aliasToPathPrefix.values()));
-    }
-
-    public String toResourcePath(String clientURL)
-    {
-        // Include the slash in the base path
-
-        String basePath = clientURL.substring(RequestConstants.ASSET_PATH_PREFIX.length());
-
-        for (String alias : sortedAliases)
-        {
-            if (basePath.startsWith(alias)) { return aliasToPathPrefix.get(alias) + "/"
-                    + basePath.substring(alias.length() + 1); }
-        }
-
-        return basePath;
+                String.format(
+                        "Unable to create a client URL for classpath resource %s: The resource path was not within an aliased path.",
+                        resourcePath), new AvailableValues("Aliased paths", aliasToPathPrefix.values()));
     }
 
     public Map<String, String> getMappings()

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetAliasManager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetAliasManager.java?rev=1076765&r1=1076764&r2=1076765&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetAliasManager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetAliasManager.java Thu Mar  3 20:02:47 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008, 2010 The Apache Software Foundation
+// Copyright 2006, 2008, 2010, 2011 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.
@@ -54,14 +54,6 @@ public interface ClasspathAssetAliasMana
     String toClientURL(String resourcePath);
 
     /**
-     * Reverses {@link #toClientURL(String)}, stripping off the asset prefix, and re-expanding any aliased folders back
-     * to complete folders.
-     * 
-     * @deprecated No longer used as of Tapestry 5.2, may be removed in a later release.
-     */
-    String toResourcePath(String clientURL);
-
-    /**
      * Returns the mappings used by the service: the keys are the folder aliases (i.e, "corelib")
      * and the values are the corresponding paths (i.e., "org/apache/tapestry5/corelib"). This
      * exists primarily so that {@link ClasspathAssetRequestHandler}s can be created automatically

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java?rev=1076765&r1=1076764&r2=1076765&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java Thu Mar  3 20:02:47 2011
@@ -822,12 +822,6 @@ public abstract class TapestryTestCase e
         expect(link.toRedirectURI()).andReturn(URI).atLeastOnce();
     }
 
-    /** @deprecated May be removed in Tapestry 5.3 */
-    protected final void train_toResourcePath(ClasspathAssetAliasManager manager, String clientURL, String resourcePath)
-    {
-        expect(manager.toResourcePath(clientURL)).andReturn(resourcePath).atLeastOnce();
-    }
-
     protected final void train_value(Id annotation, String value)
     {
         expect(annotation.value()).andReturn(value).atLeastOnce();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java?rev=1076765&r1=1076764&r2=1076765&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java Thu Mar  3 20:02:47 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2009, 2010, 2011 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.
@@ -124,26 +124,4 @@ public class ClasspathAssetAliasManagerI
         { "org/apache/tapestry5/Foo.bar", "tapestry/Foo.bar" }, };
     }
 
-    @Test(dataProvider = "to_resource_path_data")
-    public void to_resource_path(String clientURL, String expectedResourcePath)
-    {
-        ClasspathAssetAliasManager manager = new ClasspathAssetAliasManagerImpl(null, configuration());
-
-        assertEquals(manager.toResourcePath(clientURL), expectedResourcePath);
-    }
-
-    @DataProvider
-    public Object[][] to_resource_path_data()
-    {
-        Object[][] data = to_client_url_data();
-
-        for (Object[] pair : data)
-        {
-            Object buffer = pair[0];
-            pair[0] = RequestConstants.ASSET_PATH_PREFIX + pair[1];
-            pair[1] = buffer;
-        }
-
-        return data;
-    }
 }