@Test public void processValidRecord() throws IOException { mapDriver.withInput(new Text("a"), new Text("ein")); mapDriver.withInput(new Text("a"), new Text("zwei")); mapDriver.withInput(new Text("c"), new Text("drei")); mapDriver.withOutput(new Text("a"), new Text("ein")); mapDriver.withOutput(new Text("a"), new Text("zwei")); mapDriver.withOutput(new Text("c"), new Text("drei")); mapDriver.runTest(); }
@Test public void testMapper() throws IOException, URISyntaxException { MapDriver<LongWritable, Text, Text, Text> mapDriver; JpylyzerMapper mapper = new JpylyzerMapper(); String name = "B400022028241-RT1/balloon.jp2"; mapDriver = MapDriver.newMapDriver(mapper); File testFolder = new File(Thread.currentThread().getContextClassLoader().getResource(name).toURI()) .getParentFile() .getParentFile() .getParentFile() .getParentFile(); File jpylyzerPath = new File(testFolder, "src/test/extras/jpylyzer-1.10.1/jpylyzer.py"); mapDriver .getConfiguration() .set( dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants.JPYLYZER_PATH, jpylyzerPath.getAbsolutePath()); String testFile = getAbsolutePath(name); mapDriver.withInput(new LongWritable(1), new Text(testFile)); mapDriver.withOutput( new Text(testFile), Utils.asText(JpylyzerMapper.jpylize(testFile, jpylyzerPath.getAbsolutePath()))); mapDriver.runTest(); }
@Test public void testMapper() throws IOException { mapDriver.withInput( new LongWritable(), new Text( "Wed Apr 24 23:04:58 2013 [SESSION 2954383360]: Scanning path '/Users/komamitsu/Library/Caches/com.avast.registration/Cache.db' started.")); mapDriver.withOutput(new Text("Apr 24"), new LongWritable(1)); mapDriver.runTest(); }
@Test public void testMapper() throws IOException { mapperDriver.withInput( new LongWritable(), new Text("item_a_id" + "\t" + "item_b_id" + "\t" + "2" + "\t" + "timestamp")); mapperDriver.withOutput( new Text("item_a_id" + "\t" + "item_b_id"), new Text("4.0" + "\t" + "timestamp")); // mapperDriver.runTest(); }
@Test(dataProvider = "simpleTest") public void simpleTest(String inString, String[] splits, int lineNum, int wordCount) throws IOException { mapDriver.withInput(new LongWritable(), new Text(inString)); for (String split : splits) { mapDriver.withOutput(new Text(split), new IntWritable(1)); } mapDriver.runTest(); }
@Test public void testSimplest() throws IOException { MapDriver<LongWritable, Text, Text, Text> mapDriver; JpylyzerMapper mapper = new JpylyzerMapper(); mapDriver = MapDriver.newMapDriver(mapper); mapDriver .getConfiguration() .set(dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants.JPYLYZER_PATH, "echo"); mapDriver.withInput(new LongWritable(1), new Text("ein")); mapDriver.withOutput(new Text("ein"), new Text("ein")); mapDriver.runTest(); }
@Test(dataProvider = "simpleTest") public void countersTest(String inString, String[] splits, int lineNum, int wordCount) throws IOException { mapDriver.withInput(new LongWritable(), new Text(inString)); for (String split : splits) { mapDriver.withOutput(new Text(split), new IntWritable(1)); } mapDriver.runTest(); Counters counters = mapDriver.getCounters(); assertEquals( counters.findCounter(WordCountWithTestsMapper.Status.LINES_NUM).getValue(), lineNum, "Wrong lines num!"); assertEquals( counters.findCounter(WordCountWithTestsMapper.Status.WORD_COUNT).getValue(), wordCount, "Wrong word count!"); }
@Test public void testMapper() throws IOException { mapDriver.withInput(new LongWritable(0), inputFilePath); mapDriver.withOutput(new LongWritable(0), outputdir); mapDriver.runTest(); }
@Test public void testMap() throws IOException { mapDriver.withInput(new LongWritable(1), new Text("Marco-Fabio,Luca,Gordon")); mapDriver.withInput(new LongWritable(2), new Text("Fabio-Nathalia,Marco")); mapDriver.withInput(new LongWritable(3), new Text("Luca-Nathalia,Marco")); mapDriver.withInput(new LongWritable(4), new Text("Nathalia-Fabio,Luca")); mapDriver.withInput(new LongWritable(5), new Text("Gordon-Marco")); mapDriver.withOutput(new Text("Marco"), new TextPair("Fabio", "FRIENDS")); mapDriver.withOutput(new Text("Marco"), new TextPair("Luca", "FRIENDS")); mapDriver.withOutput(new Text("Marco"), new TextPair("Gordon", "FRIENDS")); mapDriver.withOutput(new Text("Luca"), new TextPair("Fabio", "Marco")); mapDriver.withOutput(new Text("Fabio"), new TextPair("Luca", "Marco")); mapDriver.withOutput(new Text("Gordon"), new TextPair("Fabio", "Marco")); mapDriver.withOutput(new Text("Fabio"), new TextPair("Gordon", "Marco")); mapDriver.withOutput(new Text("Gordon"), new TextPair("Luca", "Marco")); mapDriver.withOutput(new Text("Luca"), new TextPair("Gordon", "Marco")); mapDriver.withOutput(new Text("Fabio"), new TextPair("Nathalia", "FRIENDS")); mapDriver.withOutput(new Text("Fabio"), new TextPair("Marco", "FRIENDS")); mapDriver.withOutput(new Text("Marco"), new TextPair("Nathalia", "Fabio")); mapDriver.withOutput(new Text("Nathalia"), new TextPair("Marco", "Fabio")); mapDriver.withOutput(new Text("Luca"), new TextPair("Nathalia", "FRIENDS")); mapDriver.withOutput(new Text("Luca"), new TextPair("Marco", "FRIENDS")); mapDriver.withOutput(new Text("Marco"), new TextPair("Nathalia", "Luca")); mapDriver.withOutput(new Text("Nathalia"), new TextPair("Marco", "Luca")); mapDriver.withOutput(new Text("Nathalia"), new TextPair("Fabio", "FRIENDS")); mapDriver.withOutput(new Text("Nathalia"), new TextPair("Luca", "FRIENDS")); mapDriver.withOutput(new Text("Luca"), new TextPair("Fabio", "Nathalia")); mapDriver.withOutput(new Text("Fabio"), new TextPair("Luca", "Nathalia")); mapDriver.withOutput(new Text("Gordon"), new TextPair("Marco", "FRIENDS")); mapDriver.runTest(); }
@Test public void testMapper() throws IOException { mapDriver.withInput(new LongWritable(), new Text(INPUT_LINE)); mapDriver.withOutput(new Text("ip1"), new IntWritable(40028)); mapDriver.runTest(); }