[ofbiz-framework] branch trunk updated: Improved: Convert ProductTest.xml to Groovy (OFBIZ-11852)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Convert ProductTest.xml to Groovy (OFBIZ-11852)

akashjain
This is an automated email from the ASF dual-hosted git repository.

akashjain pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new bc95f05  Improved: Convert ProductTest.xml to Groovy (OFBIZ-11852)
bc95f05 is described below

commit bc95f057f2ea5c5d08e1445a59db448cfd8972dc
Author: Akash Jain <[hidden email]>
AuthorDate: Tue Aug 4 21:52:08 2020 +0530

    Improved: Convert ProductTest.xml to Groovy (OFBIZ-11852)
---
 .../product/minilang/product/test/ProductTest.xml  | 331 -------------------
 .../org/apache/ofbiz/product/ProductTest.groovy    | 363 +++++++++++++++++++++
 applications/product/testdef/ProductTest.xml       |   2 +-
 3 files changed, 364 insertions(+), 332 deletions(-)

diff --git a/applications/product/minilang/product/test/ProductTest.xml b/applications/product/minilang/product/test/ProductTest.xml
deleted file mode 100644
index 5be5fd3..0000000
--- a/applications/product/minilang/product/test/ProductTest.xml
+++ /dev/null
@@ -1,331 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<!-- TODO: All the test cases of this file will be migrated to ProductTests.groovy -->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
-    <simple-method method-name="testCreateProduct" short-description="Test create Product" login-required="false">
-        <set field="serviceCtx.internalName" value="Test_product"/>
-        <set field="serviceCtx.productTypeId" value="Test_type"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createProduct" in-map-name="serviceCtx">
-            <result-to-field result-name="productId"/>
-        </call-service>
-        <entity-one entity-name="Product" value-field="product"/>
-        <assert>
-            <not>
-                <if-empty field="product"/>
-            </not>
-            <if-compare field="product.internalName" operator="equals" value="Test_product"/>
-            <if-compare field="product.productTypeId" operator="equals" value="Test_type"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testUpdateProduct" short-description="Test update Product" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_A"/>
-        <set field="serviceCtx.productName" value="Test_name_B"/>
-        <set field="serviceCtx.description" value="Updated description"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="updateProduct" in-map-name="serviceCtx"/>
-        <entity-one entity-name="Product" value-field="product">
-            <field-map field-name="productId" value="Test_product_A"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="product"/>
-            </not>
-            <if-compare field="product.productName" operator="equals" value="Test_name_B"/>
-            <if-compare field="product.description" operator="equals" value="Updated description"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testDuplicateProduct" short-description="Test duplicate Product" login-required="false">
-        <set field="serviceCtx.productId" value="Duplicate_Id"/>
-        <set field="serviceCtx.oldProductId" value="Test_product_B"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="duplicateProduct" in-map-name="serviceCtx"/>
-        <entity-one entity-name="Product" value-field="product">
-            <field-map field-name="productId" value="Duplicate_Id"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="product"/>
-            </not>
-            <if-compare field="product.productTypeId" operator="equals" value="Test_type"/>
-            <if-compare field="product.productName" operator="equals" value="Test_name_C"/>
-            <if-compare field="product.description" operator="equals" value="This is product description"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testQuickAddVariant" short-description="Test Add Variant" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_B"/>
-        <set field="serviceCtx.productFeatureIds" value="Test_feature"/>
-        <set field="serviceCtx.productVariantId" value="Test_variant"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="quickAddVariant" in-map-name="serviceCtx"/>
-        <entity-one entity-name="Product" value-field="product">
-            <field-map field-name="productId" value="Test_variant"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="product"/>
-            </not>
-            <if-compare field="product.productTypeId" operator="equals" value="Test_type"/>
-            <if-compare field="product.productName" operator="equals" value="Test_name_C"/>
-            <if-compare field="product.description" operator="equals" value="This is product description"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testDeleteProductKeywords" short-description="Test delete Product Keywords" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_C"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <entity-and entity-name="ProductKeyword" list="keywords">
-            <field-map field-name="productId" value="Test_product_C"/>
-        </entity-and>
-        <assert>
-            <not>
-                <if-empty field="keywords"/>
-            </not>
-        </assert>
-        <call-service service-name="deleteProductKeywords" in-map-name="serviceCtx"/>
-        <entity-and entity-name="ProductKeyword" list="keywords">
-            <field-map field-name="productId" value="Test_product_C"/>
-        </entity-and>
-        <assert>
-            <if-empty field="keywords"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testDiscontinueProductSales" short-description="Test discontinue Product Sales" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_C"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="discontinueProductSales" in-map-name="serviceCtx"/>
-        <entity-one entity-name="Product" value-field="product">
-            <field-map field-name="productId" value="Test_product_C"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="product.salesDiscontinuationDate"/>
-            </not>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testCreateProductReview" short-description="Test create Product Review" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_C"/>
-        <set field="serviceCtx.productStoreId" value="Test_store"/>
-        <set field="serviceCtx.productRating" type="BigDecimal" value="5"/>
-        <set field="serviceCtx.productReview" value="Test review"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createProductReview" in-map-name="serviceCtx">
-            <result-to-field result-name="productReviewId"/>
-        </call-service>
-        <entity-one entity-name="ProductReview" value-field="review"/>
-        <assert>
-            <not>
-                <if-empty field="review"/>
-            </not>
-            <if-compare field="review.productId" operator="equals" value="Test_product_C"/>
-            <if-compare field="review.productStoreId" operator="equals" value="Test_store"/>
-            <if-compare field="review.productRating" operator="equals" value="5.000000"/>
-            <if-compare field="review.productReview" operator="equals" value="Test review"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testUpdateProductReview" short-description="Test update Product Review" login-required="false">
-        <set field="serviceCtx.productReviewId" value="Test_review"/>
-        <set field="serviceCtx.productRating" type="BigDecimal" value="3"/>
-        <set field="serviceCtx.productReview" value="Updated review"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="updateProductReview" in-map-name="serviceCtx"/>
-        <entity-one entity-name="ProductReview" value-field="review">
-            <field-map field-name="productReviewId" value="Test_review"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="review"/>
-            </not>
-            <if-compare field="review.productId" operator="equals" value="Test_product_C"/>
-            <if-compare field="review.productRating" operator="equals" value="3.000000"/>
-            <if-compare field="review.productReview" operator="equals" value="Updated review"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testFindProductById" short-description="Test find Product By Id" login-required="false">
-        <set field="serviceCtx.idToFind" value="Test_product_C"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="findProductById" in-map-name="serviceCtx">
-            <result-to-field result-name="product"/>
-        </call-service>
-        <assert>
-            <not>
-                <if-empty field="product"/>
-            </not>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testCreateProductPrice" short-description="Test create Product Price" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_A"/>
-        <set field="serviceCtx.productPriceTypeId" value="AVERAGE_COST"/>
-        <set field="serviceCtx.productPricePurposeId" value="COMPONENT_PRICE"/>
-        <set field="serviceCtx.productStoreGroupId" value="Test_group"/>
-        <set field="serviceCtx.currencyUomId" value="USD"/>
-        <set field="serviceCtx.price" type="BigDecimal" value="50"/>
-        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 00:00:00"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createProductPrice" in-map-name="serviceCtx"/>
-        <entity-one entity-name="ProductPrice" value-field="prodPrice">
-            <field-map field-name="productId" value="Test_product_A"/>
-            <field-map field-name="productPriceTypeId" value="AVERAGE_COST"/>
-            <field-map field-name="productPricePurposeId" value="COMPONENT_PRICE"/>
-            <field-map field-name="productStoreGroupId" value="Test_group"/>
-            <field-map field-name="currencyUomId" value="USD"/>
-            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="prodPrice"/>
-            </not>
-            <if-compare field="prodPrice.price" operator="equals" value="50"/>
-            <if-compare field="prodPrice.productPriceTypeId" operator="equals" value="AVERAGE_COST"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testUpdateProductPrice" short-description="Test update Product Price" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_C"/>
-        <set field="serviceCtx.productPriceTypeId" value="AVERAGE_COST"/>
-        <set field="serviceCtx.productPricePurposeId" value="COMPONENT_PRICE"/>
-        <set field="serviceCtx.productStoreGroupId" value="Test_group"/>
-        <set field="serviceCtx.currencyUomId" value="USD"/>
-        <set field="serviceCtx.price" type="BigDecimal" value="50"/>
-        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 00:00:00"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="updateProductPrice" in-map-name="serviceCtx">
-            <result-to-field result-name="fromDate"/>
-        </call-service>
-        <entity-one entity-name="ProductPrice" value-field="price">
-            <field-map field-name="productId" value="Test_product_C"/>
-            <field-map field-name="productPriceTypeId" value="AVERAGE_COST"/>
-            <field-map field-name="productPricePurposeId" value="COMPONENT_PRICE"/>
-            <field-map field-name="productStoreGroupId" value="Test_group"/>
-            <field-map field-name="currencyUomId" value="USD"/>
-            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
-        </entity-one>
-        <assert>
-            <not>
-                <if-empty field="price"/>
-            </not>
-            <if-compare field="price.price" operator="equals" value="50"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testDeleteProductPrice" short-description="Test delete Product Price" login-required="false">
-        <set field="serviceCtx.productId" value="Test_product_C"/>
-        <set field="serviceCtx.productPriceTypeId" value="AVERAGE_COST"/>
-        <set field="serviceCtx.productPricePurposeId" value="COMPONENT_PRICE"/>
-        <set field="serviceCtx.productStoreGroupId" value="Test_group"/>
-        <set field="serviceCtx.currencyUomId" value="USD"/>
-        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 00:00:00"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="deleteProductPrice" in-map-name="serviceCtx">
-            <result-to-field result-name="fromDate"/>
-        </call-service>
-        <entity-one entity-name="ProductPrice" value-field="price">
-            <field-map field-name="productId" value="Test_product_C"/>
-            <field-map field-name="productPriceTypeId" value="AVERAGE_COST"/>
-            <field-map field-name="productPricePurposeId" value="COMPONENT_PRICE"/>
-            <field-map field-name="productStoreGroupId" value="Test_group"/>
-            <field-map field-name="currencyUomId" value="USD"/>
-            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
-        </entity-one>
-        <assert>
-            <if-empty field="price"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-    <simple-method method-name="testCreateProductCategory" short-description="Test create Product Category" login-required="false">
-        <set field="serviceCtx.productCategoryId" value="TEST_CATEGORY"/>
-        <set field="serviceCtx.productCategoryTypeId" value="USAGE_CATEGORY"/>
-        <entity-one entity-name="UserLogin" value-field="userLogin">
-            <field-map field-name="userLoginId" value="system"/>
-        </entity-one>
-        <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createProductCategory" in-map-name="serviceCtx">
-            <result-to-field result-name="productCategoryId"/>
-        </call-service>
-        <entity-one entity-name="ProductCategory" value-field="productCategory"/>
-        <assert>
-            <not>
-                <if-empty field="productCategory"/>
-            </not>
-            <if-compare field="productCategory.productCategoryTypeId" operator="equals" value="USAGE_CATEGORY"/>
-        </assert>
-        <check-errors/>
-    </simple-method>
-
-</simple-methods>
\ No newline at end of file
diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTest.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTest.groovy
new file mode 100644
index 0000000..f073a13
--- /dev/null
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTest.groovy
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * 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.ofbiz.product
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+
+import java.sql.Timestamp
+
+class ProductTest extends OFBizTestCase {
+    public ProductTest(String name) {
+        super(name)
+    }
+
+    void testCreateProduct() {
+        String internalName = 'Test_product'
+        String productTypeId = 'Test_type'
+
+        Map serviceCtx = [
+                internalName: internalName,
+                productTypeId: productTypeId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createProduct', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        String productId = serviceResult.productId
+
+        GenericValue product = from('Product')
+                .where('productId', productId)
+                .queryOne()
+        assert product
+        assert internalName.equals(product.internalName)
+        assert productTypeId.equals(product.productTypeId)
+    }
+
+    void testUpdateProduct() {
+        String productId = 'Test_product_A'
+        String productName = 'Test_name_B'
+        String description = 'Updated description'
+
+        Map serviceCtx = [
+                productId: productId,
+                productName: productName,
+                description: description,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('updateProduct', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue product = from('Product')
+                .where('productId', productId)
+                .queryOne()
+        assert product
+        assert productName.equals(product.productName)
+        assert description.equals(product.description)
+    }
+
+    void testDuplicateProduct() {
+        String productId = 'Duplicate_Id'
+        String oldProductId = 'Test_product_B'
+
+        Map serviceCtx = [
+                productId: productId,
+                oldProductId: oldProductId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('duplicateProduct', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue product = from('Product')
+                .where('productId', productId)
+                .queryOne()
+        assert product
+        assert 'Test_type'.equals(product.productTypeId)
+        assert 'Test_name_C'.equals(product.productName)
+        assert 'This is product description'.equals(product.description)
+    }
+
+    void testQuickAddVariant() {
+        String productId = 'Test_product_B'
+        String productFeatureIds = 'Test_feature'
+        String productVariantId = 'Test_variant'
+
+        Map serviceCtx = [
+                productId: productId,
+                productFeatureIds: productFeatureIds,
+                productVariantId: productVariantId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('quickAddVariant', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue product = from('Product')
+                .where('productId', productVariantId)
+                .queryOne()
+        assert product
+        assert 'N'.equals(product.isVirtual)
+        assert 'Y'.equals(product.isVariant)
+        assert !product.primaryProductCategoryId
+
+        GenericValue productAssoc = from('ProductAssoc')
+                .where('productId', productId, 'productIdTo', productVariantId, 'productAssocTypeId', 'PRODUCT_VARIANT')
+                .filterByDate().queryFirst()
+        assert productAssoc
+
+        GenericValue productFeature = from('ProductFeature')
+                .where('productFeatureId', productFeatureIds)
+                .queryOne()
+        assert productFeature
+    }
+
+    void testDeleteProductKeywords() {
+        String productId = 'Test_product_C'
+
+        List keywords = from('ProductKeyword')
+                .where('productId', productId)
+                .queryList()
+        assert keywords
+
+        Map serviceCtx = [
+                productId: productId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('deleteProductKeywords', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        keywords.clear()
+        keywords = from('ProductKeyword')
+                .where('productId', productId)
+                .queryList()
+        //assert keywords == null
+        assert !keywords
+    }
+
+    void testDiscontinueProductSales() {
+        String productId = 'Test_product_C'
+
+        Map serviceCtx = [
+                productId: productId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('discontinueProductSales', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue product = from('Product')
+                .where('productId', productId)
+                .queryOne()
+        assert product
+        assert product.salesDiscontinuationDate
+    }
+
+    void testCreateProductReview() {
+        String productId = 'Test_product_C'
+        String productStoreId = 'Test_store'
+        BigDecimal productRating = new BigDecimal('5')
+        String productReview = 'Test review'
+
+        Map serviceCtx = [
+                productId: productId,
+                productStoreId: productStoreId,
+                productRating: productRating,
+                productReview: productReview,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createProductReview', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue review = from('ProductReview')
+                .where('productReviewId', serviceResult.productReviewId)
+                .queryOne()
+        assert productReview
+        assert productId.equals(review.productId)
+        assert productStoreId.equals(review.productStoreId)
+        assert productReview.equals(review.productReview)
+        assert productRating.compareTo(review.productRating) == 0
+    }
+
+    void testUpdateProductReview() {
+        String productReviewId = 'Test_review'
+        BigDecimal productRating = new BigDecimal('3')
+        String productReview = 'Updated review'
+
+        Map serviceCtx = [
+                productReviewId: productReviewId,
+                productRating: productRating,
+                productReview: productReview,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('updateProductReview', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue review = from('ProductReview')
+                .where('productReviewId', productReviewId)
+                .queryOne()
+        assert productReview
+        assert productReview.equals(review.productReview)
+        assert productRating.compareTo(review.productRating) == 0
+    }
+
+    void testFindProductById() {
+        Map serviceCtx = [
+                idToFind: 'Test_product_C',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('findProductById', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert serviceResult.product
+    }
+
+    void testCreateProductPrice() {
+        String productId = 'Test_product_A'
+        String productPriceTypeId = 'AVERAGE_COST'
+        String productPricePurposeId = 'COMPONENT_PRICE'
+        String productStoreGroupId = 'Test_group'
+        String currencyUomId = 'USD'
+        BigDecimal price = new BigDecimal('30')
+        Timestamp fromDate = UtilDateTime.toTimestamp("04/07/2013 00:00:00")
+
+        Map serviceCtx = [
+                productId: productId,
+                productPriceTypeId: productPriceTypeId,
+                productPricePurposeId: productPricePurposeId,
+                productStoreGroupId: productStoreGroupId,
+                currencyUomId: currencyUomId,
+                price: price,
+                fromDate: fromDate,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createProductPrice', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue productPrice = from('ProductPrice')
+                .where('productId', productId,
+                              'productPriceTypeId', productPriceTypeId,
+                              'productPricePurposeId', productPricePurposeId,
+                              'productStoreGroupId', productStoreGroupId,
+                              'currencyUomId', currencyUomId,
+                              'fromDate', fromDate)
+                .queryOne()
+        assert productPrice
+        assert price.compareTo(productPrice.price) == 0
+    }
+
+    void testUpdateProductPrice() {
+        String productId = 'Test_prod_price_up'
+        String productPriceTypeId = 'AVERAGE_COST'
+        String productPricePurposeId = 'COMPONENT_PRICE'
+        String productStoreGroupId = 'Test_group'
+        String currencyUomId = 'USD'
+        BigDecimal price = new BigDecimal('50')
+        Timestamp fromDate = UtilDateTime.toTimestamp("07/04/2013 00:00:00")
+
+        Map serviceCtx = [
+                productId: productId,
+                internalName: 'Test update product price',
+                productTypeId: 'Test_type',
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createProduct', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        serviceCtx.clear()
+        serviceResult.clear()
+        serviceCtx = [
+                productId: productId,
+                productPriceTypeId: productPriceTypeId,
+                productPricePurposeId: productPricePurposeId,
+                productStoreGroupId: productStoreGroupId,
+                currencyUomId: currencyUomId,
+                price: new BigDecimal('30'),
+                fromDate: fromDate,
+                userLogin: userLogin
+        ]
+        serviceResult = dispatcher.runSync('createProductPrice', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        serviceResult.clear()
+        serviceCtx.price = price
+        serviceResult = dispatcher.runSync('updateProductPrice', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert price.compareTo(serviceResult.oldPrice) != 0
+
+        GenericValue productPrice = from('ProductPrice')
+                .where('productId', productId,
+                'productPriceTypeId', productPriceTypeId,
+                'productPricePurposeId', productPricePurposeId,
+                'productStoreGroupId', productStoreGroupId,
+                'currencyUomId', currencyUomId,
+                'fromDate', fromDate)
+                .queryOne()
+        assert productPrice
+        assert productPrice.price
+        assert price.compareTo(productPrice.price) == 0
+    }
+
+    void testDeleteProductPrice() {
+        String productId = 'Test_product_C'
+        String productPriceTypeId = 'AVERAGE_COST'
+        String productPricePurposeId = 'COMPONENT_PRICE'
+        String productStoreGroupId = 'Test_group'
+        String currencyUomId = 'USD'
+        Timestamp fromDate = UtilDateTime.toTimestamp("07/04/2013 00:00:00")
+
+        Map serviceCtx = [
+                productId: productId,
+                productPriceTypeId: productPriceTypeId,
+                productPricePurposeId: productPricePurposeId,
+                productStoreGroupId: productStoreGroupId,
+                currencyUomId: currencyUomId,
+                fromDate: fromDate,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('deleteProductPrice', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue productPrice = from('ProductPrice')
+                .where('productId', productId,
+                'productPriceTypeId', productPriceTypeId,
+                'productPricePurposeId', productPricePurposeId,
+                'productStoreGroupId', productStoreGroupId,
+                'currencyUomId', currencyUomId,
+                'fromDate', fromDate)
+                .queryOne()
+        assert !productPrice
+    }
+
+    void testCreateProductCategory() {
+        String productCategoryId = 'TEST_CATEGORY'
+        String productCategoryTypeId = 'USAGE_CATEGORY'
+
+        Map serviceCtx = [
+                productCategoryId: productCategoryId,
+                productCategoryTypeId: productCategoryTypeId,
+                userLogin: userLogin
+        ]
+        Map serviceResult = dispatcher.runSync('createProductCategory', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+
+        GenericValue productCategory = from('ProductCategory')
+                .where('productCategoryId', productCategoryId)
+                .queryOne()
+        assert productCategory
+        assert 'USAGE_CATEGORY'.equals(productCategory.productCategoryTypeId)
+    }
+}
\ No newline at end of file
diff --git a/applications/product/testdef/ProductTest.xml b/applications/product/testdef/ProductTest.xml
index e67e2cc..e24b52d 100644
--- a/applications/product/testdef/ProductTest.xml
+++ b/applications/product/testdef/ProductTest.xml
@@ -27,7 +27,7 @@ under the License.
     </test-case>
 
     <test-case case-name="producttest">
-        <simple-method-test location="component://product/minilang/product/test/ProductTest.xml"/>
+        <junit-test-suite class-name="org.apache.ofbiz.product.ProductTest"/>
     </test-case>
 
     <test-case case-name="product-tests">