Skip to content
Permalink
Browse files

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.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1854650 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Mar 2, 2019
1 parent 42f152f commit e6a00e6427ce2643693c93c56f3ffb77d7c42ba1
@@ -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>
@@ -50,31 +50,20 @@
* 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");

0 comments on commit e6a00e6

Please sign in to comment.
You can’t perform that action at this time.