Improved: Remove useless ‘GroovyScriptTestCase’

(OFBIZ-11165)

This class was useless since ‘GroovyScriptTestCase’ provides the same
interesting feature as ‘OFBizTestCase’ meaning a delegator and a dispatcher.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865787 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mathieu Lirzin
2019-08-23 18:02:42 +00:00
parent 9b68a55d64
commit 9bc8ebb864
18 changed files with 80 additions and 156 deletions
@@ -21,9 +21,13 @@ package org.apache.ofbiz.accounting
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class AutoAcctgBudgetTests extends OFBizTestCase {
public AutoAcctgBudgetTests(String name) {
super(name)
}
class AutoAcctgBudgetTests extends GroovyScriptTestCase {
void testCreateBudget() {
Map serviceCtx = [:]
serviceCtx.budgetTypeId = 'CAPITAL_BUDGET'
@@ -22,8 +22,12 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
class AutoAcctgInvoiceTests extends GroovyScriptTestCase {
import org.apache.ofbiz.service.testtools.OFBizTestCase
class AutoAcctgInvoiceTests extends OFBizTestCase {
public AutoAcctgInvoiceTests(String name) {
super(name)
}
void testCreateInvoiceContent() {
def userLogin = EntityQuery.use(delegator).from('UserLogin')
.where('userLoginId', 'system')
@@ -22,9 +22,13 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class AutoAcctgLedgerTests extends OFBizTestCase {
public AutoAcctgLedgerTests(String name) {
super(name)
}
class AutoAcctgLedgerTests extends GroovyScriptTestCase {
void testCreateAcctgTrans() {
Map serviceCtx = [:]
serviceCtx.acctgTransTypeId = 'CREDIT_MEMO'
@@ -21,9 +21,13 @@ package org.apache.ofbiz.accounting
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class AutoAcctgPaymentGatewayTests extends OFBizTestCase {
public AutoAcctgPaymentGatewayTests(String name) {
super(name)
}
class AutoAcctgPaymentGatewayTests extends GroovyScriptTestCase {
void testUpdatePaymentGatewayConfig() {
Map serviceCtx = [:]
serviceCtx.paymentGatewayConfigId = 'SAGEPAY_CONFIG'
@@ -21,9 +21,13 @@ package org.apache.ofbiz.accounting
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class AutoAcctgPaymentTests extends OFBizTestCase {
public AutoAcctgPaymentTests(String name) {
super(name)
}
class AutoAcctgPaymentTests extends GroovyScriptTestCase {
void testCreatePayment() {
Map serviceCtx = [:]
serviceCtx.paymentTypeId = 'CUSTOMER_PAYMENT'
@@ -22,9 +22,13 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class ContentTests extends OFBizTestCase {
public ContentTests(String name) {
super(name)
}
class ContentTests extends GroovyScriptTestCase {
void testGetDataResource() {
Map serviceCtx = [:]
serviceCtx.dataResourceId = 'TEST_RESOURCE'
@@ -20,9 +20,13 @@ package org.apache.ofbiz.order
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class OrderTests extends OFBizTestCase {
public OrderTests(String name) {
super(name)
}
class OrderTests extends GroovyScriptTestCase {
void testAddRequirementTask() {
Map serviceCtx = [
requirementId: '1000',
@@ -18,7 +18,7 @@
*/
package org.apache.ofbiz.order
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.entity.GenericValue
@@ -31,7 +31,10 @@ import static org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp
import static org.apache.ofbiz.entity.condition.EntityCondition.makeCondition
import static org.apache.ofbiz.entity.condition.EntityComparisonOperator.GREATER_THAN_EQUAL_TO
class QuoteTests extends GroovyScriptTestCase {
class QuoteTests extends OFBizTestCase {
public QuoteTests(String name) {
super(name)
}
// Retrieves a particular login record.
private GenericValue getUserLogin(String userLoginId) {
@@ -21,9 +21,13 @@ package org.apache.ofbiz.order
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class TestCustRequestPermissionCheck extends OFBizTestCase {
public TestCustRequestPermissionCheck(String name) {
super(name)
}
class TestCustRequestPermissionCheck extends GroovyScriptTestCase {
void testCustRequestPermission() {
Map serviceCtx = [:]
serviceCtx.fromPartyId = 'Company'
@@ -20,9 +20,12 @@ package org.apache.ofbiz.party
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.party.contact.ContactMechWorker
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class ContactMechWorkerTests extends GroovyScriptTestCase {
class ContactMechWorkerTests extends OFBizTestCase {
public ContactMechWorkerTests(String name) {
super(name)
}
void testPartyContactMechResolution() {
//control for the DemoCustomer that postal, email, telecom and ftp contact are present and return correct information
@@ -21,9 +21,13 @@ package org.apache.ofbiz.product
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class ProductFeatureTypeTests extends OFBizTestCase {
public ProductFeatureTypeTests(String name) {
super(name)
}
class ProductFeatureTypeTests extends GroovyScriptTestCase {
void testCreateProductFeatureType() {
Map serviceCtx = [:]
serviceCtx.productFeatureTypeId = 'testProdFeat'
@@ -27,7 +27,7 @@ import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.order.shoppingcart.CheckOutHelper
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
import org.apache.ofbiz.order.shoppingcart.ShoppingCartItem
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.ActionResultInfo
import org.apache.ofbiz.service.ServiceUtil
@@ -35,7 +35,10 @@ import org.apache.ofbiz.service.ServiceUtil
import java.sql.Timestamp
import java.util.Map
class ProductPromoActionTest extends GroovyScriptTestCase {
class ProductPromoActionTest extends OFBizTestCase {
public ProductPromoActionTest(String name) {
super(name)
}
ShoppingCart loadOrder(String orderId) {
GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne()
@@ -24,10 +24,13 @@ import org.apache.ofbiz.base.util.UtilMisc
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
import org.apache.ofbiz.service.ServiceUtil
class ProductPromoCondTest extends GroovyScriptTestCase {
class ProductPromoCondTest extends OFBizTestCase {
public ProductPromoCondTest(String name) {
super(name)
}
Map prepareConditionMap(ShoppingCart cart, String condValue) {
return prepareConditionMap(cart, condValue, false)
@@ -22,9 +22,13 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.service.testtools.OFBizTestCase
class ProductTests extends OFBizTestCase {
public ProductTests(String name) {
super(name)
}
class ProductTests extends GroovyScriptTestCase {
void testUpdateProductCategory() {
Map serviceCtx = [:]
serviceCtx.categoryName = 'Updated Test Product Category'
@@ -1,43 +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.ofbiz.base
import org.apache.ofbiz.testtools.GroovyScriptTestCase
class BaseTest extends GroovyScriptTestCase {
void testTrue() {
assert 1, 1
}
void testFalse() {
assertNotSame 1, 0
}
void testDelegator() {
assert delegator
}
void testDispatcher() {
assert dispatcher
}
void testSecurity() {
assert security
}
}
-22
View File
@@ -84,28 +84,6 @@ under the License.
</xs:attribute>
</xs:attributeGroup>
<xs:element name="groovy-test-suite" substitutionGroup="TestCaseTypes">
<xs:annotation>
<xs:documentation>
Used for JUnit test suites written as a Groovy class. See http://groovy-lang.org/testing.html
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="attlist.groovy-test-suite"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.groovy-test-suite">
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="location" use="required">
<xs:annotation>
<xs:documentation>
Give the location where is groovy file that contaions the test suite.
You can use a flexible url location like component://mycomponent/groovyScripts/test/MySuiteTest.groovy
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:element name="service-test" substitutionGroup="TestCaseTypes">
<xs:complexType>
<xs:attributeGroup ref="attlist.service-test"/>
@@ -1,51 +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.ofbiz.testtools;
import groovy.util.GroovyTestCase;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.security.Security;
import org.apache.ofbiz.service.LocalDispatcher;
public class GroovyScriptTestCase extends GroovyTestCase {
public Delegator delegator;
public LocalDispatcher dispatcher;
public Security security;
public void setDelegator(Delegator delegator) {
this.delegator = delegator;
}
public Delegator getDelegator() {
return delegator;
}
public LocalDispatcher getDispatcher() {
return dispatcher;
}
public void setDispatcher(LocalDispatcher dispatcher) {
this.dispatcher = dispatcher;
}
public void setSecurity(Security security) {
this.security = security;
}
public Security getSecurity() {
return security;
}
}
@@ -106,14 +106,6 @@ public class ModelTestSuite {
String errMsg = "Unable to load test suite class : " + className;
Debug.logError(e, errMsg, module);
}
} else if ("groovy-test-suite".equals(nodeName)) {
try {
Class<? extends TestCase> testClass =
UtilGenerics.cast(GroovyUtil.getScriptClassFromLocation(testElement.getAttribute("location")));
this.testList.add(new TestSuite(testClass, testElement.getAttribute("name")));
} catch (GeneralException e) {
Debug.logError(e, module);
}
} else if ("service-test".equals(nodeName)) {
this.testList.add(new ServiceTest(caseName, testElement));
} else if ("simple-method-test".equals(nodeName)) {
@@ -188,10 +180,6 @@ public class ModelTestSuite {
if (test instanceof OFBizTestCase) {
((OFBizTestCase)test).setDispatcher(dispatcher);
}
} else if (test instanceof GroovyScriptTestCase) {
((GroovyScriptTestCase)test).setDelegator(delegator);
((GroovyScriptTestCase)test).setDispatcher(dispatcher);
((GroovyScriptTestCase)test).setSecurity(dispatcher.getSecurity());
}
}
}