@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); }
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); } }
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); } } }
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); } }  }
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); }
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);  }