This is an automated email from the ASF dual-hosted git repository.
ashishvijaywargiya 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 655cf5aa17 Migrate remaining minilang XML tests to Groovy JUnit test
cases (#1473)
655cf5aa17 is described below
commit 655cf5aa1705bd551475461b66c4066c2a678971
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Mon Jul 20 23:17:36 2026 +0530
Migrate remaining minilang XML tests to Groovy JUnit test cases (#1473)
---
applications/order/testdef/QuoteTests.xml | 4 +-
framework/common/minilang/test/UserLoginTests.xml | 38 ----------------
.../apache/ofbiz/common/test/UserLoginTests.groovy | 50 ++++++++++++++++++++++
framework/common/testdef/UserLoginTests.xml | 4 +-
.../entity/minilang/EntityUtilPropertiesTests.xml | 45 -------------------
.../entity/test/EntityUtilPropertiesTests.groovy | 38 ++++++++++++++++
framework/entity/testdef/entitytests.xml | 4 +-
7 files changed, 91 insertions(+), 92 deletions(-)
diff --git a/applications/order/testdef/QuoteTests.xml
b/applications/order/testdef/QuoteTests.xml
index 05e006e0c4..81b7cef21a 100644
--- a/applications/order/testdef/QuoteTests.xml
+++ b/applications/order/testdef/QuoteTests.xml
@@ -25,9 +25,7 @@ under the License.
<test-case case-name="loadQuoteTestData">
<entity-xml action="load"
entity-xml-url="component://order/testdef/data/QuoteTestData.xml"/>
</test-case>
- <!-- <test-case case-name="quote-tests"> <simple-method-test
location="component://order/minilang/test/QuoteTests.xml"/>
- </test-case> -->
- <test-case case-name="quoteTests">
+ <test-case case-name="quoteTests">
<junit-test-suite
class-name="org.apache.ofbiz.order.order.test.QuoteTests"/>
</test-case>
</test-suite>
diff --git a/framework/common/minilang/test/UserLoginTests.xml
b/framework/common/minilang/test/UserLoginTests.xml
deleted file mode 100644
index a663df150d..0000000000
--- a/framework/common/minilang/test/UserLoginTests.xml
+++ /dev/null
@@ -1,38 +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.
--->
-
-<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="testCreateUserLogin" short-description="Test
case for service createUserLogin" login-required="false">
- <set field="userLoginId" value="demo.person"/>
- <set field="serviceCtx.userLoginId" from-field="userLoginId"/>
- <set field="serviceCtx.enabled" value="Y"/>
- <set field="serviceCtx.currentPassword" value="ofbiz"/>
- <set field="serviceCtx.currentPasswordVerify" value="ofbiz"/>
- <call-service service-name="createUserLogin" in-map-name="serviceCtx"/>
- <entity-one entity-name="UserLogin" value-field="userLogin"/>
- <assert>
- <not><if-empty field="userLogin"/></not>
- <if-compare field="userLogin.enabled" operator="equals" value="Y"/>
- </assert>
- <check-errors/>
- </simple-method>
-</simple-methods>
diff --git
a/framework/common/src/test/groovy/org/apache/ofbiz/common/test/UserLoginTests.groovy
b/framework/common/src/test/groovy/org/apache/ofbiz/common/test/UserLoginTests.groovy
new file mode 100644
index 0000000000..ae4a5848d2
--- /dev/null
+++
b/framework/common/src/test/groovy/org/apache/ofbiz/common/test/UserLoginTests.groovy
@@ -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.ofbiz.common.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+
+class UserLoginTests extends OFBizTestCase {
+
+ UserLoginTests(String name) {
+ super(name)
+ }
+
+ void testCreateUserLogin() {
+ String userLoginId = 'demo.person'
+
+ Map serviceCtx = [
+ userLoginId: userLoginId,
+ enabled: 'Y',
+ currentPassword: 'ofbiz',
+ currentPasswordVerify: 'ofbiz'
+ ]
+ Map serviceResult = dispatcher.runSync('createUserLogin', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue createdUserLogin = from('UserLogin')
+ .where('userLoginId', userLoginId)
+ .queryOne()
+ assert createdUserLogin
+ assert createdUserLogin.enabled == 'Y'
+ }
+
+}
diff --git a/framework/common/testdef/UserLoginTests.xml
b/framework/common/testdef/UserLoginTests.xml
index e30def08fd..933d45dc9f 100644
--- a/framework/common/testdef/UserLoginTests.xml
+++ b/framework/common/testdef/UserLoginTests.xml
@@ -22,8 +22,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
- <test-case case-name="userlogin-tests">
- <simple-method-test
location="component://common/minilang/test/UserLoginTests.xml"/>
- </test-case>
+ <test-case case-name="userlogin-tests"><junit-test-suite
class-name="org.apache.ofbiz.common.test.UserLoginTests"/></test-case>
</test-suite>
\ No newline at end of file
diff --git a/framework/entity/minilang/EntityUtilPropertiesTests.xml
b/framework/entity/minilang/EntityUtilPropertiesTests.xml
deleted file mode 100644
index a5651b2c7d..0000000000
--- a/framework/entity/minilang/EntityUtilPropertiesTests.xml
+++ /dev/null
@@ -1,45 +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.
--->
-
-<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="testGetGeneralProperties"
short-description="test getting general properties" login-required="false">
- <call-class-method ret-field="currencyUomIdDefault"
method-name="getPropertyValue"
class-name="org.apache.ofbiz.entity.util.EntityUtilProperties">
- <string value="general"/>
- <string value="currency.uom.id.default"/>
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- </call-class-method>
- <assert><if-compare field="currencyUomIdDefault" operator="equals"
value="THB"></if-compare></assert>
-
- <call-class-method ret-field="defaultFromEmailAddress"
method-name="getPropertyValue"
class-name="org.apache.ofbiz.entity.util.EntityUtilProperties">
- <string value="general"/>
- <string value="defaultFromEmailAddress"/>
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- </call-class-method>
- <assert><if-compare field="defaultFromEmailAddress" operator="equals"
value="[email protected]"></if-compare></assert>
-
- <property-to-field resource="general"
property="currency.uom.id.default" field="currencyUomIdDefault"/>
- <assert><if-compare field="currencyUomIdDefault" operator="equals"
value="THB"></if-compare></assert>
-
- <property-to-field resource="general"
property="defaultFromEmailAddress" field="defaultFromEmailAddress"/>
- <assert><if-compare field="defaultFromEmailAddress" operator="equals"
value="[email protected]"></if-compare></assert>
- </simple-method>
-</simple-methods>
diff --git
a/framework/entity/src/test/groovy/org/apache/ofbiz/entity/test/EntityUtilPropertiesTests.groovy
b/framework/entity/src/test/groovy/org/apache/ofbiz/entity/test/EntityUtilPropertiesTests.groovy
new file mode 100644
index 0000000000..ae793a5a26
--- /dev/null
+++
b/framework/entity/src/test/groovy/org/apache/ofbiz/entity/test/EntityUtilPropertiesTests.groovy
@@ -0,0 +1,38 @@
+/*
+ * 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.entity.test
+
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+
+class EntityUtilPropertiesTests extends OFBizTestCase {
+
+ EntityUtilPropertiesTests(String name) {
+ super(name)
+ }
+
+ void testGetGeneralProperties() {
+ String currencyUomIdDefault =
EntityUtilProperties.getPropertyValue('general', 'currency.uom.id.default',
delegator)
+ assert currencyUomIdDefault == 'USD'
+
+ String defaultFromEmailAddress =
EntityUtilProperties.getPropertyValue('general', 'defaultFromEmailAddress',
delegator)
+ assert defaultFromEmailAddress == '[email protected]'
+ }
+
+}
diff --git a/framework/entity/testdef/entitytests.xml
b/framework/entity/testdef/entitytests.xml
index 7011ca6837..6344e82f69 100644
--- a/framework/entity/testdef/entitytests.xml
+++ b/framework/entity/testdef/entitytests.xml
@@ -25,7 +25,5 @@ under the License.
<test-case case-name="entity-util-tests"><junit-test-suite
class-name="org.apache.ofbiz.entity.test.EntityUtilTestSuite"/></test-case>
<test-case case-name="entity-crypto-tests"><junit-test-suite
class-name="org.apache.ofbiz.entity.test.EntityCryptoTestSuite"/></test-case>
<test-case case-name="entity-query-tests"><junit-test-suite
class-name="org.apache.ofbiz.entity.test.EntityQueryTestSuite"/></test-case>
- <test-case case-name="entity-util-properties-tests">
- <simple-method-test
location="component://entity/minilang/EntityUtilPropertiesTests.xml"/>
- </test-case>
+ <test-case case-name="entity-util-properties-tests"><junit-test-suite
class-name="org.apache.ofbiz.entity.test.EntityUtilPropertiesTests"/></test-case>
</test-suite>