KeyStoreSpiTest.rar

  • PUDN用户
    了解作者
  • Unix_Linux
    开发工具
  • 2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2014-03-22 23:31
    上传日期
Key Store Spi for Java.
KeyStoreSpiTest.rar
  • KeyStoreSpiTest.java
    15.4KB
内容介绍
/** * @author Vera Y. Petrashkova * @version $Revision$ */ package org.apache.harmony.security.tests.java.security; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetClass; import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargets; import junit.framework.TestCase; import org.apache.harmony.security.tests.support.MyKeyStoreSpi; import org.apache.harmony.security.tests.support.MyLoadStoreParams; import java.io.IOException; import java.io.InputStream; import java.security.InvalidKeyException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.KeyStoreSpi; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PublicKey; import java.security.SignatureException; import java.security.UnrecoverableEntryException; import java.security.UnrecoverableKeyException; import java.security.KeyStore.LoadStoreParameter; import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.util.Date; @TestTargetClass(value=KeyStoreSpi.class, untestedMethods={ @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineAliases", args = {} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineContainsAlias", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineDeleteEntry", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineGetCertificate", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineGetCertificateAlias", args = {java.security.cert.Certificate.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineGetCertificateChain", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineGetCreationDate", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineGetKey", args = {java.lang.String.class, char[].class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineIsCertificateEntry", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineIsKeyEntry", args = {java.lang.String.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineLoad", args = {java.io.InputStream.class, char[].class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineSetCertificateEntry", args = { java.lang.String.class, java.security.cert.Certificate.class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineSetKeyEntry", args = { java.lang.String.class, byte[].class, java.security.cert.Certificate[].class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineSetKeyEntry", args = { java.lang.String.class, java.security.Key.class, char[].class, java.security.cert.Certificate[].class} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineSize", args = {} ), @TestTargetNew( level = TestLevel.NOT_NECESSARY, notes = "", method = "engineStore", args = {java.io.OutputStream.class, char[].class} )} ) /** * Tests for <code>KeyStoreSpi</code> constructor and methods * */ public class KeyStoreSpiTest extends TestCase { @SuppressWarnings("cast") @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "KeyStoreSpi", args = {} ) public void test_KeyStoreSpi() { try { MyKeyStoreSpi ksSpi = new MyKeyStoreSpi(); assertNotNull(ksSpi); assertTrue(ksSpi instanceof KeyStoreSpi); } catch (Exception ex) { fail("Unexpected exception"); } } /* * @tests java.security.KeyStore.engineEntryInstanceOf(String, Class<? * extends Entry>) */ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineEntryInstanceOf", args = {java.lang.String.class, java.lang.Class.class} ) public void test_engineEntryInstanceOf() throws Exception { KeyStoreSpi ksSpi = new MyKeyStoreSpi(); assertTrue(ksSpi.engineEntryInstanceOf( "test_engineEntryInstanceOf_Alias1", KeyStore.PrivateKeyEntry.class)); assertFalse(ksSpi.engineEntryInstanceOf( "test_engineEntryInstanceOf_Alias2", KeyStore.SecretKeyEntry.class)); assertFalse(ksSpi.engineEntryInstanceOf( "test_engineEntryInstanceOf_Alias3", KeyStore.TrustedCertificateEntry.class)); try { assertFalse(ksSpi.engineEntryInstanceOf(null, KeyStore.TrustedCertificateEntry.class)); } catch (NullPointerException e) { // ok } try { assertFalse(ksSpi.engineEntryInstanceOf( "test_engineEntryInstanceOf_Alias1", null)); } catch (NullPointerException e) { // ok } } @TestTargets({ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineLoad", args = {java.security.KeyStore.LoadStoreParameter.class} ), @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineStore", args = {java.security.KeyStore.LoadStoreParameter.class} ), @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineGetEntry", args = { java.lang.String.class, java.security.KeyStore.ProtectionParameter.class} ), @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineSetEntry", args = { java.lang.String.class, java.security.KeyStore.Entry.class, java.security.KeyStore.ProtectionParameter.class} ) }) public void testKeyStoteSpi01() throws IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableEntryException, KeyStoreException { KeyStoreSpi ksSp
评论
    相关推荐
    • 数据库课程设计
      一个数据库课程设计,access管理工具实现,用的是窗体!
    • 数据库课程设计
      数据库课程设计十分完整有需要的请下载啊谢谢
    • 数据库课程设计
      广东工业大学数据库课程设计,可视化界面连接数据库,delphi7
    • 数据库课程设计
      数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述
    • 数据库课程设计
      数据库课程设计》由周爱武、汪海威、肖云编著,遵循数据库课程设计的具体要求,独立于具体的数据库教材,从实际应用系统的需求着手,引导读者逐步完成数据库设计全过程,重点讲解数据库系统的需求分析、概念设计、...
    • 数据库课程设计
      数据库课程设计人事管理系统 数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计...
    • 数据库课程设计
      数据库课程设计,基于visual basic自助银行管理系统,界面很清爽,实用。同学都说好,所以就上传了!!!
    • 数据库课程设计
      数据库课程设计 里面有详细的文档资料 包含数据库一切的图 以及生成的数据库表文件 期末得分为优秀
    • 数据库课程设计
      可以作为数据库课程设计,也可以作为Java的课程设计,内容全面。本资源转载的,非本人原创。用于交流学习,特此申明!
    • 数据库课程设计
      数据库课程设计蓝天大学学生管理系统 2.商店信息管理系统 3.实验室机房收费管理系统 4.图书馆资料检索系统 5.企业库存管理系统 6.仓库管理系统 7.工程项目管理系统 8.教材管理系统 9.企业人事管理系统 10.企业财务...