diff --git a/.github/workflows/awesomebot.yml b/.github/workflows/awesomebot.yml index 095dbe73..a9f25174 100644 --- a/.github/workflows/awesomebot.yml +++ b/.github/workflows/awesomebot.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '21' distribution: 'temurin' cache: 'maven' @@ -39,4 +39,3 @@ jobs: awesome_bot_exit_code="$?" echo "awesome_bot_exit_code=$awesome_bot_exit_code" >> $GITHUB_OUTPUT exit "$awesome_bot_exit_code" - \ No newline at end of file diff --git a/.github/workflows/build_artifact.yml b/.github/workflows/build_artifact.yml index cdcc1202..a4d26d0f 100644 --- a/.github/workflows/build_artifact.yml +++ b/.github/workflows/build_artifact.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - java_version: 8 + java_version: '21' java_distribution: 'temurin' jobs: diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 3fa02278..d574f1e8 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -15,8 +15,8 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - java-version: '11' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' cache: 'maven' - name: Run Checkstyle diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33d23df2..84b6662f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,11 +13,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Set up Java 8 + - name: Set up Java uses: actions/setup-java@v3 with: - java-version: '8' - distribution: 'adopt' + java-version: '21' + distribution: 'temurin' cache: 'maven' - name: Configure Git diff --git a/.github/workflows/update_documentation.yml b/.github/workflows/update_documentation.yml index f8f7dd18..f6af2c57 100644 --- a/.github/workflows/update_documentation.yml +++ b/.github/workflows/update_documentation.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '21' distribution: 'temurin' cache: 'maven' diff --git a/.gitignore b/.gitignore index ed10d27a..a7914e58 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,7 @@ ABCDE Experiment_*.html .idea/modules *.iml *.ipr +*.versionsBackup # CMake cmake-build-*/ diff --git a/pom.xml b/pom.xml index 9c6d0649..e49263f6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 cambio.simulator @@ -11,29 +12,29 @@ https://github.com/Cambio-Project/MiSim - 1.8 - 1.8 + 21 UTF-8 2.9.1 1.2 0.10.2 - 2.11.0 - 1.5.0 - 3.12.0 + 2.15.0 + 1.6.0 + 3.14.0 3.6.1 - 1.10.0 + 1.11.0 2.5.1e - 23.0.0 + 24.1.0 - 5.9.1 - 4.8.0 + 5.10.1 + 5.7.0 scm:git:https://github.com/Cambio-Project/MiSim HEAD + github @@ -50,6 +51,19 @@ + + + + org.mockito + mockito-bom + 5.7.0 + pom + import + + + + + @@ -107,37 +121,24 @@ provided - - - org.junit.vintage - junit-vintage-engine - ${junit.version} - test - org.junit.jupiter junit-jupiter-api ${junit.version} test + org.mockito mockito-core - ${mockito.version} test org.mockito mockito-junit-jupiter - ${mockito.version} - test - - - org.mockito - mockito-inline - ${mockito.version} test + org.apache.commons commons-text @@ -150,15 +151,48 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce + + enforce + + + + + ${maven.compiler.release} + + + 3.8.0 + + + + + + + + org.apache.maven.plugins maven-checkstyle-plugin - 3.3.0 + 3.3.1 com.puppycrawl.tools checkstyle - 9.3 + 10.12.5 + compile + + + + org.junit.vintage + junit-vintage-engine + ${junit.version} + compile @@ -184,13 +218,13 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M7 + 3.2.2 org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.6.2 attach-javadocs @@ -209,9 +243,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.1 - + 3.11.0 + + -Xpkginfo:always @@ -220,10 +255,11 @@ org.apache.maven.plugins maven-shade-plugin - 3.3.0 + 3.5.1 - + cambio.simulator.Main @@ -252,13 +288,13 @@ org.codehaus.mojo versions-maven-plugin - 2.12.0 + 2.16.2 org.apache.maven.plugins maven-release-plugin - 3.0.0-M6 + 3.0.1 v@{project.version} diff --git a/src/test/java/cambio/simulator/entities/networking/AbstractDependencyDescriptionTest.java b/src/test/java/cambio/simulator/entities/networking/AbstractDependencyDescriptionTest.java index 4f55b175..ca53fc7a 100644 --- a/src/test/java/cambio/simulator/entities/networking/AbstractDependencyDescriptionTest.java +++ b/src/test/java/cambio/simulator/entities/networking/AbstractDependencyDescriptionTest.java @@ -8,12 +8,12 @@ import cambio.simulator.models.MiSimModel; import cambio.simulator.test.TestBase; -import org.junit.Before; import cambio.simulator.entities.microservice.Microservice; import cambio.simulator.entities.microservice.Operation; import desmoj.core.simulator.Experiment; import desmoj.core.simulator.Model; +import org.junit.jupiter.api.BeforeEach; /** * A base class that provides basic mocks for setting up unit tests on @@ -27,7 +27,7 @@ public abstract class AbstractDependencyDescriptionTest extends TestBase { protected Operation startOperation; protected Request request; - @Before + @BeforeEach public void setup() { this.random = mock(Random.class); diff --git a/src/test/java/cambio/simulator/entities/networking/AlternativeDependencyDescriptionTest.java b/src/test/java/cambio/simulator/entities/networking/AlternativeDependencyDescriptionTest.java index 227493a9..2e5df85c 100644 --- a/src/test/java/cambio/simulator/entities/networking/AlternativeDependencyDescriptionTest.java +++ b/src/test/java/cambio/simulator/entities/networking/AlternativeDependencyDescriptionTest.java @@ -1,7 +1,7 @@ package cambio.simulator.entities.networking; -import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -10,11 +10,11 @@ import java.util.Collections; import java.util.List; -import org.junit.Test; import cambio.simulator.entities.microservice.Microservice; import cambio.simulator.entities.microservice.Operation; import desmoj.core.dist.ContDistConstant; +import org.junit.jupiter.api.Test; /** * Runs unit tests for {@link AlternativeDependencyDescription}. diff --git a/src/test/java/cambio/simulator/entities/networking/LoopDependencyDescriptionTest.java b/src/test/java/cambio/simulator/entities/networking/LoopDependencyDescriptionTest.java index eeea44c3..50d1703a 100644 --- a/src/test/java/cambio/simulator/entities/networking/LoopDependencyDescriptionTest.java +++ b/src/test/java/cambio/simulator/entities/networking/LoopDependencyDescriptionTest.java @@ -1,7 +1,7 @@ package cambio.simulator.entities.networking; -import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -10,7 +10,8 @@ import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import cambio.simulator.entities.microservice.Microservice; import cambio.simulator.entities.microservice.Operation; @@ -55,12 +56,14 @@ public void testNoChildren() { assertEquals(0, result.size()); } - @Test(expected = IllegalArgumentException.class) + @Test public void testZeroIterations() { - final LoopDependencyDescription dependency = new LoopDependencyDescription(model, 1, 1, 0); - setupLoopDependencyWithOneChild(dependency, 1); - when(random.nextDouble()).thenReturn(0.5); - dependency.generateDependenciesForExecutions(request, random); + Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> { + final LoopDependencyDescription dependency = new LoopDependencyDescription(model, 1, 1, 0); + setupLoopDependencyWithOneChild(dependency, 1); + when(random.nextDouble()).thenReturn(0.5); + dependency.generateDependenciesForExecutions(request, random); + }); } @Test diff --git a/src/test/java/cambio/simulator/resources/CPUProcessSchedulerTest.java b/src/test/java/cambio/simulator/resources/CPUProcessSchedulerTest.java index ced5b738..abd95b25 100644 --- a/src/test/java/cambio/simulator/resources/CPUProcessSchedulerTest.java +++ b/src/test/java/cambio/simulator/resources/CPUProcessSchedulerTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -class CPUProcessSchedulerTest { +abstract class CPUProcessSchedulerTest { private CPUProcessScheduler scheduler; @@ -34,8 +34,6 @@ class CPUProcessSchedulerTest { void setUp() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Assumptions.assumeTrue(this.getClass() != CPUProcessSchedulerTest.class); //skips tests in this superclass - TestExperiment testExperiment = new TestExperiment(); TestModel mod = new TestModel(null, "TestModel", false, false, () -> { }, () -> { @@ -186,4 +184,4 @@ protected void testProcessOrder(ArrayList> arrivalList assertEquals(arrivalList.get(expectedResult[i] - 1).getValue0(), current.getValue0()); } } -} \ No newline at end of file +} diff --git a/src/test/java/cambio/simulator/test/consistency/ReproducibilityTests.java b/src/test/java/cambio/simulator/test/consistency/ReproducibilityTests.java index b8a0d867..b40a14ed 100644 --- a/src/test/java/cambio/simulator/test/consistency/ReproducibilityTests.java +++ b/src/test/java/cambio/simulator/test/consistency/ReproducibilityTests.java @@ -98,7 +98,7 @@ void testReproducibility(File scenario, File architecture, boolean keepOutput, b try { TestUtils.compareFileContentsOfDirectories(rawOutput1, rawOutput2); - } catch (AssertionFailedError | junit.framework.AssertionFailedError e) { + } catch (AssertionFailedError e) { Path trace1; Path trace2;