use of org.apache.harmony.xnet.tests.support.KeyManagerFactorySpiImpl in project robovm by robovm.
the class KeyManagerFactorySpiTest method test_Constructor.
/**
* javax.net.ssl.KeyManagerFactorySpi#KeyManagerFactorySpi()
*/
public void test_Constructor() {
try {
KeyManagerFactorySpiImpl kmf = new KeyManagerFactorySpiImpl();
assertTrue(kmf instanceof KeyManagerFactorySpi);
} catch (Exception e) {
fail("Unexpected Exception " + e.toString());
}
}
use of org.apache.harmony.xnet.tests.support.KeyManagerFactorySpiImpl in project robovm by robovm.
the class KeyManagerFactorySpiTest method test_engineInit_02.
/**
* javax.net.ssl.KeyManagerFactorySpi#KengineInit(ManagerFactoryParameters spec)
*/
public void test_engineInit_02() {
KeyManagerFactorySpiImpl kmf = new KeyManagerFactorySpiImpl();
try {
kmf.engineInit(null);
fail("InvalidAlgorithmParameterException wasn't thrown");
} catch (InvalidAlgorithmParameterException iape) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of InvalidAlgorithmParameterException");
}
try {
char[] psw = "password".toCharArray();
Parameters pr = new Parameters(psw);
kmf.engineInit(pr);
} catch (Exception e) {
fail(e + " unexpected exception was thrown");
}
}
use of org.apache.harmony.xnet.tests.support.KeyManagerFactorySpiImpl in project robovm by robovm.
the class KeyManagerFactorySpiTest method test_engineInit_01.
/**
* javax.net.ssl.KeyManagerFactorySpi#KengineInit(KeyStore ks, char[] password)
*/
public void test_engineInit_01() {
KeyManagerFactorySpiImpl kmf = new KeyManagerFactorySpiImpl();
KeyStore ks;
char[] psw = "password".toCharArray();
try {
kmf.engineInit(null, null);
fail("NoSuchAlgorithmException wasn't thrown");
} catch (NoSuchAlgorithmException kse) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of NoSuchAlgorithmException");
}
try {
kmf.engineInit(null, psw);
fail("KeyStoreException wasn't thrown");
} catch (KeyStoreException uke) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of KeyStoreException");
}
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
kmf.engineInit(ks, null);
fail("UnrecoverableKeyException wasn't thrown");
} catch (UnrecoverableKeyException uke) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of UnrecoverableKeyException");
}
try {
KeyStore kst = KeyStore.getInstance(KeyStore.getDefaultType());
kst.load(null, null);
kmf.engineInit(kst, psw);
} catch (Exception e) {
fail("Unexpected exception " + e);
}
}
use of org.apache.harmony.xnet.tests.support.KeyManagerFactorySpiImpl in project robovm by robovm.
the class KeyManagerFactorySpiTest method test_engineGetKeyManagers.
/**
* javax.net.ssl.KeyManagerFactorySpi#engineGetKeyManagers()
*/
public void test_engineGetKeyManagers() {
KeyManagerFactorySpiImpl kmf = new KeyManagerFactorySpiImpl();
try {
KeyManager[] km = kmf.engineGetKeyManagers();
fail("IllegalStateException wasn't thrown");
} catch (IllegalStateException ise) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of IllegalStateException");
}
try {
char[] psw = "password".toCharArray();
Parameters pr = new Parameters(psw);
kmf.engineInit(pr);
KeyManager[] km = kmf.engineGetKeyManagers();
assertNull("Object is not NULL", km);
} catch (Exception e) {
fail(e + " unexpected exception was thrown");
}
}
Aggregations