org.gradle.api.tasks.TaskValidationException Java Examples
The following examples show how to use
org.gradle.api.tasks.TaskValidationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatingTaskExecuter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) { List<String> messages = new ArrayList<String>(); for (TaskValidator validator : task.getValidators()) { validator.validate(task, messages); } if (!messages.isEmpty()) { List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>(); messages = messages.subList(0, Math.min(5, messages.size())); for (String message : messages) { causes.add(new InvalidUserDataException(message)); } String errorMessage; if (messages.size() == 1) { errorMessage = String.format("A problem was found with the configuration of %s.", task); } else { errorMessage = String.format("Some problems were found with the configuration of %s.", task); } state.executed(new TaskValidationException(errorMessage, causes)); return; } executer.execute(task, state, context); }
Example #2
Source File: ValidatingTaskExecuter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) { List<String> messages = new ArrayList<String>(); for (TaskValidator validator : task.getValidators()) { validator.validate(task, messages); } if (!messages.isEmpty()) { List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>(); messages = messages.subList(0, Math.min(5, messages.size())); for (String message : messages) { causes.add(new InvalidUserDataException(message)); } String errorMessage; if (messages.size() == 1) { errorMessage = String.format("A problem was found with the configuration of %s.", task); } else { errorMessage = String.format("Some problems were found with the configuration of %s.", task); } state.executed(new TaskValidationException(errorMessage, causes)); return; } executer.execute(task, state, context); }
Example #3
Source File: ValidatingTaskExecuter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) { List<String> messages = new ArrayList<String>(); for (TaskValidator validator : task.getValidators()) { validator.validate(task, messages); } if (!messages.isEmpty()) { List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>(); messages = messages.subList(0, Math.min(5, messages.size())); for (String message : messages) { causes.add(new InvalidUserDataException(message)); } String errorMessage; if (messages.size() == 1) { errorMessage = String.format("A problem was found with the configuration of %s.", task); } else { errorMessage = String.format("Some problems were found with the configuration of %s.", task); } state.executed(new TaskValidationException(errorMessage, causes)); return; } executer.execute(task, state, context); }
Example #4
Source File: ValidatingTaskExecuter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) { List<String> messages = new ArrayList<String>(); for (TaskValidator validator : task.getValidators()) { validator.validate(task, messages); } if (!messages.isEmpty()) { List<InvalidUserDataException> causes = new ArrayList<InvalidUserDataException>(); messages = messages.subList(0, Math.min(5, messages.size())); for (String message : messages) { causes.add(new InvalidUserDataException(message)); } String errorMessage; if (messages.size() == 1) { errorMessage = String.format("A problem was found with the configuration of %s.", task); } else { errorMessage = String.format("Some problems were found with the configuration of %s.", task); } state.executed(new TaskValidationException(errorMessage, causes)); return; } executer.execute(task, state, context); }
Example #5
Source File: VerifyTest.java From gradle-download-task with Apache License 2.0 | 5 votes |
/** * Test if the plugin throws an exception if the 'src' property is empty */ @Test(expected = TaskValidationException.class) public void testExecuteEmptySrc() { Download t = makeProjectAndTask(); Verify v = makeVerifyTask(t); v.algorithm("MD5"); String calculatedChecksum = calculateChecksum(); v.checksum(calculatedChecksum); v.execute(); // should throw }
Example #6
Source File: VerifyTest.java From gradle-download-task with Apache License 2.0 | 5 votes |
/** * Test if the plugin throws an exception if the 'checksum' property is empty * @throws Exception if the test succeeds */ @Test(expected = TaskValidationException.class) public void testExecuteEmptyChecksum() throws Exception { Download t = makeProjectAndTask(); File dst = folder.newFile(); t.dest(dst); Verify v = makeVerifyTask(t); v.algorithm("MD5"); v.src(t.getDest()); v.execute(); // should throw }