abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1039944 - in /abdera/java/trunk/server/src: main/java/org/apache/abdera/protocol/server/processors/ test/java/org/apache/abdera/protocol/server/processors/
Date Sun, 28 Nov 2010 20:44:33 GMT
Author: antelder
Date: Sun Nov 28 20:44:33 2010
New Revision: 1039944

URL: http://svn.apache.org/viewvc?rev=1039944&view=rev
Log:
ABDERA-262: Apply patch from Nathan Reese to fix EntryRequestProcessor and MediaRequestProcessor
do not support POST

Added:
    abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/
    abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
  (with props)
    abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
  (with props)
Modified:
    abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessor.java
    abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessor.java

Modified: abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessor.java?rev=1039944&r1=1039943&r2=1039944&view=diff
==============================================================================
--- abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessor.java
(original)
+++ abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessor.java
Sun Nov 28 20:44:33 2010
@@ -44,6 +44,8 @@ public class EntryRequestProcessor imple
         String method = context.getMethod();
         if (method.equalsIgnoreCase("GET")) {
             return adapter.getEntry(context);
+        } else if (method.equalsIgnoreCase("POST")) {
+            return adapter.postEntry(context);
         } else if (method.equalsIgnoreCase("PUT")) {
             return adapter.putEntry(context);
         } else if (method.equalsIgnoreCase("DELETE")) {

Modified: abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessor.java?rev=1039944&r1=1039943&r2=1039944&view=diff
==============================================================================
--- abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessor.java
(original)
+++ abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessor.java
Sun Nov 28 20:44:33 2010
@@ -47,6 +47,8 @@ public class MediaRequestProcessor imple
             MediaCollectionAdapter mcadapter = (MediaCollectionAdapter)adapter;
             if (method.equalsIgnoreCase("GET")) {
                 return mcadapter.getMedia(context);
+            } else if (method.equalsIgnoreCase("POST")) {
+                return mcadapter.postMedia(context);
             } else if (method.equalsIgnoreCase("PUT")) {
                 return mcadapter.putMedia(context);
             } else if (method.equalsIgnoreCase("DELETE")) {

Added: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java?rev=1039944&view=auto
==============================================================================
--- abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
(added)
+++ abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
Sun Nov 28 20:44:33 2010
@@ -0,0 +1,110 @@
+package org.apache.abdera.protocol.server.processors;
+
+import static org.junit.Assert.*;
+
+import org.apache.abdera.protocol.server.CollectionAdapter;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
+import org.easymock.EasyMock;
+import org.junit.*;
+
+public class EntryRequestProcessorTest {
+
+        private EntryRequestProcessor processor = new EntryRequestProcessor();
+        private CollectionAdapter adapterMock = EasyMock.createStrictMock(CollectionAdapter.class);
+        private RequestContext requestMock = EasyMock.createStrictMock(RequestContext.class);
+        private ResponseContext responseMock = EasyMock.createStrictMock(ResponseContext.class);
+        
+        @After
+        public void verify() throws Exception {
+                EasyMock.verify(adapterMock);
+                EasyMock.verify(requestMock);
+                EasyMock.verify(responseMock);
+        }
+        
+        @Test
+        public void testProcessEntryGet() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("GET");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.getEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessEntryPost() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("POST");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.postEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessEntryPut() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("PUT");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.putEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessEntryDelete() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("DELETE");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.deleteEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessEntryHead() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("HEAD");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.headEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessEntryOptions() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("OPTIONS");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.optionsEntry(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processEntry(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        
+}

Propchange: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/EntryRequestProcessorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java?rev=1039944&view=auto
==============================================================================
--- abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
(added)
+++ abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
Sun Nov 28 20:44:33 2010
@@ -0,0 +1,110 @@
+package org.apache.abdera.protocol.server.processors;
+
+import static org.junit.Assert.*;
+
+import org.apache.abdera.protocol.server.MediaCollectionAdapter;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
+import org.easymock.EasyMock;
+import org.junit.*;
+
+public class MediaRequestProcessorTest {
+
+        private MediaRequestProcessor processor = new MediaRequestProcessor();
+        private MediaCollectionAdapter adapterMock = EasyMock.createStrictMock(MediaCollectionAdapter.class);
+        private RequestContext requestMock = EasyMock.createStrictMock(RequestContext.class);
+        private ResponseContext responseMock = EasyMock.createStrictMock(ResponseContext.class);
+        
+        @After
+        public void verify() throws Exception {
+                EasyMock.verify(adapterMock);
+                EasyMock.verify(requestMock);
+                EasyMock.verify(responseMock);
+        }
+        
+        @Test
+        public void testProcessMediaGet() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("GET");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.getMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessMediaPost() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("POST");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.postMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessMediaPut() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("PUT");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.putMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessMediaDelete() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("DELETE");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.deleteMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessMediaHead() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("HEAD");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.headMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        @Test
+        public void testProcessMediaOptions() {
+                EasyMock.replay(responseMock);
+                
+                EasyMock.expect(requestMock.getMethod()).andReturn("OPTIONS");
+                EasyMock.replay(requestMock);
+                
+                EasyMock.expect(adapterMock.optionsMedia(requestMock)).andReturn(responseMock);
+                EasyMock.replay(adapterMock);
+                
+                ResponseContext response = processor.processMedia(requestMock, adapterMock);
+                assertNotNull(response);
+        }
+        
+        
+}

Propchange: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/processors/MediaRequestProcessorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message