MediaRequestProcessor implements RequestProcessor { protected ResponseContext processMedia(RequestContext context, CollectionAdapter adapter) { String method = context.getMethod(); if (adapter instanceof MediaCollectionAdapter) { 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")) { return mcadapter.deleteMedia(context); } else if (method.equalsIgnoreCase("HEAD")) { return mcadapter.headMedia(context); } else if (method.equalsIgnoreCase("OPTIONS")) { return mcadapter.optionsMedia(context); } else { return null; } } else { return ProviderHelper.notallowed(context); } }  ResponseContext process(RequestContext context,
                                   WorkspaceManager workspaceManager,
                                   CollectionAdapter collectionAdapter);  }
@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); }