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 18 package org.apache.harmony.xnet.tests.javax.net.ssl; 19 20 import java.net.Socket; 21 import java.security.Principal; 22 import java.security.PrivateKey; 23 import java.security.cert.X509Certificate; 24 25 import javax.net.ssl.X509ExtendedKeyManager; 26 27 import junit.framework.TestCase; 28 29 30 /** 31 * Tests for <code>X509ExtendedKeyManager</code> class constructors and methods. 32 */ 33 public class X509ExtendedKeyManagerTest extends TestCase { 34 35 public final void testChooseEngineClientAlias() { 36 X509ExtendedKeyManager km = new MyX509ExtendedKeyManager(); 37 if (km.chooseEngineClientAlias(null, null, null) != null) { 38 fail("non null result"); 39 } 40 } 41 42 public final void testChooseEngineServerAlias() { 43 X509ExtendedKeyManager km = new MyX509ExtendedKeyManager(); 44 if (km.chooseEngineServerAlias(null, null, null) != null) { 45 fail("non null result"); 46 } 47 } 48 49 } 50 51 class MyX509ExtendedKeyManager extends X509ExtendedKeyManager { 52 53 /* 54 * @see javax.net.ssl.X509KeyManager#chooseClientAlias(java.lang.String[], 55 * java.security.Principal[], java.net.Socket) 56 */ 57 public String chooseClientAlias(String[] keyType, Principal[] issuers, 58 Socket socket) { 59 return null; 60 } 61 62 /* 63 * @see javax.net.ssl.X509KeyManager#chooseServerAlias(java.lang.String, 64 * java.security.Principal[], java.net.Socket) 65 */ 66 public String chooseServerAlias(String keyType, Principal[] issuers, 67 Socket socket) { 68 return null; 69 } 70 71 /* 72 * @see javax.net.ssl.X509KeyManager#getCertificateChain(java.lang.String) 73 */ 74 public X509Certificate[] getCertificateChain(String alias) { 75 return null; 76 } 77 78 /* 79 * @see javax.net.ssl.X509KeyManager#getClientAliases(java.lang.String, 80 * java.security.Principal[]) 81 */ 82 public String[] getClientAliases(String keyType, Principal[] issuers) { 83 return null; 84 } 85 86 /* 87 * @see javax.net.ssl.X509KeyManager#getServerAliases(java.lang.String, 88 * java.security.Principal[]) 89 */ 90 public String[] getServerAliases(String keyType, Principal[] issuers) { 91 return null; 92 } 93 94 /* 95 * @see javax.net.ssl.X509KeyManager#getPrivateKey(java.lang.String) 96 */ 97 public PrivateKey getPrivateKey(String alias) { 98 return null; 99 } 100 101 } 102