use of org.gradle.tooling.internal.protocol.test.InternalJvmTestRequest in project gradle by gradle.
the class TestExecutionBuildConfigurationAction method configureBuildForInternalJvmTestRequest.
private List<Test> configureBuildForInternalJvmTestRequest(GradleInternal gradle, TestExecutionRequestAction testExecutionRequest) {
final Collection<InternalJvmTestRequest> internalJvmTestRequests = testExecutionRequest.getInternalJvmTestRequests();
if (internalJvmTestRequests.isEmpty()) {
return Collections.emptyList();
}
List<Test> tasksToExecute = new ArrayList<Test>();
final Set<Project> allprojects = gradle.getRootProject().getAllprojects();
for (Project project : allprojects) {
final Collection<Test> testTasks = project.getTasks().withType(Test.class);
for (Test testTask : testTasks) {
for (InternalJvmTestRequest jvmTestRequest : internalJvmTestRequests) {
final TestFilter filter = testTask.getFilter();
filter.includeTest(jvmTestRequest.getClassName(), jvmTestRequest.getMethodName());
}
}
tasksToExecute.addAll(testTasks);
}
return tasksToExecute;
}
use of org.gradle.tooling.internal.protocol.test.InternalJvmTestRequest in project gradle by gradle.
the class TestExecutionResultEvaluator method formatInternalTestExecutionRequest.
private String formatInternalTestExecutionRequest() {
StringBuilder requestDetails = new StringBuilder(INDENT).append("Requested tests:");
for (InternalTestDescriptor internalTestDescriptor : internalTestExecutionRequest.getTestExecutionDescriptors()) {
requestDetails.append("\n").append(Strings.repeat(INDENT, 2)).append(internalTestDescriptor.getDisplayName());
requestDetails.append(" (Task: '").append(((DefaultTestDescriptor) internalTestDescriptor).getTaskPath()).append("')");
}
final Collection<InternalJvmTestRequest> internalJvmTestRequests = internalTestExecutionRequest.getInternalJvmTestRequests();
for (InternalJvmTestRequest internalJvmTestRequest : internalJvmTestRequests) {
final String className = internalJvmTestRequest.getClassName();
final String methodName = internalJvmTestRequest.getMethodName();
if (methodName == null) {
requestDetails.append("\n").append(Strings.repeat(INDENT, 2)).append("Test class ").append(className);
} else {
requestDetails.append("\n").append(Strings.repeat(INDENT, 2)).append("Test method ").append(className).append(".").append(methodName).append("()");
}
}
return requestDetails.toString();
}
Aggregations