1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17
18package org.apache.harmony.xnet.tests.javax.net.ssl;
19
20import java.net.Socket;
21import java.security.Principal;
22import java.security.PrivateKey;
23import java.security.cert.X509Certificate;
24
25import javax.net.ssl.X509ExtendedKeyManager;
26
27import junit.framework.TestCase;
28
29
30/**
31 * Tests for <code>X509ExtendedKeyManager</code> class constructors and methods.
32 *
33 */
34public class X509ExtendedKeyManagerTest extends TestCase {
35
36    public final void testChooseEngineClientAlias() {
37        X509ExtendedKeyManager km = new MyX509ExtendedKeyManager();
38        if (km.chooseEngineClientAlias(null, null, null) != null) {
39            fail("non null result");
40        }
41    }
42
43    public final void testChooseEngineServerAlias() {
44        X509ExtendedKeyManager km = new MyX509ExtendedKeyManager();
45        if (km.chooseEngineServerAlias(null, null, null) != null) {
46            fail("non null result");
47        }
48    }
49
50}
51
52class MyX509ExtendedKeyManager extends X509ExtendedKeyManager {
53
54    /*
55     * @see javax.net.ssl.X509KeyManager#chooseClientAlias(java.lang.String[],
56     *      java.security.Principal[], java.net.Socket)
57     */
58    public String chooseClientAlias(String[] keyType, Principal[] issuers,
59            Socket socket) {
60        return null;
61    }
62
63    /*
64     * @see javax.net.ssl.X509KeyManager#chooseServerAlias(java.lang.String,
65     *      java.security.Principal[], java.net.Socket)
66     */
67    public String chooseServerAlias(String keyType, Principal[] issuers,
68            Socket socket) {
69        return null;
70    }
71
72    /*
73     * @see javax.net.ssl.X509KeyManager#getCertificateChain(java.lang.String)
74     */
75    public X509Certificate[] getCertificateChain(String alias) {
76        return null;
77    }
78
79    /*
80     * @see javax.net.ssl.X509KeyManager#getClientAliases(java.lang.String,
81     *      java.security.Principal[])
82     */
83    public String[] getClientAliases(String keyType, Principal[] issuers) {
84        return null;
85    }
86
87    /*
88     * @see javax.net.ssl.X509KeyManager#getServerAliases(java.lang.String,
89     *      java.security.Principal[])
90     */
91    public String[] getServerAliases(String keyType, Principal[] issuers) {
92        return null;
93    }
94
95    /*
96     * @see javax.net.ssl.X509KeyManager#getPrivateKey(java.lang.String)
97     */
98    public PrivateKey getPrivateKey(String alias) {
99        return null;
100    }
101
102}
103