List of usage examples for org.apache.commons.configuration PropertiesConfiguration load
public synchronized void load(Reader in) throws ConfigurationException
From source file:org.apache.james.modules.objectstorage.SwiftKeystone2ConfigurationReaderTest.java
@Test void failToReadSwiftKeystone2ConfigurationWhenMissingCrendentials() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_USER_NAME, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftKeystone2ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone2ConfigurationReaderTest.java
@Test void failToReadSwiftKeystone2ConfigurationWhenMissingUserName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftKeystone2ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone2ConfigurationReaderTest.java
@Test void failToReadSwiftKeystone2ConfigurationWhenMissingTenantName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftKeystone2ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void readUnscopedKeystone3Configuration() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_USER_DOMAIN_NAME))); assertThat(SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftKeystone3ObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)) .identity(IdentityV3.of(DomainName.of(USER_DOMAIN_NAME), UserName.of(USER_NAME))).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void readUnscopedKeystone3ConfigurationWithRegion() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_USER_DOMAIN_NAME, CONFIG_REGION))); assertThat(SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftKeystone3ObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)) .identity(IdentityV3.of(DomainName.of(USER_DOMAIN_NAME), UserName.of(USER_NAME))) .region(Optional.of(Region.of(REGION))).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void failsToReadKeystone3ConfigurationWithoutEndpoint() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_USER_DOMAIN_NAME))); assertThatThrownBy(() -> SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void failsToReadKeystone3ConfigurationWithoutCredentials() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_USER_NAME, CONFIG_USER_DOMAIN_NAME))); assertThatThrownBy(() -> SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void failsToReadKeystone3ConfigurationWithoutUserName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_DOMAIN_NAME))); assertThatThrownBy(() -> SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void failsToReadKeystone3ConfigurationWithoutUserDomainName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME))); assertThatThrownBy(() -> SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void readDomainScopedKeystone3Configuration() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_USER_DOMAIN_NAME, CONFIG_SCOPE_DOMAIN_ID))); assertThat(SwiftKeystone3ConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftKeystone3ObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)) .identity(IdentityV3.of(DomainName.of(USER_DOMAIN_NAME), UserName.of(USER_NAME))) .domainId(DomainId.of(SCOPE_DOMAIN_ID)).build()); }