abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1239237 [11/12] - in /abdera/abdera2-server: ./ .settings/ etc/ examples/ examples/src/ examples/src/main/ examples/src/main/java/ examples/src/main/java/org/ examples/src/main/java/org/apache/ examples/src/main/java/org/apache/abdera2/ ex...
Date Wed, 01 Feb 2012 17:55:02 GMT
Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.custom;
+
+import org.apache.abdera2.common.misc.Chain;
+import org.apache.abdera2.common.misc.Task;
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.BaseRequestContextWrapper;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.RegexTargetResolver;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.TemplateManagerTargetBuilder;
+import org.apache.abdera2.protocol.server.impl.AbstractAtompubWorkspaceProvider;
+import org.apache.abdera2.protocol.server.impl.SimpleWorkspaceInfo;
+
+public class CustomProvider extends AbstractAtompubWorkspaceProvider {
+
+    private final SimpleAdapter adapter;
+
+    @SuppressWarnings("unchecked")
+    public CustomProvider(String href) {
+        this.adapter = new SimpleAdapter(href);
+        RegexTargetResolver<RequestContext> resolver = 
+          new RegexTargetResolver<RequestContext>()
+            .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
+            .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
+            .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
+            .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection", "entry");
+        setTargetResolver(resolver);
+        TemplateManagerTargetBuilder<TargetType> tmb =
+          (TemplateManagerTargetBuilder<TargetType>) 
+            TemplateManagerTargetBuilder
+              .<TargetType>make()
+              .add(TargetType.TYPE_SERVICE, "{target_base}/atom")
+              .add(TargetType.TYPE_COLLECTION,
+                           "{target_base}/atom/{collection}{?q,c,s,p,l,i,o}")
+              .add(TargetType.TYPE_CATEGORIES, "{target_base}/atom/{collection};categories")
+              .add(TargetType.TYPE_ENTRY, "{target_base}/atom/{collection}/{entry}")
+              .get();
+        setTargetBuilder(tmb);
+        addWorkspace(
+          SimpleWorkspaceInfo
+            .make()
+            .title("A Simple Workspace")
+            .collection(adapter)
+            .get()
+        );
+        addFilter(new SimpleFilter());
+    }
+
+    public CollectionAdapter getCollectionAdapter(RequestContext request) {
+        return adapter;
+    }
+
+    public static class SimpleFilter implements Task<RequestContext,ResponseContext> {
+        public ResponseContext apply(RequestContext request, Chain<RequestContext,ResponseContext> chain) {
+            BaseRequestContextWrapper rcw = new BaseRequestContextWrapper(request);
+            rcw.setAttribute("offset", 10);
+            rcw.setAttribute("count", 10);
+            return chain.next(rcw);
+        }
+    }
+
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.custom;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Categories;
+import org.apache.abdera2.model.Collection;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Feed;
+import org.apache.abdera2.model.Service;
+import org.apache.abdera2.model.Workspace;
+import org.apache.abdera2.protocol.client.AbderaClient;
+import org.apache.abdera2.protocol.client.AbderaClientResponse;
+import org.apache.abdera2.protocol.client.AbderaSession;
+import org.apache.abdera2.protocol.client.ClientResponse;
+import org.apache.abdera2.protocol.client.Session;
+import org.apache.abdera2.test.server.JettyServer;
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.http.ResponseType;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.joda.time.DateTime;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CustomProviderTest {
+
+    private static JettyServer server;
+    private static Abdera abdera = Abdera.getInstance();
+    private static AbderaClient client = new AbderaClient();
+
+    private static String BASE = "http://localhost:9002/atom";
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        try {
+            server = new JettyServer();
+            server.start(CustomAtompubServiceManager.class);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        client.shutdown();
+        server.stop();
+    }
+
+    @Test
+    public void testGetService() throws IOException {
+      AbderaSession session = (AbderaSession) client.newSession();
+        AbderaClientResponse resp = (AbderaClientResponse) session.get(BASE);
+        assertNotNull(resp);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.APP_MEDIA_TYPE));
+        Document<Service> doc = resp.getDocument();        
+        try {
+            prettyPrint(doc);
+        } catch (Exception e) {
+        }
+        Service service = doc.getRoot();
+        prettyPrint(service);
+        assertEquals(1, service.getWorkspaces().size());
+        Workspace workspace = service.getWorkspaces().get(0);
+        assertEquals(1, workspace.getCollections().size());
+        Collection collection = workspace.getCollections().get(0);
+        assertEquals(BASE + "/feed?", collection.getResolvedHref().toString());
+        assertEquals("A simple feed", collection.getTitle().toString());
+        resp.release();
+    }
+
+    @Test
+    public void testGetCategories() {
+      AbderaSession session = (AbderaSession) client.newSession();
+        AbderaClientResponse resp = (AbderaClientResponse) session.get(BASE + "/feed;categories");
+        assertNotNull(resp);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.CAT_MEDIA_TYPE));
+        Document<Categories> doc = resp.getDocument();
+        Categories cats = doc.getRoot();
+        assertEquals(3, cats.getCategories().size());
+        assertEquals("foo", cats.getCategories().get(0).getTerm());
+        assertEquals("bar", cats.getCategories().get(1).getTerm());
+        assertEquals("baz", cats.getCategories().get(2).getTerm());
+        assertFalse(cats.isFixed());
+    }
+
+    @Test
+    public void testGetFeed() throws Exception {
+      AbderaSession session = (AbderaSession) client.newSession();
+        AbderaClientResponse resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        assertNotNull(resp);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.ATOM_MEDIA_TYPE));
+        Document<Feed> doc = resp.getDocument();
+        Feed feed = doc.getRoot();
+        assertEquals("tag:example.org,2008:feed", feed.getId().toString());
+        assertEquals("A simple feed", feed.getTitle());
+        assertEquals("Simple McGee", feed.getAuthor().getName());
+        assertEquals(0, feed.getEntries().size());
+        resp.release();
+    }
+
+    protected void prettyPrint(Base doc) throws IOException {
+        // WriterFactory writerFactory = abdera.getWriterFactory();
+        // Writer writer = writerFactory.getWriter("prettyxml");
+        // writer.writeTo(doc, System.out);
+        // System.out.println();
+    }
+
+    @Test
+    public void testPostEntry() {
+      AbderaSession session = (AbderaSession) client.newSession();
+        Entry entry = abdera.newEntry();
+        entry.setId(BASE + "/feed/entries/1");
+        entry.setTitle("test entry");
+        entry.setContent("Test Content");
+        entry.addLink("http://example.org");
+        entry.setUpdated(DateTime.now());
+        entry.addAuthor("James");
+        AbderaClientResponse resp = (AbderaClientResponse) session.post(BASE + "/feed", entry);
+        assertNotNull(resp);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        assertEquals(201, resp.getStatus());
+        assertNotNull(resp.getLocation());
+        resp.release();
+        resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        Document<Feed> feed_doc = resp.getDocument();
+        Feed feed = feed_doc.getRoot();
+        assertEquals(1, feed.getEntries().size());
+    }
+
+    @Test
+    public void testPostMedia() {
+      Session session = client.newSession();
+        ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {0x01, 0x02, 0x03, 0x04});
+        ClientResponse resp = session.post(
+          BASE + "/feed", in, 
+          session.getDefaultRequestOptions()
+            .contentType("application/octet-stream")
+            .get());
+        assertEquals(ResponseType.CLIENT_ERROR, resp.getType());
+        assertEquals(405, resp.getStatus());
+        resp.release();
+    }
+
+    @Test
+    public void testPutEntry() throws IOException {
+      AbderaSession session = (AbderaSession) client.newSession();
+      AbderaClientResponse resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        Document<Feed> feed_doc = resp.getDocument();
+        Feed feed = feed_doc.getRoot();
+        prettyPrint(feed);
+        Entry entry = feed.getEntries().get(0);
+        String edit = entry.getEditLinkResolvedHref().toString();
+        resp.release();
+        resp = (AbderaClientResponse) session.get(edit);
+        Document<Entry> doc = resp.getDocument();
+        prettyPrint(doc.getRoot());
+        entry = doc.getRoot();
+        entry.setTitle("This is the modified title");
+        resp.release();
+        resp = (AbderaClientResponse) session.put(edit, entry);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        assertEquals(204, resp.getStatus());
+        resp.release();
+        resp = (AbderaClientResponse) session.get(edit);
+        doc = resp.getDocument();
+        entry = doc.getRoot();
+        assertEquals("This is the modified title", entry.getTitle());
+        resp.release();
+        resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        feed_doc = resp.getDocument();
+        feed = feed_doc.getRoot();
+        assertEquals(1, feed.getEntries().size());
+        resp.release();
+    }
+
+    @Test
+    public void testDeleteEntry() {
+      AbderaSession session = (AbderaSession) client.newSession();
+      AbderaClientResponse resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        Document<Feed> feed_doc = resp.getDocument();
+        Feed feed = feed_doc.getRoot();
+        Entry entry = feed.getEntries().get(0);
+        String edit = entry.getEditLinkResolvedHref().toString();
+        resp.release();
+        resp = (AbderaClientResponse) session.delete(edit);
+        assertEquals(ResponseType.SUCCESSFUL, resp.getType());
+        resp.release();
+        resp = (AbderaClientResponse) session.get(BASE + "/feed");
+        feed_doc = resp.getDocument();
+        feed = feed_doc.getRoot();
+        assertEquals(0, feed.getEntries().size());
+        resp.release();
+    }
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.custom;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.RequestContext.Scope;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.ProviderHelper;
+import org.apache.abdera2.common.protocol.ResponseContextException;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.text.UrlEncoding;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Feed;
+import org.apache.abdera2.parser.ParseException;
+import org.apache.abdera2.protocol.server.context.FOMResponseContext;
+import org.apache.abdera2.protocol.server.context.StreamWriterResponseContext;
+import org.apache.abdera2.protocol.server.impl.AbstractAtompubCollectionAdapter;
+import org.apache.abdera2.protocol.server.impl.AbstractAtompubProvider;
+import org.apache.abdera2.util.MorePredicates;
+import org.apache.abdera2.writer.StreamWriter;
+import org.joda.time.DateTime;
+
+import com.google.common.base.Function;
+
+@SuppressWarnings("unchecked")
+public class SimpleAdapter extends AbstractAtompubCollectionAdapter {
+
+    public SimpleAdapter(String href) {
+      super(href);
+      putHandler(TargetType.TYPE_COLLECTION,"GET",getItemList());
+      putHandler(TargetType.TYPE_COLLECTION,"HEAD",getItemList());
+      putHandler(TargetType.TYPE_COLLECTION,"POST",postItem());
+      putHandler(TargetType.TYPE_ENTRY,"DELETE",deleteItem());
+      putHandler(TargetType.TYPE_ENTRY,"GET",getItem());
+      putHandler(TargetType.TYPE_ENTRY,"HEAD",getItem());
+      putHandler(TargetType.TYPE_ENTRY,"PUT",putItem());
+      putHandler(TargetType.TYPE_CATEGORIES,"GET",getCategories());
+      putHandler(TargetType.TYPE_CATEGORIES,"HEAD",getCategories());
+    }
+  
+    @Override
+    public String getAuthor(RequestContext request) throws ResponseContextException {
+        return "Simple McGee";
+    }
+
+    @Override
+    public String getId(RequestContext request) {
+        return "tag:example.org,2008:feed";
+    }
+
+    public String getHref(RequestContext request) {
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("collection", "feed");
+        return request.urlFor(TargetType.TYPE_COLLECTION, params);
+    }
+
+    public String getTitle(RequestContext request) {
+        return "A simple feed";
+    }
+
+    private Document<Feed> getFeedDocument(RequestContext context) throws ResponseContextException {
+        Feed feed = (Feed)context.getAttribute(Scope.SESSION, "feed");
+        if (feed == null) {
+            feed = createFeedBase(context);
+            feed.setBaseUri(getHref(context));
+            context.setAttribute(Scope.SESSION, "feed", feed);
+        }
+        return feed.getDocument();
+    }
+
+    private Function<RequestContext,ResponseContext> getItemList() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          Document<Feed> feed;
+          try {
+              feed = getFeedDocument(input);
+          } catch (ResponseContextException e) {
+              return e.getResponseContext();
+          }
+          return AbstractAtompubProvider
+            .returnBase(feed, 200, feed.getRoot().getUpdated())
+            .setEntityTag(
+              AbstractAtompubProvider
+                .calculateEntityTag(feed.getRoot()));
+        }
+      };
+    }
+
+    public Function<RequestContext,ResponseContext> deleteItem() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          Entry entry = getAbderaEntry(input);
+          if (entry != null)
+              entry.discard();
+          return ProviderHelper.nocontent();
+        }
+      };
+    }
+
+    private Function<RequestContext,ResponseContext> getItem() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          Entry entry = (Entry)getAbderaEntry(input);
+          if (entry != null) {
+              Feed feed = entry.getParentElement();
+              entry = (Entry)entry.clone();
+              entry.setSource(feed.getAsSource());
+              Document<Entry> entry_doc = entry.getDocument();
+              return AbstractAtompubProvider
+                .returnBase(entry_doc, 200, entry.getEdited())
+                .setEntityTag(AbstractAtompubProvider
+                  .calculateEntityTag(entry));
+          } else {
+              return ProviderHelper.notfound(input);
+          }
+        }
+      };
+    }
+    
+    private Function<RequestContext,ResponseContext> postItem() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext request) {
+          try {
+              Document<Entry> entry_doc = 
+                (Document<Entry>) AbstractAtompubProvider.<Entry>getDocument(request).clone();
+              if (entry_doc != null) {
+                  Entry entry = entry_doc.getRoot();
+                  if (!MorePredicates.VALID_ENTRY.apply(entry))
+                      return ProviderHelper.badrequest(request);
+                  setEntryDetails(request, entry, Abdera.getInstance().getFactory().newUuidUri());
+                  Feed feed = getFeedDocument(request).getRoot();
+                  feed.insertEntry(entry);
+                  feed.setUpdated(DateTime.now());
+                  FOMResponseContext<?> rc =
+                      (FOMResponseContext<?>)AbstractAtompubProvider.returnBase(entry_doc, 201, entry.getEdited());
+                  return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
+                      .toString()).setContentLocation(rc.getLocation().toString()).setEntityTag(AbstractAtompubProvider
+                      .calculateEntityTag(entry));
+              } else {
+                  return ProviderHelper.badrequest(request);
+              }
+          } catch (ParseException pe) {
+              return ProviderHelper.notsupported(request);
+          } catch (ClassCastException cce) {
+              return ProviderHelper.notsupported(request);
+          } catch (Exception e) {
+              return ProviderHelper.badrequest(request);
+          }
+        }
+      };
+    }
+    
+    private void setEntryDetails(RequestContext request, Entry entry, String id) {
+        entry.setUpdated(DateTime.now());
+        entry.setEdited(entry.getUpdated());
+        entry.getIdElement().setValue(id);
+        entry.addLink(getEntryLink(request, entry.getId().toASCIIString()), "edit");
+    }
+
+    private String getEntryLink(RequestContext request, String entryid) {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("collection", request.getTarget().getParameter("collection"));
+        params.put("entry", entryid);
+        return request.urlFor(TargetType.TYPE_ENTRY, params);
+    }
+
+    private Function<RequestContext,ResponseContext> putItem() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext request) {
+          Entry orig_entry = getAbderaEntry(request);
+          if (orig_entry != null) {
+              try {
+                  Document<Entry> entry_doc = 
+                    (Document<Entry>)AbstractAtompubProvider
+                      .getDocument(request).clone();
+                  if (entry_doc != null) {
+                      Entry entry = entry_doc.getRoot();
+                      if (!entry.getId().equals(orig_entry.getId()))
+                          return ProviderHelper.conflict(request);
+                      if (!MorePredicates.VALID_ENTRY.apply(entry))
+                          return ProviderHelper.badrequest(request);
+                      setEntryDetails(request, entry, orig_entry.getId().toString());
+                      orig_entry.discard();
+                      Feed feed = getFeedDocument(request).getRoot();
+                      feed.insertEntry(entry);
+                      feed.setUpdated(DateTime.now());
+                      return ProviderHelper.nocontent();
+                  } else {
+                      return ProviderHelper.badrequest(request);
+                  }
+              } catch (ParseException pe) {
+                  return ProviderHelper.notsupported(request);
+              } catch (ClassCastException cce) {
+                  return ProviderHelper.notsupported(request);
+              } catch (Exception e) {
+                  return ProviderHelper.badrequest(request);
+              }
+          } else {
+              return ProviderHelper.notfound(request);
+          }
+        }
+      };
+    }
+    
+    private Entry getAbderaEntry(RequestContext request) {
+        try {
+            return getFeedDocument(request).getRoot().getEntry(getResourceName(request));
+        } catch (Exception e) {
+        }
+        return null;
+    }
+
+    public String getResourceName(RequestContext request) {
+        if (request.getTarget().getType() != TargetType.TYPE_ENTRY)
+            return null;
+        String[] segments = request.getUri().toString().split("/");
+        return UrlEncoding.decode(segments[segments.length - 1]);
+    }
+
+    private Function<RequestContext,ResponseContext> getCategories() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          return new StreamWriterResponseContext(Abdera.getInstance()) {
+              protected void writeTo(StreamWriter sw) throws IOException {
+                  sw.startDocument().startCategories(false).writeCategory("foo").writeCategory("bar")
+                      .writeCategory("baz").endCategories().endDocument();
+              }
+          }.setStatus(200).setContentType(Constants.CAT_MEDIA_TYPE);
+        }
+      };
+    }
+
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.customer;
+
+public class Customer {
+    private int id;
+    private String name;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/Customer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.customer;
+
+import java.util.Arrays;
+//import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContextException;
+import org.apache.abdera2.model.Content;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Person;
+import org.apache.abdera2.protocol.server.impl.AbstractEntityCollectionAdapter;
+import org.joda.time.DateTime;
+
+public class CustomerAdapter extends AbstractEntityCollectionAdapter<Customer> {
+    private static final String ID_PREFIX = "urn:acme:customer:";
+
+    private AtomicInteger nextId = new AtomicInteger(1000);
+    private Map<Integer, Customer> customers = new HashMap<Integer, Customer>();
+    private Factory factory = Abdera.getInstance().getFactory();
+
+    public CustomerAdapter(String href) {
+      super(href);
+    }
+    
+    public String getId(RequestContext request) {
+        return "tag:example.org,2007:feed";
+    }
+
+    @Override
+    public Customer postEntry(String title,
+                              IRI id,
+                              String summary,
+                              org.joda.time.DateTime updated,
+                              List<Person> authors,
+                              Content content,
+                              RequestContext request) throws ResponseContextException {
+        Customer customer = contentToCustomer(content);
+        customers.put(customer.getId(), customer);
+
+        return customer;
+    }
+
+    private Customer contentToCustomer(Content content) {
+        Customer customer = new Customer();
+
+        return contentToCustomer(content, customer);
+    }
+
+    private Customer contentToCustomer(Content content, Customer customer) {
+        Element firstChild = content.getFirstChild();
+        customer.setName(firstChild.getAttributeValue("name"));
+        customer.setId(nextId.incrementAndGet());
+        return customer;
+    }
+
+    public void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException {
+        Integer id = getIdFromResourceName(resourceName);
+        customers.remove(id);
+    }
+
+    public String getAuthor(RequestContext request) {
+        return "Acme Industries";
+    }
+
+    @Override
+    public List<Person> getAuthors(Customer entry, RequestContext context) throws ResponseContextException {
+        Person author = Abdera.getInstance().getFactory().newAuthor();
+        author.setName("Acme Industries");
+        return Arrays.asList(author);
+    }
+
+    public Object getContent(Customer entry, RequestContext request) {
+        Content content = factory.newContent();
+        Element customerEl = factory.newElement(new QName("customer"));
+        customerEl.setAttributeValue(new QName("name"), entry.getName());
+
+        content.setValueElement(customerEl);
+        return content;
+    }
+
+    public Iterable<Customer> getEntries(RequestContext request) {
+        return customers.values();
+    }
+
+    public Customer getEntry(String resourceName, RequestContext request) throws ResponseContextException {
+        Integer id = getIdFromResourceName(resourceName);
+        return customers.get(id);
+    }
+
+    private Integer getIdFromResourceName(String resourceName) throws ResponseContextException {
+        int idx = resourceName.indexOf("-");
+        if (idx == -1) {
+            throw new ResponseContextException(404);
+        }
+        Integer id = new Integer(resourceName.substring(0, idx));
+        return id;
+    }
+
+    public Customer getEntryFromId(String id, RequestContext request) {
+        return customers.get(new Integer(id));
+    }
+
+    public String getId(Customer entry) {
+        // TODO: is this valid?
+        return ID_PREFIX + entry.getId();
+    }
+
+    public String getName(Customer entry) {
+        return entry.getId() + "-" + entry.getName().replaceAll(" ", "_");
+    }
+
+    public String getTitle(RequestContext request) {
+        return "Acme Customer Database";
+    }
+
+    public String getTitle(Customer entry) {
+        return entry.getName();
+    }
+
+    public org.joda.time.DateTime getUpdated(Customer entry) {
+        return org.joda.time.DateTime.now();
+    }
+
+    @Override
+    public void putEntry(Customer entry,
+                         String title,
+                         DateTime updated,
+                         List<Person> authors,
+                         String summary,
+                         Content content,
+                         RequestContext request) throws ResponseContextException {
+        contentToCustomer(content, entry);
+    }
+
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.test.server.customer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.http.ResponseType;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Collection;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Service;
+import org.apache.abdera2.model.Workspace;
+import org.apache.abdera2.protocol.client.AbderaClient;
+import org.apache.abdera2.protocol.client.AbderaClientResponse;
+import org.apache.abdera2.protocol.client.AbderaSession;
+import org.apache.abdera2.protocol.server.AtompubProvider;
+import org.apache.abdera2.protocol.server.impl.DefaultAtompubProvider;
+import org.apache.abdera2.protocol.server.impl.SimpleWorkspaceInfo;
+import org.apache.abdera2.test.JettyUtil;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.servlet.AbderaServlet;
+import org.apache.abdera2.writer.Writer;
+import org.apache.abdera2.writer.WriterFactory;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.joda.time.DateTime;
+import org.junit.After;
+import org.junit.Test;
+
+public class CustomerAdapterTest {
+
+    DefaultAtompubProvider customerProvider;
+
+    private void setupAbdera(String base) throws Exception {
+        customerProvider = new DefaultAtompubProvider(base);
+        CustomerAdapter ca = new CustomerAdapter("customers");
+        customerProvider
+          .addWorkspace(
+            SimpleWorkspaceInfo
+              .make()
+              .title("Customer Workspace")
+              .collection(ca)
+              .get());
+    }
+
+    @Test
+    public void testCustomerProvider() throws Exception {
+        setupAbdera("/");
+        initializeJetty("/");
+
+        runTests("/");
+    }
+
+    @Test
+    public void testCustomerProviderWithNonRootContextPath() throws Exception {
+        setupAbdera("/");
+        initializeJetty("/foo");
+        runTests("/foo/");
+    }
+
+    private void runTests(String base) throws IOException {
+        Abdera abdera = Abdera.getInstance();
+        Factory factory = abdera.getFactory();
+
+        AbderaClient client = new AbderaClient(abdera);
+        AbderaSession session = (AbderaSession) client.newSession();
+
+        String uri = "http://localhost:9002" + base;
+
+        // Service document test.
+
+        AbderaClientResponse res = (AbderaClientResponse) session.get(uri);
+        assertNotNull(res);
+        try {
+            assertEquals(200, res.getStatus());
+            assertEquals(ResponseType.SUCCESSFUL, res.getType());
+            assertTrue(MimeTypeHelper.isMatch(res.getContentType().toString(), Constants.APP_MEDIA_TYPE));
+
+            Document<Service> doc = res.getDocument();
+            Service service = doc.getRoot();
+            assertEquals(1, service.getWorkspaces().size());
+
+            Workspace workspace = service.getWorkspaces().get(0);
+            assertEquals(1, workspace.getCollections().size());
+
+            // Keep the loop in case we add other collections to the test.
+
+            for (Collection collection : workspace.getCollections()) {
+                if (collection.getTitle().equals("Acme Customer Database")) {
+                    String expected = uri + "customers";
+                    String actual = collection.getResolvedHref().toString();
+                    assertEquals(expected, actual);
+                }
+            }
+        } finally {
+            res.release();
+        }
+
+        // Testing of entry creation
+        IRI colUri = new IRI(uri).resolve("customers");
+
+        Entry entry = factory.newEntry();
+        entry.setTitle("This is ignored right now");
+        entry.setUpdated(DateTime.now());
+        entry.addAuthor("Acme Industries");
+        entry.setId(factory.newUuidUri());
+        entry.setSummary("Customer document");
+
+        Element customerEl = factory.newElement(new QName("customer"));
+        customerEl.setAttributeValue(new QName("name"), "Dan Diephouse");
+        entry.setContent(customerEl);
+
+        res = (AbderaClientResponse) session.post(
+          colUri.toString() + "?test=foo", 
+          entry,
+          session.getDefaultRequestOptions()
+            .contentType("application/atom+xml;type=entry")
+            .get());
+        assertEquals(201, res.getStatus());
+
+        // prettyPrint(abdera, res.getDocument());
+
+        IRI location = res.getLocation();
+        assertEquals(uri + "customers/1001-Dan_Diephouse", location.toString());
+
+        // GET the entry
+        res = (AbderaClientResponse) session.get(location.toString());
+        assertEquals(200, res.getStatus());
+        org.apache.abdera2.model.Document<Entry> entry_doc = res.getDocument();
+        // prettyPrint(abdera, entry_doc);
+        entry = entry_doc.getRoot();
+        assertEquals(uri + "customers/1001-Dan_Diephouse", entry_doc.getRoot().getEditLinkResolvedHref().toString());
+        res.release();
+        
+        // HEAD
+        res = (AbderaClientResponse) session.head(location.toString());
+        assertEquals(200, res.getStatus());
+        assertEquals(0, res.getContentLength());
+        res.release();
+
+        // Try invalid resources
+        res = (AbderaClientResponse) session.get(colUri + "/foobar");
+        assertEquals(404, res.getStatus());
+        res.release();
+
+        res = (AbderaClientResponse) session.head(colUri + "/foobar");
+        assertEquals(404, res.getStatus());
+        assertEquals(0, res.getContentLength());
+        res.release();
+
+        IRI badColUri = new IRI(uri).resolve("customersbad");
+        // GET the service doc
+        res = (AbderaClientResponse) session.get(colUri.toString());
+        assertEquals(200, res.getStatus());
+        res.release();
+        res = (AbderaClientResponse) session.get(badColUri.toString());
+        assertEquals(404, res.getStatus());
+        res.release();
+        client.shutdown();
+    }
+
+    protected void prettyPrint(Abdera abdera, Base doc) throws IOException {
+        WriterFactory factory = abdera.getWriterFactory();
+        Writer writer = factory.getWriter("prettyxml");
+        writer.writeTo(doc, System.out);
+        System.out.println();
+    }
+
+    @SuppressWarnings("serial")
+    private void initializeJetty(String contextPath) throws Exception {
+
+        JettyUtil.addServlet(new ServletHolder(new AbderaServlet() {
+            @Override
+            protected AtompubProvider createProvider() {
+                customerProvider.init(null);
+                return customerProvider;
+            }
+        }), "/*");
+        JettyUtil.setContextPath(contextPath);
+        JettyUtil.start();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        JettyUtil.stop();
+    }
+
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedAdapter.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedAdapter.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedAdapter.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,83 @@
+package org.apache.abdera2.test.server.multipart;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.mail.MessagingException;
+
+import org.apache.abdera2.parser.ParseException;
+import org.apache.abdera2.protocol.server.impl.AbstractAtompubProvider;
+import org.apache.abdera2.protocol.server.multipart.AbstractMultipartCollectionAdapter;
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.EmptyResponseContext;
+import org.apache.abdera2.common.protocol.TargetType;
+
+import com.google.common.base.Function;
+
+public class MultipartRelatedAdapter 
+  extends AbstractMultipartCollectionAdapter {
+
+    public MultipartRelatedAdapter(String href) {
+      super(href);
+      putHandler(TargetType.TYPE_COLLECTION,"POST",handlePost());
+    }
+  
+    @Override
+    public String getAuthor(RequestContext request) {
+        return "Acme Industries";
+    }
+
+    @Override
+    public String getId(RequestContext request) {
+        return "tag:example.org,2008:feed";
+    }
+
+    private Function<RequestContext,ResponseContext> handlePost() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          return AbstractAtompubProvider.IS_ATOM.apply(input) ?
+            NOT_ALLOWED.apply(input) :
+            postMedia().apply(input);
+        }
+      };
+    }
+    
+    public Function<RequestContext,ResponseContext> postMedia() {
+      return new Function<RequestContext,ResponseContext>() {
+        public ResponseContext apply(RequestContext input) {
+          try {
+              if (MimeTypeHelper.isMultipart(input.getContentType().toString())) {
+                  getMultipartRelatedData(input);
+              }
+              return new EmptyResponseContext(201);
+          } catch (ParseException pe) {
+              return new EmptyResponseContext(415, pe.getLocalizedMessage());
+          } catch (IOException ioe) {
+              return new EmptyResponseContext(500, ioe.getLocalizedMessage());
+          } catch (MessagingException e) {
+              return new EmptyResponseContext(500, e.getLocalizedMessage());
+          }
+        }
+      };
+    }
+
+    public String getTitle(RequestContext request) {
+        return "Acme Multipart/related adapter";
+    }
+
+    @SuppressWarnings("serial")
+    public Map<String, String> getAlternateAccepts(RequestContext request) {
+      if (accepts == null) {
+        accepts = new HashMap<String, String>() {{
+          put("video/*", null); /* doesn't accept multipart related */
+          put("image/jpg", ""); /* doesn't accept multipart related */
+          put("image/png", Constants.LN_ALTERNATE_MULTIPART_RELATED /* multipart-related */);
+        }};
+      }
+      return accepts;
+    }
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedTest.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedTest.java (added)
+++ abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedTest.java Wed Feb  1 17:54:54 2012
@@ -0,0 +1,127 @@
+package org.apache.abdera2.test.server.multipart;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+import org.apache.abdera2.common.protocol.RequestProcessor;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.servlet.AbderaServlet;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.protocol.client.AbderaClient;
+import org.apache.abdera2.protocol.client.AbderaClientResponse;
+import org.apache.abdera2.protocol.client.AbderaSession;
+import org.apache.abdera2.protocol.client.Client;
+import org.apache.abdera2.protocol.server.AtompubProvider;
+import org.apache.abdera2.protocol.server.impl.DefaultAtompubProvider;
+import org.apache.abdera2.protocol.server.impl.SimpleWorkspaceInfo;
+import org.apache.abdera2.protocol.server.processors.MultipartRelatedServiceRequestProcessor;
+import org.apache.abdera2.test.JettyUtil;
+import org.apache.http.entity.mime.content.InputStreamBody;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.junit.After;
+import org.junit.Test;
+
+import com.google.common.base.Function;
+
+@SuppressWarnings("serial")
+public class MultipartRelatedTest {
+
+    private void initializeJetty(String contextPath) throws Exception {
+
+        JettyUtil.addServlet(new ServletHolder(new AbderaServlet() {
+            @Override
+            protected AtompubProvider createProvider() {
+                DefaultAtompubProvider provider = new DefaultAtompubProvider("/");
+                Map<TargetType,Function<CollectionAdapter,? extends RequestProcessor>> map = 
+                  new HashMap<TargetType,Function<CollectionAdapter,? extends RequestProcessor>>();
+                map.put(TargetType.TYPE_SERVICE, 
+                  RequestProcessor.forClass(
+                    MultipartRelatedServiceRequestProcessor.class, 
+                    provider.getWorkspaceManager()));
+
+                provider.addRequestProcessors(map);            
+                MultipartRelatedAdapter ca = 
+                  new MultipartRelatedAdapter("media");  
+                provider
+                  .addWorkspace(
+                    SimpleWorkspaceInfo
+                      .make()
+                      .title("multipart/related Workspace")
+                      .collection(ca)
+                      .get());
+                provider.init(null);
+                return provider;
+            }
+        }), "/*");
+        JettyUtil.setContextPath(contextPath);
+        JettyUtil.start();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        JettyUtil.stop();
+    }
+
+    @Test
+    public void testServiceDocument() throws Exception {
+        initializeJetty("/");
+        Client client = new AbderaClient(Abdera.getInstance());
+        AbderaSession session = (AbderaSession) client.newSession();
+        AbderaClientResponse res = (AbderaClientResponse) session.get("http://localhost:9002/");
+        assertEquals(200, res.getStatus());
+        StringWriter sw = new StringWriter();
+        res.getDocument().writeTo(sw);
+        res.release();
+        assertTrue(sw.toString().contains("accept alternate=\"multipart-related\">image/png"));
+        assertTrue(sw.toString().contains("accept>video/*"));
+        assertTrue(sw.toString().contains("accept>image/jpg"));
+        client.shutdown();
+    }
+
+    @Test
+    public void testPostMedia() throws Exception {
+        execTest(201, "image/png");
+    }
+
+    @Test
+    public void testPostMediaInvalidContentType() throws Exception {
+        // collection doesn't accept multipart files with this content type
+        execTest(415, "image/jpg");
+    }
+
+    private void execTest(int status, String contentType) throws Exception {
+        initializeJetty("/");
+
+        Abdera abdera = Abdera.getInstance();
+        Factory factory = abdera.getFactory();
+
+        Client client = new AbderaClient(abdera);
+        AbderaSession session = (AbderaSession) client.newSession();
+
+        Entry entry = factory.newEntry();
+
+        entry.setTitle("my image");
+        entry.addAuthor("david");
+        entry.setId("tag:apache.org,2008:234534344");
+        entry.setSummary("multipart test");
+        entry.setContent(new IRI("cid:234234@example.com"), contentType);
+
+        AbderaClientResponse res =
+            (AbderaClientResponse) session.post(
+          "http://localhost:9002/media", 
+          entry, 
+          new InputStreamBody(this.getClass().getResourceAsStream("/info.png"),contentType,null));
+        assertEquals(status, res.getStatus());
+        
+        res.release();
+        client.shutdown();
+    }
+}

Propchange: abdera/abdera2-server/test/src/main/java/org/apache/abdera2/test/server/multipart/MultipartRelatedTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/abdera/adapter/sample.properties
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/abdera/adapter/sample.properties?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/abdera/adapter/sample.properties (added)
+++ abdera/abdera2-server/test/src/main/resources/abdera/adapter/sample.properties Wed Feb  1 17:54:54 2012
@@ -0,0 +1,5 @@
+subUri=sample
+adapterClassName=org.apache.abdera2.test.server.basic.SampleBasicAdapter
+title=title for any sample feed
+author=rayc
+configFile=dummyFileLocation
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/abdera/adapter/sample.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/activities/adapter/sample.properties
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/activities/adapter/sample.properties?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/activities/adapter/sample.properties (added)
+++ abdera/abdera2-server/test/src/main/resources/activities/adapter/sample.properties Wed Feb  1 17:54:54 2012
@@ -0,0 +1,5 @@
+subUri=sample
+adapterClassName=org.apache.abdera2.test.activities.server.SampleBasicAdapter
+title=title for any sample feed
+author=rayc
+configFile=dummyFileLocation
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/activities/adapter/sample.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/complete.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/complete.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/complete.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/complete.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom" 
+      xmlns:fh="http://purl.org/syndication/history/1.0">
+  <fh:complete />
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/complete.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/content.xslt
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/content.xslt?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/content.xslt (added)
+++ abdera/abdera2-server/test/src/main/resources/content.xslt Wed Feb  1 17:54:54 2012
@@ -0,0 +1,7 @@
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:a="http://example.org"
+  version="1.0" >
+  <xsl:output method="text" />
+  <xsl:template match = "/" >This is a test <xsl:value-of select="a:a/a:b/a:c" /></xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/content.xslt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/entry.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/entry.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/entry.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/entry.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<entry xmlns="http://www.w3.org/2005/Atom">
+<title>Atom-Powered Robots Run Amok</title>
+<link href="http://example.org/2003/12/13/atom03"/>
+<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+<updated>2003-12-13T18:30:02Z</updated>
+<summary>Some text.</summary>
+</entry>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/entry.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/feed.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/feed.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/feed.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/feed.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+<title>Example Feed</title>
+<link href="http://example.org/"/>
+<updated>2003-12-13T18:30:02Z</updated>
+<author>
+<name>John Doe</name>
+</author>
+<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+<entry>
+<title>Atom-Powered Robots Run Amok</title>
+<link href="http://example.org/2003/12/13/atom03"/>
+<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+<updated>2003-12-13T18:30:02Z</updated>
+<summary>Some text.</summary>
+</entry>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/feed.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/info.png
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/info.png?rev=1239237&view=auto
==============================================================================
Binary file - no diff available.

Propchange: abdera/abdera2-server/test/src/main/resources/info.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: abdera/abdera2-server/test/src/main/resources/key.jks
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/key.jks?rev=1239237&view=auto
==============================================================================
Binary file - no diff available.

Propchange: abdera/abdera2-server/test/src/main/resources/key.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: abdera/abdera2-server/test/src/main/resources/rss1.rdf
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/rss1.rdf?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/rss1.rdf (added)
+++ abdera/abdera2-server/test/src/main/resources/rss1.rdf Wed Feb  1 17:54:54 2012
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+
+<rdf:RDF 
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:content="http://purl.org/rss/1.0/modules/content/"
+  xmlns="http://purl.org/rss/1.0/"
+>
+
+  <channel rdf:about="http://www.xml.com/xml/news.rss">
+    <title>XML.com</title>
+    <link>http://xml.com/pub</link>
+    <dc:creator>James Snell (mailto:jasnell@example.com)</dc:creator>
+    <dc:subject>Anything</dc:subject>
+    <dc:identifier>foo</dc:identifier>
+    <dc:rights>Copyright 2007 Foo</dc:rights>
+    <dc:date>2000-01-01T12:00+00:00</dc:date>
+    <dc:language>en-US</dc:language>
+    <dc:contributor>John Doe (mailto:jdoe@example.org)</dc:contributor>
+    <description>
+      XML.com features a rich mix of information and services 
+      for the XML community.
+    </description>
+
+    <image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
+
+    <items>
+      <rdf:Seq>
+        <rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" />
+        <rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" />
+      </rdf:Seq>
+    </items>
+
+    <textinput rdf:resource="http://search.xml.com" />
+
+  </channel>
+  
+  <image rdf:about="http://xml.com/universal/images/xml_tiny.gif">
+    <title>XML.com</title>
+    <link>http://www.xml.com</link>
+    <url>http://xml.com/universal/images/xml_tiny.gif</url>
+  </image>
+  
+  <item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html">
+    <title>Processing Inclusions with XSLT</title>
+    <link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link>
+    <description>
+     Processing document inclusions with general XML tools can be 
+     problematic. This article proposes a way of preserving inclusion 
+     information through SAX-based processing.
+    </description>
+    <content:encoded>testing</content:encoded>
+    <dc:creator>Bob (mailto:bob@example.org)</dc:creator>
+  </item>
+  
+  <item rdf:about="http://xml.com/pub/2000/08/09/rdfdb/index.html">
+    <title>Putting RDF to Work</title>
+    <link>http://xml.com/pub/2000/08/09/rdfdb/index.html</link>
+    <description>
+     Tool and API support for the Resource Description Framework 
+     is slowly coming of age. Edd Dumbill takes a look at RDFDB, 
+     one of the most exciting new RDF toolkits.
+    </description>
+    <content:encoded>testing</content:encoded>
+    <dc:creator>Joe (mailto:joe@example.org)</dc:creator>
+  </item>
+
+  <textinput rdf:about="http://search.xml.com">
+    <title>Search XML.com</title>
+    <description>Search XML.com's XML collection</description>
+    <name>s</name>
+    <link>http://search.xml.com</link>
+  </textinput>
+
+</rdf:RDF>
\ No newline at end of file

Added: abdera/abdera2-server/test/src/main/resources/simple.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/simple.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/simple.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/simple.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+  
+  <title>Example Feed</title>
+  <link href="http://example.org/"/>
+  <updated>2003-12-13T18:30:02Z</updated>
+  <author>
+    <name>John Doe</name>
+  </author>
+  <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+
+  <entry>
+    <title>Atom-Powered Robots Run Amok</title>
+    <link href="http://example.org/2003/12/13/atom03"/>
+    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+    <updated>2003-12-13T18:30:02Z</updated>
+    <summary>Some text.</summary>
+  </entry>
+
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/simple.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/simpleEntry.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/simpleEntry.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/simpleEntry.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/simpleEntry.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<entry xmlns="http://www.w3.org/2005/Atom">
+  <!-- no content -->
+</entry>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/simpleEntry.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/simpleFeed.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/simpleFeed.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/simpleFeed.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/simpleFeed.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <!-- no content -->
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/simpleFeed.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/simpleService.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/simpleService.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/simpleService.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/simpleService.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<service xmlns="http://purl.org/atom/app#">
+  <!-- no content -->
+</service>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/simpleService.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/test.xslt
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/test.xslt?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/test.xslt (added)
+++ abdera/abdera2-server/test/src/main/resources/test.xslt Wed Feb  1 17:54:54 2012
@@ -0,0 +1,7 @@
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:a="http://www.w3.org/2005/Atom"
+  version="1.0" >
+  <xsl:output method="text" />
+  <xsl:template match = "/" >This is a test <xsl:value-of select="a:feed/a:id" /></xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/test.xslt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/utf8characters.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/utf8characters.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/utf8characters.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/utf8characters.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,9 @@
+<?xml version="1.0" ?>
+<entry xmlns="http://www.w3.org/2005/Atom"> 
+   <title>Item</title>
+   <content type="xhtml" xmlns:xhtml = "http://www.w3.org/1999/xhtml" >
+		<xhtml:div>
+			<p>This is simple XHTML &#x200;&#x201; contained within a xhtml:div tag.</p>
+		</xhtml:div>
+	</content>
+</entry>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/utf8characters.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/atom10_namespace.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/atom10_namespace.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/atom10_namespace.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/atom10_namespace.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,7 @@
+<!--
+Description: Atom namespace (official)
+Expect:      not bozo and feed['title'] == u'Example Atom'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <title>Example Atom</title>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/atom10_namespace.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_email.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_email.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_email.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_email.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,13 @@
+<!--
+Description: entry author email
+Expect:      not bozo and entries[0]['author_detail']['email'] == u'me@example.com'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <author>
+    <name>Example author</name>
+    <email>me@example.com</email>
+    <uri>http://example.com/</uri>
+  </author>
+</entry>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_email.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_name.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_name.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_name.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_name.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,13 @@
+<!--
+Description: entry author name
+Expect:      not bozo and entries[0]['author_detail']['name'] == u'Example author'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <author>
+    <name>Example author</name>
+    <email>me@example.com</email>
+    <uri>http://example.com/</uri>
+  </author>
+</entry>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_author_name.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,11 @@
+<!--
+Description: entry content base64-encoded
+Expect:      not bozo and entries[0]['content'][0]['value'] == u'Example <b>Atom</b>'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+  <content type="application/octet-stream">
+    RXhhbXBsZSA8Yj5BdG9tPC9iPg==
+  </content>
+</entry>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64_2.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64_2.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64_2.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64_2.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,11 @@
+<!--
+Description: entry content base64-encoded
+Expect:      not bozo and entries[0]['content'][0]['value'] == u'<p>History of the &lt;blink&gt; tag</p>'
+-->
+<feed xmlns="http://www.w3.org/2005/Atom">
+<entry>
+<content type="application/octet-stream">
+PHA+SGlzdG9yeSBvZiB0aGUgJmx0O2JsaW5rJmd0OyB0YWc8L3A+
+</content>
+</entry>
+</feed>
\ No newline at end of file

Propchange: abdera/abdera2-server/test/src/main/resources/www.feedparser.org/tests/wellformed/atom10/entry_content_base64_2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/contentsummary.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/contentsummary.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/contentsummary.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/contentsummary.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,88 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <id>tag:example.org,2006:/contentsummary</id>
+  <title>Content and Summary Test</title>
+  <updated>2006-01-01T12:12:12Z</updated>
+  <author><name>James</name></author>
+  <link href="http://www.snellspace.com" />
+  <link rel="self" href="http://www.snellspace.com/public/contentsummary.xml" />
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/1</id>
+    <title>Content with XML and summary</title>
+    <updated>2006-01-01T12:12:12Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <summary>If you're seeing this, your feed reader is doing a good thing. It doesn't understand the content so it is showing the text summary instead.</summary>
+    <content type="application/xml">
+      <a xmlns="tag:example.org,2006:foo"><b>If you're seeing this, something is wrong. 
+      <i>Your</i> feed <blink>reader</blink> is likely <p>trying</p> to render arbitrary <c>XML</c>
+      content as if it were HTML.</b></a>
+    </content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/2</id>
+    <title>Content with src attribute and summary</title>
+    <updated>2006-01-01T12:12:13Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <summary>If you're seeing this, your feed reader is doing a good thing. It doesn't understand the content so it is showing the text summary instead.</summary>
+    <content type="application/xml" src="http://www.snellspace.com/public/content.xml" />
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/3</id>
+    <title>Summary then Content</title>
+    <updated>2006-01-01T12:12:14Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <summary>Does it show summary?  It's ok if your reader shows this, but it is good to know whether or not your reader has a preference for showing the summary rather than the content</summary>
+    <content>Does it show content?  It's ok if your reader shows this, but it is good to know whether or not your reader has a preference for showing the content rather than the summary</content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/4</id>
+    <title>Content then Summary</title>
+    <updated>2006-01-01T12:12:15Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <content>Does it show content?  It's ok if your reader shows this, but it is good to know whether or not your reader has a preference for showing the content rather than the summary</content>
+    <summary>Does it show summary?  It's ok if your reader shows this, but it is good to know whether or not your reader has a preference for showing the summary rather than the content</summary>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/5</id>
+    <title>Content with iCal and Summary</title>
+    <updated>2006-01-01T12:12:16Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <summary>If you see this, your feed reader is doing a good thing.  The content contains iCalendar data that shouldn't be displayed. If the reader doesn't understand the content type, it likely should not attempt to display it if a text summary is available.</summary>
+    <content type="text/calendar">BEGIN:VCALENDAR
+END:VCALENDAR
+    </content>
+  </entry>
+  <entry>
+    <id>tag:example.org,2006:/contentsummary/6</id>
+    <title>Content with Base64 encoded image</title>
+    <updated>2006-01-01T12:12:17Z</updated>
+    <link href="http://www.snellspace.com/public/alternate" />
+    <summary>If you're seeing this, your feed reader is doing good.  Alternatively, your feed reader might be smart enough to Base64 decode the content and show you the GIF image.  If all you're seeing is a bunch of Base64 encoded stuff, then your feed reader is broken.</summary>
+    <content type="image/gif">
+R0lGODlhSwBLAKUfAOLcnp61x26Mm9HTx+7qx/z8/GRrQYeMa5Kpt3mUo7TG1NXMdOfp5MnV3re6
+ptrh4/b04KywmfP08eTq73d+W/v68u3w8vP2+IWeq/j5+Z+ki3qevMLEtJSZeoOkwP//////////
+////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////yH5BAEAAB8ALAAAAgBLAEkAAAb+wI9w
+SCwaj8ikcslsOomTyXNKrRYbGIE2ILV6v8aAdixINMBob4NMxqTfUwSbrIDblY/EfBy4+4kMDHl7
+Wx8PD39vAxoUBhwfWYR1BwYUEQOJVg6NBgcOmGJ7CYgDEZSVj5lNm5URDFB6c31EDxEGqKpJA40H
+mEcPkXxJHLy+uUIMHbhLDQEICl1KDrcax4aNHU3RQohLyZ3didMUxkoTAnVCGG5NHLepftMH4cwC
+Z0IICU+7jvEGHa+cKBAQTsGoJwwowUszLdsUMdHW3HOSsF+aAZ2q5KNljwqDRuWsPKBAIWAcdkLO
+pZvysSQYSvSeYEBQJMEsKhgPfLHlwAv+hpvqgE6xtfDJg39ffhZBQNPLAZdUlJmkMiHBSiEBUFY5
+6nDfPwAACECgarVI1i8TKIVcQmmB27dhxzLJM1GIAq1MJjRQEMCDBwwGqjnJSUAIBAIA3i4Qi8dM
+EYPbkDzg6xdBgAaHnsZMYsttYSKI4TI28oDgFdOSKXsIoIBegwQGejL52CH05yKIEy+IS2RNzNeb
+J/d91iDyBwWrD+hkglF2YgByjUDQvVvug7pDHmxr5vcykgl960xba8RWON23pYeuzo1vANYTJyhA
+sBpakgf07zVnorwIBLfQLUFAYeB5sMGBB652BnitmYMcF0PQ5g1SRqA3l4F+ZejXgVf+JdEAfR1+
+8NRURmAUARIEABidERNgqOGLG2BXRIEQGqGBAZsR4U5RuKl4RAAbvChkkMbZ5QECMg7hDnlD2MIk
+EboBUMQDQlZpYIgN+BViEfslwUiO0lloV5BWarhBU0JwV6MSXSLRAVRN/OfZB0CWCaMU+K0GJmkG
+nJjEmyQykWJhddqZ4QZRHLnnL5YoASgVD3hXqKEGSuHAAivO1eifcM7VVwCIKECmoUEKkeJu6eHR
+pxJfNjGZgkM0MKqdG9w0nY9LmKiEk0vId6SMk5a5QUy37pZrbErsqMR8Hmz5gaykOltsqjoa8OQH
+GPHIzadFDiHqrGYKZcSpAZIGUK7+SDy4aKwuHrpBOpmOC+CMTzTD2hAIvNsrX1L4iqCeQjwXLxFy
+jgWMHgkg0C03wZRRh3ZKcLfaNhMc4l+U1IJ23BwHHXHOHs4aghysKTlWBAZXnYoqEmsQUqQcorDI
+bLMxVdXhOTKuxx4RMIPMIiFapCPckd4hoRRHSZpKXVhCxLIHXoYALUAfQFqWNBFHZ9eRgBY6PQfU
+pQHdhwLFOZF1mqg1wZjXbKBJBNtkXJ0EU1d0/BDQSQ70tBUI4AVZFVXt4fbJe6yLxEZE/L0V2won
+AZ7TjVshhllQT8GX1U4c0kWgTQy0zVlVDDAPGk9ZIRHPgztxy0UZQYoO1uIy0Yit4au0/kRVQNlE
+BUh22NKV2WiqNAUlstkxzrVLoVSa3ETwo20a7ljERAD62JV2spUgD4bogRnuOVYJLCzEIp1ojwYD
+N1JQvGRbr6MEA7asas34lFDwfNOzTJ0EK73MDwgH9bvEj/SxvBIxohP3mx8Ab0EBDXDAJHQB3QcY
+wIED/sN886sFJ25xgA4wgiQN3GAlHEA7/wFiAA7QwFNuwUIKHEADn+CcCWdIwxoyIQgAOw==
+    </content>
+  </entry>
+</feed>

Propchange: abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/contentsummary.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/linktests.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/linktests.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/linktests.xml (added)
+++ abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/linktests.xml Wed Feb  1 17:54:54 2012
@@ -0,0 +1,93 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+  <id>tag:snellspace.com,2006:/atom/conformance/linktest/</id>
+  <title>Atom Link Tests</title>
+  <updated>2005-01-18T15:10:00Z</updated>
+  <author><name>James Snell</name></author>
+  <link href="http://www.intertwingly.net/wiki/pie/LinkConformanceTests" />
+  <link rel="self" href="http://www.snellspace.com/public/linktests.xml" />
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/1</id>
+    <title>Just a single Alternate Link</title>
+    <updated>2005-01-18T15:00:01Z</updated>
+    <summary>The aggregator should pick the second link as the alternate</summary>
+    <link rel="http://example.org/random"
+         href="http://www.snellspace.com/public/wrong" /> 
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link rel="http://example.org/random"
+         href="http://www.snellspace.com/public/wrong" /> 
+  </entry>
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/2</id>
+    <title>Two alternate links</title>
+    <updated>2005-01-18T15:00:02Z</updated>
+    <summary>The aggregator should pick either the second or third link below as the alternate</summary>
+    <link rel="ALTERNATE" href="http://www.snellspace.com/public/linktests/wrong" />    
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link type="text/plain" href="http://www.snellspace.com/public/linktests/alternate2" />
+    <link rel="ALTERNATE" href="http://www.snellspace.com/public/linktests/wrong" />
+  </entry>
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/3</id>
+    <title>One of each core link rel type</title>
+    <updated>2005-01-18T15:00:03Z</updated>
+    <summary>The aggregator should pick the first link as the alternate</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link rel="enclosure" href="http://www.snellspace.com/public/linktests/enclosure" length="19" />
+    <link rel="related" href="http://www.snellspace.com/public/linktests/related" />
+    <link rel="self" href="http://www.snellspace.com/public/linktests/self" />
+    <link rel="via" href="http://www.snellspace.com/public/linktests/via" />
+  </entry>  
+
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/4</id>
+    <title>One of each core link rel type + An additional alternate link</title>
+    <updated>2005-01-18T15:00:04Z</updated>
+    <summary>The aggregator should pick either the first or last links as the alternate. First link is likely better.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link rel="enclosure" href="http://www.snellspace.com/public/linktests/enclosure" length="19" />
+    <link rel="related" href="http://www.snellspace.com/public/linktests/related" />
+    <link rel="self" href="http://www.snellspace.com/public/linktests/self" />
+    <link rel="via" href="http://www.snellspace.com/public/linktests/via" />
+    <link rel="alternate" type="text/plain" href="http://www.snellspace.com/public/linktests/alternate2" />
+  </entry>  
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/5</id>
+    <title>Entry with a link relation registered by an extension</title>
+    <updated>2005-01-18T15:00:05Z</updated>
+    <summary>The aggregator should ignore the license link without throwing any errors.  The first link should be picked as the alternate.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link rel="license" href="http://www.snellspace.com/public/linktests/license" />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/6</id>
+    <title>Entry with a link relation identified by URI</title>
+    <updated>2005-01-18T15:00:06Z</updated>
+    <summary>The aggregator should ignore the second link without throwing any errors.  The first link should be picked as the alternate.</summary>
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+    <link rel="http://example.org" href="http://www.snellspace.com/public/linktests/example" />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/7</id>
+    <title>Entry with a link relation registered by an extension</title>
+    <updated>2005-01-18T15:00:05Z</updated>
+    <summary>The aggregator should ignore the license link without throwing any errors.  The second link should be picked as the alternate.</summary>
+    <link rel="license" href="http://www.snellspace.com/public/linktests/license" />
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+  </entry>
+  
+  <entry>
+    <id>tag:snellspace.com,2006:/atom/conformance/linktest/8</id>
+    <title>Entry with a link relation identified by URI</title>
+    <updated>2005-01-18T15:00:06Z</updated>
+    <summary>The aggregator should ignore the first link without throwing any errors.  The second link should be picked as the alternate.</summary>
+    <link rel="http://example.org" href="http://www.snellspace.com/public/linktests/example" />
+    <link href="http://www.snellspace.com/public/linktests/alternate" />
+  </entry>
+  
+</feed>

Propchange: abdera/abdera2-server/test/src/main/resources/www.snellspace.com/public/linktests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message