You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by da...@apache.org on 2008/04/30 02:20:16 UTC

svn commit: r652199 - in /incubator/abdera/java/trunk: ./ build/ dependencies/ server/ server/src/main/java/org/apache/abdera/protocol/server/impl/ server/src/test/java/org/apache/abdera/protocol/server/test/route/

Author: dandiep
Date: Tue Apr 29 17:20:16 2008
New Revision: 652199

URL: http://svn.apache.org/viewvc?rev=652199&view=rev
Log:
Port routemanager fixes to trunk as I accidentally applied them to a branch before. Also, fix the distribution repositories in the POM.

Modified:
    incubator/abdera/java/trunk/build/build.xml
    incubator/abdera/java/trunk/dependencies/deps.properties
    incubator/abdera/java/trunk/pom.xml
    incubator/abdera/java/trunk/server/pom.xml
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/route/RouteTest.java

Modified: incubator/abdera/java/trunk/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/build/build.xml (original)
+++ incubator/abdera/java/trunk/build/build.xml Tue Apr 29 17:20:16 2008
@@ -595,6 +595,9 @@
       <get src="${jetty-util.dir}/${jetty-util.jar}" dest="${dependencies}/${jetty-util.jar}" usetimestamp="true" />
       <get src="${htmlparser.dir}/${htmlparser.jar}" dest="${dependencies}/${htmlparser.jar}" usetimestamp="true" />
       <get src="${htmlparser.dir}/${htmlserializer.jar}" dest="${dependencies}/${htmlserializer.jar}" usetimestamp="true" />
+      <get src="${easymock.dir}/${easymock.jar}" dest="${dependencies}/${easymock.jar}" usetimestamp="true" />
+      <get src="${easymockclassextension.dir}/${easymockclassextension.jar}" dest="${dependencies}/${easymockclassextension.jar}" usetimestamp="true" />
+       <get src="${cglib.dir}/${cglib.jar}" dest="${dependencies}/${cglib.jar}" usetimestamp="true" />
     </parallel>
   </target>
 

Modified: incubator/abdera/java/trunk/dependencies/deps.properties
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/deps.properties?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/deps.properties (original)
+++ incubator/abdera/java/trunk/dependencies/deps.properties Tue Apr 29 17:20:16 2008
@@ -76,4 +76,12 @@
 htmlparser.zip=http://about.validator.nu/htmlparser/htmlparser-1.0.5.zip
 htmlparser.dir=http://people.apache.org/~jmsnell
 htmlparser.jar=htmlparser-1.0.5.jar
-htmlserializer.jar=serializer.jar
\ No newline at end of file
+htmlserializer.jar=serializer.jar
+
+#### Required for tests ####
+easymock.dir=http://repo1.maven.org/maven2/org/easymock/easymock/2.3/
+easymock.jar=easymock-2.3.jar
+easymockclassextension.dir=http://repo1.maven.org/maven2/org/easymock/easymockclassextension/2.3/
+easymockclassextension.jar=easymockclassextension-2.3.jar
+cglib.dir=http://repo1.maven.org/maven2/cglib/cglib-nodep/2.1_3/
+cglib.jar=cglib-nodep-2.1_3.jar

Modified: incubator/abdera/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/pom.xml?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/pom.xml (original)
+++ incubator/abdera/java/trunk/pom.xml Tue Apr 29 17:20:16 2008
@@ -383,10 +383,15 @@
   </modules>
   
   <distributionManagement>
-    <repository>
-      <id>apache.snapshots</id>
+    <snapshotRepository>
+      <id>apache.snapshots</id>
+      <name>Apache Incubating Repository</name>
+      <url>scpexe://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+    </snapshotRepository>
+    <repository>
+      <id>apache.releases</id>
       <name>Apache Incubating Repository</name>
-      <url>scp://people.apache.org/home/dandiep/public_html/abdera-take7</url>
+      <url>scpexe://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</url>
     </repository>
   </distributionManagement>
 

Modified: incubator/abdera/java/trunk/server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/pom.xml?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/pom.xml (original)
+++ incubator/abdera/java/trunk/server/pom.xml Tue Apr 29 17:20:16 2008
@@ -1,19 +1,19 @@
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.abdera</groupId>
@@ -68,6 +68,27 @@
       <artifactId>abdera-client</artifactId>
       <version>0.5.0-incubating-SNAPSHOT</version>
       <scope>test</scope>
-    </dependency>   
+    </dependency>
+
+    <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymock</artifactId>
+        <version>2.3</version>
+        <scope>test</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymockclassextension</artifactId>
+        <version>2.3</version>
+        <scope>test</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>cglib</groupId>
+        <artifactId>cglib-nodep</artifactId>
+        <version>2.1_3</version>
+        <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java Tue Apr 29 17:20:16 2008
@@ -207,8 +207,8 @@
    * @return
    */
   protected ResponseContext createErrorResponse(ResponseContextException e) {
-    if (log.isInfoEnabled()) {
-      log.info("A ResponseException was thrown.", e);
+    if (log.isDebugEnabled()) {
+      log.debug("A ResponseException was thrown.", e);
     } else if (e.getResponseContext() instanceof EmptyResponseContext
                && ((EmptyResponseContext)e.getResponseContext()).getStatus() >= 500) {
       log.warn("A ResponseException was thrown.", e);

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java Tue Apr 29 17:20:16 2008
@@ -32,7 +32,7 @@
   public static final String COLLECTION_ADAPTER_ATTRIBUTE = "collectionProvider";
 
   public CollectionAdapter getCollectionAdapter(RequestContext request) {
-    String path = request.getTargetBasePath() + request.getTargetPath();
+    String path = request.getContextPath() + request.getTargetPath();
     
     // Typically this happens when a Resolver wants to override the CollectionAdapter being used
     CollectionAdapter ca = (CollectionAdapter) request.getAttribute(Scope.REQUEST, COLLECTION_ADAPTER_ATTRIBUTE);

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java Tue Apr 29 17:20:16 2008
@@ -154,8 +154,8 @@
         if (!map.containsKey(var) && value != null) {
           map.put(var, value);
         }
-      }
-      return context.getTargetBasePath() + route.expand(getContext(map));
+      }            
+      return context.getContextPath() + route.expand(getContext(map));
     } else {
       return null;
     }

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/route/RouteTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/route/RouteTest.java?rev=652199&r1=652198&r2=652199&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/route/RouteTest.java (original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/route/RouteTest.java Tue Apr 29 17:20:16 2008
@@ -17,6 +17,10 @@
  */
 package org.apache.abdera.protocol.server.test.route;
 
+import static org.easymock.EasyMock.expect;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -24,6 +28,10 @@
 
 import org.apache.abdera.i18n.templates.HashMapContext;
 import org.apache.abdera.i18n.templates.Route;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.context.RequestContextWrapper;
+import org.apache.abdera.protocol.server.impl.RouteManager;
 import org.junit.Test;
 
 public class RouteTest extends Assert {
@@ -168,5 +176,20 @@
     Map<String, String> vars = route.parse("/base/test/");
     assertEquals("test", vars.get("collection"));
   }
+    
+  @Test
+  public void testUrlFor() throws Exception {
+    RouteManager manager = new RouteManager().addRoute(new Route("entry", "/base/:collection/:entry"));
 
+    Target targetMock = createMock(Target.class);
+    expect(targetMock.getParameter("collection")).andReturn("entries");
+    expect(targetMock.getParameter("entry")).andReturn("123");
+    replay(targetMock);
+    RequestContext contextMock = createMock(RequestContextWrapper.class);
+    expect(contextMock.getContextPath()).andReturn("/appBase");
+    expect(contextMock.getTarget()).andReturn(targetMock).times(2);
+    replay(contextMock);
+
+    assertEquals(manager.urlFor(contextMock, "entry", null), "/appBase/base/entries/123");
+  }
 }