use of java.security.cert.CertStore in project robovm by robovm.
the class myCertStore method testCertStore16.
/**
* Test for <code>getType()</code> method
*/
public void testCertStore16() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
if (!initParams()) {
return;
}
CertStore certS;
for (int i = 0; i < dValid.length; i++) {
certS = CertStore.getInstance(dValid[i], dParams);
assertEquals("Incorrect type", certS.getType(), dValid[i]);
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderCol);
assertEquals("Incorrect type", certS.getType(), dValid[i]);
} catch (IllegalArgumentException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderColName);
assertEquals("Incorrect type", certS.getType(), dValid[i]);
} catch (NoSuchProviderException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
}
}
use of java.security.cert.CertStore in project robovm by robovm.
the class myCertStore method testCertStore17.
/**
* Test for <code>getProvider()</code> method
*/
public void testCertStore17() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
if (!initParams()) {
return;
}
CertStore certS;
for (int i = 0; i < dValid.length; i++) {
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderCol);
assertEquals("Incorrect provider", certS.getProvider(), defaultProviderCol);
} catch (IllegalArgumentException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderColName);
assertEquals("Incorrect provider", certS.getProvider(), defaultProviderCol);
} catch (NoSuchProviderException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
}
}
use of java.security.cert.CertStore in project robovm by robovm.
the class myCertStore method testCertStore18.
/**
* Test for <code>getCertStoreParameters()</code> method
*/
public void testCertStore18() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
if (!initParams()) {
return;
}
CertStore certS;
for (int i = 0; i < dValid.length; i++) {
certS = CertStore.getInstance(dValid[i], dParams);
assertEquals("Incorrect parameters", ((CollectionCertStoreParameters) certS.getCertStoreParameters()).getCollection(), ((CollectionCertStoreParameters) dParams).getCollection());
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderCol);
assertEquals("Incorrect parameters", ((CollectionCertStoreParameters) certS.getCertStoreParameters()).getCollection(), ((CollectionCertStoreParameters) dParams).getCollection());
} catch (IllegalArgumentException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
try {
certS = CertStore.getInstance(dValid[i], dParams, defaultProviderColName);
assertEquals("Incorrect parameters", ((CollectionCertStoreParameters) certS.getCertStoreParameters()).getCollection(), ((CollectionCertStoreParameters) dParams).getCollection());
} catch (NoSuchProviderException e) {
fail("Unexpected IllegalArgumentException " + e.getMessage());
}
}
}
use of java.security.cert.CertStore in project robovm by robovm.
the class myCertStore method testCertStore02.
/**
* Test for
* <code>CertStore</code> constructor
* Assertion: returns CertStore object
*/
public void testCertStore02() throws InvalidAlgorithmParameterException, CertStoreException {
if (!initParams()) {
return;
}
MyCertStoreParameters pp = new MyCertStoreParameters();
CertStoreSpi spi = new MyCertStoreSpi(pp);
CertStore certS = new myCertStore(spi, dProv, dType, pp);
assertEquals("Incorrect algorithm", certS.getType(), dType);
assertEquals("Incorrect provider", certS.getProvider(), dProv);
assertTrue("Incorrect parameters", certS.getCertStoreParameters() instanceof MyCertStoreParameters);
try {
certS.getCertificates(null);
fail("CertStoreException must be thrown");
} catch (CertStoreException e) {
}
certS = new myCertStore(null, null, null, null);
assertNull("Incorrect algorithm", certS.getType());
assertNull("Incorrect provider", certS.getProvider());
assertNull("Incorrect parameters", certS.getCertStoreParameters());
try {
certS.getCertificates(null);
fail("NullPointerException must be thrown");
} catch (NullPointerException e) {
}
}
use of java.security.cert.CertStore in project robovm by robovm.
the class myCertStore method testCertStore14.
/**
* Test for method
* <code>getInstance(String type, CertStoreParameters params, Provider provider)</code>
* Assertion: return CertStore object
*/
public void testCertStore14() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
if (!initParams()) {
return;
}
CertStore certS;
for (int i = 0; i < dValid.length; i++) {
certS = CertStore.getInstance(dValid[i], dParams, dProv);
assertEquals("Incorrect type", certS.getType(), dValid[i]);
certS.getCertStoreParameters();
}
}
Aggregations