Skip to content

Commit

Permalink
Improved: Rewrite ‘ComponentConfig#getAllTestSuiteInfos’
Browse files Browse the repository at this point in the history
(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 ba54e32
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,17 @@ public static List<ServiceResourceInfo> getAllServiceResourceInfos(String type)
.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() {
Expand Down

0 comments on commit ba54e32

Please sign in to comment.