Skip to content

Commit d0c7122

Browse files
committed
Merge #137
Closes #136
1 parent f4057f2 commit d0c7122

File tree

6 files changed

+46
-1
lines changed

6 files changed

+46
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ The `cloud.aws.region` can be set to a region and will automatically use the rel
8484
* `ap-southeast-2`
8585
* `ap-northeast` (`ap-northeast-1`)
8686
* `eu-west` (`eu-west-1`)
87+
* `eu-central` (`eu-central-1`)
8788
* `sa-east` (`sa-east-1`).
8889

8990

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<elasticsearch.version>2.0.0-SNAPSHOT</elasticsearch.version>
3636
<lucene.version>5.0.0</lucene.version>
3737
<lucene.maven.version>5.0.0-snapshot-1641343</lucene.maven.version>
38-
<amazonaws.version>1.7.13</amazonaws.version>
38+
<amazonaws.version>1.9.4</amazonaws.version>
3939
<tests.output>onerror</tests.output>
4040
<tests.shuffle>true</tests.shuffle>
4141
<tests.output>onerror</tests.output>

src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ public synchronized AmazonEC2 client() {
121121
endpoint = "ec2.ap-northeast-1.amazonaws.com";
122122
} else if (region.equals("eu-west") || region.equals("eu-west-1")) {
123123
endpoint = "ec2.eu-west-1.amazonaws.com";
124+
} else if (region.equals("eu-central") || region.equals("eu-central-1")) {
125+
endpoint = "ec2.eu-central-1.amazonaws.com";
124126
} else if (region.equals("sa-east") || region.equals("sa-east-1")) {
125127
endpoint = "ec2.sa-east-1.amazonaws.com";
126128
} else {

src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ private static String getEndpoint(String region) {
183183
return "s3-eu-west-1.amazonaws.com";
184184
} else if ("eu-west-1".equals(region)) {
185185
return "s3-eu-west-1.amazonaws.com";
186+
} else if ("eu-central".equals(region)) {
187+
return "s3.eu-central-1.amazonaws.com";
188+
} else if ("eu-central-1".equals(region)) {
189+
return "s3.eu-central-1.amazonaws.com";
186190
} else if ("sa-east".equals(region)) {
187191
return "s3-sa-east-1.amazonaws.com";
188192
} else if ("sa-east-1".equals(region)) {

src/main/java/org/elasticsearch/repositories/s3/S3Repository.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ public S3Repository(RepositoryName name, RepositorySettings repositorySettings,
113113
region = "EU";
114114
} else if ("eu-west-1".equals(regionSetting)) {
115115
region = "EU";
116+
} else if ("eu-central".equals(regionSetting)) {
117+
region = "eu-central-1";
118+
} else if ("eu-central-1".equals(regionSetting)) {
119+
region = "eu-central-1";
116120
} else if ("sa-east".equals(regionSetting)) {
117121
region = "sa-east-1";
118122
} else if ("sa-east-1".equals(regionSetting)) {

src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,51 @@
2727
import org.elasticsearch.env.FailedToResolveConfigException;
2828
import org.elasticsearch.plugins.PluginsService;
2929
import org.elasticsearch.test.ElasticsearchIntegrationTest;
30+
import org.junit.After;
31+
import org.junit.Before;
3032

3133
import java.lang.annotation.Documented;
3234
import java.lang.annotation.Inherited;
3335
import java.lang.annotation.Retention;
3436
import java.lang.annotation.RetentionPolicy;
37+
import java.util.HashMap;
38+
import java.util.Map;
3539

3640
/**
3741
*
3842
*/
3943
public abstract class AbstractAwsTest extends ElasticsearchIntegrationTest {
4044

45+
/**
46+
* Those properties are set by the AWS SDK v1.9.4 and if not ignored,
47+
* lead to tests failure (see AbstractRandomizedTest#IGNORED_INVARIANT_PROPERTIES)
48+
*/
49+
private static final String[] AWS_INVARIANT_PROPERTIES = {
50+
"com.sun.org.apache.xml.internal.dtm.DTMManager",
51+
"javax.xml.parsers.DocumentBuilderFactory"
52+
};
53+
54+
private Map<String, String> properties = new HashMap<>();
55+
56+
@Before
57+
public void saveProperties() {
58+
for (String p : AWS_INVARIANT_PROPERTIES) {
59+
properties.put(p, System.getProperty(p));
60+
}
61+
}
62+
63+
@After
64+
public void restoreProperties() {
65+
for (String p : AWS_INVARIANT_PROPERTIES) {
66+
if (properties.get(p) != null) {
67+
System.setProperty(p, properties.get(p));
68+
} else {
69+
System.clearProperty(p);
70+
}
71+
}
72+
}
73+
74+
4175
/**
4276
* Annotation for tests that require AWS to run. AWS tests are disabled by default.
4377
* Look at README file for details on how to run tests

0 commit comments

Comments
 (0)