svn commit: r1854650 - in /ofbiz/ofbiz-framework/trunk/framework/testtools: dtd/test-suite.xsd src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java

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

svn commit: r1854650 - in /ofbiz/ofbiz-framework/trunk/framework/testtools: dtd/test-suite.xsd src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java

mthl
Author: mthl
Date: Sat Mar  2 16:23:39 2019
New Revision: 1854650

URL: http://svn.apache.org/viewvc?rev=1854650&view=rev
Log:
Improved: Disallow alternate test dispatcher/delegator (OFBIZ-10723)

Previously the way integration tests were run allows having a specific
dispatcher and delegator for each test.  Removing this feature helps
future simplification of the way integration tests are actually run by
allowing the algorithm to assume only one dispatcher and delegator for
all the tests.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/testtools/dtd/test-suite.xsd
    ofbiz/ofbiz-framework/trunk/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java

Modified: ofbiz/ofbiz-framework/trunk/framework/testtools/dtd/test-suite.xsd
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/testtools/dtd/test-suite.xsd?rev=1854650&r1=1854649&r2=1854650&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/testtools/dtd/test-suite.xsd (original)
+++ ofbiz/ofbiz-framework/trunk/framework/testtools/dtd/test-suite.xsd Sat Mar  2 16:23:39 2019
@@ -45,8 +45,6 @@ under the License.
     </xs:element>
     <xs:attributeGroup name="attlist.test-suite">
         <xs:attribute type="xs:string" name="suite-name" use="required"/>
-        <xs:attribute type="xs:string" name="delegator-name" default="test"/>
-        <xs:attribute type="xs:string" name="dispatcher-name" default="test-dispatcher"/>
     </xs:attributeGroup>
     <xs:element name="test-case">
         <xs:annotation><xs:documentation></xs:documentation></xs:annotation>

Modified: ofbiz/ofbiz-framework/trunk/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java?rev=1854650&r1=1854649&r2=1854650&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java Sat Mar  2 16:23:39 2019
@@ -50,31 +50,20 @@ import junit.framework.TestSuite;
  * Use this class in a JUnit test runner to bootstrap the Test Suite runner.
  */
 public class ModelTestSuite {
-
     public static final String module = ModelTestSuite.class.getName();
+    public static final String DELEGATOR_NAME = "test";
+    public static final String DISPATCHER_NAME = "test-dispatcher";
 
     protected String suiteName;
-    protected String originalDelegatorName;
-    protected String originalDispatcherName;
-
     protected Delegator delegator;
     protected LocalDispatcher dispatcher;
-
-    protected List<Test> testList = new ArrayList<Test>();
+    protected List<Test> testList = new ArrayList<>();
 
     public ModelTestSuite(Element mainElement, String testCase) {
-        this.suiteName = mainElement.getAttribute("suite-name");
-
-        this.originalDelegatorName = mainElement.getAttribute("delegator-name");
-        if (UtilValidate.isEmpty(this.originalDelegatorName)) this.originalDelegatorName = "test";
-
-        this.originalDispatcherName = mainElement.getAttribute("dispatcher-name");
-        if (UtilValidate.isEmpty(this.originalDispatcherName)) this.originalDispatcherName = "test-dispatcher";
-
         String uniqueSuffix = "-" + RandomStringUtils.randomAlphanumeric(10);
-
-        this.delegator = DelegatorFactory.getDelegator(this.originalDelegatorName).makeTestDelegator(this.originalDelegatorName + uniqueSuffix);
-        this.dispatcher = ServiceContainer.getLocalDispatcher(originalDispatcherName + uniqueSuffix, delegator);
+        this.suiteName = mainElement.getAttribute("suite-name");
+        this.delegator = DelegatorFactory.getDelegator(DELEGATOR_NAME).makeTestDelegator(DELEGATOR_NAME + uniqueSuffix);
+        this.dispatcher = ServiceContainer.getLocalDispatcher(DISPATCHER_NAME + uniqueSuffix, delegator);
 
         for (Element testCaseElement : UtilXml.childElementList(mainElement, UtilMisc.toSet("test-case", "test-group"))) {
             String caseName = testCaseElement.getAttribute("case-name");