Skip to content

Commit

Permalink
Improved: Compile groovy integration tests
Browse files Browse the repository at this point in the history
(OFBIZ-11165)

Since there is no need for dynamic reload for integration tests,
it is better to compile Groovy tests.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865786 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Aug 23, 2019
1 parent b8e9d04 commit 9b68a55
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 35 deletions.
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.accounting

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
Expand Down Expand Up @@ -49,4 +49,4 @@ class AutoAcctgBudgetTests extends GroovyScriptTestCase {
assert ! budgetStatuses?.isEmpty()
assert budgetStatuses[0].statusId == 'BG_APPROVED'
}
}
}
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.accounting

import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
Expand All @@ -24,15 +25,27 @@ import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.testtools.GroovyScriptTestCase
class AutoAcctgInvoiceTests extends GroovyScriptTestCase {
void testCreateInvoiceContent() {
Map serviceCtx = [:]
serviceCtx.invoiceId = '1008'
serviceCtx.contentId = '1000'
serviceCtx.invoiceContentTypeId = 'COMMENTS'
serviceCtx.fromDate = UtilDateTime.nowTimestamp()
serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
def userLogin = EntityQuery.use(delegator).from('UserLogin')
.where('userLoginId', 'system')
.cache()
.queryOne()

Map serviceCtx = [
invoiceId: '1008',
contentId: '1000',
invoiceContentTypeId: 'COMMENTS',
fromDate: UtilDateTime.nowTimestamp(),
userLogin: userLogin
]
Map serviceResult = dispatcher.runSync('createInvoiceContent', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
GenericValue InvoiceContent = EntityQuery.use(delegator).from('InvoiceContent').where('invoiceId', serviceResult.invoiceId, 'contentId', serviceResult.contentId, 'invoiceContentTypeId', serviceResult.invoiceContentTypeId, 'fromDate',UtilDateTime.nowTimestamp()).queryList()

GenericValue invoiceContent = EntityQuery.use(delegator).from('InvoiceContent')
.where('invoiceId', serviceResult.invoiceId,
'contentId', serviceResult.contentId,
'invoiceContentTypeId', serviceResult.invoiceContentTypeId)
.queryFirst()

assert invoiceContent.contentId == serviceResult.contentId
}
}
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.accounting

import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.entity.GenericValue
Expand Down
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.accounting

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
Expand Down
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.accounting

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
Expand Down
10 changes: 5 additions & 5 deletions applications/accounting/testdef/accountingtests.xml
Expand Up @@ -43,7 +43,7 @@
<simple-method-test location="component://accounting/minilang/test/AutoAcctgAgreementTests.xml"/>
</test-case>
<test-case case-name="auto-accounting-budget-tests">
<groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgBudgetTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.accounting.AutoAcctgBudgetTests"/>
</test-case>
<test-case case-name="auto-accounting-cost-tests">
<simple-method-test location="component://accounting/minilang/test/AutoAcctgCostTests.xml"/>
Expand All @@ -58,15 +58,15 @@
<simple-method-test location="component://accounting/minilang/test/AutoAcctgInvoiceTests.xml"/>
</test-case>
<test-case case-name="auto-accounting-invoice-tests">
<simple-method-test location="component://accounting/groovyScripts/test/AutoAcctgInvoiceTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.accounting.AutoAcctgInvoiceTests"/>
</test-case>
<test-case case-name="auto-accounting-payment-tests">
<groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgPaymentTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.accounting.AutoAcctgPaymentTests"/>
</test-case>
<test-case case-name="auto-accounting-paymentgateway-tests">
<groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgPaymentGatewayTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.accounting.AutoAcctgPaymentGatewayTests"/>
</test-case>
<test-case case-name="auto-accounting-ledger-tests">
<groovy-test-suite location="component://accounting/groovyScripts/test/AutoAcctgLedgerTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.accounting.AutoAcctgLedgerTests"/>
</test-case>
</test-suite>
Expand Up @@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.content

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 ProductTests extends GroovyScriptTestCase {
class ContentTests extends GroovyScriptTestCase {
void testGetDataResource() {
Map serviceCtx = [:]
serviceCtx.dataResourceId = 'TEST_RESOURCE'
Expand Down
2 changes: 1 addition & 1 deletion applications/content/testdef/ContentTests.xml
Expand Up @@ -26,7 +26,7 @@
</test-case>

<test-case case-name="content-tests">
<groovy-test-suite location="component://content/groovyScripts/test/ContentTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.content.ContentTests"/>
</test-case>
</test-suite>

Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.order

import org.apache.ofbiz.entity.util.EntityQuery
import org.apache.ofbiz.service.ServiceUtil
Expand Down Expand Up @@ -136,4 +137,4 @@ class OrderTests extends GroovyScriptTestCase {
Map serviceResult = dispatcher.runSync('checkCreateStockRequirementQoh', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
}
}
}
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.order

import org.apache.ofbiz.testtools.GroovyScriptTestCase
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
Expand Down
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.order

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
Expand Down
2 changes: 1 addition & 1 deletion applications/order/testdef/CustRequestTests.xml
Expand Up @@ -27,6 +27,6 @@ under the License.
</test-case>

<test-case case-name="test-cust-request-permission-check">
<groovy-test-suite location="component://order/groovyScripts/order/test/TestCustRequestPermissionCheck.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.order.TestCustRequestPermissionCheck"/>
</test-case>
</test-suite>
2 changes: 1 addition & 1 deletion applications/order/testdef/OrderTest.xml
Expand Up @@ -34,6 +34,6 @@ under the License.
<simple-method-test location="component://order/minilang/test/OrderTests.xml"/>
</test-case>
<test-case case-name="order-tests">
<groovy-test-suite location="component://order/groovyScripts/test/OrderTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.order.OrderTests"/>
</test-case>
</test-suite>
2 changes: 1 addition & 1 deletion applications/order/testdef/QuoteTests.xml
Expand Up @@ -28,6 +28,6 @@ under the License.
<!-- <test-case case-name="quote-tests"> <simple-method-test location="component://order/minilang/test/QuoteTests.xml"/>
</test-case> -->
<test-case case-name="quoteTests">
<groovy-test-suite name="quoteTests" location="component://order/groovyScripts/test/QuoteTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.order.QuoteTests"/>
</test-case>
</test-suite>
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.apache.ofbiz.party

import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.party.contact.ContactMechWorker
Expand Down
2 changes: 1 addition & 1 deletion applications/party/testdef/PartyContactMechTests.xml
Expand Up @@ -25,7 +25,7 @@
<entity-xml action="load" entity-xml-url="component://party/testdef/data/PartyContactMechTestData.xml"/>
</test-case>
<test-case case-name="ContactMechWorker-tests">
<groovy-test-suite name="contactMechWorker" location="component://party/groovyScripts/test/ContactMechWorkerTests.groovy"/>
<junit-test-suite className="org.apache.ofbiz.party.ContactMechWorkerTests"/>
</test-case>
<test-case case-name="partyContactMech-tests">
<simple-method-test location="component://party/minilang/test/PartyContactMechTests.xml"/>
Expand Down
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/

package org.apache.ofbiz.product

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityQuery
Expand Down
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.product

import org.apache.ofbiz.base.util.Debug
import org.apache.ofbiz.base.util.UtilDateTime
Expand Down
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ofbiz.product

import java.sql.Timestamp
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.base.util.UtilMisc
Expand Down
Expand Up @@ -16,7 +16,7 @@
* 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
Expand Down
5 changes: 2 additions & 3 deletions applications/product/testdef/ProductPromoTests.xml
Expand Up @@ -23,10 +23,9 @@
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">

<test-group case-name="product-Conditions-tests">
<groovy-test-suite name="prodCond" location="component://product/groovyScripts/product/test/ProductPromoCondTests.groovy"/>
<!--groovy-test-suite name="productPromoCondTests" location="component://product/groovyScripts/product/test/ProductPromoCondTests.groovy"/-->
<junit-test-suite class-name="org.apache.ofbiz.product.ProductPromoCondTests"/>
</test-group>
<test-group case-name="product-Action-tests">
<groovy-test-suite name="productPromoActionTests" location="component://product/groovyScripts/product/test/ProductPromoActionTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.product.ProductPromoActionTests"/>
</test-group>
</test-suite>
6 changes: 3 additions & 3 deletions applications/product/testdef/ProductTest.xml
Expand Up @@ -31,9 +31,9 @@ under the License.
</test-case>

<test-case case-name="product-tests">
<groovy-test-suite location="component://product/groovyScripts/test/ProductTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.product.ProductTests"/>
</test-case>
</test-suite> <test-case case-name="testCreateProductFeatureType">
<groovy-test-suite location="component://product/groovyScripts/product/test/ProductFeatureTypeTests.groovy"/>
<test-case case-name="testCreateProductFeatureType">
<junit-test-suite class-name="org.apache.ofbiz.product.ProductFeatureTypeTests"/>
</test-case>
</test-suite>
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.apache.ofbiz.base

import org.apache.ofbiz.testtools.GroovyScriptTestCase

class BaseTest extends GroovyScriptTestCase {
Expand Down
2 changes: 1 addition & 1 deletion framework/base/testdef/basetests.xml
Expand Up @@ -25,6 +25,6 @@
<junit-test-suite class-name="org.apache.ofbiz.base.util.test.UtilObjectTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.util.string.test.FlexibleStringExpanderTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.util.collections.test.FlexibleMapAccessorTests"/>
<groovy-test-suite name="simple" location="component://base/groovyScripts/test/SimpleTests.groovy"/>
<junit-test-suite class-name="org.apache.ofbiz.base.SimpleTests"/>
</test-group>
</test-suite>

0 comments on commit 9b68a55

Please sign in to comment.