Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by IntelliJ IDEA.
- * User: mike
- * Date: 11/11/05
- * Time: 15:34
- * To change this template use File | Settings | File Templates.
- */
- import static groovyx.gpars.GParsPool.*;
- def path = '/Users/mike/IdeaProjects/GradleSlowTest/src/test/java/orz/mikeneck/gradle/slow/test'
- def packagePath = path.replace('/Users/mike/IdeaProjects/GradleSlowTest/src/test/java/', '')
- assert new File(path).isDirectory()
- def head = $/package orz.mikeneck.gradle.slow.test;
- import org.junit.Before;
- import org.junit.Test;
- import java.util.List;
- import java.util.ArrayList;
- import static org.hamcrest.CoreMatchers.*;
- import static org.junit.Assert.*;
- /$
- def body =$/
- public static final int SIZE = 100;
- private List<Integer> intList;
- @Test
- public void test() throws InterruptedException {
- int number = 0;
- for (Integer i : intList) {
- assertThat(i, is(number++));
- Thread.sleep(10);
- }
- }
- @Before
- public void setUp() {
- intList = new ArrayList<Integer>();
- for (int i = 0; i <= SIZE; i++ ) {
- intList.add(i);
- }
- }
- }
- /$
- def tests = []
- (1..100).each {
- tests << it
- }
- withPool {
- tests.collectParallel {test ->
- def className = "GradleTest${test}"
- def name = "${className}.java"
- def fileName = "${path}/${name}"
- def define = "public class ${className} {"
- def contents = new StringWriter()
- contents << head
- contents << define
- contents << body
- println '----'
- println "creating ${fileName}"
- new File(fileName).write(contents.toString(), 'UTF-8')
- assert new File(fileName).exists()
- }
- }
Add Comment
Please, Sign In to add comment