Browse files

no need for specific cat mapper since its a no-op, whch can be used e…

…lsewhere
  • Loading branch information...
1 parent 0298bb5 commit 11326c48a4027b25c1e6813808e64c42fb6e2726 @pcalcado committed Apr 1, 2012
View
4 ...ud/bananiser/utilities/cat/CatMapper.java → src/com/soundcloud/bananiser/NoOpMapper.java
@@ -1,4 +1,4 @@
-package com.soundcloud.bananiser.utilities.cat;
+package com.soundcloud.bananiser;
import java.io.IOException;
@@ -8,7 +8,7 @@
import com.soundcloud.bananiser.SeqFileCompatibleMapper;
@SuppressWarnings("rawtypes")
-public class CatMapper extends SeqFileCompatibleMapper {
+public class NoOpMapper extends SeqFileCompatibleMapper {
@Override
@SuppressWarnings("unchecked")
public void map(LongWritable key, Text value, Context context)
View
3 src/com/soundcloud/bananiser/utilities/cat/CatUtility.java
@@ -3,6 +3,7 @@
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Reducer;
+import com.soundcloud.bananiser.NoOpMapper;
import com.soundcloud.bananiser.NoOpReducer;
import com.soundcloud.bananiser.utilities.BananaUtility;
@@ -13,7 +14,7 @@ public CatUtility(String[] args) {
@Override
protected void addMapperAndReducerTo(Job job) {
- job.setMapperClass(CatMapper.class);
+ job.setMapperClass(NoOpMapper.class);
if (isCompressedOutput()) {
job.setReducerClass(Reducer.class);
} else {
View
8 ...ananiser/utilities/cat/CatMapperTest.java → .../soundcloud/bananiser/NoOpMapperTest.java
@@ -1,4 +1,4 @@
-package com.soundcloud.bananiser.utilities.cat;
+package com.soundcloud.bananiser;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
@@ -12,7 +12,7 @@
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.junit.Test;
-public class CatMapperTest {
+public class NoOpMapperTest {
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void shouldNotChangeContentsOfTextFile() throws IOException,
@@ -22,7 +22,7 @@ public void shouldNotChangeContentsOfTextFile() throws IOException,
"If you kiss me, kiss me with your silver eyes");
Context context = mock(Context.class);
- CatMapper cat = new CatMapper();
+ NoOpMapper cat = new NoOpMapper();
cat.map(key, originalText, context);
verify(context, only()).write(key, originalText);
}
@@ -38,7 +38,7 @@ public void shouldNotChangeContentsOfCompressedFile() throws IOException,
originalText.getBytes());
Context context = mock(Context.class);
- CatMapper cat = new CatMapper();
+ NoOpMapper cat = new NoOpMapper();
cat.map(key, compressedText, context);
verify(context, only()).write(key, originalText);
}
View
6 test/com/soundcloud/bananiser/utilities/cat/CatUtilityTest.java
@@ -7,21 +7,21 @@
import org.apache.hadoop.mapreduce.Job;
import org.junit.Test;
+import com.soundcloud.bananiser.NoOpMapper;
import com.soundcloud.bananiser.NoOpReducer;
public class CatUtilityTest {
@SuppressWarnings({ "unchecked" })
@Test
- public void shouldUseCatMapperAndIdentityReducer()
- throws ClassNotFoundException {
+ public void shouldUseNoOpMapperAndReducer() throws ClassNotFoundException {
String[] args = new String[] { "Cat", "--input", "some/in/a",
"--output", "some/out/c" };
Configuration config = new Configuration();
CatUtility catUtility = new CatUtility(args);
Job job = catUtility.createJob(config);
- assertThat(job.getMapperClass(), sameClassAs(CatMapper.class));
+ assertThat(job.getMapperClass(), sameClassAs(NoOpMapper.class));
assertThat(job.getReducerClass(), sameClassAs(NoOpReducer.class));
}
}

0 comments on commit 11326c4

Please sign in to comment.