001: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
002: *
003: * Licensed under the Apache License, Version 2.0 (the "License");
004: * you may not use this file except in compliance with the License.
005: * 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
010: * distributed under the License is distributed on an "AS IS" BASIS,
011: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: * See the License for the specific language governing permissions and
013: * limitations under the License.
014: */
015:
016: package org.acegisecurity.adapters.jboss;
017:
018: import java.util.Hashtable;
019:
020: import javax.naming.Context;
021: import javax.naming.Name;
022: import javax.naming.NameParser;
023: import javax.naming.NamingEnumeration;
024: import javax.naming.NamingException;
025:
026: /**
027: * Mocks a <code>javax.naming.Context</code> and returns an <code>Object</code> when queried for address
028: * <code>java:comp/env/security/subject</code>.
029: *
030: * @author Ben Alex
031: * @version $Id: MockInitialContext.java 1496 2006-05-23 13:38:33Z benalex $
032: */
033: public class MockInitialContext implements Context {
034: //~ Instance fields ================================================================================================
035:
036: private Object object;
037:
038: //~ Constructors ===================================================================================================
039:
040: public MockInitialContext(Object object) {
041: this .object = object;
042: }
043:
044: private MockInitialContext() {
045: super ();
046: }
047:
048: //~ Methods ========================================================================================================
049:
050: public Object addToEnvironment(String propName, Object propVal)
051: throws NamingException {
052: throw new UnsupportedOperationException(
053: "mock method not implemented");
054: }
055:
056: public void bind(String name, Object obj) throws NamingException {
057: throw new UnsupportedOperationException(
058: "mock method not implemented");
059: }
060:
061: public void bind(Name name, Object obj) throws NamingException {
062: throw new UnsupportedOperationException(
063: "mock method not implemented");
064: }
065:
066: public void close() throws NamingException {
067: throw new UnsupportedOperationException(
068: "mock method not implemented");
069: }
070:
071: public String composeName(String name, String prefix)
072: throws NamingException {
073: throw new UnsupportedOperationException(
074: "mock method not implemented");
075: }
076:
077: public Name composeName(Name name, Name prefix)
078: throws NamingException {
079: throw new UnsupportedOperationException(
080: "mock method not implemented");
081: }
082:
083: public Context createSubcontext(String name) throws NamingException {
084: throw new UnsupportedOperationException(
085: "mock method not implemented");
086: }
087:
088: public Context createSubcontext(Name name) throws NamingException {
089: throw new UnsupportedOperationException(
090: "mock method not implemented");
091: }
092:
093: public void destroySubcontext(String name) throws NamingException {
094: throw new UnsupportedOperationException(
095: "mock method not implemented");
096: }
097:
098: public void destroySubcontext(Name name) throws NamingException {
099: throw new UnsupportedOperationException(
100: "mock method not implemented");
101: }
102:
103: public Hashtable getEnvironment() throws NamingException {
104: throw new UnsupportedOperationException(
105: "mock method not implemented");
106: }
107:
108: public String getNameInNamespace() throws NamingException {
109: throw new UnsupportedOperationException(
110: "mock method not implemented");
111: }
112:
113: public NameParser getNameParser(String name) throws NamingException {
114: throw new UnsupportedOperationException(
115: "mock method not implemented");
116: }
117:
118: public NameParser getNameParser(Name name) throws NamingException {
119: throw new UnsupportedOperationException(
120: "mock method not implemented");
121: }
122:
123: public NamingEnumeration list(String name) throws NamingException {
124: throw new UnsupportedOperationException(
125: "mock method not implemented");
126: }
127:
128: public NamingEnumeration list(Name name) throws NamingException {
129: throw new UnsupportedOperationException(
130: "mock method not implemented");
131: }
132:
133: public NamingEnumeration listBindings(String name)
134: throws NamingException {
135: throw new UnsupportedOperationException(
136: "mock method not implemented");
137: }
138:
139: public NamingEnumeration listBindings(Name name)
140: throws NamingException {
141: throw new UnsupportedOperationException(
142: "mock method not implemented");
143: }
144:
145: public Object lookup(String name) throws NamingException {
146: return this .object;
147: }
148:
149: public Object lookup(Name name) throws NamingException {
150: throw new UnsupportedOperationException(
151: "mock method not implemented");
152: }
153:
154: public Object lookupLink(String name) throws NamingException {
155: throw new UnsupportedOperationException(
156: "mock method not implemented");
157: }
158:
159: public Object lookupLink(Name name) throws NamingException {
160: throw new UnsupportedOperationException(
161: "mock method not implemented");
162: }
163:
164: public void rebind(String name, Object obj) throws NamingException {
165: throw new UnsupportedOperationException(
166: "mock method not implemented");
167: }
168:
169: public void rebind(Name name, Object obj) throws NamingException {
170: throw new UnsupportedOperationException(
171: "mock method not implemented");
172: }
173:
174: public Object removeFromEnvironment(String propName)
175: throws NamingException {
176: throw new UnsupportedOperationException(
177: "mock method not implemented");
178: }
179:
180: public void rename(String oldName, String newName)
181: throws NamingException {
182: throw new UnsupportedOperationException(
183: "mock method not implemented");
184: }
185:
186: public void rename(Name oldName, Name newName)
187: throws NamingException {
188: throw new UnsupportedOperationException(
189: "mock method not implemented");
190: }
191:
192: public void unbind(String name) throws NamingException {
193: throw new UnsupportedOperationException(
194: "mock method not implemented");
195: }
196:
197: public void unbind(Name name) throws NamingException {
198: throw new UnsupportedOperationException(
199: "mock method not implemented");
200: }
201: }
|