Skip to content
Permalink
Browse files

Improved: Rewrite ‘ComponentConfig#getAllTestSuiteInfos’

(OFBIZ-11101)

It now has a stream based implementation.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862219 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent 554cad0 commit ba54e320718f37ad3a1fae712dddc100ab8309a8
Showing with 11 additions and 12 deletions.
  1. +11 −12 framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
@@ -136,18 +136,17 @@ public static Boolean componentExists(String componentName) {
.collect(Collectors.toList());
}

public static List<TestSuiteInfo> getAllTestSuiteInfos() {
return getAllTestSuiteInfos(null);
}

public static List<TestSuiteInfo> getAllTestSuiteInfos(String componentName) {
List<TestSuiteInfo> testSuiteInfos = new ArrayList<>();
for (ComponentConfig cc : getAllComponents()) {
if (componentName == null || componentName.equals(cc.getComponentName())) {
testSuiteInfos.addAll(cc.getTestSuiteInfos());
}
}
return testSuiteInfos;
/**
* Provides the list of all the test-suite information matching a component name.
*
* @param name the name of the component to match where {@code null} means "any"
* @return a list of test-suite information
*/
public static List<TestSuiteInfo> getAllTestSuiteInfos(String name) {
return getAllComponents().stream()
.filter(cc -> name == null || name.equals(cc.getComponentName()))
.flatMap(cc -> cc.getTestSuiteInfos().stream())
.collect(Collectors.toList());
}

public static List<WebappInfo> getAllWebappResourceInfos() {

0 comments on commit ba54e32

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