bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnowl...@apache.org
Subject [05/11] bigtop git commit: BIGTOP-1984. Extract samplers library from BigPetStore data generator
Date Tue, 25 Aug 2015 14:21:39 GMT
http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSampler.java
new file mode 100644
index 0000000..4b746b2
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSampler.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.PetSpecies;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+
+public class CustomerTransactionParametersSampler implements Sampler<CustomerTransactionParameters>
+{
+	final private Sampler<Integer> nPetsSampler;
+	final private Sampler<PetSpecies> petSpeciesSampler;
+	final private Sampler<Double> purchaseTriggerTimeSampler;
+	final private Sampler<Double> transactionTriggerTimeSampler;
+
+	public CustomerTransactionParametersSampler(Sampler<Integer> nPetsSampler,
+			Sampler<PetSpecies> petSpeciesSampler,
+			Sampler<Double> purchaseTriggerTimeSampler,
+			Sampler<Double> transactionTriggerTimeSampler)
+	{
+
+		this.nPetsSampler = nPetsSampler;
+		this.petSpeciesSampler = petSpeciesSampler;
+		this.purchaseTriggerTimeSampler = purchaseTriggerTimeSampler;
+		this.transactionTriggerTimeSampler = transactionTriggerTimeSampler;
+	}
+
+	protected void generatePets(CustomerTransactionParametersBuilder builder) throws Exception
+	{
+		int nPets = this.nPetsSampler.sample();
+
+		for(int i = 0; i < nPets; i++)
+		{
+			PetSpecies species = this.petSpeciesSampler.sample();
+			builder.addPet(species);
+		}
+	}
+
+	public CustomerTransactionParameters sample() throws Exception
+	{
+		CustomerTransactionParametersBuilder builder = new CustomerTransactionParametersBuilder();
+
+		this.generatePets(builder);
+		builder.setAveragePurchaseTriggerTime(this.purchaseTriggerTimeSampler.sample());
+		builder.setAverageTransactionTriggerTime(this.transactionTriggerTimeSampler.sample());
+
+		return builder.build();
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSamplerBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSamplerBuilder.java
new file mode 100644
index 0000000..88b1d1f
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/CustomerTransactionParametersSamplerBuilder.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.Arrays;
+
+import org.apache.bigtop.datagenerators.bigpetstore.Constants;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.PetSpecies;
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.BoundedMultiModalGaussianSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.RouletteWheelSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.UniformIntSampler;
+
+public class CustomerTransactionParametersSamplerBuilder
+{
+	final private SeedFactory seedFactory;
+
+	public CustomerTransactionParametersSamplerBuilder(SeedFactory seedFactory)
+	{
+		this.seedFactory = seedFactory;
+	}
+
+	public Sampler<CustomerTransactionParameters> build()
+	{
+		Sampler<Integer> nPetsSampler = new UniformIntSampler(Constants.MIN_PETS, Constants.MAX_PETS, seedFactory);
+
+		Sampler<PetSpecies> petSpeciesSampler = RouletteWheelSampler.createUniform(Arrays.asList(PetSpecies.values()), seedFactory);
+
+		Sampler<Double> transactionTriggerTimeSampler = new BoundedMultiModalGaussianSampler(Constants.TRANSACTION_TRIGGER_TIME_GAUSSIANS,
+					Constants.TRANSACTION_TRIGGER_TIME_MIN, Constants.TRANSACTION_TRIGGER_TIME_MAX,
+					seedFactory);
+
+		Sampler<Double> purchaseTriggerTimeSampler = new BoundedMultiModalGaussianSampler(Constants.PURCHASE_TRIGGER_TIME_GAUSSIANS,
+				Constants.PURCHASE_TRIGGER_TIME_MIN, Constants.PURCHASE_TRIGGER_TIME_MAX,
+				seedFactory);
+
+		return new CustomerTransactionParametersSampler(nPetsSampler, petSpeciesSampler,
+				transactionTriggerTimeSampler, purchaseTriggerTimeSampler);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryInventory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryInventory.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryInventory.java
new file mode 100644
index 0000000..3fdacbd
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryInventory.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.bigpetstore.Constants;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Product;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+
+public class ProductCategoryInventory
+{
+	private ProductCategoryUsageTrajectory trajectory;
+	private ProductCategoryUsageSimulator simulator;
+
+	public ProductCategoryInventory(ProductCategory productCategory, CustomerTransactionParameters parameters,
+			SeedFactory seedFactory)
+	{
+
+		double amountUsedAverage = productCategory.getBaseAmountUsedAverage() * parameters.countPetsBySpecies(productCategory.getApplicableSpecies());
+		double amountUsedVariance = productCategory.getBaseAmountUsedVariance() * parameters.countPetsBySpecies(productCategory.getApplicableSpecies());
+
+		trajectory = new ProductCategoryUsageTrajectory(0.0, 0.0);
+		simulator = new ProductCategoryUsageSimulator(productCategory.getDailyUsageRate(),
+				amountUsedAverage, amountUsedVariance, seedFactory);
+	}
+
+	public void simulatePurchase(double time, Product product) throws Exception
+	{
+		double amountPurchased = product.getFieldValueAsDouble(Constants.PRODUCT_QUANTITY);
+
+		double amountRemainingBeforePurchase = trajectory.amountAtTime(time);
+
+		trajectory = simulator.simulate(time, amountRemainingBeforePurchase + amountPurchased);
+	}
+
+	public double findExhaustionTime()
+	{
+		return trajectory.getLastTime();
+	}
+
+	public double findRemainingAmount(double time)
+	{
+		return trajectory.amountAtTime(time);
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageSimulator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageSimulator.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageSimulator.java
new file mode 100644
index 0000000..cfefa16
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageSimulator.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.ExponentialSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.GaussianSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+
+public class ProductCategoryUsageSimulator
+{
+	final private double amountUsedAverage;
+	final private double amountUsedVariance;
+
+	final private Sampler<Double> timestepSampler;
+	final private Sampler<Double> R;
+
+	public ProductCategoryUsageSimulator(double dailyUsageRate, double amountUsedAverage,
+			double amountUsedVariance, SeedFactory seedFactory)
+	{
+		this.amountUsedAverage = amountUsedAverage;
+		this.amountUsedVariance = amountUsedVariance;
+
+		timestepSampler = new ExponentialSampler(dailyUsageRate, seedFactory);
+		R = new GaussianSampler(0.0, 1.0, seedFactory);
+	}
+
+	private void step(ProductCategoryUsageTrajectory trajectory) throws Exception
+	{
+		// given in days since last usage
+		double timestep = timestepSampler.sample();
+
+		double r = R.sample();
+
+		// given in units per day
+		double usageAmount = this.amountUsedAverage * timestep +
+				Math.sqrt(this.amountUsedVariance * timestep) * r;
+
+		// can't use a negative amount
+		usageAmount = Math.max(usageAmount, 0.0);
+
+		double remainingAmount = Math.max(0.0, trajectory.getLastAmount() - usageAmount);
+		double time = trajectory.getLastTime() + timestep;
+
+		trajectory.append(time, remainingAmount);
+	}
+
+	public ProductCategoryUsageTrajectory simulate(double initialTime, double initialAmount) throws Exception
+	{
+		ProductCategoryUsageTrajectory trajectory = new ProductCategoryUsageTrajectory(initialTime, initialAmount);
+
+		while(trajectory.getLastAmount() > 0.0)
+		{
+			step(trajectory);
+		}
+
+		return trajectory;
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageTrajectory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageTrajectory.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageTrajectory.java
new file mode 100644
index 0000000..45cdbc9
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProductCategoryUsageTrajectory.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.List;
+
+import org.apache.commons.lang3.tuple.Pair;
+
+import com.google.common.collect.Lists;
+
+public class ProductCategoryUsageTrajectory
+{
+	final private List<Pair<Double, Double>> trajectory;
+
+	public ProductCategoryUsageTrajectory(double initialTime, double initialAmount)
+	{
+		trajectory = Lists.newArrayList();
+		this.append(initialTime, initialAmount);
+	}
+
+	public void append(double time, double amount)
+	{
+		trajectory.add(Pair.of(time, amount));
+	}
+
+	public double getLastAmount()
+	{
+		return trajectory.get(trajectory.size() - 1).getValue();
+	}
+
+	public double getLastTime()
+	{
+		return trajectory.get(trajectory.size() - 1).getKey();
+	}
+
+	public double amountAtTime(double time)
+	{
+		Pair<Double, Double> previous = null;
+		for(Pair<Double, Double> entry : trajectory)
+		{
+			if(entry.getKey() > time)
+				break;
+			previous = entry;
+		}
+
+		if(previous == null)
+			return 0.0;
+
+		return previous.getValue();
+	}
+
+	public Pair<Double, Double> getStep(int idx)
+	{
+		return trajectory.get(idx);
+	}
+
+	public int size()
+	{
+		return trajectory.size();
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProposedPurchaseTimeSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProposedPurchaseTimeSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProposedPurchaseTimeSampler.java
new file mode 100644
index 0000000..e4380fc
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/ProposedPurchaseTimeSampler.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+
+public class ProposedPurchaseTimeSampler implements Sampler<Double>
+{
+	final CustomerInventory customerInventory;
+	final Sampler<Double> arrivalTimeSampler;
+
+	public ProposedPurchaseTimeSampler(CustomerInventory customerInventory,
+			Sampler<Double> arrivalTimeSampler)
+	{
+		this.customerInventory = customerInventory;
+		this.arrivalTimeSampler = arrivalTimeSampler;
+	}
+
+	protected double categoryProposedTime(double exhaustionTime) throws Exception
+	{
+		return Math.max(exhaustionTime - arrivalTimeSampler.sample(), 0.0);
+	}
+
+	public Double sample() throws Exception
+	{
+		double minProposedTime = Double.MAX_VALUE;
+		for(Double exhaustionTime : this.customerInventory.getExhaustionTimes().values())
+		{
+			double proposedTime = this.categoryProposedTime(exhaustionTime);
+			minProposedTime = Math.min(proposedTime, minProposedTime);
+		}
+
+		return minProposedTime;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesHiddenMarkovModel.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
new file mode 100644
index 0000000..0ae2f2c
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesHiddenMarkovModel.java
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.bigtop.datagenerators.bigpetstore.Constants;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Product;
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.ConditionalSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.RouletteWheelSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+import org.apache.bigtop.datagenerators.samplers.wfs.ConditionalWeightFunction;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class TransactionPurchasesHiddenMarkovModel implements ConditionalSampler<List<Product>, Double>
+{
+
+	protected final static String STOP_STATE = "STOP";
+
+	final ConditionalSampler<Product, String> purchasingProcesses;
+	final ConditionalWeightFunction<Double, Double> categoryWF;
+	final CustomerInventory inventory;
+
+	final SeedFactory seedFactory;
+
+	public TransactionPurchasesHiddenMarkovModel(ConditionalSampler<Product, String> purchasingProcesses,
+			ConditionalWeightFunction<Double, Double> categoryWF, CustomerInventory inventory,
+				SeedFactory seedFactory)
+	{
+		this.purchasingProcesses = purchasingProcesses;
+		this.inventory = inventory;
+		this.categoryWF = categoryWF;
+
+		this.seedFactory = seedFactory;
+	}
+
+	protected String chooseCategory(double transactionTime, int numPurchases) throws Exception
+	{
+		ImmutableMap<String, Double> exhaustionTimes = this.inventory.getExhaustionTimes();
+		Map<String, Double> weights = Maps.newHashMap();
+
+		for(Map.Entry<String, Double> entry : exhaustionTimes.entrySet())
+		{
+			String category = entry.getKey();
+			double weight = this.categoryWF.weight(entry.getValue(), transactionTime);
+			weights.put(category, weight);
+		}
+
+		if(numPurchases > 0)
+		{
+			weights.put(STOP_STATE, Constants.STOP_CATEGORY_WEIGHT);
+		}
+
+		Sampler<String> sampler = RouletteWheelSampler.create(weights, seedFactory);
+
+		return sampler.sample();
+	}
+
+	protected Product chooseProduct(String category) throws Exception
+	{
+		return this.purchasingProcesses.sample(category);
+	}
+
+	public List<Product> sample(Double transactionTime) throws Exception
+	{
+		int numPurchases = 0;
+
+		List<Product> purchasedProducts = Lists.newArrayList();
+
+		String category;
+		while(true)
+		{
+			category = this.chooseCategory(transactionTime, numPurchases);
+
+			if(category.equals(STOP_STATE))
+			{
+				break;
+			}
+
+			Product product = this.chooseProduct(category);
+
+			purchasedProducts.add(product);
+
+			this.inventory.simulatePurchase(transactionTime, product);
+			numPurchases += 1;
+		}
+
+		return purchasedProducts;
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesSamplerBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesSamplerBuilder.java
new file mode 100644
index 0000000..678c292
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionPurchasesSamplerBuilder.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Product;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.datagenerators.bigpetstore.generators.purchase.PurchasingModel;
+import org.apache.bigtop.datagenerators.bigpetstore.generators.purchase.PurchasingProcesses;
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.ConditionalSampler;
+import org.apache.bigtop.datagenerators.samplers.wfs.ConditionalWeightFunction;
+
+public class TransactionPurchasesSamplerBuilder
+{
+	final SeedFactory seedFactory;
+	final Collection<ProductCategory> productCategories;
+	final PurchasingModel purchasingProfile;
+
+	protected CustomerTransactionParameters transactionParameters;
+	protected CustomerInventory inventory;
+
+	public TransactionPurchasesSamplerBuilder(Collection<ProductCategory> productCategories,
+			PurchasingModel purchasingProfile,
+			SeedFactory seedFactory)
+	{
+		this.seedFactory = seedFactory;
+		this.productCategories = productCategories;
+		this.purchasingProfile = purchasingProfile;
+	}
+
+	public void setTransactionParameters(
+			CustomerTransactionParameters transactionParameters)
+	{
+		this.transactionParameters = transactionParameters;
+	}
+
+	public void setInventory(CustomerInventory inventory)
+	{
+		this.inventory = inventory;
+	}
+
+	public ConditionalSampler<List<Product>, Double> build() throws Exception
+	{
+		PurchasingProcesses processes = purchasingProfile.buildProcesses(seedFactory);
+
+		ConditionalWeightFunction<Double, Double> categoryWF =
+				new CategoryWeightFunction(transactionParameters.getAveragePurchaseTriggerTime());
+
+		ConditionalSampler<List<Product>, Double> sampler = new TransactionPurchasesHiddenMarkovModel(processes,
+				categoryWF, inventory, this.seedFactory);
+
+		return sampler;
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSampler.java
new file mode 100644
index 0000000..06b479b
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSampler.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.List;
+
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Customer;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Product;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Transaction;
+import org.apache.bigtop.datagenerators.samplers.samplers.ConditionalSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+
+public class TransactionSampler implements Sampler<Transaction>
+{
+	private final Sampler<Double> timeSampler;
+	private final ConditionalSampler<List<Product>, Double> purchasesSampler;
+	private final Sampler<Integer> idSampler;
+	private final Customer customer;
+
+	public TransactionSampler(Customer customer, Sampler<Double> timeSampler,
+			ConditionalSampler<List<Product>, Double> purchasesSampler,
+			Sampler<Integer> idSampler)
+	{
+		this.timeSampler = timeSampler;
+		this.customer = customer;
+		this.purchasesSampler = purchasesSampler;
+		this.idSampler = idSampler;
+	}
+
+
+	public Transaction sample() throws Exception
+	{
+		Double transactionTime = timeSampler.sample();
+		List<Product> purchase = purchasesSampler.sample(transactionTime);
+		Integer id = idSampler.sample();
+
+		Transaction transaction = new Transaction(id, customer, customer.getStore(),
+				transactionTime, purchase);
+
+		return transaction;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSamplerBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSamplerBuilder.java
new file mode 100644
index 0000000..80f336f
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionSamplerBuilder.java
@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Customer;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Product;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.Transaction;
+import org.apache.bigtop.datagenerators.bigpetstore.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.datagenerators.bigpetstore.generators.purchase.PurchasingModel;
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.ConditionalSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.SequenceSampler;
+
+public class TransactionSamplerBuilder
+{
+	private final Collection<ProductCategory> productCategories;
+	private final Customer customer;
+	private final PurchasingModel purchasingProfile;
+	private final SeedFactory seedFactory;
+
+	CustomerTransactionParameters parameters;
+	CustomerInventory inventory;
+
+	public TransactionSamplerBuilder(Collection<ProductCategory> productCategories,
+			Customer customer,
+			PurchasingModel purchasingProfile,
+			SeedFactory seedFactory) throws Exception
+	{
+		this.customer = customer;
+		this.seedFactory = seedFactory;
+		this.purchasingProfile = purchasingProfile;
+		this.productCategories = productCategories;
+	}
+
+	protected void buildParameters() throws Exception
+	{
+		CustomerTransactionParametersSamplerBuilder builder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		parameters = builder.build().sample();
+	}
+
+	protected ConditionalSampler<List<Product>, Double> buildPurchasesSampler() throws Exception
+	{
+		TransactionPurchasesSamplerBuilder builder = new TransactionPurchasesSamplerBuilder(productCategories,
+				purchasingProfile, seedFactory);
+
+		builder.setTransactionParameters(parameters);
+		builder.setInventory(inventory);
+
+		return builder.build();
+	}
+
+	protected Sampler<Double> buildTimeSampler()
+	{
+		TransactionTimeSamplerBuilder builder = new TransactionTimeSamplerBuilder(seedFactory);
+		builder.setCustomerTransactionParameters(parameters);
+		builder.setCustomerInventory(inventory);
+
+		return builder.build();
+	}
+
+	protected void buildCustomerInventory()
+	{
+		CustomerInventoryBuilder inventoryBuilder = new CustomerInventoryBuilder(parameters,
+				seedFactory);
+		inventoryBuilder.addAllProductCategories(productCategories);
+		inventory = inventoryBuilder.build();
+	}
+
+	public Sampler<Transaction> build() throws Exception
+	{
+		buildParameters();
+		buildCustomerInventory();
+
+		Sampler<Double> timeSampler = buildTimeSampler();
+
+		return new TransactionSampler(customer, timeSampler, buildPurchasesSampler(), new SequenceSampler());
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimePDF.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimePDF.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimePDF.java
new file mode 100644
index 0000000..8e7369b
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimePDF.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.samplers.pdfs.ConditionalProbabilityDensityFunction;
+
+public class TransactionTimePDF implements ConditionalProbabilityDensityFunction<Double, Double>
+{
+	public double probability(Double proposedTime, Double lastTransactionTime)
+	{
+		if(proposedTime >= lastTransactionTime)
+		{
+			return 1.0;
+		}
+
+		return 0.0;
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimeSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimeSamplerBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimeSamplerBuilder.java
new file mode 100644
index 0000000..41fd984
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/main/java/org/apache/bigtop/datagenerators/bigpetstore/generators/transaction/TransactionTimeSamplerBuilder.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.bigtop.datagenerators.bigpetstore.generators.transaction;
+
+import org.apache.bigtop.datagenerators.samplers.SeedFactory;
+import org.apache.bigtop.datagenerators.samplers.samplers.ExponentialSampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.Sampler;
+import org.apache.bigtop.datagenerators.samplers.samplers.StatefulMonteCarloSampler;
+
+public class TransactionTimeSamplerBuilder
+{
+	private final SeedFactory seedFactory;
+	private CustomerInventory customerInventory;
+	private CustomerTransactionParameters transactionParameters;
+
+	public TransactionTimeSamplerBuilder(SeedFactory seedFactory)
+	{
+		this.seedFactory = seedFactory;
+	}
+
+	public void setCustomerInventory(CustomerInventory inventory)
+	{
+		this.customerInventory = inventory;
+	}
+
+	public void setCustomerTransactionParameters(CustomerTransactionParameters parameters)
+	{
+		this.transactionParameters = parameters;
+	}
+
+	public Sampler<Double> build()
+	{
+		double lambda = 1.0 / transactionParameters.getAverageTransactionTriggerTime();
+		Sampler<Double> arrivalTimeSampler = new ExponentialSampler(lambda, seedFactory);
+		Sampler<Double> proposedTimeSampler = new ProposedPurchaseTimeSampler(customerInventory,
+				arrivalTimeSampler);
+
+		return new StatefulMonteCarloSampler<Double>(proposedTimeSampler,
+				new TransactionTimePDF(),
+				0.0,
+				seedFactory);
+	}
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/TestProduct.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/TestProduct.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/TestProduct.java
deleted file mode 100644
index f1e835a..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/TestProduct.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.datamodels;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.Map;
-
-import org.apache.bigtop.bigpetstore.datagenerator.Constants;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
-import org.junit.Test;
-
-import com.google.common.collect.Maps;
-
-public class TestProduct
-{
-
-	@Test
-	public void testString()
-	{
-		Map<String, Object> fields = Maps.newHashMap();
-		fields.put(Constants.PRODUCT_CATEGORY, "poop bags");
-		fields.put(Constants.PRODUCT_QUANTITY, 120);
-		fields.put("price", 12.80);
-		
-		Product product = new Product(fields);
-		
-		assertEquals(product.getFieldValueAsString(Constants.PRODUCT_CATEGORY), "poop bags");
-		assertEquals(product.getFieldValueAsString("price"), "12.8");
-		assertEquals(product.getFieldValueAsString(Constants.PRODUCT_QUANTITY), "120");
-	}
-	
-	@Test
-	public void testDouble()
-	{
-		Map<String, Object> fields = Maps.newHashMap();
-		fields.put(Constants.PRODUCT_CATEGORY, "poop bags");
-		fields.put(Constants.PRODUCT_QUANTITY, 120);
-		fields.put("price", 12.80);
-		
-		Product product = new Product(fields);
-		
-		assertNull(product.getFieldValueAsDouble(Constants.PRODUCT_CATEGORY));
-		assertEquals(product.getFieldValueAsDouble("price"), 12.80, 1e-5);
-		assertNull(product.getFieldValueAsDouble(Constants.PRODUCT_QUANTITY));
-	}
-	
-	@Test
-	public void testLong()
-	{
-		Map<String, Object> fields = Maps.newHashMap();
-		fields.put(Constants.PRODUCT_CATEGORY, "poop bags");
-		fields.put(Constants.PRODUCT_QUANTITY, 120);
-		fields.put("price", 12.80);
-		
-		Product product = new Product(fields);
-		
-		assertNull(product.getFieldValueAsLong(Constants.PRODUCT_CATEGORY));
-		assertNull(product.getFieldValueAsLong("price"));
-		assertEquals((long) product.getFieldValueAsLong(Constants.PRODUCT_QUANTITY), 120L);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovModelBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovModelBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovModelBuilder.java
deleted file mode 100644
index b9e63f2..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovModelBuilder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels.MarkovModel;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels.MarkovModelBuilder;
-import org.junit.Test;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.matchers.JUnitMatchers.*;
-
-public class TestMarkovModelBuilder
-{
-
-	@Test
-	public void testAddStateState()
-	{
-		MarkovModelBuilder<String> builder = MarkovModelBuilder.create();
-		
-		builder.addStartState("a", 1.0);
-		
-		MarkovModel<String> msm = builder.build();
-		
-		assertThat(msm.getStartWeights().keySet(), hasItem("a"));
-		assertEquals((double) msm.getStartWeights().get("a"), (double) 1.0, 0.000001);
-		
-	}
-	
-	@Test
-	public void testAddEdgeTransition()
-	{
-		MarkovModelBuilder<String> builder = MarkovModelBuilder.create();
-		
-		builder.addTransition("a", "b", 1.0);
-		
-		MarkovModel<String> msm = builder.build();
-		
-		assertThat(msm.getTransitionWeights().keySet(), hasItem("a"));
-		assertThat(msm.getTransitionWeights().get("a").keySet(), hasItem("b"));
-		assertEquals((double) msm.getTransitionWeights().get("a").get("b"), (double) 1.0, 0.000001);	
-	}
-	
-	@Test
-	public void testBuildMSM()
-	{
-		MarkovModelBuilder<String> builder = MarkovModelBuilder.create();
-		
-		builder.addStartState("a", 1.0);
-		builder.addTransition("a", "b", 1.0);
-		builder.addTransition("a", "c", 1.0);
-		
-		MarkovModel<String> msm = builder.build();
-		
-		assertThat(msm.getStartWeights().keySet(), hasItem("a"));
-		assertThat(msm.getTransitionWeights().keySet(), hasItem("a"));
-		assertThat(msm.getTransitionWeights().get("a").keySet(), hasItem("b"));
-		assertThat(msm.getTransitionWeights().get("a").keySet(), hasItem("c"));
-		assertEquals((double) msm.getTransitionWeights().get("a").get("b"), (double) 1.0, 0.000001);
-		assertEquals((double) msm.getTransitionWeights().get("a").get("c"), (double) 1.0, 0.000001);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovProcess.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovProcess.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovProcess.java
deleted file mode 100644
index e2ff4d5..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/markovmodels/TestMarkovProcess.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-
-import java.util.Arrays;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels.MarkovModel;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels.MarkovModelBuilder;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.markovmodels.MarkovProcess;
-import org.junit.Test;
-
-public class TestMarkovProcess
-{
-
-	@Test
-	public void test() throws Exception
-	{
-		SeedFactory factory = new SeedFactory(1245);
-		MarkovModelBuilder<String> builder = MarkovModelBuilder.create();
-		
-		builder.addStartState("a", 1.0);
-		builder.addTransition("a", "b", 1.0);
-		builder.addTransition("a", "c", 1.0);
-		
-		MarkovModel<String> msm = builder.build();
-		MarkovProcess<String> process = MarkovProcess.create(msm, factory);
-		
-		String firstState = process.sample();
-		assertEquals(firstState, "a");
-		
-		String secondState = process.sample();
-		assertThat(Arrays.asList("b", "c"), hasItem(secondState));
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/TestMultinomialPDF.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/TestMultinomialPDF.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/TestMultinomialPDF.java
deleted file mode 100644
index 8952389..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/pdfs/TestMultinomialPDF.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.pdfs;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
-
-public class TestMultinomialPDF
-{
-
-	@Test
-	public void testToString()
-	{
-		Map<String, Double> objects = ImmutableMap.of("A", 0.1, "B", 0.3, "C", 0.5);
-		MultinomialPDF<String> pdf = new MultinomialPDF<String>(objects);
-		String string = pdf.toString();
-		Set<String> observed = Sets.newHashSet(string.split("\n"));
-		Set<String> expected = Sets.newHashSet("0.1,A", "0.3,B", "0.5,C");
-		
-		Assert.assertEquals(expected, observed);
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestBoundedMultiModalGaussianSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestBoundedMultiModalGaussianSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestBoundedMultiModalGaussianSampler.java
deleted file mode 100644
index 9300d08..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestBoundedMultiModalGaussianSampler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-
-public class TestBoundedMultiModalGaussianSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		double upperbound = 10.0;
-		double lowerbound = 1.0;
-		
-		List<Pair<Double, Double>> distributions = Lists.newArrayList(Pair.of(2.0, 2.0), Pair.of(7.5, 2.0));
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<Double> sampler = new BoundedMultiModalGaussianSampler(distributions, lowerbound, upperbound, seedFactory);
-		
-		Double result = sampler.sample();
-		
-		assertTrue(result >= lowerbound);
-		assertTrue(result <= upperbound);
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestExponentialSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestExponentialSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestExponentialSampler.java
deleted file mode 100644
index 228b97d..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestExponentialSampler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertTrue;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.ExponentialSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.junit.Test;
-
-public class TestExponentialSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		double lambda = 1.0 / 2.0;
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<Double> sampler = new ExponentialSampler(lambda, seedFactory);
-		
-		Double result = sampler.sample();
-		
-		assertTrue(result >= 0.0);
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestGaussianSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestGaussianSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestGaussianSampler.java
deleted file mode 100644
index fbe8c18..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestGaussianSampler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertTrue;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.GaussianSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.junit.Test;
-
-public class TestGaussianSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		double mean = 2.0;
-		double var = 1.0;
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<Double> sampler = new GaussianSampler(mean, var, seedFactory);
-		
-		Double result = sampler.sample();
-		
-		assertTrue(result >= -10);
-		assertTrue(result <= 10);
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestRouletteWheelSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestRouletteWheelSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestRouletteWheelSampler.java
deleted file mode 100644
index f1152c5..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestRouletteWheelSampler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-
-import java.util.Map;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.RouletteWheelSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-public class TestRouletteWheelSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		Map<String, Double> dataPoints = ImmutableMap.of(
-				"a", 0.25,
-				"b", 0.25,
-				"c", 0.25,
-				"d", 0.25
-				);
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<String> sampler = new RouletteWheelSampler<String>(dataPoints, seedFactory);
-		
-		String result = sampler.sample();
-		
-		assertThat(dataPoints.keySet(), hasItem(result));
-	}
-	
-	@Test
-	public void testSampleUnnormalized() throws Exception
-	{
-		Map<String, Double> dataPoints = ImmutableMap.of(
-				"a", 1.0,
-				"b", 1.0,
-				"c", 1.0,
-				"d", 1.0
-				);
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<String> sampler = new RouletteWheelSampler<String>(dataPoints, seedFactory);
-		
-		String result = sampler.sample();
-		
-		assertThat(dataPoints.keySet(), hasItem(result));
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestSequenceSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestSequenceSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestSequenceSampler.java
deleted file mode 100644
index 6684773..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestSequenceSampler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.SequenceSampler;
-import org.junit.Test;
-
-public class TestSequenceSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		Sampler<Integer> sampler = new SequenceSampler(0, 10, 1);
-		
-		for(int i = 0; i < 10; i++)
-		{
-			Integer value = sampler.sample();
-			assertEquals( (int) value, i);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestUniformIntSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestUniformIntSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestUniformIntSampler.java
deleted file mode 100644
index a700cdf..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/framework/samplers/TestUniformIntSampler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.framework.samplers;
-
-import static org.junit.Assert.assertTrue;
-
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.UniformIntSampler;
-import org.junit.Test;
-
-public class TestUniformIntSampler
-{
-
-	@Test
-	public void testSample() throws Exception
-	{
-		int upperbound = 10;
-		int lowerbound = 1;
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<Integer> sampler = new UniformIntSampler(lowerbound, upperbound, seedFactory);
-		
-		Integer result = sampler.sample();
-		
-		assertTrue(result >= lowerbound);
-		assertTrue(result <= upperbound);
-	}
-	
-	@Test
-	public void testSampleInclusive() throws Exception
-	{
-		int upperbound = 2;
-		int lowerbound = 1;
-		
-		SeedFactory seedFactory = new SeedFactory(1234);
-		
-		Sampler<Integer> sampler = new UniformIntSampler(lowerbound, upperbound, seedFactory);
-		
-		Integer result = sampler.sample();
-		
-		assertTrue(result >= lowerbound);
-		assertTrue(result <= upperbound);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerLocationPDF.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerLocationPDF.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerLocationPDF.java
deleted file mode 100644
index 0800c58..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerLocationPDF.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.generators.customer;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.bigtop.bigpetstore.datagenerator.Constants;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Test;
-
-public class TestCustomerLocationPDF
-{
-
-	@Test
-	public void testProbability() throws Exception
-	{
-		List<ZipcodeRecord> zipcodes = Arrays.asList(new ZipcodeRecord[] {				
-				new ZipcodeRecord("11111", Pair.of(1.0, 1.0), "AZ", "Tempte", 30000.0, 100),
-				new ZipcodeRecord("22222", Pair.of(2.0, 2.0), "AZ", "Phoenix", 45000.0, 200),
-				new ZipcodeRecord("33333", Pair.of(3.0, 3.0), "AZ", "Flagstaff", 60000.0, 300)
-				});
-		
-		List<Store> stores = new ArrayList<Store>();
-		for(int i = 0; i < zipcodes.size(); i++)
-		{
-			Store store = new Store(i, "Store_" + i, zipcodes.get(i));
-			stores.add(store);
-		}
-		
-		CustomerLocationPDF customerLocationPDF = new CustomerLocationPDF(zipcodes, stores.get(0), 
-					Constants.AVERAGE_CUSTOMER_STORE_DISTANCE);
-		
-		double prob = customerLocationPDF.probability(zipcodes.get(0));
-		
-		assertTrue(prob > 0.0);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
deleted file mode 100644
index 639b2af..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSampler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.generators.customer;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.bigtop.bigpetstore.datagenerator.Constants;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.pdfs.ProbabilityDensityFunction;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.ConditionalSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.RouletteWheelSampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.SequenceSampler;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Test;
-
-import com.google.common.collect.Maps;
-
-public class TestCustomerSampler
-{
-	protected ConditionalSampler<ZipcodeRecord, Store> buildLocationSampler(List<Store> stores, List<ZipcodeRecord> records,
-			SeedFactory factory)
-	{
-		final Map<Store, Sampler<ZipcodeRecord>> locationSamplers = Maps.newHashMap();
-		for(Store store : stores)
-		{
-			ProbabilityDensityFunction<ZipcodeRecord> locationPDF = new CustomerLocationPDF(records,
-					store, Constants.AVERAGE_CUSTOMER_STORE_DISTANCE);
-			Sampler<ZipcodeRecord> locationSampler = RouletteWheelSampler.create(records, locationPDF, factory);
-			locationSamplers.put(store, locationSampler);
-		}
-			
-		return new ConditionalSampler<ZipcodeRecord, Store>()
-				{
-					public ZipcodeRecord sample(Store store) throws Exception
-					{
-						return locationSamplers.get(store).sample();
-					}
-				};
-	}
-
-	@Test
-	public void testBuild() throws Exception
-	{	
-		SeedFactory factory = new SeedFactory(1234);
-		
-		Collection<String> nameList = Arrays.asList(new String[] {"Fred", "Gary", "George", "Fiona"});
-		List<ZipcodeRecord> zipcodes = Arrays.asList(new ZipcodeRecord[] {				
-				new ZipcodeRecord("11111", Pair.of(1.0, 1.0), "AZ", "Tempte", 30000.0, 100),
-				new ZipcodeRecord("22222", Pair.of(2.0, 2.0), "AZ", "Phoenix", 45000.0, 200),
-				new ZipcodeRecord("33333", Pair.of(3.0, 3.0), "AZ", "Flagstaff", 60000.0, 300)
-				});
-		
-		List<Store> stores = new ArrayList<Store>();
-		for(int i = 0; i < zipcodes.size(); i++)
-		{
-			Store store = new Store(i, "Store_" + i, zipcodes.get(i));
-			stores.add(store);
-		}
-		
-		
-		Sampler<Integer> idSampler = new SequenceSampler();
-		Sampler<String> nameSampler = RouletteWheelSampler.createUniform(nameList, factory);
-		Sampler<Store> storeSampler = RouletteWheelSampler.createUniform(stores, factory);
-		ConditionalSampler<ZipcodeRecord, Store> zipcodeSampler = buildLocationSampler(stores, zipcodes, factory);
-		
-		Sampler<Customer> sampler = new CustomerSampler(idSampler, nameSampler, nameSampler, storeSampler, zipcodeSampler);
-		
-		Customer customer = sampler.sample();
-		
-		assertNotNull(customer);
-		assertTrue(customer.getId() >= 0);
-		assertNotNull(customer.getName());
-		assertNotNull(customer.getName().getLeft());
-		assertTrue(nameList.contains(customer.getName().getLeft()));
-		assertNotNull(customer.getName().getRight());
-		assertTrue(nameList.contains(customer.getName().getRight()));
-		assertNotNull(customer.getLocation());
-		assertTrue(zipcodes.contains(customer.getLocation()));
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
deleted file mode 100644
index 74c8348..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.generators.customer;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.Names;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
-import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-public class TestCustomerSamplerBuilder
-{
-
-	@Test
-	public void testSample() throws Exception
-	{	
-		Map<String, Double> nameList = ImmutableMap.of("Fred", 1.0, "George", 1.0, "Gary", 1.0, "Fiona", 1.0);
-		List<ZipcodeRecord> zipcodes = Arrays.asList(new ZipcodeRecord[] {				
-				new ZipcodeRecord("11111", Pair.of(1.0, 1.0), "AZ", "Tempte", 30000.0, 100),
-				new ZipcodeRecord("22222", Pair.of(2.0, 2.0), "AZ", "Phoenix", 45000.0, 200),
-				new ZipcodeRecord("33333", Pair.of(3.0, 3.0), "AZ", "Flagstaff", 60000.0, 300)
-				});
-		
-		Names names = new Names(nameList, nameList);
-		
-		// don't need product categories for building customers
-		InputData inputData = new InputData(zipcodes, names);
-		
-		List<Store> stores = Arrays.asList(new Store(0, "Store_0", zipcodes.get(0)),
-				new Store(1, "Store_1", zipcodes.get(1)),
-				new Store(2, "Store_2", zipcodes.get(2))
-				);
-		
-		SeedFactory factory = new SeedFactory(1234);
-		
-		CustomerSamplerBuilder builder = new CustomerSamplerBuilder(stores, inputData, factory);
-		Sampler<Customer> sampler = builder.build();
-		
-		Customer customer = sampler.sample();
-		
-		assertNotNull(customer);
-		assertTrue(customer.getId() >= 0);
-		assertNotNull(customer.getName());
-		assertNotNull(customer.getName().getLeft());
-		assertNotNull(customer.getName().getRight());
-		assertNotNull(customer.getLocation());
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
deleted file mode 100644
index 3b7c2e8..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.generators.products.cartesian;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestCartesianProductBase
-{
-	@Test
-	public void testNext()
-	{
-		Iterator<Map<String, Double>> iter = new CartesianProductBase<Double>("count",
-				Arrays.asList(1.0, 2.0, 3.0));
-
-		Assert.assertTrue(iter.hasNext());
-
-		Map<String, Double> map = iter.next();
-		Assert.assertEquals(1, map.size());
-		Assert.assertTrue(map.containsKey("count"));
-		Assert.assertEquals( (double) map.get("count"), (double) 1.0, 0.0001);
-
-		Assert.assertTrue(iter.hasNext());
-
-		map = iter.next();
-		Assert.assertEquals(1, map.size());
-		Assert.assertTrue(map.containsKey("count"));
-		Assert.assertEquals( (double) map.get("count"), (double) 2.0, 0.0001);
-
-		Assert.assertTrue(iter.hasNext());
-
-		map = iter.next();
-		Assert.assertEquals(1, map.size());
-		Assert.assertTrue(map.containsKey("count"));
-		Assert.assertEquals( (double) map.get("count"), (double) 3.0, 0.0001);
-
-		Assert.assertFalse(iter.hasNext());
-	}
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/15af83eb/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
deleted file mode 100644
index 5071a54..0000000
--- a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.bigtop.bigpetstore.datagenerator.generators.products.cartesian;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestCartesianProductField
-{
-
-	@Test
-	public void testTwoLevels()
-	{
-		Iterator<Map<String, String>> iter = new CartesianProductField<String>(
-				"children", Arrays.asList("1", "2"),
-					new CartesianProductBase<String>(
-							"animal", Arrays.asList("cat", "dog")));
-
-		Assert.assertEquals(iter.hasNext(), true);
-		Map<String, String> map = iter.next();
-		Assert.assertEquals(map.size(), 2);
-		Assert.assertTrue(map.containsKey("animal"));
-		Assert.assertTrue(map.containsKey("children"));
-		Assert.assertEquals(map.get("animal"), "cat");
-		Assert.assertEquals(map.get("children"), "1");
-
-		Assert.assertEquals(iter.hasNext(), true);
-		map = iter.next();
-		Assert.assertEquals(map.size(), 2);
-		Assert.assertTrue(map.containsKey("animal"));
-		Assert.assertTrue(map.containsKey("children"));
-		Assert.assertEquals(map.get("animal"), "cat");
-		Assert.assertEquals(map.get("children"), "2");
-
-		Assert.assertEquals(iter.hasNext(), true);
-		map = iter.next();
-		Assert.assertEquals(map.size(), 2);
-		Assert.assertTrue(map.containsKey("animal"));
-		Assert.assertTrue(map.containsKey("children"));
-		Assert.assertEquals(map.get("animal"), "dog");
-		Assert.assertEquals(map.get("children"), "1");
-
-		Assert.assertEquals(iter.hasNext(), true);
-		map = iter.next();
-		Assert.assertEquals(map.size(), 2);
-		Assert.assertTrue(map.containsKey("animal"));
-		Assert.assertTrue(map.containsKey("children"));
-		Assert.assertEquals(map.get("animal"), "dog");
-		Assert.assertEquals(map.get("children"), "2");
-
-		Assert.assertFalse(iter.hasNext());
-		Assert.assertFalse(iter.hasNext());
-		Assert.assertFalse(iter.hasNext());
-	}
-}


Mime
View raw message