use of org.apache.axis2.transport.testkit.tests.ManagedTestCase in project wso2-axis2-transports by wso2.
the class ManagedTestSuite method run.
@Override
public void run(TestResult result) {
LogManager logManager = LogManager.INSTANCE;
if (!reuseResources) {
super.run(result);
} else {
TestResourceSet resourceSet = null;
for (Enumeration<?> e = tests(); e.hasMoreElements(); ) {
Test test = (Test) e.nextElement();
if (test instanceof ManagedTestCase) {
ManagedTestCase ttest = (ManagedTestCase) test;
TestResourceSet newResourceSet = ttest.getResourceSet();
try {
if (resourceSet == null) {
logManager.setTestCase(ttest);
newResourceSet.setUp();
} else {
TestResourceSetTransition transition = new TestResourceSetTransition(resourceSet, newResourceSet);
transition.tearDown();
logManager.setTestCase(ttest);
transition.setUp();
}
} catch (Throwable t) {
result.addError(this, t);
return;
}
resourceSet = newResourceSet;
}
runTest(test, result);
}
if (resourceSet != null) {
try {
resourceSet.tearDown();
logManager.setTestCase(null);
} catch (Throwable t) {
result.addError(this, t);
return;
}
}
}
}
use of org.apache.axis2.transport.testkit.tests.ManagedTestCase in project wso2-axis2-transports by wso2.
the class ManagedTestSuite method addTest.
@Override
public void addTest(Test test) {
if (test instanceof ManagedTestCase) {
ManagedTestCase ttest = (ManagedTestCase) test;
Map<String, String> map = ttest.getNameComponents();
boolean excluded = false;
for (FilterExpression exclude : excludes) {
if (exclude.matches(map)) {
excluded = true;
break;
}
}
if (excluded != invertExcludes) {
return;
}
ttest.init(StringUtils.leftPad(String.valueOf(nextId++), 4, '0'), reuseResources, testClass);
ttest.getResourceSet().resolve();
}
super.addTest(test);
}
Aggregations