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());
}
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);
}
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());
}
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());
}
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()));
}
Aggregations