Search in sources :

Example 16 with Identity

use of java.security.Identity in project robovm by robovm.

the class IdentityScope2Test method test_size.

/**
     * java.security.IdentityScope#size()
     */
public void test_size() throws Exception {
    IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
    Identity id = new IdentitySubclass();
    id.setPublicKey(getPubKey());
    sub.addIdentity(id);
    assertEquals("Wrong size", 1, sub.size());
}
Also used : IdentitySubclass(org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass) Identity(java.security.Identity)

Example 17 with Identity

use of java.security.Identity in project robovm by robovm.

the class IdentityScope2Test method test_getIdentityLjava_lang_String.

/**
     * java.security.IdentityScope#getIdentity(java.lang.String)
     */
public void test_getIdentityLjava_lang_String() throws Exception {
    IdentityScopeSubclass sub = new IdentityScopeSubclass("test", new IdentityScopeSubclass());
    Identity id = new IdentitySubclass("test");
    id.setPublicKey(getPubKey());
    sub.addIdentity(id);
    Identity returnedId = sub.getIdentity("test");
    assertEquals("Returned Identity not the same as the added one", id, returnedId);
}
Also used : IdentitySubclass(org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass) Identity(java.security.Identity)

Example 18 with Identity

use of java.security.Identity in project robovm by robovm.

the class IdentityTest method testGetScope.

/**
     * verify Identity.getScope() returns identity's scope
     */
public void testGetScope() throws Exception {
    Identity i = new IdentityStub("testGetScope");
    assertNull(i.getScope());
    IdentityScope s = IdentityScope.getSystemScope();
    Identity i2 = new IdentityStub("testGetScope2", s);
    assertSame(s, i2.getScope());
}
Also used : IdentityScope(java.security.IdentityScope) IdentityStub(org.apache.harmony.security.tests.support.IdentityStub) Identity(java.security.Identity)

Example 19 with Identity

use of java.security.Identity in project robovm by robovm.

the class IdentityTest method testGetPublicKey.

/**
     * verify Identity.getPublicKey() returns public key
     */
public void testGetPublicKey() throws Exception {
    Identity i = new IdentityStub("testGetPublicKey");
    assertNull(i.getPublicKey());
    PublicKey pk = new PublicKeyStub("kkk", "Identity.testGetPublicKey", null);
    i.setPublicKey(pk);
    assertSame(pk, i.getPublicKey());
}
Also used : IdentityStub(org.apache.harmony.security.tests.support.IdentityStub) PublicKey(java.security.PublicKey) PublicKeyStub(org.apache.harmony.security.tests.support.PublicKeyStub) Identity(java.security.Identity)

Example 20 with Identity

use of java.security.Identity in project robovm by robovm.

the class IdentityTest method testIdentityStringIdentityScope.

/**
     * verify Identity(String, IdentityScope) creates instance with given name and in give scope
     */
public void testIdentityStringIdentityScope() throws Exception {
    IdentityScope s = IdentityScope.getSystemScope();
    Identity i = new IdentityStub("iii2", s);
    assertNotNull(i);
    assertEquals("iii2", i.getName());
    assertSame(s, i.getScope());
    assertSame(i, s.getIdentity(i.getName()));
}
Also used : IdentityScope(java.security.IdentityScope) IdentityStub(org.apache.harmony.security.tests.support.IdentityStub) Identity(java.security.Identity)

Aggregations

Identity (java.security.Identity)23 IdentityStub (org.apache.harmony.security.tests.support.IdentityStub)13 IdentitySubclass (org.apache.harmony.security.tests.java.security.Identity2Test.IdentitySubclass)8 PublicKeyStub (org.apache.harmony.security.tests.support.PublicKeyStub)7 KeyManagementException (java.security.KeyManagementException)5 CertificateStub (org.apache.harmony.security.tests.support.CertificateStub)4 PublicKey (java.security.PublicKey)3 IdentityScope (java.security.IdentityScope)2 FileInputStream (java.io.FileInputStream)1 Principal (java.security.Principal)1 Group (java.security.acl.Group)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 Vector (java.util.Vector)1 Subject (javax.security.auth.Subject)1 IdentityScopeSubclass (org.apache.harmony.security.tests.java.security.IdentityScope2Test.IdentityScopeSubclass)1 Test (org.junit.Test)1 Column (org.teiid.metadata.Column)1 MetadataFactory (org.teiid.metadata.MetadataFactory)1