Skip to content

Commit 73cf141

Browse files
committed
fix failing MRSuite (not using the proper Embedded ES port)
1 parent b8d9b37 commit 73cf141

File tree

7 files changed

+22
-4
lines changed

7 files changed

+22
-4
lines changed

src/test/java/org/elasticsearch/hadoop/integration/cascading/CascadingHadoopSearchTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
import org.elasticsearch.hadoop.integration.TestSettings;
2323
import org.junit.Test;
2424

25-
import cascading.flow.FlowConnectorProps;
2625
import cascading.flow.hadoop.HadoopFlowConnector;
27-
import cascading.operation.DebugLevel;
2826
import cascading.pipe.Pipe;
2927
import cascading.tap.Tap;
3028

src/test/java/org/elasticsearch/hadoop/integration/mr/MRNewApiSaveTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
import org.apache.hadoop.mapreduce.Job;
2727
import org.apache.hadoop.mapreduce.Mapper;
2828
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
29+
import org.elasticsearch.hadoop.integration.TestSettings;
2930
import org.elasticsearch.hadoop.mr.ESOutputFormat;
31+
import org.elasticsearch.hadoop.util.TestUtils;
3032
import org.elasticsearch.hadoop.util.WritableUtils;
3133
import org.junit.Test;
3234

@@ -54,6 +56,7 @@ protected void map(Object key, Object value, Context context) throws IOException
5456
@Test
5557
public void testBasicSave() throws Exception {
5658
Configuration conf = new Configuration();
59+
TestUtils.addProperties(conf, TestSettings.TESTING_PROPS);
5760
conf.setBoolean("mapred.used.genericoptionsparser", true);
5861
conf.set("mapred.job.tracker", "local");
5962
conf.set("es.resource", "mrnewapi/save");

src/test/java/org/elasticsearch/hadoop/integration/mr/MRNewApiSearchTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818
import org.apache.hadoop.conf.Configuration;
1919
import org.apache.hadoop.io.MapWritable;
2020
import org.apache.hadoop.io.Text;
21-
import org.apache.hadoop.mapred.JobClient;
2221
import org.apache.hadoop.mapreduce.Job;
22+
import org.elasticsearch.hadoop.integration.TestSettings;
2323
import org.elasticsearch.hadoop.mr.ESInputFormat;
24+
import org.elasticsearch.hadoop.util.TestUtils;
2425
import org.junit.Test;
2526

2627
public class MRNewApiSearchTest {
2728

2829
@Test
2930
public void testBasicSearch() throws Exception {
3031
Configuration conf = new Configuration();
32+
TestUtils.addProperties(conf, TestSettings.TESTING_PROPS);
3133
conf.setBoolean("mapred.used.genericoptionsparser", true);
3234
conf.set("mapred.job.tracker", "local");
3335
conf.set("es.resource", "mrnewapi/save/_search?q=*");

src/test/java/org/elasticsearch/hadoop/integration/mr/MROldApiSaveTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import org.apache.hadoop.mapred.Reporter;
3232
import org.apache.hadoop.mapred.TextInputFormat;
3333
import org.apache.hadoop.mapred.lib.IdentityReducer;
34+
import org.elasticsearch.hadoop.integration.TestSettings;
3435
import org.elasticsearch.hadoop.mr.ESOutputFormat;
36+
import org.elasticsearch.hadoop.util.TestUtils;
3537
import org.elasticsearch.hadoop.util.WritableUtils;
3638
import org.junit.Test;
3739

@@ -59,6 +61,7 @@ public void map(Object key, Object value, OutputCollector output, Reporter repor
5961
@Test
6062
public void testBasicSave() throws Exception {
6163
JobConf conf = new JobConf();
64+
TestUtils.addProperties(conf, TestSettings.TESTING_PROPS);
6265
conf.setInputFormat(TextInputFormat.class);
6366
conf.setOutputFormat(ESOutputFormat.class);
6467
conf.setMapOutputValueClass(MapWritable.class);

src/test/java/org/elasticsearch/hadoop/integration/mr/MROldApiSearchTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@
1919
import org.apache.hadoop.io.Text;
2020
import org.apache.hadoop.mapred.JobClient;
2121
import org.apache.hadoop.mapred.JobConf;
22+
import org.elasticsearch.hadoop.integration.TestSettings;
2223
import org.elasticsearch.hadoop.mr.ESInputFormat;
24+
import org.elasticsearch.hadoop.util.TestUtils;
2325
import org.junit.Test;
2426

2527
public class MROldApiSearchTest {
2628

2729
@Test
2830
public void testBasicSearch() throws Exception {
2931
JobConf conf = new JobConf();
32+
TestUtils.addProperties(conf, TestSettings.TESTING_PROPS);
3033
conf.setInputFormat(ESInputFormat.class);
3134
conf.setOutputFormat(PrintStreamOutputFormat.class);
3235
conf.setOutputKeyClass(Text.class);

src/test/java/org/elasticsearch/hadoop/integration/rest/RestSaveTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.elasticsearch.hadoop.integration.TestSettings;
2323
import org.elasticsearch.hadoop.rest.BufferedRestClient;
24-
import org.elasticsearch.hadoop.rest.TestRestClient;
2524
import org.junit.Test;
2625

2726
public class RestSaveTest {

src/test/java/org/elasticsearch/hadoop/util/TestUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
package org.elasticsearch.hadoop.util;
1717

1818
import java.io.File;
19+
import java.util.Map.Entry;
20+
import java.util.Properties;
1921

2022
import org.apache.commons.lang.reflect.FieldUtils;
2123
import org.apache.commons.logging.LogFactory;
24+
import org.apache.hadoop.conf.Configuration;
2225
import org.apache.hadoop.fs.permission.FsPermission;
2326
import org.apache.hadoop.mapreduce.JobSubmissionFiles;
2427

@@ -66,4 +69,11 @@ public static boolean delete(File file) {
6669
}
6770
return file.delete() & result;
6871
}
72+
73+
public static Configuration addProperties(Configuration conf, Properties props) {
74+
for (Entry<Object, Object> entry : props.entrySet()) {
75+
conf.set(entry.getKey().toString(), entry.getValue().toString());
76+
}
77+
return conf;
78+
}
6979
}

0 commit comments

Comments
 (0)