abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r616579 - in /incubator/abdera/java/trunk: jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
Date Wed, 30 Jan 2008 01:28:28 GMT
Author: dandiep
Date: Tue Jan 29 17:28:24 2008
New Revision: 616579

URL: http://svn.apache.org/viewvc?rev=616579&view=rev
Log:
Fix JCR test too.

Modified:
    incubator/abdera/java/trunk/jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java

Modified: incubator/abdera/java/trunk/jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java?rev=616579&r1=616578&r2=616579&view=diff
==============================================================================
--- incubator/abdera/java/trunk/jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java
(original)
+++ incubator/abdera/java/trunk/jcr/src/test/java/org/apache/abdera/jcr/JcrCollectionAdapterTest.java
Tue Jan 29 17:28:24 2008
@@ -90,10 +90,11 @@
     //prettyPrint(abdera, res.getDocument());
 
     IRI location = res.getLocation();
-    assertEquals(colUri + "/Some_Entry", location.toString());
+    assertEquals("/feed/Some_Entry", location.toString());
 
     // GET the entry
-    res = client.get(location.toString());
+    IRI entryIri = colUri.resolve(location);
+    res = client.get(entryIri.toString());
     assertEquals(200, res.getStatus());
 
     //prettyPrint(abdera, res.getDocument());
@@ -111,7 +112,7 @@
     entry.setSummary("New Summary");
     entry.setContent("New Content");
 
-    res = client.put(location.toString(), entry, opts);
+    res = client.put(entryIri.resolve(location).toString(), entry, opts);
     assertEquals(204, res.getStatus());
 
     res = client.get(colUri.toString());
@@ -122,7 +123,7 @@
     //prettyPrint(abdera, feed_doc);
 
     // test 404 not found
-    res = client.get(location.toString() + "Invalid");
+    res = client.get(colUri.resolve(location).toString() + "Invalid");
     assertEquals(404, res.getStatus());
   }
 

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java?rev=616579&r1=616578&r2=616579&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
Tue Jan 29 17:28:24 2008
@@ -20,9 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -38,7 +36,6 @@
 import org.apache.abdera.protocol.server.ProviderHelper;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
-import org.apache.abdera.protocol.server.TargetType;
 import org.apache.abdera.protocol.server.context.EmptyResponseContext;
 import org.apache.abdera.protocol.server.context.MediaResponseContext;
 import org.apache.abdera.protocol.server.context.ResponseContextException;
@@ -64,8 +61,7 @@
       T doc = postMedia(request.getContentType(), request.getSlug(), 
                              request.getInputStream(), request);
 
-      IRI baseIri = ProviderHelper.resolveBase(request);
-      IRI entryIri = getEntryBaseFromFeedIRI(baseIri);
+      IRI entryIri = getFeedIRI(request);
 
       Entry entry = request.getAbdera().getFactory().newEntry();
 
@@ -99,7 +95,7 @@
                                  entry.getContentElement(), request);
           entry.getIdElement().setValue(getId(entryObj));
         
-          IRI entryBaseUri = new IRI(getHref(request) + "/");          
+          IRI entryBaseUri = getFeedIRI(request);          
           IRI entryIri = entryBaseUri.resolve(getName(entryObj));
           entry.addLink(entryIri.toString(), "edit");
     
@@ -180,8 +176,7 @@
   protected void addFeedDetails(Feed feed, RequestContext request) throws ResponseContextException
{
     feed.setUpdated(new Date());
 
-    IRI baseIri = ProviderHelper.resolveBase(request);
-    IRI entryIri = getEntryBaseFromFeedIRI(baseIri);
+    IRI entryIri = getFeedIRI(request);
     
     Iterable<T> entries = getEntries(request);
     if (entries != null) {
@@ -198,6 +193,11 @@
       }
     }
   }
+
+  private IRI getFeedIRI(RequestContext request) {
+    IRI entryIri = new IRI(getHref(request) + "/");
+    return entryIri;
+  }
   /**
    * Gets the UUID for the specified entry.
    * @param entry
@@ -351,7 +351,7 @@
       T doc = postMedia(request.getContentType(), request.getSlug(), 
                                request.getInputStream(), request);
 
-      IRI feedUri = new IRI(getHref(request) + "/");
+      IRI feedUri = getFeedIRI(request);
 
       Entry entry = request.getAbdera().getFactory().newEntry();
 
@@ -386,7 +386,7 @@
         
         entry.getIdElement().setValue(getId(entryObj));
 
-        IRI feedUri = new IRI(getHref(request) + "/");
+        IRI feedUri = getFeedIRI(request);
 
         IRI entryIri = feedUri.resolve(getName(entryObj));
         entry.addLink(entryIri.toString(), "edit");



Mime
View raw message