Search in sources :

Example 86 with IllegalConfigurationException

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
    }
}
Also used : HashMap(java.util.HashMap) IllegalConfigurationException(org.apache.qpid.server.configuration.IllegalConfigurationException) File(java.io.File)

Example 87 with IllegalConfigurationException

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);
}
Also used : IllegalConfigurationException(org.apache.qpid.server.configuration.IllegalConfigurationException) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject)

Aggregations

IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)87 HashMap (java.util.HashMap)31 IOException (java.io.IOException)25 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)20 File (java.io.File)15 UUID (java.util.UUID)12 ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)12 GeneralSecurityException (java.security.GeneralSecurityException)10 AbstractConfiguredObject (org.apache.qpid.server.model.AbstractConfiguredObject)9 LinkedHashMap (java.util.LinkedHashMap)7 Map (java.util.Map)7 ServerScopedRuntimeException (org.apache.qpid.server.util.ServerScopedRuntimeException)7 AccessControlException (java.security.AccessControlException)6 ArrayList (java.util.ArrayList)6 Protocol (org.apache.qpid.server.model.Protocol)5 UnknownAlternateBindingException (org.apache.qpid.server.virtualhost.UnknownAlternateBindingException)5 MalformedURLException (java.net.MalformedURLException)4 URL (java.net.URL)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)4 HashSet (java.util.HashSet)4