Skip to content

Instantly share code, notes, and snippets.

//create cassandra connection, please see how I do connect to cluster
private Cluster buildCluster(){
Cluster.Builder builder = Cluster.builder();
connectionSettings.getCassandraAddresses().forEach(builder::addContactPoint);
if(connectionSettings.getMinPoolSize() !=null){
builder.withPoolingOptions(createPoolingOptions());
}
import lombok.Builder;
import lombok.Data;
import lombok.NonNull;
@Data
public class Visitor {
private String visitorId;
private Integer siteId;
private Long visitTs;
package ru.develbureau.mrtesting.sequencefile;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.GzipCodec;
import org.apache.hadoop.util.ReflectionUtils;
@seregasheypak
seregasheypak / gist:5425807
Created April 20, 2013 12:18
MapReduceDriver for unit-testing
package ru.develbureau.mrtesting.mapreduce;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mrunit.mapreduce.MapReduceDriver;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ru.develbureau.mrtesting.model.LoggedRequest;
import ru.develbureau.mrtesting.parser.ApacheLogParser;
@seregasheypak
seregasheypak / gist:5391341
Created April 15, 2013 21:13
A concrete class for Apache log parsing mapper, combiner, reducer
package ru.develbureau.mrtesting.mapreduce.itest;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
@seregasheypak
seregasheypak / gist:5391266
Created April 15, 2013 21:01
A base test class
package ru.develbureau.mrtesting.mapreduce.minimrcluster;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.hadoop.mapreduce.Job;