EntryRequestProcessor implements RequestProcessor { protected ResponseContext processEntry(RequestContext context, CollectionAdapter adapter) { 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")) { return adapter.deleteEntry(context); } else if (method.equalsIgnoreCase("HEAD")) { return adapter.headEntry(context); } else if (method.equalsIgnoreCase("OPTIONS")) { return adapter.optionsEntry(context); } else { return null; } }  ResponseContext process(RequestContext context,
                                   WorkspaceManager workspaceManager,
                                   CollectionAdapter collectionAdapter);  }
@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); }