use of org.broadleafcommerce.core.catalog.domain.RelatedProduct in project BroadleafCommerce by BroadleafCommerce.
the class ProductDaoTest method getRelatedCrossProduct.
private static RelatedProduct getRelatedCrossProduct(Product prod, Product prodToRelate, List<RelatedProduct> upSales) {
RelatedProduct rp1 = new CrossSaleProductImpl();
rp1.setProduct(prod);
rp1.setPromotionMessage("brand new coffee");
rp1.setRelatedProduct(prodToRelate);
upSales.add(rp1);
return rp1;
}
use of org.broadleafcommerce.core.catalog.domain.RelatedProduct in project BroadleafCommerce by BroadleafCommerce.
the class ProductDaoTest method getRelatedUpSaleProduct.
private static RelatedProduct getRelatedUpSaleProduct(Product prod, Product prodToRelate, List<RelatedProduct> upSales) {
RelatedProduct rp1 = new UpSaleProductImpl();
rp1.setProduct(prod);
rp1.setPromotionMessage("brand new coffee");
rp1.setRelatedProduct(prodToRelate);
upSales.add(rp1);
return rp1;
}
use of org.broadleafcommerce.core.catalog.domain.RelatedProduct in project BroadleafCommerce by BroadleafCommerce.
the class ProductDaoTest method testReadProductsWithCrossSaleValues.
@Test(groups = "testReadProductsWithCrossSaleValues", dependsOnGroups = "createCrossSaleValues")
@Transactional
public void testReadProductsWithCrossSaleValues() {
Product result = productDao.readProductById(savedProducts.get(1).getId());
List<RelatedProduct> related = result.getCrossSaleProducts();
assert (related != null);
assert (!related.isEmpty());
assert (related.size() == 2 || related.size() == 3);
for (RelatedProduct rp : related) {
assert (rp instanceof CrossSaleProductImpl);
}
}
use of org.broadleafcommerce.core.catalog.domain.RelatedProduct in project BroadleafCommerce by BroadleafCommerce.
the class ProductDaoTest method createUpSaleValues.
@Test(groups = "createUpSaleValues", dependsOnGroups = "createProducts")
@Rollback(false)
@Transactional
public void createUpSaleValues() {
Product prod1 = savedProducts.get(0);
List<RelatedProduct> upSales = new ArrayList<>();
getRelatedUpSaleProduct(prod1, savedProducts.get(2), upSales);
getRelatedUpSaleProduct(prod1, savedProducts.get(3), upSales);
getRelatedUpSaleProduct(prod1, savedProducts.get(4), upSales);
prod1.setUpSaleProducts(upSales);
prod1 = catalogService.saveProduct(prod1);
assert (prod1.getId() != null);
Product prod2 = savedProducts.get(1);
List<RelatedProduct> upSales2 = new ArrayList<>();
getRelatedUpSaleProduct(prod2, savedProducts.get(5), upSales2);
getRelatedUpSaleProduct(prod2, savedProducts.get(6), upSales2);
prod2.setUpSaleProducts(upSales2);
prod2 = catalogService.saveProduct(prod2);
assert (prod2.getId() != null);
}
use of org.broadleafcommerce.core.catalog.domain.RelatedProduct in project BroadleafCommerce by BroadleafCommerce.
the class ProductDaoTest method testReadProductsWithUpSaleValues.
@Test(groups = "testReadProductsWithUpSaleValues", dependsOnGroups = "createUpSaleValues")
@Transactional
public void testReadProductsWithUpSaleValues() {
Product result = productDao.readProductById(savedProducts.get(0).getId());
List<RelatedProduct> related = result.getUpSaleProducts();
assert (related != null);
assert (!related.isEmpty());
assert (related.size() == 2 || related.size() == 3);
for (RelatedProduct rp : related) {
assert (rp instanceof UpSaleProductImpl);
}
}
Aggregations