Skip to content

Commit

Permalink
Improved: Remove useless ‘GroovyScriptTestCase’
Browse files Browse the repository at this point in the history
(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
  • Loading branch information
mthl committed Aug 23, 2019
1 parent 9b68a55 commit 9bc8ebb
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ 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

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

This file was deleted.

22 changes: 0 additions & 22 deletions framework/testtools/dtd/test-suite.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ private void parseTestElement(String caseName, Element testElement) {
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)) {
Expand Down Expand Up @@ -188,10 +180,6 @@ private void prepareTest(Test test)
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());
}
}
}

0 comments on commit 9bc8ebb

Please sign in to comment.