use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class NonJavaKeyStoreTest method testCreationOfTrustStoreFromInvalidPrivateKeyAndValidCertificate.
public void testCreationOfTrustStoreFromInvalidPrivateKeyAndValidCertificate() throws Exception {
File[] resources = extractResourcesFromTestKeyStore(true);
_testResources.addAll(Arrays.asList(resources));
File invalidPrivateKey = TestFileUtils.createTempFile(this, ".invalid.pk", "content");
_testResources.add(invalidPrivateKey);
Map<String, Object> attributes = new HashMap<>();
attributes.put(NonJavaKeyStore.NAME, "myTestTrustStore");
attributes.put("privateKeyUrl", invalidPrivateKey.toURI().toURL().toExternalForm());
attributes.put("certificateUrl", resources[1].toURI().toURL().toExternalForm());
attributes.put(NonJavaKeyStore.TYPE, "NonJavaKeyStore");
try {
_factory.create(KeyStore.class, attributes, _broker);
fail("Created key store from invalid certificate");
} catch (IllegalConfigurationException e) {
// pass
}
}
use of org.apache.qpid.server.configuration.IllegalConfigurationException in project qpid-broker-j by apache.
the class JsonFilePreferenceStoreFactoryService method createInstance.
@Override
public PreferenceStore createInstance(final ConfiguredObject<?> parent, final Map<String, Object> preferenceStoreAttributes) {
final Object path = preferenceStoreAttributes.get(PATH);
if (path == null || !(path instanceof String)) {
throw new IllegalConfigurationException("JsonFilePreferenceStore requires path");
}
final String posixFilePermissions = parent.getContextValue(String.class, SystemConfig.POSIX_FILE_PERMISSIONS);
return new JsonFilePreferenceStore((String) path, posixFilePermissions);
}
Aggregations