svn commit: r1856597 - in /ofbiz/ofbiz-framework/trunk/applications/content: groovyScripts/test/ groovyScripts/test/ContentTests.groovy ofbiz-component.xml testdef/ testdef/ContentTests.xml testdef/data/ testdef/data/ContentTestsData.xml

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

svn commit: r1856597 - in /ofbiz/ofbiz-framework/trunk/applications/content: groovyScripts/test/ groovyScripts/test/ContentTests.groovy ofbiz-component.xml testdef/ testdef/ContentTests.xml testdef/data/ testdef/data/ContentTestsData.xml

surajk
Author: surajk
Date: Sat Mar 30 05:43:33 2019
New Revision: 1856597

URL: http://svn.apache.org/viewvc?rev=1856597&view=rev
Log:
Added: Unit test case for service - getDataResource.
(OFBIZ-8423)
Thanks Tanmay Muley for reporting and Yogesh Naroliya for providing the updated patch.

Added:
    ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/
    ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy   (with props)
    ofbiz/ofbiz-framework/trunk/applications/content/testdef/
    ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml   (with props)
    ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/
    ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml   (with props)
Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/ofbiz-component.xml

Added: ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy?rev=1856597&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy (added)
+++ ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy Sat Mar 30 05:43:33 2019
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+
+
+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 {
+    void testGetDataResource() {
+        Map serviceCtx = [:]
+        serviceCtx.dataResourceId = 'TEST_RESOURCE'
+        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        Map serviceResult = dispatcher.runSync('getDataResource', serviceCtx)
+        assert ServiceUtil.isSuccess(serviceResult)
+        assert serviceResult.resultData.dataResource.dataResourceId == 'TEST_RESOURCE'
+        assert serviceResult.resultData.dataResource.dataResourceTypeId == 'TEST_RESOURCE_TYPE'
+    }
+}

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/groovyScripts/test/ContentTests.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/ofbiz-framework/trunk/applications/content/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/ofbiz-component.xml?rev=1856597&r1=1856596&r2=1856597&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/ofbiz-component.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/ofbiz-component.xml Sat Mar 30 05:43:33 2019
@@ -44,6 +44,8 @@ under the License.
     <service-resource type="model" loader="main" location="servicedef/services_website.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
     <service-resource type="mca" loader="main" location="servicedef/mca.xml"/>
+    
+    <test-suite loader="main" location="testdef/ContentTests.xml"/>
 
     <webapp name="content"
         title="Content"

Added: ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml?rev=1856597&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml (added)
+++ ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml Sat Mar 30 05:43:33 2019
@@ -0,0 +1,32 @@
+<?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.
+  -->
+<test-suite suite-name="contenttests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+    
+    <test-case case-name="content-tests-data-load">
+        <entity-xml action="load" entity-xml-url="component://content/testdef/data/ContentTestsData.xml"/>
+    </test-case>
+    
+    <test-case case-name="content-tests">
+        <groovy-test-suite location="component://content/groovyScripts/test/ContentTests.groovy"/>
+    </test-case>
+</test-suite>
+

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/ContentTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml?rev=1856597&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml (added)
+++ ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml Sat Mar 30 05:43:33 2019
@@ -0,0 +1,41 @@
+<?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.
+-->
+
+<entity-engine-xml>
+    <DataResourceType dataResourceTypeId="TEST_RESOURCE_TYPE" description="Test Data Resource Type" hasTable="N"/>
+    <DataResource dataResourceId="TEST_RESOURCE" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <DataResource dataResourceId="TEST_RESOURCE2" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <DataResource dataResourceId="TEST_RESOURCE3" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <DataResource dataResourceId="TEST_SUBJECT" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <DataResource dataResourceId="TEST_PLAIN_BODY" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <DataResource dataResourceId="TEST_HTML_BODY" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <ElectronicText dataResourceId="TEST_SUBJECT" textData="Test Subject"/>
+    <ElectronicText dataResourceId="TEST_PLAIN_BODY" textData="Test plain body"/>
+    <ElectronicText dataResourceId="TEST_HTML_BODY" textData="&lt;HTML&gt; &lt;BODY&gt; &lt;P&gt;Test html body&lt;/P&gt; &lt;/BODY&gt; &lt;/HTML&gt;"/>
+    <DataResource dataResourceId="TEST_CONTENT_TEXT1" dataResourceTypeId="TEST_RESOURCE_TYPE"/>
+    <ElectronicText dataResourceId="TEST_CONTENT_TEXT1" textData="Test text"/>
+    <ContentType contentTypeId="TEST_CONTENT_TYPE"/>
+    <Content contentId="TEST_CONTENT1" contentTypeId="TEST_CONTENT_TYPE" dataResourceId="TEST_RESOURCE"/>
+    <Content contentId="TEST_CONTENT2" contentTypeId="TEST_CONTENT_TYPE" dataResourceId="TEST_RESOURCE"/>
+    <Content contentId="TEST_CONTENT3" contentTypeId="TEST_CONTENT_TYPE" dataResourceId="TEST_RESOURCE3"/>
+    <ContentAssocType contentAssocTypeId="TEST_ASSOC_TYPE"/>
+    <ContentAssoc contentId="TEST_CONTENT1" contentIdTo="TEST_CONTENT2" contentAssocTypeId="TEST_ASSOC_TYPE" mapKey="Test_key" fromDate="2013-07-04 00:00:00"/>
+</entity-engine-xml>
+

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/applications/content/testdef/data/ContentTestsData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml