BIGTOP-1918. Add product enumeration to BPS data generato

Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/89393913
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/89393913
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/89393913

Branch: refs/heads/master
Commit: 89393913a07d27e02228a499464553fd8b18dd9c
Parents: 6fd647e
Author: RJ Nowling <[email protected]>
Authored: Sat Jul 11 11:33:37 2015 -0500
Committer: RJ Nowling <[email protected]>
Committed: Sat Jul 11 11:33:37 2015 -0500

----------------------------------------------------------------------
 .../bigpetstore/datagenerator/Constants.java    |   6 +-
 .../bigpetstore/datagenerator/DataLoader.java   |  10 +-
 .../datagenerator/ProductGenerator.java         |  39 ++
 .../datagenerator/cli/Simulation.java           |  16 +-
 .../datamodels/inputs/InputData.java            |  13 +-
 .../datamodels/inputs/ProductCategory.java      |   4 -
 .../inputs/ProductCategoryBuilder.java          | 133 ------
 .../datareaders/ProductsReader.java             | 152 -------
 .../products/ProductBuilderIterator.java        |  80 ++++
 .../products/ProductCategoryBuilder.java        | 195 ++++++++
 .../generators/products/ProductFieldValue.java  |  45 ++
 .../products/ProductFilterIterator.java         |  72 +++
 .../generators/products/ProductIterator.java    |  78 ++++
 .../products/cartesian/CartesianProduct.java    |  24 +
 .../cartesian/CartesianProductBase.java         |  56 +++
 .../cartesian/CartesianProductField.java        |  79 ++++
 .../collections/SmallProductCollection.java     | 162 +++++++
 .../products/rules/AlwaysTrueRule.java          |  29 ++
 .../generators/products/rules/AndRule.java      |  50 +++
 .../products/rules/FieldPredicate.java          |  48 ++
 .../generators/products/rules/NotRule.java      |  36 ++
 .../generators/products/rules/OrRule.java       |  43 ++
 .../generators/products/rules/Rule.java         |  23 +
 .../input_data/product_categories.json          | 440 -------------------
 .../customer/TestCustomerSamplerBuilder.java    |   5 +-
 .../cartesian/TestCartesianProductBase.java     |  41 ++
 .../cartesian/TestCartesianProductField.java    |  57 +++
 .../TestProductCategoryMarkovModelSampler.java  |   8 +-
 .../purchase/TestPurchasingModelSampler.java    |   8 +-
 .../TestPurchasingModelSamplerBuilder.java      |   8 +-
 .../transaction/TestCustomerInventory.java      |   2 +-
 .../TestCustomerInventoryBuilder.java           |   2 +-
 .../TestProductCategoryInventory.java           |   2 +-
 ...stTransactionPurchasesHiddenMarkovModel.java |   2 +-
 34 files changed, 1185 insertions(+), 783 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
index 90b363e..f43cf92 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/Constants.java
@@ -42,7 +42,7 @@ public class Constants
        
        public static final File NAMEDB_FILE = new File("namedb/data/data.dat");
        
-       public static final File PRODUCTS_FILE = new 
File("product_categories.json");
+       public static final String PRODUCTS_COLLECTION = "small";
        
        public static final double INCOME_SCALING_FACTOR = 100.0;
        
@@ -89,8 +89,10 @@ public class Constants
        public static final double STATIC_FIELD_VALUE_WEIGHT_EXPONENTIAL = 2.0;
        
        
-       public static final String PRODUCT_QUANTITY = "size";
+       public static final String PRODUCT_QUANTITY = "quantity";
        public static final String PRODUCT_CATEGORY = "category";
+       public static final String PRODUCT_UNIT_PRICE = "unitPrice";
+       public static final String PRODUCT_PRICE = "price";
        
        public static final double STOP_CATEGORY_WEIGHT = 0.01;
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
index fbd158d..a67acd7 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/DataLoader.java
@@ -18,15 +18,12 @@ package org.apache.bigtop.bigpetstore.datagenerator;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.InputStream;
-import java.util.Collection;
 import java.util.List;
 
 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.ProductCategory;
 import 
org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ZipcodeRecord;
 import org.apache.bigtop.bigpetstore.datagenerator.datareaders.NameReader;
-import org.apache.bigtop.bigpetstore.datagenerator.datareaders.ProductsReader;
 import org.apache.bigtop.bigpetstore.datagenerator.datareaders.ZipcodeReader;
 
 public class DataLoader
@@ -53,12 +50,7 @@ public class DataLoader
                Names names = nameReader.readData();
                System.out.println("Read " + names.getFirstNames().size() + " 
first names and " + names.getLastNames().size() + " last names");
                
-               System.out.println("Reading product data");
-               ProductsReader reader = new 
ProductsReader(getResource(Constants.PRODUCTS_FILE));
-               Collection<ProductCategory> productCategories = 
reader.readData();
-               System.out.println("Read " + productCategories.size() + " 
product categories");
-               
-               InputData inputData = new InputData(zipcodeTable, names, 
productCategories);
+               InputData inputData = new InputData(zipcodeTable, names);
                
                return inputData;
        }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
new file mode 100644
index 0000000..fb3e068
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/ProductGenerator.java
@@ -0,0 +1,39 @@
+/**
+ * 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;
+
+import java.util.List;
+
+import 
org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.collections.SmallProductCollection;
+
+public class ProductGenerator
+{
+       String collection;
+
+       public ProductGenerator(String collection)
+       {
+               this.collection = collection;
+       }
+
+       public List<ProductCategory> generate()
+       {
+               SmallProductCollection collection = new 
SmallProductCollection();
+               List<ProductCategory> categories = 
collection.generateProductCategory();
+
+               return categories;
+       }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
index b3e07af..f8bf18f 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/cli/Simulation.java
@@ -20,7 +20,9 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Vector;
 
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
 import org.apache.bigtop.bigpetstore.datagenerator.CustomerGenerator;
+import org.apache.bigtop.bigpetstore.datagenerator.ProductGenerator;
 import org.apache.bigtop.bigpetstore.datagenerator.PurchasingModelGenerator;
 import org.apache.bigtop.bigpetstore.datagenerator.StoreGenerator;
 import org.apache.bigtop.bigpetstore.datagenerator.TransactionGenerator;
@@ -28,6 +30,7 @@ import 
org.apache.bigtop.bigpetstore.datagenerator.datamodels.Customer;
 import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Store;
 import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Transaction;
 import org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.InputData;
+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.RouletteWheelSampler;
 import org.apache.bigtop.bigpetstore.datagenerator.framework.samplers.Sampler;
@@ -48,6 +51,7 @@ public class Simulation
        List<Customer> customers;
        Sampler<PurchasingModel> purchasingModelSampler;
        List<Transaction> transactions;
+       List<ProductCategory> productCategories;
        
        public Simulation(InputData inputData, int nStores, int nCustomers, int 
nPurchasingModels, double simulationTime, long seed)
        {
@@ -93,10 +97,17 @@ public class Simulation
                System.out.println("Generated " + customers.size() + " 
customers");
        }
        
+       public void generateProducts()
+       {
+               System.out.println("Generating products");
+               ProductGenerator generator = new 
ProductGenerator(Constants.PRODUCTS_COLLECTION);
+               productCategories = generator.generate();
+       }
+
        public void generatePurchasingProfiles() throws Exception
        {
                System.out.println("Generating purchasing profiles");
-               PurchasingModelGenerator generator = new 
PurchasingModelGenerator(inputData.getProductCategories(), seedFactory);
+               PurchasingModelGenerator generator = new 
PurchasingModelGenerator(productCategories, seedFactory);
                
                Collection<PurchasingModel> purchasingProfiles = new 
Vector<PurchasingModel>();
                for(int i = 0; i < nPurchasingModels; i++)
@@ -121,7 +132,7 @@ public class Simulation
                        PurchasingModel profile = 
purchasingModelSampler.sample();
                        
                        TransactionGenerator generator = new 
TransactionGenerator(customer,
-                                       profile, 
inputData.getProductCategories(), seedFactory);
+                                       profile, productCategories, 
seedFactory);
                        
                        while(true)
                        {
@@ -140,6 +151,7 @@ public class Simulation
        {
                generateStores();
                generateCustomers();
+               generateProducts();
                generatePurchasingProfiles();
                generateTransactions();
        }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
index def554c..4fad219 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/InputData.java
@@ -16,7 +16,6 @@
 package org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs;
 
 import java.io.Serializable;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -26,15 +25,12 @@ public class InputData implements Serializable
        
        List<ZipcodeRecord> zipcodeTable;
        Names names;
-       Collection<ProductCategory> productCategories;
        
        public InputData(List<ZipcodeRecord> zipcodeTable,
-                       Names names,
-                       Collection<ProductCategory> productCategories)
+                       Names names)
        {
                this.zipcodeTable = Collections.unmodifiableList(zipcodeTable);
                this.names = names;
-               this.productCategories = 
Collections.unmodifiableCollection(productCategories);
        }
        
        public List<ZipcodeRecord> getZipcodeTable()
@@ -46,11 +42,4 @@ public class InputData implements Serializable
        {
                return names;
        }
-       
-       public Collection<ProductCategory> getProductCategories()
-       {
-               return productCategories;
-       }
-       
-       
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
index db40288..6fb0572 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategory.java
@@ -105,8 +105,4 @@ public class ProductCategory implements Serializable
        {
                return products;
        }
-       
-       
-       
-       
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategoryBuilder.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategoryBuilder.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategoryBuilder.java
deleted file mode 100644
index ee5fd62..0000000
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datamodels/inputs/ProductCategoryBuilder.java
+++ /dev/null
@@ -1,133 +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.inputs;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
-import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class ProductCategoryBuilder
-{
-       String categoryLabel;
-       Set<PetSpecies> applicableSpecies;
-       Set<String> fieldNames;
-       Boolean triggerTransaction;
-       Double dailyUsageRate;
-       Double amountUsedPerPetAverage;
-       Double amountUsedPerPetVariance;
-       Double triggerTransactionRate;
-       Double triggerPurchaseRate;
-       List<Product> products;
-       
-       public ProductCategoryBuilder()
-       {
-               applicableSpecies = Sets.newHashSet();
-               fieldNames = Sets.newHashSet();
-               products = Lists.newArrayList();
-               
-               dailyUsageRate = 0.0;
-               amountUsedPerPetAverage = 0.0;
-               amountUsedPerPetVariance = 0.0;
-               triggerTransactionRate = 0.0;
-               triggerPurchaseRate = 0.0;
-               triggerTransaction = false;
-               categoryLabel = null;
-       }
-       
-       public void setCategory(String category)
-       {
-               this.categoryLabel = category;
-       }
-       
-       public void setTriggerTransaction(Boolean triggerTransaction)
-       {
-               this.triggerTransaction = triggerTransaction;
-       }
-       
-       public void setDailyUsageRate(Double dailyUsageRate)
-       {
-               this.dailyUsageRate = dailyUsageRate;
-       }
-       
-       public void setAmountUsedPetPetAverage(Double baseAmountUsedAverage)
-       {
-               this.amountUsedPerPetAverage = baseAmountUsedAverage;
-       }
-       
-       public void setAmountUsedPetPetVariance(Double baseAmountUsedVariance)
-       {
-               this.amountUsedPerPetVariance = baseAmountUsedVariance;
-       }
-       
-       public void setTriggerTransactionRate(Double triggerTransactionRate)
-       {
-               this.triggerTransactionRate = triggerTransactionRate;
-       }
-       
-       public void setTriggerPurchaseRate(Double triggerPurchaseRate)
-       {
-               this.triggerPurchaseRate = triggerPurchaseRate;
-       }
-       
-       public void addApplicableSpecies(PetSpecies species)
-       {
-               this.applicableSpecies.add(species);
-       }
-       
-       public void addFieldName(String fieldName)
-       {
-               this.fieldNames.add(fieldName);
-       }
-       
-       public void addProduct(Product product)
-       {
-               this.products.add(product);
-       }
-       
-       protected boolean validateProducts()
-       {
-               for(Product product : products)
-               {
-                       for(String fieldName : product.getFieldNames())
-                       {
-                               if(!fieldNames.contains(fieldName))
-                                       return false;
-                       }
-                       
-                       for(String fieldName : fieldNames)
-                       {
-                               if(!product.getFieldNames().contains(fieldName))
-                                       return false;
-                       }
-               }
-               
-               return true;
-       }
-       
-       public ProductCategory build()
-       {
-               validateProducts();
-               
-               return new ProductCategory(categoryLabel, applicableSpecies, 
fieldNames, triggerTransaction,
-                               dailyUsageRate, amountUsedPerPetAverage, 
amountUsedPerPetVariance, triggerTransactionRate,
-                                       triggerPurchaseRate, products);
-       }
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/ProductsReader.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/ProductsReader.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/ProductsReader.java
deleted file mode 100644
index 91db010..0000000
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/datareaders/ProductsReader.java
+++ /dev/null
@@ -1,152 +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.datareaders;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.List;
-import java.util.Map;
-
-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.datamodels.inputs.ProductCategoryBuilder;
-
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-
-public class ProductsReader
-{
-       InputStream path;
-       
-       public ProductsReader(InputStream path)
-       {
-               this.path = path;
-       }
-       
-       protected Product parseProduct(Object productJson)
-       {
-               Map<String, Object> fields = (Map<String, Object>) productJson;
-               Product product = new Product(fields);
-               return product;
-       }
-       
-       protected ProductCategory parseProductCategory(Object 
productCategoryObject) throws Exception
-       {
-               Map<String, Object> jsonProductCategory = (Map<String, Object>) 
productCategoryObject;
-
-               ProductCategoryBuilder builder = new ProductCategoryBuilder();
-               
-               for(Map.Entry<String, Object> entry : 
jsonProductCategory.entrySet())
-               {
-                       Object key = entry.getKey();
-                       Object value = entry.getValue();
-
-                       if(key.equals("category"))
-                       {
-                               builder.setCategory( (String) entry.getValue());
-                       }
-                       else if(key.equals("species"))
-                       {
-                               for(String species : (List<String>) value)
-                               {
-                                       if(species.equals("dog"))
-                                       {
-                                               
builder.addApplicableSpecies(PetSpecies.DOG);
-                                       }
-                                       else if(species.equals("cat"))
-                                       {
-                                               
builder.addApplicableSpecies(PetSpecies.CAT);
-                                       }
-                                       else
-                                       {
-                                               throw new Exception("Invalid 
species " + species + " encountered when parsing product categories JSON.");
-                                       }
-                               }
-                       }
-                       else if(key.equals("trigger_transaction"))
-                       {
-                               builder.setTriggerTransaction((Boolean) 
entry.getValue()); 
-                       }
-                       else if(key.equals("fields"))
-                       {
-                               for(String fieldName : (List<String>) value)
-                               {
-                                       builder.addFieldName(fieldName);
-                               }
-                       }
-                       else if(key.equals("daily_usage_rate"))
-                       {
-                               builder.setDailyUsageRate((Double) value);
-                       }
-                       else if(key.equals("base_amount_used_average"))
-                       {
-                               builder.setAmountUsedPetPetAverage((Double) 
value);
-                       }
-                       else if(key.equals("base_amount_used_variance"))
-                       {
-                               builder.setAmountUsedPetPetVariance((Double) 
value);
-                       }
-                       else if(key.equals("transaction_trigger_rate"))
-                       {
-                               builder.setTriggerTransactionRate((Double) 
value);
-                       }
-                       else if(key.equals("transaction_purchase_rate"))
-                       {
-                               builder.setTriggerPurchaseRate((Double) value);
-                       }
-                       else if(key.equals("items"))
-                       {
-                               for(Object productJson : (List<Object>) value)
-                               {
-                                       Product product = 
parseProduct(productJson);
-                                       builder.addProduct(product);
-                               }
-                       }
-                       else
-                       {
-                               throw new Exception("Invalid field " + key + " 
encountered when parsing product categories JSON.");
-                       }
-                       
-               }
-               
-               return builder.build();
-       }
-       
-       public List<ProductCategory> readData() throws Exception
-       {
-               Gson gson = new Gson();
-               
-               Reader reader = new InputStreamReader(path);
-               Object json = gson.fromJson(reader, Object.class);
-               
-               List<Object> productCategoryObjects = (List<Object>) json;
-
-               List<ProductCategory> productCategories = Lists.newArrayList();
-               
-               for(Object obj : productCategoryObjects)
-               {
-                       ProductCategory productCategory = 
parseProductCategory(obj);
-                       productCategories.add(productCategory);
-               }
-               
-               reader.close();
-               
-               return productCategories;
-               
-       }
-}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductBuilderIterator.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductBuilderIterator.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductBuilderIterator.java
new file mode 100644
index 0000000..c7dd0ab
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductBuilderIterator.java
@@ -0,0 +1,80 @@
+/**
+ * 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;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.Constants;
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+import com.google.common.collect.Maps;
+
+public class ProductBuilderIterator implements Iterator<Product>
+{
+       Iterator<Map<String, ProductFieldValue>> productIterator;
+       double basePrice;
+       String productCategory;
+
+       public ProductBuilderIterator(double basePrice, String productCategory,
+                       Iterator<Map<String, ProductFieldValue>> 
productIterator)
+       {
+               this.productIterator = productIterator;
+               this.basePrice = basePrice;
+               this.productCategory = productCategory;
+       }
+
+       @Override
+       public boolean hasNext()
+       {
+               return productIterator != null && productIterator.hasNext();
+       }
+
+       @Override
+       public Product next()
+       {
+               Map<String, ProductFieldValue> productComponents = 
productIterator.next();
+
+               double sum = 0.0;
+               double product = 1.0;
+
+               Map<String, Object> productFields = Maps.newHashMap();
+
+               for(Map.Entry<String, ProductFieldValue> entry : 
productComponents.entrySet())
+               {
+                       productFields.put(entry.getKey(), 
entry.getValue().getValue());
+                       sum += entry.getValue().getAdd();
+                       product *= entry.getValue().getMultiply();
+               }
+
+               double quantity = (Double) 
productFields.get(Constants.PRODUCT_QUANTITY);
+               double price = product * (sum + basePrice);
+               double unitPrice = price / quantity;
+
+               productFields.put(Constants.PRODUCT_UNIT_PRICE, unitPrice);
+               productFields.put(Constants.PRODUCT_PRICE, price);
+               productFields.put(Constants.PRODUCT_CATEGORY, productCategory);
+
+               return new Product(productFields);
+       }
+
+       @Override
+       public void remove()
+       {
+               throw new UnsupportedOperationException("ProductBuilder does 
not support remove()");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductCategoryBuilder.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductCategoryBuilder.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductCategoryBuilder.java
new file mode 100644
index 0000000..df8ae12
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductCategoryBuilder.java
@@ -0,0 +1,195 @@
+/**
+ * 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;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+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.generators.products.rules.AlwaysTrueRule;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.rules.NotRule;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.rules.OrRule;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.rules.Rule;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+public class ProductCategoryBuilder
+{
+       String categoryLabel;
+       Set<PetSpecies> applicableSpecies;
+       Boolean triggerTransaction;
+       Double dailyUsageRate;
+       Double amountUsedPerPetAverage;
+       Double amountUsedPerPetVariance;
+       Double triggerTransactionRate;
+       Double triggerPurchaseRate;
+       List<Rule> exclusionRules;
+       Map<String, Collection<ProductFieldValue>> productFieldValues;
+       Double basePrice;
+       List<Product> products;
+
+       public ProductCategoryBuilder()
+       {
+               applicableSpecies = Sets.newHashSet();
+
+               dailyUsageRate = 0.0;
+               amountUsedPerPetAverage = 0.0;
+               amountUsedPerPetVariance = 0.0;
+               triggerTransactionRate = 0.0;
+               triggerPurchaseRate = 0.0;
+               triggerTransaction = false;
+               categoryLabel = null;
+               exclusionRules = new Vector<Rule>();
+               productFieldValues = Maps.newHashMap();
+               basePrice = 1.0;
+               products = Lists.newArrayList();
+       }
+
+       public void setCategory(String category)
+       {
+               this.categoryLabel = category;
+       }
+
+       public void setTriggerTransaction(Boolean triggerTransaction)
+       {
+               this.triggerTransaction = triggerTransaction;
+       }
+
+       public void setDailyUsageRate(Double dailyUsageRate)
+       {
+               this.dailyUsageRate = dailyUsageRate;
+       }
+
+       public void setAmountUsedPetPetAverage(Double baseAmountUsedAverage)
+       {
+               this.amountUsedPerPetAverage = baseAmountUsedAverage;
+       }
+
+       public void setAmountUsedPetPetVariance(Double baseAmountUsedVariance)
+       {
+               this.amountUsedPerPetVariance = baseAmountUsedVariance;
+       }
+
+       public void setTriggerTransactionRate(Double triggerTransactionRate)
+       {
+               this.triggerTransactionRate = triggerTransactionRate;
+       }
+
+       public void setTriggerPurchaseRate(Double triggerPurchaseRate)
+       {
+               this.triggerPurchaseRate = triggerPurchaseRate;
+       }
+
+       public void addApplicableSpecies(PetSpecies species)
+       {
+               this.applicableSpecies.add(species);
+       }
+
+       public void addProduct(Product product)
+       {
+               products.add(product);
+       }
+
+       public void addExclusionRule(Rule rule)
+       {
+               this.exclusionRules.add(rule);
+       }
+
+       public void addPropertyValues(String fieldName, ProductFieldValue ... 
values)
+       {
+               this.productFieldValues.put(fieldName,  Arrays.asList(values));
+       }
+
+       public void setBasePrice(double basePrice)
+       {
+               this.basePrice = basePrice;
+       }
+
+
+       protected List<Product> generateProducts()
+       {
+               Rule combinedRules = new NotRule(new AlwaysTrueRule());
+               if(exclusionRules.size() == 1)
+               {
+                       combinedRules = exclusionRules.get(0);
+               }
+               else if(exclusionRules.size() > 1)
+               {
+                        combinedRules = new OrRule(exclusionRules.toArray(new 
Rule[] {}));
+               }
+
+               Iterator<Product> productIterator = new 
ProductIterator(productFieldValues, combinedRules,
+                               basePrice, categoryLabel);
+
+               while(productIterator.hasNext())
+               {
+                       products.add(productIterator.next());
+               }
+
+               return products;
+       }
+
+       public void validateProducts()
+       {
+               for(Product product : products)
+               {
+                       
if(!product.getFieldNames().contains(Constants.PRODUCT_CATEGORY))
+                       {
+                               throw new IllegalStateException("Product must 
have field " + Constants.PRODUCT_CATEGORY);
+                       }
+
+                       
if(!product.getFieldNames().contains(Constants.PRODUCT_QUANTITY))
+                       {
+                               throw new IllegalStateException("Product must 
have field " + Constants.PRODUCT_QUANTITY);
+                       }
+
+                       
if(!product.getFieldNames().contains(Constants.PRODUCT_PRICE))
+                       {
+                               throw new IllegalStateException("Product must 
have field " + Constants.PRODUCT_PRICE);
+                       }
+
+                       
if(!product.getFieldNames().contains(Constants.PRODUCT_UNIT_PRICE))
+                       {
+                               throw new IllegalStateException("Product must 
have field " + Constants.PRODUCT_UNIT_PRICE);
+                       }
+               }
+       }
+
+       public ProductCategory build()
+       {
+               List<Product> products = generateProducts();
+
+               Set<String> fieldNames = Sets.newHashSet();
+               for(Product product : products)
+               {
+                       fieldNames.addAll(product.getFieldNames());
+               }
+
+               return new ProductCategory(categoryLabel, applicableSpecies, 
fieldNames, triggerTransaction,
+                               dailyUsageRate, amountUsedPerPetAverage, 
amountUsedPerPetVariance, triggerTransactionRate,
+                                       triggerPurchaseRate, products);
+       }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFieldValue.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFieldValue.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFieldValue.java
new file mode 100644
index 0000000..fe4d7fa
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFieldValue.java
@@ -0,0 +1,45 @@
+/**
+ * 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;
+
+public class ProductFieldValue
+{
+       Object value;
+       double add;
+       double multiply;
+
+       public ProductFieldValue(Object value, double add, double multiply)
+       {
+               this.value = value;
+               this.add = add;
+               this.multiply = multiply;
+       }
+
+       public Object getValue()
+       {
+               return value;
+       }
+
+       public double getAdd()
+       {
+               return add;
+       }
+
+       public double getMultiply()
+       {
+               return multiply;
+       }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFilterIterator.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFilterIterator.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFilterIterator.java
new file mode 100644
index 0000000..c0e285d
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductFilterIterator.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.bigpetstore.datagenerator.generators.products;
+
+import java.util.Iterator;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.rules.Rule;
+
+public class ProductFilterIterator implements Iterator<Product>
+{
+       Rule rule;
+       Iterator<Product> products;
+       Product buffer;
+
+       public ProductFilterIterator(Rule rule, Iterator<Product> products)
+       {
+               this.rule = rule;
+               this.products = products;
+               this.buffer = getNext();
+       }
+
+       private Product getNext()
+       {
+               while(products.hasNext())
+               {
+                       Product product = products.next();
+
+                       if(!rule.ruleMatches(product))
+                       {
+                               return product;
+                       }
+               }
+
+               return null;
+       }
+
+       @Override
+       public boolean hasNext()
+       {
+               return buffer != null;
+       }
+
+       @Override
+       public Product next()
+       {
+               Product previous = buffer;
+               buffer = getNext();
+
+               return previous;
+       }
+
+       @Override
+       public void remove()
+       {
+               throw new UnsupportedOperationException("ProductFilter does not 
support remove()");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductIterator.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductIterator.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductIterator.java
new file mode 100644
index 0000000..ccfef56
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/ProductIterator.java
@@ -0,0 +1,78 @@
+/**
+ * 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;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.cartesian.CartesianProduct;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.cartesian.CartesianProductBase;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.cartesian.CartesianProductField;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.rules.Rule;
+
+public class ProductIterator implements Iterator<Product>
+{
+
+       Iterator<Product> productIterator;
+
+       public ProductIterator(Map<String, Collection<ProductFieldValue>> 
fieldValues, Rule matcher,
+                       double basePrice, String productCategory)
+       {
+               productIterator = new ProductFilterIterator(matcher,
+                               new ProductBuilderIterator(basePrice, 
productCategory,
+                                               
buildCartesianProductIterator(fieldValues)));
+       }
+
+       public Iterator<Map<String, ProductFieldValue>>
+               buildCartesianProductIterator(Map<String, 
Collection<ProductFieldValue>> fieldValues)
+       {
+               CartesianProduct<ProductFieldValue> product = null;
+               for(Map.Entry<String, Collection<ProductFieldValue>> pair : 
fieldValues.entrySet())
+               {
+                       if(product == null)
+                       {
+                               product = new 
CartesianProductBase<ProductFieldValue>(pair.getKey(), pair.getValue());
+                       } else
+                       {
+                               product = new 
CartesianProductField<ProductFieldValue>(pair.getKey(), pair.getValue(), 
product);
+                       }
+
+               }
+
+               return product;
+       }
+
+       @Override
+       public boolean hasNext()
+       {
+               return productIterator.hasNext();
+       }
+
+       @Override
+       public Product next()
+       {
+               return productIterator.next();
+       }
+
+       @Override
+       public void remove()
+       {
+               throw new UnsupportedOperationException("ProductIterator does 
not support remove()");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProduct.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProduct.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProduct.java
new file mode 100644
index 0000000..f688980
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProduct.java
@@ -0,0 +1,24 @@
+/**
+ * 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.Iterator;
+import java.util.Map;
+
+public interface CartesianProduct<T> extends Iterator<Map<String, T>>
+{
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductBase.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductBase.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductBase.java
new file mode 100644
index 0000000..7b0934c
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductBase.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.bigpetstore.datagenerator.generators.products.cartesian;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class CartesianProductBase<T> implements CartesianProduct<T>
+{
+       String fieldName;
+       Iterator<T> fieldValues;
+
+       public CartesianProductBase(String fieldName, Collection<T> fieldValues)
+       {
+               this.fieldName = fieldName;
+               this.fieldValues = fieldValues.iterator();
+       }
+
+
+       @Override
+       public boolean hasNext()
+       {
+               return fieldValues.hasNext();
+       }
+
+       @Override
+       public Map<String, T> next()
+       {
+               Map<String, T> map = new HashMap<String, T>();
+               map.put(fieldName, fieldValues.next());
+
+               return map;
+       }
+
+       @Override
+       public void remove()
+       {
+               throw new UnsupportedOperationException("CartesianProductBase 
does not support remove()");
+       }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductField.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductField.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductField.java
new file mode 100644
index 0000000..166efc8
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/CartesianProductField.java
@@ -0,0 +1,79 @@
+/**
+ * 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.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+public class CartesianProductField<T> implements CartesianProduct<T>
+{
+       String fieldName;
+       Iterator<T> fieldValuesIterator;
+       Collection<T> fieldValues;
+       CartesianProduct<T> previous;
+       Map<String, T> baseValue;
+
+       public CartesianProductField(String fieldName, Collection<T> 
fieldValues, CartesianProduct<T> previous)
+       {
+               this.fieldValues = fieldValues;
+               this.fieldName = fieldName;
+               this.previous = previous;
+       }
+
+       @Override
+       public boolean hasNext()
+       {
+               return previous.hasNext() || (fieldValuesIterator != null && 
fieldValuesIterator.hasNext());
+       }
+
+       @Override
+       public Map<String, T> next()
+       {
+               if(fieldValuesIterator != null)
+               {
+                       Map<String, T> map = new HashMap<String, T>(baseValue);
+                       map.put(fieldName, fieldValuesIterator.next());
+
+                       if(!fieldValuesIterator.hasNext())
+                       {
+                               fieldValuesIterator = null;
+                       }
+
+                       return map;
+               } else if(previous.hasNext())
+               {
+                       baseValue = previous.next();
+                       fieldValuesIterator = fieldValues.iterator();
+
+                       Map<String, T> map = new HashMap<String, T>(baseValue);
+                       map.put(fieldName, fieldValuesIterator.next());
+
+                       return map;
+               }
+
+               throw new NoSuchElementException();
+       }
+
+       @Override
+       public void remove()
+       {
+               throw new UnsupportedOperationException("CartesianProductBase 
does not support remove()");
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/collections/SmallProductCollection.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/collections/SmallProductCollection.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/collections/SmallProductCollection.java
new file mode 100644
index 0000000..8ca71ef
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/collections/SmallProductCollection.java
@@ -0,0 +1,162 @@
+/**
+ * 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.collections;
+
+import java.util.List;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.PetSpecies;
+import 
org.apache.bigtop.bigpetstore.datagenerator.datamodels.inputs.ProductCategory;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductCategoryBuilder;
+import 
org.apache.bigtop.bigpetstore.datagenerator.generators.products.ProductFieldValue;
+
+import com.google.common.collect.Lists;
+
+public class SmallProductCollection
+{
+       private ProductCategory createDogFood()
+       {
+               ProductCategoryBuilder builder = new ProductCategoryBuilder();
+
+               builder.addApplicableSpecies(PetSpecies.DOG);
+               builder.setCategory("dry dog food");
+               builder.setTriggerTransaction(true);
+               builder.setDailyUsageRate(2.0);
+               builder.setAmountUsedPetPetAverage(0.25);
+               builder.setAmountUsedPetPetVariance(0.1);
+               builder.setTriggerTransactionRate(2.0);
+               builder.setTriggerPurchaseRate(7.0);
+               builder.setBasePrice(2.0);
+
+               builder.addPropertyValues("brand",
+                               new ProductFieldValue("Wellfed", 0.0, 1.0),
+                               new ProductFieldValue("Happy Pup", 0.67, 1.0),
+                               new ProductFieldValue("Dog Days", 1.0, 1.0));
+
+               builder.addPropertyValues("flavor",
+                               new ProductFieldValue("Chicken", 0.0, 1.0),
+                               new ProductFieldValue("Pork", 0.0, 1.0),
+                               new ProductFieldValue("Lamb & Rice", 0.0, 1.0),
+                               new ProductFieldValue("Fish & Potato", 0.0, 
1.0));
+
+               builder.addPropertyValues("quantity",
+                               new ProductFieldValue(4.5, 0.0, 4.5),
+                               new ProductFieldValue(15.0, 0.0, 15.0),
+                               new ProductFieldValue(30.0, 0.0, 30.0));
+
+               return builder.build();
+       }
+
+       private ProductCategory createCatFood()
+       {
+               ProductCategoryBuilder builder = new ProductCategoryBuilder();
+
+               builder.addApplicableSpecies(PetSpecies.CAT);
+               builder.setCategory("dry cat food");
+               builder.setTriggerTransaction(true);
+               builder.setDailyUsageRate(2.0);
+               builder.setAmountUsedPetPetAverage(0.1);
+               builder.setAmountUsedPetPetVariance(0.05);
+               builder.setTriggerTransactionRate(2.0);
+               builder.setTriggerPurchaseRate(7.0);
+               builder.setBasePrice(2.14);
+
+               builder.addPropertyValues("brand",
+                               new ProductFieldValue("Wellfed", 0.0, 1.0),
+                               new ProductFieldValue("Pretty Cat", 0.72, 1.0),
+                               new ProductFieldValue("Feisty Feline", 0.0, 
1.0));
+
+               builder.addPropertyValues("flavor",
+                               new ProductFieldValue("Tuna", 0.0, 1.0),
+                               new ProductFieldValue("Chicken & Rice", 0.0, 
1.0));
+
+               builder.addPropertyValues("quantity",
+                               new ProductFieldValue(7.0, 0.0, 7.0),
+                               new ProductFieldValue(15.0, 0.0, 15.0));
+
+               builder.addPropertyValues("hairball management",
+                               new ProductFieldValue("true", 0.0, 1.0),
+                               new ProductFieldValue("false", 0.0, 1.0));
+
+               return builder.build();
+       }
+
+       private ProductCategory createKittyLitter()
+       {
+               ProductCategoryBuilder builder = new ProductCategoryBuilder();
+
+               builder.addApplicableSpecies(PetSpecies.CAT);
+               builder.setCategory("kitty litter");
+               builder.setTriggerTransaction(true);
+               builder.setDailyUsageRate(1.0);
+               builder.setAmountUsedPetPetAverage(0.1);
+               builder.setAmountUsedPetPetVariance(0.05);
+               builder.setTriggerTransactionRate(2.0);
+               builder.setTriggerPurchaseRate(7.0);
+               builder.setBasePrice(1.43);
+
+               builder.addPropertyValues("brand",
+                               new ProductFieldValue("Pretty Cat", 0.0, 1.0),
+                               new ProductFieldValue("Feisty Feline", 0.07, 
1.0));
+
+               builder.addPropertyValues("quantity",
+                               new ProductFieldValue(7.0, 0.0, 7.0),
+                               new ProductFieldValue(14.0, 0.0, 14.0),
+                               new ProductFieldValue(28.0, 0.0, 28.0));
+
+               return builder.build();
+       }
+
+       private ProductCategory createPoopBags()
+       {
+               ProductCategoryBuilder builder = new ProductCategoryBuilder();
+
+               builder.addApplicableSpecies(PetSpecies.DOG);
+               builder.setCategory("poop bags");
+               builder.setTriggerTransaction(true);
+               builder.setDailyUsageRate(2.0);
+               builder.setAmountUsedPetPetAverage(1.0);
+               builder.setAmountUsedPetPetVariance(0.5);
+               builder.setTriggerTransactionRate(2.0);
+               builder.setTriggerPurchaseRate(7.0);
+               builder.setBasePrice(0.17);
+
+               builder.addPropertyValues("brand",
+                               new ProductFieldValue("Happy Pup", 0.0, 1.0),
+                               new ProductFieldValue("Dog Days", 0.04, 1.0));
+
+               builder.addPropertyValues("color",
+                               new ProductFieldValue("blue", 0.0, 1.0),
+                               new ProductFieldValue("multicolor", 0.0, 1.0));
+
+               builder.addPropertyValues("quantity",
+                               new ProductFieldValue(60.0, 0.0, 60.0),
+                               new ProductFieldValue(120.0, 0.0, 120.0));
+
+               return builder.build();
+       }
+
+       public List<ProductCategory> generateProductCategory()
+       {
+               List<ProductCategory> productCategories = Lists.newArrayList();
+
+               productCategories.add(this.createDogFood());
+               productCategories.add(this.createCatFood());
+               productCategories.add(this.createKittyLitter());
+               productCategories.add(this.createPoopBags());
+
+               return productCategories;
+       }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AlwaysTrueRule.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AlwaysTrueRule.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AlwaysTrueRule.java
new file mode 100644
index 0000000..d973346
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AlwaysTrueRule.java
@@ -0,0 +1,29 @@
+/**
+ * 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.rules;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public class AlwaysTrueRule implements Rule
+{
+
+       @Override
+       public boolean ruleMatches(Product product) throws 
IllegalArgumentException
+       {
+               return true;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AndRule.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AndRule.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AndRule.java
new file mode 100644
index 0000000..4be89be
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/AndRule.java
@@ -0,0 +1,50 @@
+/**
+ * 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.rules;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public class AndRule implements Rule
+{
+       List<Rule> rules;
+
+       public AndRule(Rule rule1, Rule rule2, Rule ... rules)
+       {
+               this.rules = new LinkedList<Rule>(Arrays.asList(rules));
+               this.rules.add(rule1);
+               this.rules.add(rule2);
+       }
+
+       @Override
+       public boolean ruleMatches(Product product) throws 
IllegalArgumentException
+       {
+               boolean matches = true;
+               for(Rule rule : rules)
+               {
+                       if(! rule.ruleMatches(product))
+                       {
+                               matches = false;
+                       }
+               }
+
+               return matches;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/FieldPredicate.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/FieldPredicate.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/FieldPredicate.java
new file mode 100644
index 0000000..37e7c12
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/FieldPredicate.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.products.rules;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public class FieldPredicate implements Rule
+{
+       String fieldName;
+       Collection<String> allowedValues;
+
+       public FieldPredicate(String fieldName, String ... allowedValues)
+       {
+               this.fieldName = fieldName;
+               this.allowedValues = Arrays.asList(allowedValues);
+       }
+
+       @Override
+       public boolean ruleMatches(Product product)
+       {
+               if(! product.getFieldNames().contains(fieldName))
+               {
+                       throw new IllegalArgumentException("Product (" + 
product.toString() +
+                                       ") does not contain field name (" + 
fieldName + ")");
+               }
+
+               Object seenValue = product.getFieldValue(fieldName);
+
+               return allowedValues.contains(seenValue);
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/NotRule.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/NotRule.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/NotRule.java
new file mode 100644
index 0000000..ffac751
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/NotRule.java
@@ -0,0 +1,36 @@
+/**
+ * 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.rules;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public class NotRule implements Rule
+{
+       Rule rule;
+
+       public NotRule(Rule rule)
+       {
+               this.rule = rule;
+       }
+
+
+       @Override
+       public boolean ruleMatches(Product product) throws 
IllegalArgumentException
+       {
+               return ! rule.ruleMatches(product);
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/OrRule.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/OrRule.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/OrRule.java
new file mode 100644
index 0000000..c3ed549
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/OrRule.java
@@ -0,0 +1,43 @@
+/**
+ * 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.rules;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public class OrRule implements Rule
+{
+       Rule[] rules;
+
+       public OrRule(Rule ... rules)
+       {
+               this.rules = rules;
+       }
+
+       @Override
+       public boolean ruleMatches(Product product) throws 
IllegalArgumentException
+       {
+               for(Rule rule : rules)
+               {
+                       if(rule.ruleMatches(product))
+                       {
+                               return true;
+                       }
+               }
+
+               return false;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/Rule.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/Rule.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/Rule.java
new file mode 100644
index 0000000..4aa7945
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/rules/Rule.java
@@ -0,0 +1,23 @@
+/**
+ * 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.rules;
+
+import org.apache.bigtop.bigpetstore.datagenerator.datamodels.Product;
+
+public interface Rule
+{
+       public boolean ruleMatches(Product product) throws 
IllegalArgumentException;
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/main/resources/input_data/product_categories.json
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/resources/input_data/product_categories.json
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/main/resources/input_data/product_categories.json
deleted file mode 100644
index 4c880bd..0000000
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/main/resources/input_data/product_categories.json
+++ /dev/null
@@ -1,440 +0,0 @@
-[
-       {
-               "category" : "dry dog food",
-               "species" : ["dog"],
-               "trigger_transaction" : true,
-               "fields" : ["brand", "flavor", "size"],
-               "daily_usage_rate" : 2.0,
-               "base_amount_used_average" : 0.25,
-               "base_amount_used_variance" : 0.1,
-               "transaction_trigger_rate" : 2.0,
-               "transaction_purchase_rate" : 7.0,
-               "items" : 
-                               [
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Pork",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Pork",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Chicken",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Pork",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Chicken",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Pork",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Happy Pup",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 2.67
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Chicken",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Pork",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Chicken",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Pork",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Lamb & Rice",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 3.00
-                                       },
-                                       {
-                                               "category" : "dry dog food",
-                                               "brand" : "Dog Days",
-                                               "flavor" : "Fish & Potato",
-                                               "size" : 30.0,
-                                               "per_unit_cost" : 3.00
-                                       }
-                               ]
-       },
-       {
-               "category" : "dry cat food",
-               "species" : ["cat"],
-               "trigger_transaction" : true,
-               "fields" : ["brand", "flavor", "size"],
-               "daily_usage_rate" : 2.0,
-               "base_amount_used_average" : 0.1,
-               "base_amount_used_variance" : 0.05,
-               "transaction_trigger_rate" : 2.0,
-               "transaction_purchase_rate" : 7.0,
-               "items" : 
-                               [
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Pretty Cat",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.86
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Pretty Cat",
-                                               "flavor" : "Tuna",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.86
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Pretty Cat",
-                                               "flavor" : "Chicken & Rice",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.86
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Pretty Cat",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.86
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Pretty Cat",
-                                               "flavor" : "Tuna",
-                                               "size" : 15.0,
-                                               "per_unit_cost" : 2.86
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken & Rice",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Tuna",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken & Rice",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Wellfed",
-                                               "flavor" : "Tuna",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Chicken & Rice",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Tuna",
-                                               "size" : 7.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Chicken & Rice",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Chicken & Rice 
(Hairball Management)",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       },
-                                       {
-                                               "category" : "dry cat food",
-                                               "brand" : "Feisty Feline",
-                                               "flavor" : "Tuna",
-                                               "size" : 14.0,
-                                               "per_unit_cost" : 2.14
-                                       }
-                               ]
-       },
-       {
-               "category" : "kitty litter",
-               "species" : ["cat"],
-               "trigger_transaction" : true,
-               "fields" : ["brand", "size"],
-               "daily_usage_rate" : 1.0,
-               "base_amount_used_average" : 0.1,
-               "base_amount_used_variance" : 0.05,
-               "transaction_trigger_rate" : 2.0,
-               "transaction_purchase_rate" : 7.0,
-               "items" : 
-                               [
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Pretty Cat",
-                                               "size" : 7,
-                                               "per_unit_cost" : 1.43
-                                       }
-                                       ,
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Pretty Cat",
-                                               "size" : 14,
-                                               "per_unit_cost" : 1.43
-                                       },
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Pretty Cat",
-                                               "size" : 28,
-                                               "per_unit_cost" : 1.43
-                                       },
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Fiesty Feline",
-                                               "size" : 7,
-                                               "per_unit_cost" : 1.50
-                                       }
-                                       ,
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Fiesty Feline",
-                                               "size" : 14,
-                                               "per_unit_cost" : 1.50
-                                       },
-                                       {
-                                               "category" : "kitty litter",
-                                               "brand" : "Feisty Feline",
-                                               "size" : 28,
-                                               "per_unit_cost" : 1.50
-                                       }
-                               ]
-
-       },
-       {
-               "category" : "poop bags",
-               "species" : ["dog"],
-               "trigger_transaction" : true,
-               "fields" : ["brand", "color", "size"],
-               "daily_usage_rate" : 2.0,
-               "base_amount_used_average" : 1.0,
-               "base_amount_used_variance" : 0.5,
-               "transaction_trigger_rate" : 2.0,
-               "transaction_purchase_rate" : 7.0,
-               "items" : 
-                       [
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Happy Pup",
-                                       "color" : "Blue",
-                                       "size" : 60,
-                                       "per_unit_cost" : 0.17
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Happy Pup",
-                                       "color" : "Blue",
-                                       "size" : 120,
-                                       "per_unit_cost" : 0.17
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Happy Pup",
-                                       "color" : "multicolor",
-                                       "size" : 60,
-                                       "per_unit_cost" : 0.17
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Happy Pup",
-                                       "color" : "multicolor",
-                                       "size" : 120,
-                                       "per_unit_cost" : 0.17
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Dog Days",
-                                       "color" : "Blue",
-                                       "size" : 60,
-                                       "per_unit_cost" : 0.21
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Dog Days",
-                                       "color" : "Blue",
-                                       "size" : 120,
-                                       "per_unit_cost" : 0.21
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Dog Days",
-                                       "color" : "multicolor",
-                                       "size" : 60,
-                                       "per_unit_cost" : 0.21
-                               },
-                               {
-                                       "category" : "poop bags",
-                                       "brand" : "Dog Days",
-                                       "color" : "multicolor",
-                                       "size" : 120,
-                                       "per_unit_cost" : 0.21
-                               }
-                       ]
-       }
-]

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
index cd92052..fdff826 100644
--- 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/customer/TestCustomerSamplerBuilder.java
@@ -18,7 +18,6 @@ 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.List;
 import java.util.Map;
@@ -28,11 +27,9 @@ import 
org.apache.bigtop.bigpetstore.datagenerator.datamodels.Pair;
 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.ProductCategory;
 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.bigtop.bigpetstore.datagenerator.generators.customer.CustomerSamplerBuilder;
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableMap;
@@ -53,7 +50,7 @@ public class TestCustomerSamplerBuilder
                Names names = new Names(nameList, nameList);
                
                // don't need product categories for building customers
-               InputData inputData = new InputData(zipcodes, names, new 
ArrayList<ProductCategory>());
+               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)),

http://git-wip-us.apache.org/repos/asf/bigtop/blob/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
new file mode 100644
index 0000000..f171980
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductBase.java
@@ -0,0 +1,41 @@
+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/89393913/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
----------------------------------------------------------------------
diff --git 
a/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
new file mode 100644
index 0000000..42d62c7
--- /dev/null
+++ 
b/bigtop-bigpetstore/bigpetstore-data-generator/src/test/java/org/apache/bigtop/bigpetstore/datagenerator/generators/products/cartesian/TestCartesianProductField.java
@@ -0,0 +1,57 @@
+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());
+       }
+}

Reply via email to