| package org.apache.archiva.redback.rest.services.mock; |
| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. 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. |
| */ |
| |
| import javax.ws.rs.container.ContainerRequestContext; |
| import javax.ws.rs.core.Cookie; |
| import javax.ws.rs.core.MediaType; |
| import javax.ws.rs.core.MultivaluedMap; |
| import javax.ws.rs.core.Request; |
| import javax.ws.rs.core.Response; |
| import javax.ws.rs.core.SecurityContext; |
| import javax.ws.rs.core.UriInfo; |
| import java.io.InputStream; |
| import java.net.URI; |
| import java.util.Collection; |
| import java.util.Date; |
| import java.util.List; |
| import java.util.Locale; |
| import java.util.Map; |
| |
| /** |
| * Created by Martin Stockhammer on 21.01.17. |
| * |
| * RequestContext used in unit tests. |
| */ |
| public class MockContainerRequestContext implements ContainerRequestContext { |
| |
| private boolean aborted = false; |
| |
| private UriInfo uriInfo; |
| |
| @Override |
| public Object getProperty(String s) { |
| return null; |
| } |
| |
| @Override |
| public Collection<String> getPropertyNames() { |
| return null; |
| } |
| |
| @Override |
| public void setProperty(String s, Object o) { |
| |
| } |
| |
| @Override |
| public void removeProperty(String s) { |
| |
| } |
| |
| @Override |
| public UriInfo getUriInfo() { |
| return uriInfo; |
| } |
| |
| public void setUriInfo(UriInfo uriInfo) { |
| this.uriInfo = uriInfo; |
| } |
| |
| @Override |
| public void setRequestUri(URI uri) { |
| |
| } |
| |
| @Override |
| public void setRequestUri(URI uri, URI uri1) { |
| |
| } |
| |
| @Override |
| public Request getRequest() { |
| return null; |
| } |
| |
| |
| @Override |
| public String getMethod() { |
| return null; |
| } |
| |
| @Override |
| public void setMethod(String s) { |
| |
| } |
| |
| @Override |
| public MultivaluedMap<String, String> getHeaders() { |
| return null; |
| } |
| |
| @Override |
| public String getHeaderString(String s) { |
| return null; |
| } |
| |
| @Override |
| public Date getDate() { |
| return null; |
| } |
| |
| @Override |
| public Locale getLanguage() { |
| return null; |
| } |
| |
| @Override |
| public int getLength() { |
| return 0; |
| } |
| |
| @Override |
| public MediaType getMediaType() { |
| return null; |
| } |
| |
| @Override |
| public List<MediaType> getAcceptableMediaTypes() { |
| return null; |
| } |
| |
| @Override |
| public List<Locale> getAcceptableLanguages() { |
| return null; |
| } |
| |
| @Override |
| public Map<String, Cookie> getCookies() { |
| return null; |
| } |
| |
| @Override |
| public boolean hasEntity() { |
| return false; |
| } |
| |
| @Override |
| public InputStream getEntityStream() { |
| return null; |
| } |
| |
| @Override |
| public void setEntityStream(InputStream inputStream) { |
| |
| } |
| |
| @Override |
| public SecurityContext getSecurityContext() { |
| return null; |
| } |
| |
| @Override |
| public void setSecurityContext(SecurityContext securityContext) { |
| |
| } |
| |
| @Override |
| public void abortWith(Response response) { |
| this.aborted=true; |
| } |
| |
| public boolean isAborted() { |
| return aborted; |
| } |
| } |