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;
017:
018: import org.aspectj.lang.JoinPoint;
019: import org.aspectj.lang.Signature;
020: import org.aspectj.lang.reflect.CodeSignature;
021: import org.aspectj.lang.reflect.SourceLocation;
022:
023: import java.lang.reflect.Method;
024:
025: /**
026: * A mock AspectJ <code>JoinPoint</code>.
027: *
028: * @author Ben Alex
029: * @version $Id: MockJoinPoint.java 1496 2006-05-23 13:38:33Z benalex $
030: */
031: public class MockJoinPoint implements JoinPoint {
032: //~ Instance fields ================================================================================================
033:
034: private Method beingInvoked;
035: private Object object;
036:
037: //~ Constructors ===================================================================================================
038:
039: public MockJoinPoint(Object object, Method beingInvoked) {
040: this .object = object;
041: this .beingInvoked = beingInvoked;
042: }
043:
044: private MockJoinPoint() {
045: }
046:
047: //~ Methods ========================================================================================================
048:
049: public Object[] getArgs() {
050: throw new UnsupportedOperationException("mock not implemented");
051: }
052:
053: public String getKind() {
054: throw new UnsupportedOperationException("mock not implemented");
055: }
056:
057: public Signature getSignature() {
058: throw new UnsupportedOperationException("mock not implemented");
059: }
060:
061: public SourceLocation getSourceLocation() {
062: throw new UnsupportedOperationException("mock not implemented");
063: }
064:
065: public StaticPart getStaticPart() {
066: return new MockStaticPart(beingInvoked);
067: }
068:
069: public Object getTarget() {
070: return object;
071: }
072:
073: public Object getThis() {
074: throw new UnsupportedOperationException("mock not implemented");
075: }
076:
077: public String toLongString() {
078: throw new UnsupportedOperationException("mock not implemented");
079: }
080:
081: public String toShortString() {
082: throw new UnsupportedOperationException("mock not implemented");
083: }
084:
085: //~ Inner Classes ==================================================================================================
086:
087: private class MockCodeSignature implements CodeSignature {
088: private Method beingInvoked;
089:
090: public MockCodeSignature(Method beingInvoked) {
091: this .beingInvoked = beingInvoked;
092: }
093:
094: private MockCodeSignature() {
095: }
096:
097: public Class getDeclaringType() {
098: throw new UnsupportedOperationException(
099: "mock not implemented");
100: }
101:
102: public String getDeclaringTypeName() {
103: throw new UnsupportedOperationException(
104: "mock not implemented");
105: }
106:
107: public Class[] getExceptionTypes() {
108: throw new UnsupportedOperationException(
109: "mock not implemented");
110: }
111:
112: public int getModifiers() {
113: throw new UnsupportedOperationException(
114: "mock not implemented");
115: }
116:
117: public String getName() {
118: return beingInvoked.getName();
119: }
120:
121: public String[] getParameterNames() {
122: throw new UnsupportedOperationException(
123: "mock not implemented");
124: }
125:
126: public Class[] getParameterTypes() {
127: return beingInvoked.getParameterTypes();
128: }
129:
130: public String toLongString() {
131: throw new UnsupportedOperationException(
132: "mock not implemented");
133: }
134:
135: public String toShortString() {
136: throw new UnsupportedOperationException(
137: "mock not implemented");
138: }
139: }
140:
141: private class MockStaticPart implements StaticPart {
142: private Method beingInvoked;
143:
144: public MockStaticPart(Method beingInvoked) {
145: this .beingInvoked = beingInvoked;
146: }
147:
148: private MockStaticPart() {
149: }
150:
151: public String getKind() {
152: throw new UnsupportedOperationException(
153: "mock not implemented");
154: }
155:
156: public Signature getSignature() {
157: return new MockCodeSignature(beingInvoked);
158: }
159:
160: public SourceLocation getSourceLocation() {
161: throw new UnsupportedOperationException(
162: "mock not implemented");
163: }
164:
165: public String toLongString() {
166: throw new UnsupportedOperationException(
167: "mock not implemented");
168: }
169:
170: public String toShortString() {
171: throw new UnsupportedOperationException(
172: "mock not implemented");
173: }
174: }
175: }
|