001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.mock;
014
015import java.util.*;
016
017import javax.servlet.*;
018import javax.servlet.http.*;
019
020/**
021 * An implementation of {@link HttpSession} for mocking purposes.
022 *
023 * <h5 class='section'>See Also:</h5>
024 * <ul>
025 *    <li class='link'>{@doc juneau-rest-server.UnitTesting}
026 * </ul>
027 */
028public class MockHttpSession implements HttpSession {
029
030   /**
031    * Creates a new HTTP session.
032    *
033    * @return A new HTTP session.
034    */
035   public static MockHttpSession create() {
036      return new MockHttpSession();
037   }
038
039   @Override /* HttpSession */
040   public long getCreationTime() {
041      return 0;
042   }
043
044   @Override /* HttpSession */
045   public String getId() {
046      return null;
047   }
048
049   @Override /* HttpSession */
050   public long getLastAccessedTime() {
051      return 0;
052   }
053
054   @Override /* HttpSession */
055   public ServletContext getServletContext() {
056      return null;
057   }
058
059   @Override /* HttpSession */
060   public void setMaxInactiveInterval(int interval) {
061   }
062
063   @Override /* HttpSession */
064   public int getMaxInactiveInterval() {
065      return 0;
066   }
067
068   @SuppressWarnings("deprecation")
069   @Override /* HttpSession */
070   public HttpSessionContext getSessionContext() {
071      return null;
072   }
073
074   @Override /* HttpSession */
075   public Object getAttribute(String name) {
076      return null;
077   }
078
079   @Override /* HttpSession */
080   public Object getValue(String name) {
081      return null;
082   }
083
084   @Override /* HttpSession */
085   public Enumeration<String> getAttributeNames() {
086      return null;
087   }
088
089   @Override /* HttpSession */
090   public String[] getValueNames() {
091      return null;
092   }
093
094   @Override /* HttpSession */
095   public void setAttribute(String name, Object value) {
096   }
097
098   @Override /* HttpSession */
099   public void putValue(String name, Object value) {
100   }
101
102   @Override /* HttpSession */
103   public void removeAttribute(String name) {
104   }
105
106   @Override /* HttpSession */
107   public void removeValue(String name) {
108   }
109
110   @Override /* HttpSession */
111   public void invalidate() {
112   }
113
114   @Override /* HttpSession */
115   public boolean isNew() {
116      return false;
117   }
118}