Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions gradle-modules/gradle-parallel-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id 'java-library'
}

test {
maxParallelForks = (int) (Runtime.runtime.availableProcessors() / 2 + 1)
useJUnitPlatform {
includeTags testForGradleTag
}
forkEvery = 0
}

repositories {
mavenCentral()
}

dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
}
1 change: 1 addition & 0 deletions gradle-modules/gradle-parallel-testing/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
testForGradleTag=serial
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
251 changes: 251 additions & 0 deletions gradle-modules/gradle-parallel-testing/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gradle-modules/gradle-parallel-testing/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'gradle-parallel-testing'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.baeldung.paralleltesting;

public class Application {

public static void main(String[] args) {
System.out.println("Available processors (cores): " + Runtime.getRuntime()
.availableProcessors());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.baeldung.paralleltesting;

public final class ClassSingleton {

public String info = "Initial info class";
private static ClassSingleton INSTANCE;

private static int count = 0;

private ClassSingleton() {
}

public static ClassSingleton getINSTANCE() {
return INSTANCE;
}

public int getCount() {
return count;
}

public static ClassSingleton getInstance() {
if (INSTANCE == null) {
INSTANCE = new ClassSingleton();
}
count++;
return INSTANCE;
}

// more features below ...
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.baeldung.paralleltesting;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

public class FolderCreator {

Boolean createFolder(Path path, String name) throws IOException {
String newFolder = path.toAbsolutePath() + name;
File f = new File(newFolder);
return f.mkdir();
}
}
Loading