use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CRLRevocationManager_initCRLCacheLocationTest method testInitCRLCacheLocation_locExistsAndNotADirectory.
public void testInitCRLCacheLocation_locExistsAndNotADirectory() throws Exception {
String crlLocation = UUID.randomUUID().toString();
File createFile = new File("target/" + crlLocation);
createFile.createNewFile();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.CRL_CACHE_LOCATION, "target/" + crlLocation));
CRLRevocationManager.initCRLCacheLocation();
assertNull(CRLRevocationManager.crlCacheLocation);
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CRLRevocationManager_initCRLCacheLocationTest method tearDown.
@Override
public void tearDown() {
CRLRevocationManager.getInstance().flush();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.CRL_CACHE_LOCATION, ""));
CRLRevocationManager.initCRLCacheLocation();
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_registerJCEProvidersTest method testRegisterJCEProviders_singleValidConfiguredProvider_providerNotAlreadyRegistered.
public void testRegisterJCEProviders_singleValidConfiguredProvider_providerNotAlreadyRegistered() {
Security.removeProvider("BC");
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER_CLASSES, "org.bouncycastle.jce.provider.BouncyCastleProvider"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES));
assertEquals("org.bouncycastle.jce.provider.BouncyCastleProvider", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES).getParamValue());
assertNull(Security.getProvider("BC"));
CryptoExtensions.registerJCEProviders();
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES));
assertEquals("org.bouncycastle.jce.provider.BouncyCastleProvider", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES).getParamValue());
assertNotNull(Security.getProvider("BC"));
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_registerJCEProvidersTest method testRegisterJCEProviders_multipleProviders_providerNotAlreadyRegistered.
public void testRegisterJCEProviders_multipleProviders_providerNotAlreadyRegistered() {
Security.removeProvider("BC");
Security.removeProvider("JunitMockProvider");
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER_CLASSES, "org.bouncycastle.jce.provider.BouncyCastleProvider,org.nhindirect.stagent.MockJCEProvider"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES));
assertEquals("org.bouncycastle.jce.provider.BouncyCastleProvider,org.nhindirect.stagent.MockJCEProvider", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES).getParamValue());
assertNull(Security.getProvider("BC"));
assertNull(Security.getProvider("JunitMockProvider"));
CryptoExtensions.registerJCEProviders();
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES));
assertEquals("org.bouncycastle.jce.provider.BouncyCastleProvider,org.nhindirect.stagent.MockJCEProvider", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER_CLASSES).getParamValue());
assertNotNull(Security.getProvider("BC"));
assertNotNull(Security.getProvider("JunitMockProvider"));
Security.removeProvider("JunitMockProvider");
}
use of org.nhindirect.stagent.options.OptionsParameter in project nhin-d by DirectProject.
the class CryptoExtensions_getJCEProviderNameForTypeAndAlgorithmTest method testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_foundProvider_assertProviderName.
public void testGetJCEProviderNameForTypeAndAlgorithm_configuredJCENames_foundProvider_assertProviderName() {
CryptoExtensions.registerJCEProviders();
OptionsManager.getInstance().setOptionsParameter(new OptionsParameter(OptionsParameter.JCE_PROVIDER, "BC"));
assertNotNull(OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER));
assertEquals("BC", OptionsManager.getInstance().getParameter(OptionsParameter.JCE_PROVIDER).getParamValue());
assertEquals("BC", CryptoExtensions.getJCEProviderNameForTypeAndAlgorithm("CertPathValidator", "PKIX"));
}
Aggregations