gt: 	    ProductAttribute whiteAttribute = new ProductAttribute();
context: package com.salesmanager.test.order;
  
  import java.math.BigDecimal;
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.List;
  
  import org.junit.Assert;
  import org.junit.Ignore;
  import org.junit.Test;
  
  import com.salesmanager.core.business.constants.Constants;
  import com.salesmanager.core.business.exception.ServiceException;
  import com.salesmanager.core.model.catalog.category.Category;
  import com.salesmanager.core.model.catalog.category.CategoryDescription;
  import com.salesmanager.core.model.catalog.product.Product;
  import com.salesmanager.core.model.catalog.product.attribute.ProductAttribute;
  import com.salesmanager.core.model.catalog.product.attribute.ProductOption;
  import com.salesmanager.core.model.catalog.product.attribute.ProductOptionDescription;
  import com.salesmanager.core.model.catalog.product.attribute.ProductOptionType;
  import com.salesmanager.core.model.catalog.product.attribute.ProductOptionValue;
  import com.salesmanager.core.model.catalog.product.attribute.ProductOptionValueDescription;
  import com.salesmanager.core.model.catalog.product.availability.ProductAvailability;
  import com.salesmanager.core.model.catalog.product.description.ProductDescription;
  import com.salesmanager.core.model.catalog.product.manufacturer.Manufacturer;
  import com.salesmanager.core.model.catalog.product.manufacturer.ManufacturerDescription;
  import com.salesmanager.core.model.catalog.product.price.ProductPrice;
  import com.salesmanager.core.model.catalog.product.price.ProductPriceDescription;
  import com.salesmanager.core.model.catalog.product.price.ProductPriceType;
  import com.salesmanager.core.model.catalog.product.type.ProductType;
  import com.salesmanager.core.model.common.Billing;
  import com.salesmanager.core.model.common.Delivery;
  import com.salesmanager.core.model.customer.Customer;
  import com.salesmanager.core.model.customer.CustomerGender;
  import com.salesmanager.core.model.merchant.MerchantStore;
  import com.salesmanager.core.model.order.Order;
  import com.salesmanager.core.model.order.OrderCriteria;
  import com.salesmanager.core.model.order.OrderList;
  import com.salesmanager.core.model.order.OrderTotal;
  import com.salesmanager.core.model.order.orderproduct.OrderProduct;
  import com.salesmanager.core.model.order.orderproduct.OrderProductAttribute;
  import com.salesmanager.core.model.order.orderproduct.OrderProductPrice;
  import com.salesmanager.core.model.order.orderstatus.OrderStatus;
  import com.salesmanager.core.model.order.orderstatus.OrderStatusHistory;
  import com.salesmanager.core.model.order.payment.CreditCard;
  import com.salesmanager.core.model.payments.CreditCardType;
  import com.salesmanager.core.model.payments.PaymentType;
  import com.salesmanager.core.model.reference.country.Country;
  import com.salesmanager.core.model.reference.currency.Currency;
  import com.salesmanager.core.model.reference.language.Language;
  import com.salesmanager.core.model.reference.zone.Zone;
  
  
  //@Ignore
  public class OrderTest extends com.salesmanager.test.common.AbstractSalesManagerCoreTestCase {
  
  
  	
  
  	@Test
  	public void getMerchantOrders() throws ServiceException {
  		
  
  
  		Currency currency = currencyService.getByCode(USD_CURRENCY_CODE);
  		Country country = countryService.getByCode("US");
  		Zone zone = zoneService.getByCode("VT");
  		Language en = languageService.getByCode("en");
  		
  		MerchantStore merchant = merchantService.getByCode( MerchantStore.DEFAULT_STORE );	
  	
  		/** Create a customer **/
  		Customer customer = new Customer();	
  		customer.setMerchantStore(merchant);
  		customer.setDefaultLanguage(en);
  		customer.setEmailAddress("email@email.com");
  		customer.setPassword("-1999");
  		customer.setNick("My New nick");
  		customer.setCompany(" Apple");	
  		customer.setGender(CustomerGender.M);
  		customer.setDateOfBirth(new Date());		
  		
  		Billing billing = new Billing();
  	    billing.setAddress("Billing address");
  	    billing.setCity("Billing city");
  	    billing.setCompany("Billing company");
  	    billing.setCountry(country);
  	    billing.setFirstName("Carl");
  	    billing.setLastName("Samson");
  	    billing.setPostalCode("Billing postal code");
  	    billing.setState("Billing state");
  	    billing.setZone(zone);
  	    
  	    Delivery delivery = new Delivery();
  	    delivery.setAddress("Shipping address");
  	    delivery.setCountry(country);
  	    delivery.setZone(zone);	    
  	    
  	    customer.setBilling(billing);
  	    customer.setDelivery(delivery);
  	    
  		customerService.create(customer);	
  		
  		
  		//create a product with attributes
  
  	    /** CATALOG CREATION **/
  	    
  	    ProductType generalType = productTypeService.getProductType(ProductType.GENERAL_TYPE);
  
  	    /**
  	     * Create the category
  	     */
  	    Category shirts = new Category();
  	    shirts.setMerchantStore(merchant);
  	    shirts.setCode("shirts");
  
  	    CategoryDescription shirtsEnglishDescription = new CategoryDescription();
  	    shirtsEnglishDescription.setName("Shirts");
  	    shirtsEnglishDescription.setCategory(shirts);
  	    shirtsEnglishDescription.setLanguage(en);
  
  	    List<CategoryDescription> descriptions = new ArrayList<CategoryDescription>();
  	    descriptions.add(shirtsEnglishDescription);
  
  
  	    shirts.setDescriptions(descriptions);
  	    categoryService.create(shirts);
  	    
  	    
  	    /**
  	     * Create a manufacturer
  	     */
  	    Manufacturer addidas = new Manufacturer();
  	    addidas.setMerchantStore(merchant);
  	    addidas.setCode("addidas");
  
  	    ManufacturerDescription addidasDesc = new ManufacturerDescription();
  	    addidasDesc.setLanguage(en);
  	    addidasDesc.setManufacturer(addidas);
  	    addidasDesc.setName("Addidas");
  	    addidas.getDescriptions().add(addidasDesc);
  
  	    manufacturerService.create(addidas);
  	    
  	    /**
  	     * Create an option
  	     */
  	    ProductOption option = new ProductOption();
  	    option.setMerchantStore(merchant);
  	    option.setCode("color");
  	    option.setProductOptionType(ProductOptionType.Radio.name());
  	    
  	    ProductOptionDescription optionDescription = new ProductOptionDescription();
  	    optionDescription.setLanguage(en);
  	    optionDescription.setName("Color");
  	    optionDescription.setDescription("Item color");
  	    optionDescription.setProductOption(option);
  	    
  	    option.getDescriptions().add(optionDescription);
  	    
  	    productOptionService.saveOrUpdate(option);
  	    
  	    
  	    /** first option value **/
  	    ProductOptionValue white = new ProductOptionValue();
  	    white.setMerchantStore(merchant);
  	    white.setCode("white");
  	    
  	    ProductOptionValueDescription whiteDescription = new ProductOptionValueDescription();
  	    whiteDescription.setLanguage(en);
  	    whiteDescription.setName("White");
  	    whiteDescription.setDescription("White color");
  	    whiteDescription.setProductOptionValue(white);
  	    
  	    white.getDescriptions().add(whiteDescription);
  	    
  	    productOptionValueService.saveOrUpdate(white);
  	    
  	    
  	    ProductOptionValue black = new ProductOptionValue();
  	    black.setMerchantStore(merchant);
  	    black.setCode("black");
  	    
  	    /** second option value **/
  	    ProductOptionValueDescription blackDesc = new ProductOptionValueDescription();
  	    blackDesc.setLanguage(en);
  	    blackDesc.setName("Black");
  	    blackDesc.setDescription("Black color");
  	    blackDesc.setProductOptionValue(black);
  	    
  	    black.getDescriptions().add(blackDesc);
  
  	    productOptionValueService.saveOrUpdate(black);
  	    
  	    
  	    /**
  	     * Create a complex product
  	     */
  	    Product product = new Product();
  	    product.setProductHeight(new BigDecimal(4));
  	    product.setProductLength(new BigDecimal(3));
  	    product.setProductWidth(new BigDecimal(1));
  	    product.setSku("TB12345");
  	    product.setManufacturer(addidas);
  	    product.setType(generalType);
  	    product.setMerchantStore(merchant);
  
  	    // Product description
  	    ProductDescription description = new ProductDescription();
  	    description.setName("Short sleeves shirt");
  	    description.setLanguage(en);
  	    description.setProduct(product);
  
  	    product.getDescriptions().add(description);
  	    product.getCategories().add(shirts);
  	    
  	    
  	    //availability
  	    ProductAvailability availability = new ProductAvailability();
  	    availability.setProductDateAvailable(new Date());
  	    availability.setProductQuantity(100);
  	    availability.setRegion("*");
  	    availability.setProduct(product);// associate with product
  	    
  	    //price
  	    ProductPrice dprice = new ProductPrice();
  	    dprice.setDefaultPrice(true);
  	    dprice.setProductPriceAmount(new BigDecimal(29.99));
  	    dprice.setProductAvailability(availability);
  	    
  	    
  
  	    ProductPriceDescription dpd = new ProductPriceDescription();
  	    dpd.setName("Base price");
  	    dpd.setProductPrice(dprice);
  	    dpd.setLanguage(en);
  
  	    dprice.getDescriptions().add(dpd);
  	    availability.getPrices().add(dprice);
  	    product.getAvailabilities().add(availability);
  	    
  	    
  	    //attributes
  	    //white
  