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.SwiftKeystone3ConfigurationReaderTest.java
@Test void readProjectScopedKeystone3Configuration() 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_PROJECT_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))) .project(Project.of(ProjectName.of(SCOPE_PROJECT_NAME))).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void readProjectOfDomainNameScopedKeystone3Configuration() 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_PROJECT_NAME, CONFIG_SCOPE_PROJECT_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))).project(Project .of(ProjectName.of(SCOPE_PROJECT_NAME), DomainName.of(SCOPE_PROJECT_DOMAIN_NAME))) .build());//from ww w. jav a 2 s . com }
From source file:org.apache.james.modules.objectstorage.SwiftKeystone3ConfigurationReaderTest.java
@Test void readProjectOfDomainIdScopedKeystone3Configuration() 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_PROJECT_NAME, CONFIG_SCOPE_PROJECT_DOMAIN_ID, 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))).project(Project .of(ProjectName.of(SCOPE_PROJECT_NAME), DomainId.of(SCOPE_PROJECT_DOMAIN_ID))) .build());/*from w ww.ja v a 2 s. c o m*/ }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void readBasicTempAuthConfiguration() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_TENANT_NAME))); assertThat(SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftTempAuthObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)).tenantName(TenantName.of(TENANT_NAME)) .userName(UserName.of(USER_NAME)).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void readTempAuthConfigurationWithRegion() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThat(SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftTempAuthObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)).tenantName(TenantName.of(TENANT_NAME)) .userName(UserName.of(USER_NAME)).region(Optional.of(Region.of(REGION))).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void readTempAuthConfigurationWithCustomTempAuthHeaders() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_TENANT_NAME, CONFIG_USER_HEADER_NAME, CONFIG_PASS_HEADER_NAME))); assertThat(SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isEqualTo(SwiftTempAuthObjectStorage.configBuilder().endpoint(URI.create(ENDPOINT)) .credentials(Credentials.of(CREDENTIALS)).tenantName(TenantName.of(TENANT_NAME)) .userName(UserName.of(USER_NAME)) .tempAuthHeaderUserName(UserHeaderName.of(USER_HEADER_NAME)) .tempAuthHeaderPassName(PassHeaderName.of(PASS_HEADER_NAME)).build()); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void failToReadSwiftTempAuthConfigurationWhenMissingEndpoint() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void failToReadSwiftTempAuthConfigurationWhenMissingCrendentials() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_USER_NAME, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void failToReadSwiftTempAuthConfigurationWhenMissingUserName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader(StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_TENANT_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }
From source file:org.apache.james.modules.objectstorage.SwiftTmpAuthConfigurationReaderTest.java
@Test void failToReadSwiftTempAuthConfigurationWhenMissingTenantName() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(new StringReader( StringUtils.joinWith("\n", CONFIG_ENDPOINT, CONFIG_CREDENTIALS, CONFIG_USER_NAME, CONFIG_REGION))); assertThatThrownBy(() -> SwiftTmpAuthConfigurationReader.readSwiftConfiguration(configuration)) .isInstanceOf(IllegalArgumentException.class); }