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.mock2; 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 * <ul class='seealso'> 024 * <li class='link'>{@doc juneau-rest-mock} 025 * </ul> 026 */ 027public class MockHttpSession implements HttpSession { 028 029 /** 030 * Creates a new HTTP session. 031 * 032 * @return A new HTTP session. 033 */ 034 public static MockHttpSession create() { 035 return new MockHttpSession(); 036 } 037 038 @Override /* HttpSession */ 039 public long getCreationTime() { 040 return 0; 041 } 042 043 @Override /* HttpSession */ 044 public String getId() { 045 return null; 046 } 047 048 @Override /* HttpSession */ 049 public long getLastAccessedTime() { 050 return 0; 051 } 052 053 @Override /* HttpSession */ 054 public ServletContext getServletContext() { 055 return null; 056 } 057 058 @Override /* HttpSession */ 059 public void setMaxInactiveInterval(int interval) { 060 } 061 062 @Override /* HttpSession */ 063 public int getMaxInactiveInterval() { 064 return 0; 065 } 066 067 @SuppressWarnings("deprecation") 068 @Override /* HttpSession */ 069 public HttpSessionContext getSessionContext() { 070 return null; 071 } 072 073 @Override /* HttpSession */ 074 public Object getAttribute(String name) { 075 return null; 076 } 077 078 @Override /* HttpSession */ 079 public Object getValue(String name) { 080 return null; 081 } 082 083 @Override /* HttpSession */ 084 public Enumeration<String> getAttributeNames() { 085 return null; 086 } 087 088 @Override /* HttpSession */ 089 public String[] getValueNames() { 090 return null; 091 } 092 093 @Override /* HttpSession */ 094 public void setAttribute(String name, Object value) { 095 } 096 097 @Override /* HttpSession */ 098 public void putValue(String name, Object value) { 099 } 100 101 @Override /* HttpSession */ 102 public void removeAttribute(String name) { 103 } 104 105 @Override /* HttpSession */ 106 public void removeValue(String name) { 107 } 108 109 @Override /* HttpSession */ 110 public void invalidate() { 111 } 112 113 @Override /* HttpSession */ 114 public boolean isNew() { 115 return false; 116 } 117}