Skip to content

Commit

Permalink
Update to MRUnit 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite committed Jul 26, 2014
1 parent 7c2be37 commit f0c771b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion book/pom.xml
Expand Up @@ -20,7 +20,7 @@
<pig.version>0.9.1</pig.version>
<hive.version>0.8.0</hive.version>
<hbase.version>0.94.15</hbase.version>
<mrunit.version>0.8.1-incubating</mrunit.version>
<mrunit.version>1.1.0</mrunit.version>
<spark.version>1.0.1</spark.version>
<zookeeper.version>3.4.2</zookeeper.version>
<sqoop.version>1.4.0-incubating</sqoop.version>
Expand Down
6 changes: 3 additions & 3 deletions ch05/src/test/java/v1/MaxTemperatureMapperTest.java
Expand Up @@ -17,7 +17,7 @@ public void processesValidRecord() throws IOException, InterruptedException {
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1950"), new IntWritable(-11))
.runTest();
}
Expand All @@ -33,7 +33,7 @@ public void ignoresMissingTemperatureRecord() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.runTest();
}
// ^^ MaxTemperatureMapperTestV1Missing
Expand All @@ -46,7 +46,7 @@ public void processesMalformedTemperatureRecord() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1957"), new IntWritable(1957))
.runTest();
}
Expand Down
3 changes: 1 addition & 2 deletions ch05/src/test/java/v1/MaxTemperatureReducerTest.java
Expand Up @@ -14,8 +14,7 @@ public void returnsMaximumIntegerInValues() throws IOException,
InterruptedException {
new ReduceDriver<Text, IntWritable, Text, IntWritable>()
.withReducer(new MaxTemperatureReducer())
.withInputKey(new Text("1950"))
.withInputValues(Arrays.asList(new IntWritable(10), new IntWritable(5)))
.withInput(new Text("1950"), Arrays.asList(new IntWritable(10), new IntWritable(5)))
.withOutput(new Text("1950"), new IntWritable(10))
.runTest();
}
Expand Down
4 changes: 2 additions & 2 deletions ch05/src/test/java/v2/MaxTemperatureMapperTest.java
Expand Up @@ -15,7 +15,7 @@ public void processesValidRecord() throws IOException, InterruptedException {
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1950"), new IntWritable(-11))
.runTest();
}
Expand All @@ -29,7 +29,7 @@ public void ignoresMissingTemperatureRecord() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.runTest();
}
}
8 changes: 4 additions & 4 deletions ch05/src/test/java/v3/MaxTemperatureMapperTest.java
Expand Up @@ -15,7 +15,7 @@ public void processesValidRecord() throws IOException, InterruptedException {
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1950"), new IntWritable(-11))
.runTest();
}
Expand All @@ -29,7 +29,7 @@ public void processesPositiveTemperatureRecord() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1950"), new IntWritable(11))
.runTest();
}
Expand All @@ -43,7 +43,7 @@ public void ignoresMissingTemperatureRecord() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.runTest();
}

Expand All @@ -57,7 +57,7 @@ public void ignoresSuspectQualityRecord() throws IOException,
// Suspect quality ^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.runTest();
}

Expand Down
6 changes: 3 additions & 3 deletions ch05/src/test/java/v5/MaxTemperatureMapperTest.java
Expand Up @@ -19,7 +19,7 @@ public void parsesValidRecord() throws IOException, InterruptedException {
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withOutput(new Text("1950"), new IntWritable(-11))
.runTest();
}
Expand All @@ -33,7 +33,7 @@ public void parsesMissingTemperature() throws IOException,
// Temperature ^^^^^
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.runTest();
}
//vv MaxTemperatureMapperTestV5Malformed
Expand All @@ -47,7 +47,7 @@ public void parsesMalformedTemperature() throws IOException,
Counters counters = new Counters();
new MapDriver<LongWritable, Text, Text, IntWritable>()
.withMapper(new MaxTemperatureMapper())
.withInputValue(value)
.withInput(new LongWritable(0), value)
.withCounters(counters)
.runTest();
Counter c = counters.findCounter(MaxTemperatureMapper.Temperature.MALFORMED);
Expand Down
20 changes: 17 additions & 3 deletions hadoop-meta/pom.xml
Expand Up @@ -85,7 +85,7 @@ A module which allows the Hadoop dependencies to be specified by a Maven profile
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
<classifier>hadoop100</classifier>
<classifier>hadoop1</classifier>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -141,11 +141,18 @@ A module which allows the Hadoop dependencies to be specified by a Maven profile
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
<classifier>hadoop023</classifier>
<classifier>hadoop2</classifier>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -195,11 +202,18 @@ A module which allows the Hadoop dependencies to be specified by a Maven profile
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>${mrunit.version}</version>
<classifier>hadoop023</classifier>
<classifier>hadoop2</classifier>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down

0 comments on commit f0c771b

Please sign in to comment.