bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnowl...@apache.org
Subject [01/23] bigtop git commit: BIGTOP-1983. Move BigPetStore data generator to bigtop-data-generators
Date Tue, 25 Aug 2015 13:48:01 GMT
Repository: bigtop
Updated Branches:
  refs/heads/master 33e8d3c6e -> 3bbbb557a


http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/store/TestStoreSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/store/TestStoreSamplerBuilder.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/store/TestStoreSamplerBuilder.java
new file mode 100644
index 0000000..b7b0a52
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/store/TestStoreSamplerBuilder.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.bigpetstore.datagenerator.generators.store;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+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.samplers.Sampler;
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Test;
+
+public class TestStoreSamplerBuilder
+{
+
+	@Test
+	public void testBuild() 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)
+				});
+		
+		assertTrue(zipcodes.size() > 0);
+		
+		SeedFactory factory = new SeedFactory(1234);
+		
+		StoreSamplerBuilder builder = new StoreSamplerBuilder(zipcodes, factory);
+		Sampler<Store> sampler = builder.build();
+		
+		Store store = sampler.sample();
+		assertNotNull(store);
+		assertTrue(store.getId() >= 0);
+		assertNotNull(store.getName());
+		assertNotNull(store.getLocation());
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventory.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventory.java
new file mode 100644
index 0000000..322bb5e
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventory.java
@@ -0,0 +1,94 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductCategoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerInventory;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.ProductCategoryInventory;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+public class TestCustomerInventory
+{
+	
+	@Test
+	public void testPurchase() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		
+		CustomerTransactionParametersSamplerBuilder transParamsBuilder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = transParamsBuilder.build();
+		
+		CustomerTransactionParameters parameters = sampler.sample();
+		
+		ProductCategoryBuilder builder = new ProductCategoryBuilder();
+		builder.addApplicableSpecies(PetSpecies.DOG);
+		builder.setAmountUsedPetPetAverage(1.0);
+		builder.setAmountUsedPetPetVariance(1.0);
+		builder.setDailyUsageRate(2.0);
+		builder.setCategory("dog food");
+		
+		
+		ProductCategory category = builder.build();
+		
+		ProductCategoryInventory productInventory = new ProductCategoryInventory(category, parameters,
seedFactory);
+		
+		Map<String, ProductCategoryInventory> inventories = Maps.newHashMap();
+		inventories.put("dog food", productInventory);
+		
+		CustomerInventory inventory = new CustomerInventory(inventories);
+		
+		for(Map.Entry<String, Double> entry : inventory.getExhaustionTimes().entrySet())
+		{
+			assertEquals(entry.getValue(), 0.0, 0.0001);
+		}
+		
+		for(Map.Entry<String, Double> entry : inventory.getInventoryAmounts(0.0).entrySet())
+		{
+			assertEquals(entry.getValue(), 0.0, 0.0001);
+		}
+		
+		Map<String, Object> fields = Maps.newHashMap();
+		fields.put(Constants.PRODUCT_CATEGORY, "dog food");
+		fields.put(Constants.PRODUCT_QUANTITY, 30.0);
+		Product product = new Product(fields);
+		
+		inventory.simulatePurchase(1.0, product);
+		
+		Map<String, Double> exhaustionTimes = inventory.getExhaustionTimes();
+		assertTrue(exhaustionTimes.containsKey("dog food"));
+		assertTrue(exhaustionTimes.get("dog food") > 0.0);
+		
+		Map<String, Double> amounts = inventory.getInventoryAmounts(2.0);
+		assertTrue(amounts.containsKey("dog food"));
+		assertTrue(amounts.get("dog food") > 0.0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventoryBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventoryBuilder.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventoryBuilder.java
new file mode 100644
index 0000000..d8d6d70
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerInventoryBuilder.java
@@ -0,0 +1,91 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductCategoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerInventory;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerInventoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+public class TestCustomerInventoryBuilder
+{
+	
+	@Test
+	public void testBuild() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		
+		CustomerTransactionParametersSamplerBuilder transParamsBuilder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = transParamsBuilder.build();
+		
+		CustomerTransactionParameters parameters = sampler.sample();
+		
+		ProductCategoryBuilder builder = new ProductCategoryBuilder();
+		builder.addApplicableSpecies(PetSpecies.DOG);
+		builder.setAmountUsedPetPetAverage(1.0);
+		builder.setAmountUsedPetPetVariance(1.0);
+		builder.setDailyUsageRate(2.0);
+		builder.setCategory("dog food");
+		
+		ProductCategory category = builder.build();
+		
+		CustomerInventoryBuilder inventoryBuilder = new CustomerInventoryBuilder(parameters, seedFactory);
+		inventoryBuilder.addProductCategory(category);
+		
+		CustomerInventory inventory = inventoryBuilder.build();
+		
+		for(Map.Entry<String, Double> entry : inventory.getExhaustionTimes().entrySet())
+		{
+			assertEquals(entry.getValue(), 0.0, 0.0001);
+		}
+		
+		for(Map.Entry<String, Double> entry : inventory.getInventoryAmounts(0.0).entrySet())
+		{
+			assertEquals(entry.getValue(), 0.0, 0.0001);
+		}
+		
+		Map<String, Object> fields = Maps.newHashMap();
+		fields.put(Constants.PRODUCT_CATEGORY, "dog food");
+		fields.put(Constants.PRODUCT_QUANTITY, 30.0);
+		Product product = new Product(fields);
+		
+		inventory.simulatePurchase(1.0, product);
+		
+		Map<String, Double> exhaustionTimes = inventory.getExhaustionTimes();
+		assertTrue(exhaustionTimes.containsKey("dog food"));
+		assertTrue(exhaustionTimes.get("dog food") > 0.0);
+		
+		Map<String, Double> amounts = inventory.getInventoryAmounts(2.0);
+		assertTrue(amounts.containsKey("dog food"));
+		assertTrue(amounts.get("dog food") > 0.0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParameters.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParameters.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParameters.java
new file mode 100644
index 0000000..a9fdaec
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParameters.java
@@ -0,0 +1,69 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.junit.Test;
+
+import com.google.common.collect.HashMultiset;
+import com.google.common.collect.Multiset;
+
+public class TestCustomerTransactionParameters
+{
+
+	@Test
+	public void testCountPetsBySpecies() throws Exception
+	{
+		Multiset<PetSpecies> petCounts = HashMultiset.create();
+		
+		petCounts.add(PetSpecies.CAT);
+		petCounts.add(PetSpecies.CAT);
+		petCounts.add(PetSpecies.CAT);
+		
+		
+		CustomerTransactionParameters transParams = new CustomerTransactionParameters(
+				petCounts, 0.0, 0.0);
+		
+		
+		assertEquals(transParams.countPetsBySpecies(PetSpecies.CAT), 3);
+		assertEquals(transParams.countPetsBySpecies(PetSpecies.DOG), 0);
+		assertEquals(transParams.countPets(), 3);
+	}
+	
+	@Test
+	public void testCountPetsByMultipleSpecies() throws Exception
+	{
+		Multiset<PetSpecies> petCounts = HashMultiset.create();
+		
+		petCounts.add(PetSpecies.CAT);
+		petCounts.add(PetSpecies.CAT);
+		petCounts.add(PetSpecies.DOG);
+		
+		
+		CustomerTransactionParameters transParams = new CustomerTransactionParameters(
+				petCounts, 0.0, 0.0);
+		
+		
+		assertEquals(transParams.countPetsBySpecies(Arrays.asList(PetSpecies.values())), 3);
+		assertEquals(transParams.countPets(), 3);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersBuilder.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersBuilder.java
new file mode 100644
index 0000000..0630c63
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersBuilder.java
@@ -0,0 +1,48 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersBuilder;
+import org.junit.Test;
+
+public class TestCustomerTransactionParametersBuilder
+{
+
+	@Test
+	public void testBuild() throws Exception
+	{
+		CustomerTransactionParametersBuilder builder = new CustomerTransactionParametersBuilder();
+		
+		builder.addPet(PetSpecies.DOG);
+		builder.addPet(PetSpecies.DOG);
+		builder.addPet(PetSpecies.DOG);
+		
+		builder.setAveragePurchaseTriggerTime(1.0);
+		builder.setAverageTransactionTriggerTime(2.0);
+		
+		CustomerTransactionParameters transParams = builder.build();
+		
+		assertTrue(transParams.countPetsBySpecies(PetSpecies.DOG) == 3);
+		assertTrue(transParams.countPetsBySpecies(PetSpecies.CAT) == 0);
+		assertTrue(transParams.getAveragePurchaseTriggerTime() == 1.0);
+		assertTrue(transParams.getAverageTransactionTriggerTime() == 2.0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSampler.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSampler.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSampler.java
new file mode 100644
index 0000000..49fa16d
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSampler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.junit.Test;
+
+public class TestCustomerTransactionParametersSampler
+{
+
+	@Test
+	public void testSample() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		CustomerTransactionParametersSamplerBuilder builder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = builder.build();
+		
+		CustomerTransactionParameters transParams = sampler.sample();
+		
+		assertTrue(transParams.countPets() >= Constants.MIN_PETS);
+		assertTrue(transParams.countPets() <= Constants.MAX_PETS);
+		assertTrue(transParams.getAveragePurchaseTriggerTime() >= Constants.PURCHASE_TRIGGER_TIME_MIN);
+		assertTrue(transParams.getAveragePurchaseTriggerTime() <= Constants.PURCHASE_TRIGGER_TIME_MAX);
+		assertTrue(transParams.getAverageTransactionTriggerTime() >= Constants.TRANSACTION_TRIGGER_TIME_MIN);
+		assertTrue(transParams.getAverageTransactionTriggerTime() <= Constants.TRANSACTION_TRIGGER_TIME_MAX);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSamplerBuilder.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSamplerBuilder.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSamplerBuilder.java
new file mode 100644
index 0000000..fbe4e08
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestCustomerTransactionParametersSamplerBuilder.java
@@ -0,0 +1,47 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.junit.Test;
+
+public class TestCustomerTransactionParametersSamplerBuilder
+{
+
+	@Test
+	public void testBuild() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		CustomerTransactionParametersSamplerBuilder builder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = builder.build();
+		
+		CustomerTransactionParameters transParams = sampler.sample();
+		
+		assertTrue(transParams.countPets() >= Constants.MIN_PETS);
+		assertTrue(transParams.countPets() <= Constants.MAX_PETS);
+		assertTrue(transParams.getAveragePurchaseTriggerTime() >= Constants.PURCHASE_TRIGGER_TIME_MIN);
+		assertTrue(transParams.getAveragePurchaseTriggerTime() <= Constants.PURCHASE_TRIGGER_TIME_MAX);
+		assertTrue(transParams.getAverageTransactionTriggerTime() >= Constants.TRANSACTION_TRIGGER_TIME_MIN);
+		assertTrue(transParams.getAverageTransactionTriggerTime() <= Constants.TRANSACTION_TRIGGER_TIME_MAX);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryInventory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryInventory.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryInventory.java
new file mode 100644
index 0000000..dc08979
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryInventory.java
@@ -0,0 +1,75 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductCategoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.ProductCategoryInventory;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+public class TestProductCategoryInventory
+{
+	
+	@Test
+	public void testPurchase() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		
+		CustomerTransactionParametersSamplerBuilder transParamsBuilder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = transParamsBuilder.build();
+		
+		CustomerTransactionParameters parameters = sampler.sample();
+		
+		ProductCategoryBuilder builder = new ProductCategoryBuilder();
+		builder.addApplicableSpecies(PetSpecies.DOG);
+		builder.setAmountUsedPetPetAverage(1.0);
+		builder.setAmountUsedPetPetVariance(1.0);
+		builder.setDailyUsageRate(2.0);
+		
+		
+		ProductCategory category = builder.build();
+		
+		ProductCategoryInventory inventory = new ProductCategoryInventory(category, parameters,
seedFactory);
+		
+		assertEquals(inventory.findExhaustionTime(), 0.0, 0.0001);
+		assertEquals(inventory.findRemainingAmount(0.0), 0.0, 0.0001);
+		
+		Map<String, Object> fields = Maps.newHashMap();
+		fields.put(Constants.PRODUCT_CATEGORY, "dog food");
+		fields.put(Constants.PRODUCT_QUANTITY, 30.0);
+		Product product = new Product(fields);
+		
+		inventory.simulatePurchase(1.0, product);
+		
+		assertTrue(inventory.findExhaustionTime() > 1.0);
+		assertTrue(inventory.findRemainingAmount(1.0) > 0.0);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageSimulator.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageSimulator.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageSimulator.java
new file mode 100644
index 0000000..6c093df
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageSimulator.java
@@ -0,0 +1,51 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.bigtop.bigpetstore.datagenerator.framework.SeedFactory;
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Test;
+
+public class TestProductCategoryUsageSimulator
+{
+	
+	@Test
+	public void testSimulate() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		
+		ProductCategoryUsageSimulator simulator = new ProductCategoryUsageSimulator(2.0, 1.0, 1.0,
seedFactory);
+		
+		ProductCategoryUsageTrajectory trajectory = simulator.simulate(0.0, 30.0);
+		
+		assertEquals(0.0, trajectory.getLastAmount(), 0.0001);
+		
+		Pair<Double, Double> previousEntry = trajectory.getStep(0);
+		for(int i = 1; i < trajectory.size(); i++)
+		{
+			Pair<Double, Double> entry = trajectory.getStep(i);
+			// time should move forward
+			assertTrue(previousEntry.getLeft() <= entry.getLeft());
+			// remaining amounts should go down
+			assertTrue(previousEntry.getRight() >= entry.getRight());
+			previousEntry = entry;
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageTrajectory.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageTrajectory.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageTrajectory.java
new file mode 100644
index 0000000..5462de2
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestProductCategoryUsageTrajectory.java
@@ -0,0 +1,69 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Test;
+
+public class TestProductCategoryUsageTrajectory
+{
+	
+	@Test
+	public void testTrajectory()
+	{
+		double initialAmount = 30.0;
+		double initialTime = 0.0;
+		
+		ProductCategoryUsageTrajectory trajectory = new ProductCategoryUsageTrajectory(initialTime,
initialAmount);
+		
+		assertEquals(trajectory.size(), 1);
+		
+		Pair<Double, Double> entry = trajectory.getStep(0);
+		assertEquals(initialTime, entry.getLeft(), 0.0001);
+		assertEquals(initialAmount, entry.getRight(), 0.0001);
+		
+		trajectory.append(1.0, 25.0);
+		
+		assertEquals(2, trajectory.size());
+		
+		entry = trajectory.getStep(1);
+		assertEquals(1.0, entry.getLeft(), 0.0001);
+		assertEquals(25.0, entry.getRight(), 0.0001);
+		
+		assertEquals(1.0, trajectory.getLastTime(), 0.0001);
+		assertEquals(25.0, trajectory.getLastAmount(), 0.0001);
+	}
+	
+	@Test
+	public void testAmountAtTime()
+	{
+		ProductCategoryUsageTrajectory trajectory = new ProductCategoryUsageTrajectory(0.0, 30.0);
+		trajectory.append(1.0, 25.0);
+		trajectory.append(2.0, 20.0);
+		trajectory.append(3.0, 50.0);
+		trajectory.append(4.0, 40.0);
+		trajectory.append(4.0, 50.0);
+		trajectory.append(5.0, 30.0);
+		
+		assertEquals(30.0, trajectory.amountAtTime(0.5), 0.0001);
+		assertEquals(50.0, trajectory.amountAtTime(4.0), 0.0001);
+		assertEquals(30.0, trajectory.amountAtTime(10.0), 0.0001);
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionPurchasesHiddenMarkovModel.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionPurchasesHiddenMarkovModel.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionPurchasesHiddenMarkovModel.java
new file mode 100644
index 0000000..6383c2e
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionPurchasesHiddenMarkovModel.java
@@ -0,0 +1,205 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+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.samplers.Sampler;
+import org.apache.bigtop.bigpetstore.datagenerator.framework.wfs.ConditionalWeightFunction;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductCategoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.MarkovPurchasingModel;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.purchase.PurchasingProcesses;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CategoryWeightFunction;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerInventory;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerInventoryBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParameters;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.CustomerTransactionParametersSamplerBuilder;
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.TransactionPurchasesHiddenMarkovModel;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class TestTransactionPurchasesHiddenMarkovModel
+{
+	
+	private List<Product> createProducts(String category)
+	{
+		List<Product> products = Lists.newArrayList();
+		
+		for(int i = 0; i < 10; i++)
+		{
+			Map<String, Object> fields = Maps.newHashMap();
+			fields.put(Constants.PRODUCT_CATEGORY, category);
+			fields.put(Constants.PRODUCT_QUANTITY, (double) (i + 1));
+			Product product = new Product(fields);
+			products.add(product);
+		}
+		
+		return products;
+	}
+	
+	private MarkovModel<Product> createMarkovModel(ProductCategory category)
+	{
+		MarkovModelBuilder<Product> markovBuilder = new MarkovModelBuilder<Product>();
+		
+		for(Product product1 : category.getProducts())
+		{
+			markovBuilder.addStartState(product1, 1.0);
+			for(Product product2 : category.getProducts())
+			{
+				markovBuilder.addTransition(product1, product2, 1.0);
+			}
+		}
+		
+		return markovBuilder.build();
+	}
+	
+	protected PurchasingProcesses createProcesses(ProductCategory dogFoodCategory,
+			ProductCategory catFoodCategory, SeedFactory seedFactory)
+	{	
+		MarkovModel<Product> dogFoodModel = createMarkovModel(dogFoodCategory);
+		MarkovModel<Product> catFoodModel = createMarkovModel(catFoodCategory);
+		
+		Map<String, MarkovModel<Product>> models = Maps.newHashMap();
+		models.put("dog food", dogFoodModel);
+		models.put("cat food", catFoodModel);
+		
+		MarkovPurchasingModel profile = new MarkovPurchasingModel(models);
+		
+		return profile.buildProcesses(seedFactory);
+	}
+	
+	protected ProductCategory createCategory(String category)
+	{
+		List<Product> products = createProducts(category);
+		
+		ProductCategoryBuilder builder = new ProductCategoryBuilder();
+		
+		if(category.equals("dog food"))
+		{
+			builder.addApplicableSpecies(PetSpecies.DOG);
+		}
+		else
+		{
+			builder.addApplicableSpecies(PetSpecies.CAT);
+		}
+		
+		builder.setAmountUsedPetPetAverage(1.0);
+		builder.setAmountUsedPetPetVariance(1.0);
+		builder.setDailyUsageRate(2.0);
+		builder.setCategory(category);
+		builder.setTriggerPurchaseRate(1.0 / 10.0);
+		builder.setTriggerPurchaseRate(1.0 / 10.0);
+		
+		for(Product product : products)
+		{
+			builder.addProduct(product);
+		}
+		
+		return builder.build();
+	}
+
+	protected TransactionPurchasesHiddenMarkovModel createHMM() throws Exception
+	{
+		SeedFactory seedFactory = new SeedFactory(1234);
+		
+		ProductCategory dogFoodCategory = createCategory("dog food");
+		ProductCategory catFoodCategory = createCategory("cat food");
+		
+		PurchasingProcesses processes = createProcesses(dogFoodCategory, catFoodCategory, seedFactory);
+		
+		CustomerTransactionParametersSamplerBuilder transParamsBuilder = new CustomerTransactionParametersSamplerBuilder(seedFactory);
+		Sampler<CustomerTransactionParameters> sampler = transParamsBuilder.build();
+		
+		CustomerTransactionParameters parameters = sampler.sample();
+		
+		CustomerInventoryBuilder inventoryBuilder = new CustomerInventoryBuilder(parameters, seedFactory);
+		inventoryBuilder.addProductCategory(dogFoodCategory);
+		inventoryBuilder.addProductCategory(catFoodCategory);
+		CustomerInventory inventory = inventoryBuilder.build();
+		
+		ConditionalWeightFunction<Double, Double> categoryWF =
+				new CategoryWeightFunction(parameters.getAveragePurchaseTriggerTime());
+		
+		TransactionPurchasesHiddenMarkovModel hmm = new TransactionPurchasesHiddenMarkovModel(processes,
+				categoryWF, inventory, seedFactory);
+		
+		return hmm;
+	}
+	
+	@Test
+	public void testChooseCategory() throws Exception
+	{
+		TransactionPurchasesHiddenMarkovModel hmm = createHMM();
+		
+		String category = hmm.chooseCategory(1.0, 0);
+		
+		assertNotNull(category);
+		assertTrue(category.equals(TransactionPurchasesHiddenMarkovModel.STOP_STATE) ||
+				category.equals("dog food") ||
+				category.equals("cat food"));
+	}
+	
+	@Test
+	public void testChooseProduct() throws Exception
+	{
+		TransactionPurchasesHiddenMarkovModel hmm = createHMM();
+		
+		Product product = hmm.chooseProduct("dog food");
+		
+		assertNotNull(product);
+		assertTrue(product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("dog food"));
+		
+		product = hmm.chooseProduct("cat food");
+		
+		assertNotNull(product);
+		assertTrue(product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("cat food"));
+	}
+	
+	@Test
+	public void testSample() throws Exception
+	{	
+		TransactionPurchasesHiddenMarkovModel hmm = createHMM();
+		
+		List<Product> purchase = hmm.sample(1.0);
+		
+		assertTrue(purchase.size() > 0);
+		
+		for(int i = 0; i < purchase.size(); i++)
+		{
+			Product product = purchase.get(i);
+			
+			// first product should never be null
+			assertNotNull(product);
+			assertTrue(product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("dog food") || 
+					product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("cat food"));
+		}
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/3bbbb557/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
----------------------------------------------------------------------
diff --git a/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
new file mode 100644
index 0000000..6c2bf31
--- /dev/null
+++ b/bigtop-data-generators/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/transaction/TestTransactionTimePDF.java
@@ -0,0 +1,35 @@
+/**
+ * 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.transaction;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.bigtop.bigpetstore.datagenerator.generators.transaction.TransactionTimePDF;
+import org.junit.Test;
+
+public class TestTransactionTimePDF
+{
+	
+	@Test
+	public void testProbability() throws Exception
+	{
+		TransactionTimePDF pdf = new TransactionTimePDF();
+		
+		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
+		assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
+		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
+	}
+}


Mime
View raw message