Merge pull request #60 from Echtzeitsysteme/hotfix/api-termination

Terminate the GIPS API after each test run
This commit is contained in:
Maximilian Kratz 2024-03-29 08:24:52 +01:00 committed by GitHub
commit 3021dcaf93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 93 additions and 1 deletions

View file

@ -31,6 +31,11 @@ public class GipsIlpLpOutputTest extends AGipsIlpTimeOutTest {
deleteFile();
}
@AfterEach
protected void terminateApi() {
con.terminate();
}
@Override
public void callableSetUp() {
IlpTimeOutModelGenerator.persistModel(MODEL_PATH);

View file

@ -1,5 +1,7 @@
package test.suite.gips.ilp.timeout;
import org.junit.jupiter.api.AfterEach;
import test.suite.gips.utils.AConnector;
public abstract class AGipsIlpTimeOutTest {
@ -11,4 +13,11 @@ public abstract class AGipsIlpTimeOutTest {
protected abstract void callableSetUp();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -17,7 +17,7 @@ public class GipsIlpTimeOutClsNotInModelTriggerExTest extends AGipsIlpTimeOutTes
public void resetModel() {
IlpTimeOutModelGenerator.reset();
}
@Override
public void callableSetUp() {
IlpTimeOutModelGenerator.persistModel(MODEL_PATH);

View file

@ -28,4 +28,11 @@ public abstract class AGipslImportsTest {
out.delete();
}
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -1,5 +1,6 @@
package test.suite.gips.multilayeredinheritence;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import test.suite.gips.utils.AConnector;
@ -16,6 +17,13 @@ public abstract class AMultiLayeredInheritenceTest {
public abstract void resetModel();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
//
// Tests with no constraints
//

View file

@ -1,5 +1,7 @@
package test.suite.gips.nullproject;
import org.junit.jupiter.api.AfterEach;
import test.suite.gips.utils.AConnector;
public abstract class AGipsNullProjectTest {
@ -10,5 +12,12 @@ public abstract class AGipsNullProjectTest {
protected AConnector con;
protected abstract void callableSetUp();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -1,5 +1,7 @@
package test.suite.gips.scheduling;
import org.junit.jupiter.api.AfterEach;
import test.suite.gips.utils.AConnector;
public abstract class AGipsSchedulingTest {
@ -10,5 +12,12 @@ public abstract class AGipsSchedulingTest {
protected AConnector con;
protected abstract void callableSetUp();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -1,5 +1,7 @@
package test.suite.gips.sort;
import org.junit.jupiter.api.AfterEach;
import test.suite.gips.utils.AConnector;
public abstract class AGipsSortTest {
@ -10,5 +12,12 @@ public abstract class AGipsSortTest {
protected AConnector con;
protected abstract void callableSetUp();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -36,5 +36,12 @@ public abstract class AGipslAllBuildTest {
final File f = new File(OUTPUT_PATH);
assertTrue(f.exists() && !f.isDirectory());
}
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -8,6 +8,7 @@ import java.util.Map;
import org.emoflon.gips.core.gt.GTMapping;
import org.emoflon.gips.core.ilp.ILPSolverOutput;
import org.emoflon.gips.core.ilp.ILPSolverStatus;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
public abstract class AGipslAllBuildVarEqMappingTest extends AGipslAllBuildTest {
@ -26,6 +27,13 @@ public abstract class AGipslAllBuildVarEqMappingTest extends AGipslAllBuildTest
*/
protected abstract void runChecks(final boolean exptectedZero);
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
// Actual tests
// Positive tests

View file

@ -1,5 +1,7 @@
package test.suite.gipsl.all.build.resourceset;
import org.junit.jupiter.api.AfterEach;
import test.suite.gips.utils.AResourceConnector;
import test.suite.gipsl.all.build.utils.AllBuildResourceSetModelGenerator;
@ -7,5 +9,12 @@ public abstract class AGipslAllBuildResourceSetTest {
protected AResourceConnector con;
protected AllBuildResourceSetModelGenerator gen = new AllBuildResourceSetModelGenerator();
@AfterEach
protected void terminateApi() {
if (con != null) {
con.terminate();
}
}
}

View file

@ -27,4 +27,10 @@ public abstract class AConnector {
return api.solveILPProblem();
}
public void terminate() {
if (api != null) {
api.terminate();
}
}
}

View file

@ -14,5 +14,11 @@ public abstract class AResourceConnector {
}
public abstract void apply();
public void terminate() {
if (api != null) {
api.terminate();
}
}
}