001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: * @author Aleksei Y. Semenov
020: * @version $Revision$
021: */package org.apache.harmony.security.tests.support;
022:
023: import java.security.Identity;
024: import java.security.IdentityScope;
025: import java.security.KeyManagementException;
026: import java.security.PublicKey;
027: import java.util.Enumeration;
028:
029: /**
030: * This is stub implementation of IdentityScope for testing purposes
031: */
032:
033: public class IdentityScopeStub extends IdentityScope {
034:
035: /**
036: * Stub constructor
037: */
038: public IdentityScopeStub() {
039: super ();
040: }
041:
042: /**
043: * Stub constructor
044: * @param name
045: */
046: public IdentityScopeStub(String name) {
047: super (name);
048: }
049:
050: /**
051: * Stub constructor
052: * @param name
053: * @param scope
054: * @throws KeyManagementException
055: */
056: public IdentityScopeStub(String name, IdentityScope scope)
057: throws KeyManagementException {
058: super (name, scope);
059: }
060:
061: /**
062: * Stub - returns 0
063: * @see java.security.IdentityScope#size()
064: */
065: public int size() {
066:
067: return 0;
068: }
069:
070: /**
071: * Stub - returns <code>this</code>
072: * @see java.security.IdentityScope#getIdentity(java.lang.String)
073: */
074: public Identity getIdentity(String name) {
075:
076: return this ;
077: }
078:
079: /**
080: * Stub - returns <code>this</code>
081: * @see java.security.IdentityScope#getIdentity(java.security.PublicKey)
082: */
083: public Identity getIdentity(PublicKey key) {
084: return this ;
085: }
086:
087: /**
088: * Stub - does nothing
089: * @see java.security.IdentityScope#addIdentity(java.security.Identity)
090: */
091: public void addIdentity(Identity identity)
092: throws KeyManagementException {
093:
094: }
095:
096: /**
097: * Stub - does nothing
098: * @see java.security.IdentityScope#removeIdentity(java.security.Identity)
099: */
100: public void removeIdentity(Identity identity)
101: throws KeyManagementException {
102:
103: }
104:
105: /**
106: * Stub - returns <code>null</code>
107: * @see java.security.IdentityScope#identities()
108: */
109: public Enumeration identities() {
110: return null;
111: }
112:
113: /**
114: * Sets the system's identity scope
115: * @param scope
116: */
117: public static void mySetSystemScope(IdentityScope scope) {
118:
119: IdentityScope.setSystemScope(scope);
120: }
121:
122: }
|