diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.classpath b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.classpath
new file mode 100644
index 000000000..81fe078c2
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.gitignore b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.project b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.project
new file mode 100644
index 000000000..6693e659e
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.project
@@ -0,0 +1,28 @@
+
+
+ org.palladiosimulator.simulizar.monitorrepository.map.tests
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..9154beff7
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=17
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/META-INF/MANIFEST.MF b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..dff7b79de
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.palladiosimulator.simulizar.monitorrepository.map.tests
+Bundle-Version: 5.2.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-17
+Require-Bundle: org.palladiosimulator.simulizar.monitorrepository.map;bundle-version="5.2.0",
+ org.junit,
+ org.palladiosimulator.monitorrepository.map;bundle-version="1.0.0",
+ org.palladiosimulator.simulizar.runtimemeasurement,
+ org.palladiosimulator.measurementframework,
+ org.palladiosimulator.simulizar;bundle-version="2.0.8",
+ org.jscience
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/build.properties b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/org.palladiosimulator.simulizar.monitorrepository.map.tests.launch b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/org.palladiosimulator.simulizar.monitorrepository.map.tests.launch
new file mode 100644
index 000000000..ae2701371
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/org.palladiosimulator.simulizar.monitorrepository.map.tests.launch
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/src/org/palladiosimulator/simulizar/monitorrepository/map/runtimemeasurement/tests/MonitorRepositoryMapRuntimeMeasurementsRecorderTest.java b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/src/org/palladiosimulator/simulizar/monitorrepository/map/runtimemeasurement/tests/MonitorRepositoryMapRuntimeMeasurementsRecorderTest.java
new file mode 100644
index 000000000..dfb44f53f
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.monitorrepository.map.tests/src/org/palladiosimulator/simulizar/monitorrepository/map/runtimemeasurement/tests/MonitorRepositoryMapRuntimeMeasurementsRecorderTest.java
@@ -0,0 +1,147 @@
+package org.palladiosimulator.simulizar.monitorrepository.map.runtimemeasurement.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.List;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.NonSI;
+import javax.measure.unit.SI;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint;
+import org.palladiosimulator.edp2.models.measuringpoint.MeasuringpointFactory;
+import org.palladiosimulator.measurementframework.MeasuringValue;
+import org.palladiosimulator.measurementframework.TupleMeasurement;
+import org.palladiosimulator.metricspec.constants.MetricDescriptionConstants;
+import org.palladiosimulator.monitorrepository.MeasurementSpecification;
+import org.palladiosimulator.monitorrepository.Monitor;
+import org.palladiosimulator.monitorrepository.MonitorRepositoryFactory;
+import org.palladiosimulator.monitorrepository.map.ExponentialSmoothing;
+import org.palladiosimulator.monitorrepository.map.Map;
+import org.palladiosimulator.monitorrepository.map.MapFactory;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurement;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurementFactory;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurementModel;
+import org.palladiosimulator.simulizar.monitorrepository.map.runtimemeasurement.MonitorRepositoryMapRuntimeMeasurementsRecorder;
+
+public class MonitorRepositoryMapRuntimeMeasurementsRecorderTest {
+
+ private static final double DELTA = Math.pow(10, -8);
+
+ private Map mapProcessingType;
+ private ExponentialSmoothing exponentialSmoothing;
+ private RuntimeMeasurementModel rmModel;
+ private MeasuringPoint measuringPoint;
+ private Monitor monitor;
+ private MeasurementSpecification spec;
+ private Measure pointInTime;
+ private MeasuringValue wrongMetricMeasurement;
+ private MeasuringValue correctMeasurement;
+
+ private InternalRuntimeMeasurementsRecorder rtMeasurementsRecorderUnderTest;
+
+ @Before
+ public void setUp() throws Exception {
+ this.measuringPoint = MeasuringpointFactory.eINSTANCE.createResourceURIMeasuringPoint();
+ this.measuringPoint.setStringRepresentation("MeasuringPoint");
+
+ this.monitor = MonitorRepositoryFactory.eINSTANCE.createMonitor();
+ this.monitor.setMeasuringPoint(this.measuringPoint);
+
+ this.spec = MonitorRepositoryFactory.eINSTANCE.createMeasurementSpecification();
+ this.spec.setMetricDescription(MetricDescriptionConstants.RESPONSE_TIME_METRIC);
+ this.spec.setMonitor(this.monitor);
+
+ this.exponentialSmoothing = MapFactory.eINSTANCE.createExponentialSmoothing();
+ this.exponentialSmoothing.setSmoothingFactor(0.5); // computes the arithmetic mean then
+
+ this.mapProcessingType = MapFactory.eINSTANCE.createMap();
+ this.mapProcessingType.setEntityName("Map Processing Type Response Time");
+ this.mapProcessingType.setMapper(this.exponentialSmoothing);
+ this.mapProcessingType.setOutputMetricDescription(MetricDescriptionConstants.RESPONSE_TIME_METRIC);
+ this.mapProcessingType.setMeasurementSpecification(this.spec);
+
+ this.rmModel = RuntimeMeasurementFactory.eINSTANCE.createRuntimeMeasurementModel();
+
+ this.rtMeasurementsRecorderUnderTest = new InternalRuntimeMeasurementsRecorder(this.rmModel,
+ this.mapProcessingType);
+
+ this.pointInTime = Measure.valueOf(10d, SI.SECOND);
+ this.correctMeasurement = new TupleMeasurement(MetricDescriptionConstants.RESPONSE_TIME_METRIC_TUPLE,
+ this.pointInTime, Measure.valueOf(1d / 60, NonSI.MINUTE)); // 1 second = 1/60 min
+ this.wrongMetricMeasurement = new TupleMeasurement(MetricDescriptionConstants.POWER_CONSUMPTION_TUPLE,
+ this.pointInTime, Measure.valueOf(42d, SI.WATT));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCtorNullArgument() {
+ new MonitorRepositoryMapRuntimeMeasurementsRecorder(null, this.mapProcessingType);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCtorNullArgument2() {
+ new MonitorRepositoryMapRuntimeMeasurementsRecorder(this.rmModel, null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testCtorIllegalStateArgument() {
+ // use the response time metric set description to trigger the exception
+ this.mapProcessingType.setOutputMetricDescription(MetricDescriptionConstants.RESPONSE_TIME_METRIC_TUPLE);
+ new MonitorRepositoryMapRuntimeMeasurementsRecorder(this.rmModel, this.mapProcessingType);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testNewMeasurementAvailableNullArgument() {
+ this.rtMeasurementsRecorderUnderTest.newMeasurementAvailable(null);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testNewMeasurementAvailableWrongMetric() {
+ this.rtMeasurementsRecorderUnderTest.newMeasurementAvailable(this.wrongMetricMeasurement);
+ }
+
+ @Test
+ public void testNewMeasurementAvailableCompatibleMetric() {
+ this.rtMeasurementsRecorderUnderTest.newMeasurementAvailable(this.correctMeasurement);
+ RuntimeMeasurement measurement = this.rtMeasurementsRecorderUnderTest.getMeasurement();
+
+ assertEquals(this.spec.getId(), measurement.getMeasurementSpecification().getId());
+ assertEquals(this.measuringPoint.getStringRepresentation(),
+ measurement.getMeasuringPoint().getStringRepresentation());
+ assertEquals(0.5, measurement.getMeasuringValue(), DELTA); // 0.5s
+
+ this.rtMeasurementsRecorderUnderTest.newMeasurementAvailable(this.correctMeasurement);
+ measurement = this.rtMeasurementsRecorderUnderTest.getMeasurement();
+ assertEquals(0.75, measurement.getMeasuringValue(), DELTA);
+ }
+
+ @Test
+ public void testPreUnregister() {
+ List allMeasurements = this.rtMeasurementsRecorderUnderTest.getModel().getMeasurements();
+ int size = allMeasurements.size();
+ this.rtMeasurementsRecorderUnderTest.preUnregister();
+
+ assertEquals(size - 1, this.rtMeasurementsRecorderUnderTest.getModel().getMeasurements().size());
+ assertFalse(this.rmModel.getMeasurements().contains(this.rtMeasurementsRecorderUnderTest.getMeasurement()));
+ }
+
+ private class InternalRuntimeMeasurementsRecorder extends MonitorRepositoryMapRuntimeMeasurementsRecorder {
+
+ public InternalRuntimeMeasurementsRecorder(final RuntimeMeasurementModel rmModel, final Map mapProcessingType) {
+ super(rmModel, mapProcessingType);
+ }
+
+ public RuntimeMeasurement getMeasurement() {
+ return super.getPRMMeasurement();
+ }
+
+ public RuntimeMeasurementModel getModel() {
+ return super.getPrmModel();
+ }
+
+ }
+}
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/.classpath b/tests/org.palladiosimulator.simulizar.reliability.tests/.classpath
new file mode 100644
index 000000000..675a5e296
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/.classpath
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/.project b/tests/org.palladiosimulator.simulizar.reliability.tests/.project
new file mode 100644
index 000000000..628c2ad2f
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/.project
@@ -0,0 +1,28 @@
+
+
+ org.palladiosimulator.simulizar.reliability.tests
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.palladiosimulator.simulizar.reliability.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..62ef3488c
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/META-INF/MANIFEST.MF b/tests/org.palladiosimulator.simulizar.reliability.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..87e05600e
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Reliability Extension Tests
+Bundle-SymbolicName: org.palladiosimulator.simulizar.reliability.tests
+Bundle-Version: 5.2.0.qualifier
+Fragment-Host: org.palladiosimulator.simulizar.reliability;bundle-version="5.2.0"
+Automatic-Module-Name: org.palladiosimulator.simulizar.reliability.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-17
+Require-Bundle: org.palladiosimulator.simulizar.test.commons;bundle-version="5.0.0",
+ tools.mdsd.junit5utils;bundle-version="0.1.0",
+ de.uka.ipd.sdq.workflow,
+ org.palladiosimulator.metricspec,
+ org.palladiosimulator.edp2,
+ tools.mdsd.library.standalone.initialization;bundle-version="0.2.0",
+ org.palladiosimulator.pcm.resources;bundle-version="4.3.0",
+ de.uka.ipd.sdq.simulation.abstractsimengine.desmoj;bundle-version="4.3.0",
+ de.uka.ipd.sdq.errorhandling;bundle-version="4.3.0",
+ de.desmoj;bundle-version="2.3.3"
+Import-Package: org.hamcrest;version="2.2.0",
+ org.junit.jupiter.api;version="5.7.0"
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/build.properties b/tests/org.palladiosimulator.simulizar.reliability.tests/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ExecutionResultTest.java b/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ExecutionResultTest.java
new file mode 100644
index 000000000..22216dbc9
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ExecutionResultTest.java
@@ -0,0 +1,47 @@
+package org.palladiosimulator.simulizar.reliability.tests;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.closeTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.palladiosimulator.simulizar.test.commons.util.MeasurementTestUtils.allMeasurementsOfMetric;
+import static org.palladiosimulator.simulizar.test.commons.util.MeasurementTestUtils.getMeasurementOfAt;
+
+import org.junit.jupiter.api.Test;
+import org.palladiosimulator.edp2.models.ExperimentData.ExperimentRun;
+import org.palladiosimulator.measurementframework.measure.IdentifierMeasure;
+import org.palladiosimulator.metricspec.constants.MetricDescriptionConstants;
+import org.palladiosimulator.pcm.usagemodel.UsageScenario;
+import org.palladiosimulator.simulizar.reliability.di.DaggerReliabilityExtensionComponent;
+import org.palladiosimulator.simulizar.test.commons.annotation.LoadPCMInstanceFromBundle;
+import org.palladiosimulator.simulizar.test.commons.annotation.RunSimuLizar;
+import org.palladiosimulator.simulizar.test.commons.annotation.SimulationConfig;
+import org.palladiosimulator.simulizar.test.commons.annotation.UseSimuLizarExtension;
+
+import de.uka.ipd.sdq.workflow.jobs.JobFailedException;
+import de.uka.ipd.sdq.workflow.jobs.UserCanceledException;
+import tools.mdsd.junit5utils.annotations.PluginTestOnly;
+
+@PluginTestOnly
+class ExecutionResultTest {
+
+ @Test
+ @LoadPCMInstanceFromBundle(bundleName = "org.palladiosimulator.simulizar.reliability.tests", basePath = "testmodels/simulizar151", modelFiles = {
+ "default.allocation", "default.usagemodel", "My.monitorrepository" })
+ @UseSimuLizarExtension(DaggerReliabilityExtensionComponent.class)
+ @SimulationConfig(simulateReliability = true)
+ @RunSimuLizar
+ void testExecutionResultRecording(UsageScenario usageScenarion,ExperimentRun expRun)
+ throws JobFailedException, UserCanceledException {
+ var resultMeasurement = getMeasurementOfAt(expRun.getMeasurement(),
+ MetricDescriptionConstants.EXECUTION_RESULT_TYPE_TUPLE, usageScenarion);
+ assertTrue(resultMeasurement.isPresent());
+
+ var results = allMeasurementsOfMetric(resultMeasurement.get(), MetricDescriptionConstants.EXECUTION_RESULT_TYPE);
+
+ var noSuccesses = results.stream().map(IdentifierMeasure.class::cast).map(m -> m.getValue().getLiteral())
+ .filter(lit -> lit.equals(MetricDescriptionConstants.EXECUTION_RESULT_TYPE_SUCCESS.getLiteral())).count();
+ assertThat(noSuccesses * 1.0 / results.size(), is(closeTo(0.7d, 0.1)));
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ReliabilityTest.java b/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ReliabilityTest.java
new file mode 100644
index 000000000..8dbebe7a6
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/src/org/palladiosimulator/simulizar/reliability/tests/ReliabilityTest.java
@@ -0,0 +1,55 @@
+package org.palladiosimulator.simulizar.reliability.tests;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.closeTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.palladiosimulator.simulizar.test.commons.util.MeasurementTestUtils.allMeasurementsOfMetric;
+import static org.palladiosimulator.simulizar.test.commons.util.MeasurementTestUtils.getMeasurementOfAt;
+
+import org.junit.jupiter.api.Test;
+import org.palladiosimulator.edp2.models.ExperimentData.ExperimentRun;
+import org.palladiosimulator.metricspec.constants.MetricDescriptionConstants;
+import org.palladiosimulator.pcm.seff.ExternalCallAction;
+import org.palladiosimulator.simulizar.reliability.di.DaggerReliabilityExtensionComponent;
+import org.palladiosimulator.simulizar.test.commons.annotation.LoadPCMInstanceFromBundle;
+import org.palladiosimulator.simulizar.test.commons.annotation.Named;
+import org.palladiosimulator.simulizar.test.commons.annotation.RunSimuLizar;
+import org.palladiosimulator.simulizar.test.commons.annotation.SimulationConfig;
+import org.palladiosimulator.simulizar.test.commons.annotation.UseSimuLizarExtension;
+
+import de.uka.ipd.sdq.workflow.jobs.JobFailedException;
+import de.uka.ipd.sdq.workflow.jobs.UserCanceledException;
+import tools.mdsd.junit5utils.annotations.PluginTestOnly;
+
+@PluginTestOnly
+class ReliabilityTest {
+
+ @Test
+ @LoadPCMInstanceFromBundle(bundleName = "org.palladiosimulator.simulizar.reliability.tests", basePath = "testmodels/simulizar148", modelFiles = {
+ "default.allocation", "default.usagemodel", "default.monitorrepository" })
+ @UseSimuLizarExtension(DaggerReliabilityExtensionComponent.class)
+ @SimulationConfig(simulateReliability = true)
+ @RunSimuLizar
+ void testReliabilityExtension(@Named("ExternalCallActionFoo") ExternalCallAction fooCallAction,
+ @Named("ExternalCallActionBar") ExternalCallAction barCallAction, ExperimentRun expRun)
+ throws JobFailedException, UserCanceledException {
+ var fooMeasurement = getMeasurementOfAt(expRun.getMeasurement(),
+ MetricDescriptionConstants.RESPONSE_TIME_METRIC_TUPLE, fooCallAction);
+ assertTrue(fooMeasurement.isPresent());
+
+ var barMeasurement = getMeasurementOfAt(expRun.getMeasurement(),
+ MetricDescriptionConstants.RESPONSE_TIME_METRIC_TUPLE, barCallAction);
+ assertTrue(barMeasurement.isPresent());
+
+ var fooCalls = allMeasurementsOfMetric(fooMeasurement.get(), MetricDescriptionConstants.RESPONSE_TIME_METRIC);
+ var barCalls = allMeasurementsOfMetric(barMeasurement.get(), MetricDescriptionConstants.RESPONSE_TIME_METRIC);
+
+ assertThat(fooCalls, hasSize(greaterThan(100)));
+ assertThat(barCalls, hasSize(greaterThan(100)));
+ assertThat(barCalls.size() * 1.0 / fooCalls.size(), is(closeTo(0.5d, 0.1)));
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.allocation b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.allocation
new file mode 100644
index 000000000..70ec68972
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.allocation
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.measuringpoint b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.measuringpoint
new file mode 100644
index 000000000..259abba92
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.measuringpoint
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.monitorrepository b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.monitorrepository
new file mode 100644
index 000000000..93d353cad
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.monitorrepository
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.repository b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.repository
new file mode 100644
index 000000000..7bae82505
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.repository
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.resourceenvironment b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.resourceenvironment
new file mode 100644
index 000000000..d5283efad
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.resourceenvironment
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.system b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.system
new file mode 100644
index 000000000..bd06cce53
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.system
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.usagemodel b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.usagemodel
new file mode 100644
index 000000000..886ed5d95
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar148/default.usagemodel
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/.project b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/.project
new file mode 100644
index 000000000..377c65fe6
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/.project
@@ -0,0 +1,12 @@
+
+
+ simulizar151
+
+
+
+
+
+
+ org.eclipse.sirius.nature.modelingproject
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.measuringpoint b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.measuringpoint
new file mode 100644
index 000000000..d1a69c074
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.measuringpoint
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.monitorrepository b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.monitorrepository
new file mode 100644
index 000000000..837c3b3b8
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.monitorrepository
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.resourceenvironment b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.resourceenvironment
new file mode 100644
index 000000000..3c9b45859
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/My.resourceenvironment
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.allocation b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.allocation
new file mode 100644
index 000000000..38c81fd43
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.allocation
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.repository b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.repository
new file mode 100644
index 000000000..09f5301a0
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.repository
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.system b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.system
new file mode 100644
index 000000000..e855e7dc9
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.system
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.usagemodel b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.usagemodel
new file mode 100644
index 000000000..6caac8003
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/default.usagemodel
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/representations.aird b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/representations.aird
new file mode 100644
index 000000000..3cfe62a04
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.reliability.tests/testmodels/simulizar151/representations.aird
@@ -0,0 +1,954 @@
+
+
+
+ My.resourceenvironment
+ pathmap://PCM_MODELS/Palladio.resourcetype
+ default.allocation
+ default.system
+ default.repository
+ default.usagemodel
+ pathmap://PCM_MODELS/FailureTypes.repository
+ pathmap://PCM_MODELS/PrimitiveTypes.repository
+ My.measuringpoint
+ My.monitorrepository
+ pathmap://METRIC_SPEC_MODELS/commonMetrics.metricspec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.classpath b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.classpath
new file mode 100644
index 000000000..81fe078c2
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.project b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.project
new file mode 100644
index 000000000..78ad151f9
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.project
@@ -0,0 +1,28 @@
+
+
+ org.palladiosimulator.simulizar.slidingwindow.tests
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..9154beff7
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=17
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/META-INF/MANIFEST.MF b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..d46dd62d5
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Simulizar Sliding Window Tests
+Bundle-SymbolicName: org.palladiosimulator.simulizar.slidingwindow.tests
+Bundle-Version: 5.2.0.qualifier
+Bundle-Activator: org.palladiosimulator.simulizar.slidingwindow.impl.tests.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit;bundle-version="4.11.0",
+ de.uka.ipd.sdq.simulation.abstractsimengine,
+ de.uka.ipd.sdq.simucomframework,
+ org.palladiosimulator.edp2,
+ de.uka.ipd.sdq.simucomframework.simucomstatus,
+ org.palladiosimulator.probeframework,
+ org.palladiosimulator.simulizar,
+ org.palladiosimulator.simulizar.slidingwindow,
+ org.palladiosimulator.experimentanalysis,
+ de.uka.ipd.sdq.scheduler;bundle-version="1.0.0",
+ org.palladiosimulator.experimentanalysis.tests,
+ org.jscience,
+ org.palladiosimulator.edp2.dao;bundle-version="1.0.0",
+ org.palladiosimulator.edp2.repository.local;bundle-version="1.0.0",
+ org.palladiosimulator.metricspec.resources;bundle-version="1.0.0",
+ org.palladiosimulator.recorderframework.edp2;bundle-version="2.0.2",
+ org.palladiosimulator.recorderframework;bundle-version="2.0.1",
+ org.palladiosimulator.simulizar.runtimemeasurement,
+ org.palladiosimulator.measurementframework
+Bundle-RequiredExecutionEnvironment: JavaSE-17
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/build.properties b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/org.palladiosimulator.simulizar.slidingwindow.tests.launch b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/org.palladiosimulator.simulizar.slidingwindow.tests.launch
new file mode 100644
index 000000000..11699d6f8
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/org.palladiosimulator.simulizar.slidingwindow.tests.launch
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/ArithmeticMeanAggregatorTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/ArithmeticMeanAggregatorTest.java
new file mode 100644
index 000000000..194c84563
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/ArithmeticMeanAggregatorTest.java
@@ -0,0 +1,29 @@
+package org.palladiosimulator.simulizar.slidingwindow.aggregators.tests;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.SI;
+
+import org.palladiosimulator.metricspec.NumericalBaseMetricDescription;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.ArithmeticMeanAggregator;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator;
+
+public class ArithmeticMeanAggregatorTest extends SlidingWindowStatisticalCharacterizationAggregatorTest {
+
+ @Override
+ protected StatisticalCharacterizationAggregator getStatisticalCharacterizationAggregator(
+ NumericalBaseMetricDescription expectedMetric) {
+ return new ArithmeticMeanAggregator(expectedMetric);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeFirstTest() {
+ return Measure.valueOf(452.025, SI.SECOND);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeSecondTest() {
+ return Measure.valueOf(362.72, SI.SECOND);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/GeometricMeanAggregatorTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/GeometricMeanAggregatorTest.java
new file mode 100644
index 000000000..329105c6c
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/GeometricMeanAggregatorTest.java
@@ -0,0 +1,29 @@
+package org.palladiosimulator.simulizar.slidingwindow.aggregators.tests;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.SI;
+
+import org.palladiosimulator.metricspec.NumericalBaseMetricDescription;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.GeometricMeanAggregator;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator;
+
+public class GeometricMeanAggregatorTest extends SlidingWindowStatisticalCharacterizationAggregatorTest {
+
+ @Override
+ protected StatisticalCharacterizationAggregator getStatisticalCharacterizationAggregator(
+ NumericalBaseMetricDescription expectedMetric) {
+ return new GeometricMeanAggregator(expectedMetric);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeFirstTest() {
+ return Measure.valueOf(7.0533234616974002588733413490183, SI.SECOND);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeSecondTest() {
+ return Measure.valueOf(6.7110052498303912116958243874521, SI.SECOND);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/HarmonicMeanAggregatorTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/HarmonicMeanAggregatorTest.java
new file mode 100644
index 000000000..95cf73608
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/HarmonicMeanAggregatorTest.java
@@ -0,0 +1,31 @@
+package org.palladiosimulator.simulizar.slidingwindow.aggregators.tests;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.SI;
+
+import org.palladiosimulator.metricspec.NumericalBaseMetricDescription;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.HarmonicMeanAggregator;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator;
+
+public class HarmonicMeanAggregatorTest extends SlidingWindowStatisticalCharacterizationAggregatorTest {
+
+ @Override
+ protected StatisticalCharacterizationAggregator getStatisticalCharacterizationAggregator(
+ NumericalBaseMetricDescription expectedMetric) {
+ return new HarmonicMeanAggregator(expectedMetric);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeFirstTest() {
+ double sumOfInverses = 1 / 0.1 + 1 / 5.5 + 1 / 2.5 + 1 / 1800;
+ return Measure.valueOf(4d / sumOfInverses, SI.SECOND);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeSecondTest() {
+ double sumOfInverses = 1 / 0.1 + 2 / 5.5 + 1 / 2.5 + 1 / 1800;
+ return Measure.valueOf(5 / sumOfInverses, SI.SECOND);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/MedianAggregatorTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/MedianAggregatorTest.java
new file mode 100644
index 000000000..16c5c7f5a
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/MedianAggregatorTest.java
@@ -0,0 +1,29 @@
+package org.palladiosimulator.simulizar.slidingwindow.aggregators.tests;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.SI;
+
+import org.palladiosimulator.metricspec.NumericalBaseMetricDescription;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.MedianAggregator;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator;
+
+public class MedianAggregatorTest extends SlidingWindowStatisticalCharacterizationAggregatorTest {
+
+ @Override
+ protected StatisticalCharacterizationAggregator getStatisticalCharacterizationAggregator(
+ NumericalBaseMetricDescription expectedMetric) {
+ return new MedianAggregator(expectedMetric);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeFirstTest() {
+ return Measure.valueOf(4d, SI.SECOND);
+ }
+
+ @Override
+ protected Measure getExpectedAggregatedResponseTimeSecondTest() {
+ return Measure.valueOf(5.5, SI.SECOND);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/SlidingWindowStatisticalCharacterizationAggregatorTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/SlidingWindowStatisticalCharacterizationAggregatorTest.java
new file mode 100644
index 000000000..91ee1d266
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/aggregators/tests/SlidingWindowStatisticalCharacterizationAggregatorTest.java
@@ -0,0 +1,161 @@
+package org.palladiosimulator.simulizar.slidingwindow.aggregators.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Dimensionless;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.NonSI;
+import javax.measure.unit.SI;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.palladiosimulator.experimentanalysis.windowaggregators.tests.SlidingWindowAggregatorTest;
+import org.palladiosimulator.measurementframework.MeasuringValue;
+import org.palladiosimulator.measurementframework.TupleMeasurement;
+import org.palladiosimulator.metricspec.MetricSetDescription;
+import org.palladiosimulator.metricspec.NumericalBaseMetricDescription;
+import org.palladiosimulator.metricspec.constants.MetricDescriptionConstants;
+import org.palladiosimulator.monitorrepository.statisticalcharacterization.StatisticalCharacterizationAggregator;
+import org.palladiosimulator.simulizar.slidingwindow.aggregators.SlidingWindowStatisticalCharacterizationAggregator;
+
+public abstract class SlidingWindowStatisticalCharacterizationAggregatorTest extends SlidingWindowAggregatorTest {
+
+ private static final MetricSetDescription WINDOW_DATA_METRIC = MetricDescriptionConstants.RESPONSE_TIME_METRIC_TUPLE;
+ private static final NumericalBaseMetricDescription RESULT_METRIC = (NumericalBaseMetricDescription) MetricDescriptionConstants.RESPONSE_TIME_METRIC;
+
+ private Measure almostZeroResponseTime;
+ private Measure secondsResponseTime;
+ private Measure milliSecondsResponseTime;
+ private Measure minsResponseTime;
+
+ protected MeasuringValue exepectedAggregatedResponseTimeMeasuringValueFirstTest;
+ protected MeasuringValue exepectedAggregatedResponseTimeMeasuringValueSecondTest;
+
+ // constant that denotes the maximum delta between double values for which both numbers are
+ // still considered equal
+ private static final double DELTA = Math.pow(10, -4);
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ this.aggregatorUnderTest = new SlidingWindowStatisticalCharacterizationAggregator(this.dummyRecorder,
+ getStatisticalCharacterizationAggregator(RESULT_METRIC));
+ this.almostZeroResponseTime = Measure.valueOf(0.1d, SI.SECOND);
+ this.secondsResponseTime = Measure.valueOf(5.5d, SI.SECOND);
+ this.milliSecondsResponseTime = Measure.valueOf(2500d, SI.MILLI(SI.SECOND));
+ this.minsResponseTime = Measure.valueOf(30d, NonSI.MINUTE);
+
+ this.exepectedAggregatedResponseTimeMeasuringValueFirstTest = createResponseTimeTupleMeasurement(
+ getExpectedAggregatedResponseTimeFirstTest());
+ this.exepectedAggregatedResponseTimeMeasuringValueSecondTest = createResponseTimeTupleMeasurement(
+ getExpectedAggregatedResponseTimeSecondTest());
+ }
+
+ protected abstract StatisticalCharacterizationAggregator getStatisticalCharacterizationAggregator(
+ NumericalBaseMetricDescription expectedMetric);
+
+ /**
+ * Response times to aggregate: 0.1s, 5.5s, 2500ms, 30min
+ *
+ * @return
+ */
+ protected abstract Measure getExpectedAggregatedResponseTimeFirstTest();
+
+ /**
+ * Response times to aggregate: 0.1s, 5.5s, 5.5s 2500ms, 30min
+ *
+ * @return
+ */
+ protected abstract Measure getExpectedAggregatedResponseTimeSecondTest();
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private MeasuringValue createResponseTimeTupleMeasurement(final Measure responseTime) {
+
+ Measure pointInTimeMeasure = Measure
+ .valueOf(this.currentLowerBound.getValue() + this.windowLength.getValue(), SI.SECOND);
+ return new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, responseTime);
+ }
+
+ private void addResponseTimeTupleMeasurements() {
+ // window position: [0-10]
+
+ Measure pointInTimeMeasure = Measure.valueOf(0d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.almostZeroResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(3d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.milliSecondsResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(4d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.minsResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(9d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.secondsResponseTime));
+ }
+
+ private void addResponseTimeTupleMeasurementsOddNumber() {
+ // window position: [0-10]
+
+ Measure pointInTimeMeasure = Measure.valueOf(0d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.almostZeroResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(3d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.milliSecondsResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(4d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.minsResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(5d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.secondsResponseTime));
+
+ pointInTimeMeasure = Measure.valueOf(8d, SI.SECOND);
+ this.data.addLast(new TupleMeasurement(WINDOW_DATA_METRIC, pointInTimeMeasure, this.secondsResponseTime));
+ }
+
+ private void assertLastRecordedMeasurementEquals(final MeasuringValue expected) {
+ MeasuringValue lastMeasurement = this.dummyRecorder.getLastMeasurement();
+ assertNotNull(lastMeasurement);
+ assertMeasurementsEqual(expected, lastMeasurement);
+ }
+
+ private static void assertMeasurementsEqual(final MeasuringValue expected, final MeasuringValue actual) {
+ Measure expectedResponseTime = expected.getMeasureForMetric(RESULT_METRIC);
+ Measure actualResponseTime = actual.getMeasureForMetric(RESULT_METRIC);
+
+ assertEquals(expectedResponseTime.getValue(), actualResponseTime.getValue(), DELTA);
+ }
+
+ @Test
+ public void testOnSlidingWindowFullEmptyData() {
+ this.aggregatorUnderTest.onSlidingWindowFull(this.data, this.currentLowerBound, this.windowLength);
+ assertLastRecordedMeasurementEquals(createResponseTimeTupleMeasurement(Measure.valueOf(0d, SI.SECOND)));
+ }
+
+ @Test
+ public void testOnSlidingWindowFull() {
+ addResponseTimeTupleMeasurements();
+ this.aggregatorUnderTest.onSlidingWindowFull(this.data, this.currentLowerBound, this.windowLength);
+ assertLastRecordedMeasurementEquals(this.exepectedAggregatedResponseTimeMeasuringValueFirstTest);
+ }
+
+ @Test
+ public void testOnSlidingWindowFullOddNumber() {
+ addResponseTimeTupleMeasurementsOddNumber();
+ this.aggregatorUnderTest.onSlidingWindowFull(this.data, this.currentLowerBound, this.windowLength);
+ assertLastRecordedMeasurementEquals(this.exepectedAggregatedResponseTimeMeasuringValueSecondTest);
+ }
+
+ @Test
+ public final void testGetExpectedWindowDataMetric() {
+ assertEquals(RESULT_METRIC, this.aggregatorUnderTest.getExpectedWindowDataMetric());
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/Activator.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/Activator.java
new file mode 100644
index 000000000..b6441a989
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/Activator.java
@@ -0,0 +1,30 @@
+package org.palladiosimulator.simulizar.slidingwindow.impl.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/SimulizarSlidingWindowTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/SimulizarSlidingWindowTest.java
new file mode 100644
index 000000000..4b8b9bb5c
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/impl/tests/SimulizarSlidingWindowTest.java
@@ -0,0 +1,144 @@
+package org.palladiosimulator.simulizar.slidingwindow.impl.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Duration;
+import javax.measure.unit.SI;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.palladiosimulator.experimentanalysis.tests.SlidingWindowTest;
+import org.palladiosimulator.simulizar.slidingwindow.impl.SimulizarSlidingWindow;
+import org.palladiosimulator.simulizar.slidingwindow.tests.utils.SimuComModelMock;
+
+import de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager;
+import de.uka.ipd.sdq.scheduler.resources.active.ResourceTableManager;
+import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
+
+public class SimulizarSlidingWindowTest extends SlidingWindowTest {
+
+ private SimuComModel model = null;
+ private IResourceTableManager resourceTableManager;
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ this.resourceTableManager = new ResourceTableManager();
+ this.model = SimuComModelMock.obtainMockModel(this.tempFolder, resourceTableManager);
+ this.slidingWindowUnderTest = new SimulizarSlidingWindow(windowLength, increment, windowMetricDescription,
+ dummyStrategy, this.model);
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ SimuComModelMock.releaseMockModel();
+ this.model = null;
+ super.tearDown();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorNoMetricDefined() {
+ new SimulizarSlidingWindow(windowLength, increment, null, dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorNoMoveOnStrategyDefined() {
+ new SimulizarSlidingWindow(windowLength, increment, windowMetricDescription, null, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorNoWindowLengthDefined() {
+ new SimulizarSlidingWindow(null, increment, windowMetricDescription, dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorIllegalWindowLengthDefinedNegativeValue() {
+ new SimulizarSlidingWindow(Measure.valueOf(-10d, SI.SECOND), increment, windowMetricDescription, dummyStrategy,
+ this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorIllegalWindowLengthDefinedNaNValue() {
+ new SimulizarSlidingWindow(Measure.valueOf(Double.NaN, SI.SECOND), increment, measurementsMetricDescription,
+ dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorIllegalWindowLengthDefinedInfiniteValue() {
+ new SimulizarSlidingWindow(Measure.valueOf(Double.NEGATIVE_INFINITY, SI.SECOND), increment,
+ measurementsMetricDescription, dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorNoIncrementDefined() {
+ new SimulizarSlidingWindow(windowLength, null, measurementsMetricDescription, dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorIllegalIncrementDefined() {
+ new SimulizarSlidingWindow(windowLength, Measure.valueOf(-10d, SI.SECOND), measurementsMetricDescription,
+ dummyStrategy, this.model);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCtorNoModelDefined() {
+ new SimulizarSlidingWindow(windowLength, Measure.valueOf(10d, SI.SECOND), measurementsMetricDescription,
+ dummyStrategy, null);
+ }
+
+ @Override
+ @Test
+ public void testGetCurrentUpperBound() {
+ super.testGetCurrentUpperBound();
+ // sim time is Double.MAX_VALUE now according to mocked model
+ this.model.getSimulationControl().setMaxSimTime(5); // window is longer than simulation now
+ // hence, check if upper bound has been adjusted
+ Measure expected = Measure
+ .valueOf(this.model.getSimulationControl().getCurrentSimulationTime(), SI.SECOND);
+ assertEquals(expected, this.slidingWindowUnderTest.getCurrentUpperBound());
+ }
+
+ @Override
+ @Test
+ public void testGetEffectiveWindowLength() {
+ super.testGetEffectiveWindowLength();
+ // sim time is Double.MAX_VALUE now according to mocked model
+ this.model.getSimulationControl().setMaxSimTime(5); // window is longer than simulation now
+ // thus, check if length has been adjusted
+ assertTrue(this.slidingWindowUnderTest.getEffectiveWindowLength().compareTo(this.windowLength) < 0);
+ assertEquals(this.model.getSimulationControl().getCurrentSimulationTime(),
+ this.slidingWindowUnderTest.getEffectiveWindowLength().getValue(), Double.MIN_NORMAL);
+ }
+
+ @Override
+ @Test
+ public void testMoveOn() {
+ super.testMoveOn();
+ // mock periodic window full/move on event controlled by model
+ ((SimuComModelMock) this.model).triggerMockWindowMoveOn((SimulizarSlidingWindow) this.slidingWindowUnderTest);
+ // assert that the window bounds have been adjusted (moved forward) correctly
+ Measure expectedNewUpperBound = Measure.valueOf(
+ this.currentLowerBound.getValue() + this.increment.getValue() + this.windowLength.getValue(),
+ SI.SECOND);
+ assertEquals(expectedNewUpperBound, this.slidingWindowUnderTest.getCurrentUpperBound());
+
+ // test with different units
+ SimulizarSlidingWindow window = new SimulizarSlidingWindow(Measure.valueOf(1d, SI.SECOND),
+ Measure.valueOf(500d, SI.MILLI(SI.SECOND)), measurementsMetricDescription, this.dummyStrategy,
+ this.model);
+ ((SimuComModelMock) this.model).triggerMockWindowMoveOn(window);
+ expectedNewUpperBound = Measure.valueOf(1.5d, SI.SECOND);
+ assertEquals(expectedNewUpperBound, window.getCurrentUpperBound());
+ }
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/runtimemeasurement/tests/SlidingWindowRuntimeMeasurementsRecorderTest.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/runtimemeasurement/tests/SlidingWindowRuntimeMeasurementsRecorderTest.java
new file mode 100644
index 000000000..f136ec9aa
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/runtimemeasurement/tests/SlidingWindowRuntimeMeasurementsRecorderTest.java
@@ -0,0 +1,116 @@
+package org.palladiosimulator.simulizar.slidingwindow.runtimemeasurement.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.measure.Measure;
+import javax.measure.quantity.Dimensionless;
+import javax.measure.unit.NonSI;
+import javax.measure.unit.SI;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.palladiosimulator.edp2.models.measuringpoint.MeasuringPoint;
+import org.palladiosimulator.edp2.models.measuringpoint.MeasuringpointFactory;
+import org.palladiosimulator.measurementframework.BasicMeasurement;
+import org.palladiosimulator.measurementframework.MeasuringValue;
+import org.palladiosimulator.measurementframework.TupleMeasurement;
+import org.palladiosimulator.metricspec.constants.MetricDescriptionConstants;
+import org.palladiosimulator.monitorrepository.MeasurementSpecification;
+import org.palladiosimulator.monitorrepository.Monitor;
+import org.palladiosimulator.monitorrepository.MonitorRepositoryFactory;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurement;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurementFactory;
+import org.palladiosimulator.runtimemeasurement.RuntimeMeasurementModel;
+import org.palladiosimulator.simulizar.slidingwindow.runtimemeasurement.SlidingWindowRuntimeMeasurementsRecorder;
+
+public class SlidingWindowRuntimeMeasurementsRecorderTest {
+
+ private RuntimeMeasurementModel rmModel;
+ private MeasuringPoint measuringPoint;
+ private Monitor monitor;
+ private MeasurementSpecification spec;
+ private MeasuringValue wrongMetricMeasurement;
+ private MeasuringValue correctMeasurement;
+
+ private InternalSlidingWindowRuntimeMeasurementsRecorder recorderUnderTest;
+
+ @Before
+ public void setUp() throws Exception {
+ this.rmModel = RuntimeMeasurementFactory.eINSTANCE.createRuntimeMeasurementModel();
+ this.spec = MonitorRepositoryFactory.eINSTANCE.createMeasurementSpecification();
+ this.measuringPoint = MeasuringpointFactory.eINSTANCE.createResourceURIMeasuringPoint();
+ this.monitor = MonitorRepositoryFactory.eINSTANCE.createMonitor();
+ this.monitor.setMeasuringPoint(this.measuringPoint);
+ this.spec.setMetricDescription(MetricDescriptionConstants.UTILIZATION_OF_ACTIVE_RESOURCE_TUPLE);
+ this.spec.setMonitor(this.monitor);
+
+ Measure timeMeasure = Measure.valueOf(42.0, SI.SECOND);
+ Measure utilizationMeasure = Measure.valueOf(0.42, Dimensionless.UNIT);
+ this.wrongMetricMeasurement = new BasicMeasurement<>(Measure.valueOf(3.5d, NonSI.HOUR),
+ MetricDescriptionConstants.WAITING_TIME_METRIC);
+ this.correctMeasurement = new TupleMeasurement(MetricDescriptionConstants.UTILIZATION_OF_ACTIVE_RESOURCE_TUPLE,
+ timeMeasure, utilizationMeasure);
+
+ this.recorderUnderTest = new InternalSlidingWindowRuntimeMeasurementsRecorder(this.rmModel, this.spec);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCtorNullArgument() {
+ RuntimeMeasurementModel m = null;
+ new SlidingWindowRuntimeMeasurementsRecorder(m, this.spec);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCtorNullArgument2() {
+ new SlidingWindowRuntimeMeasurementsRecorder(this.rmModel, null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testNewMeasurementAvailableNull() {
+ this.recorderUnderTest.newMeasurementAvailable(null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testNewMeasurementAvailableWrongMetric() {
+ this.recorderUnderTest.newMeasurementAvailable(this.wrongMetricMeasurement);
+ }
+
+ @Test
+ public void testNewMeasurementAvailableCompatibleMetric() {
+ this.recorderUnderTest.newMeasurementAvailable(this.correctMeasurement);
+ RuntimeMeasurement rmMeasurement = this.recorderUnderTest.getLastMeasurement();
+
+ assertEquals(0.42, rmMeasurement.getMeasuringValue(), Math.pow(10, -8));
+ assertEquals(this.spec.getId(), rmMeasurement.getMeasurementSpecification().getId());
+ }
+
+ @Test
+ public void testNewMeasurementAvailableSubsumedMetric() {
+ // slightly change metric
+ this.spec.setMetricDescription(MetricDescriptionConstants.UTILIZATION_OF_ACTIVE_RESOURCE);
+ this.recorderUnderTest = new InternalSlidingWindowRuntimeMeasurementsRecorder(this.rmModel, this.spec);
+
+ this.recorderUnderTest.newMeasurementAvailable(this.correctMeasurement);
+ RuntimeMeasurement rmMeasurement = this.recorderUnderTest.getLastMeasurement();
+
+ assertEquals(0.42, rmMeasurement.getMeasuringValue(), Math.pow(10, -8));
+ assertEquals(this.spec.getId(), rmMeasurement.getMeasurementSpecification().getId());
+ }
+
+ private class InternalSlidingWindowRuntimeMeasurementsRecorder extends SlidingWindowRuntimeMeasurementsRecorder {
+
+ public InternalSlidingWindowRuntimeMeasurementsRecorder(final RuntimeMeasurementModel rmModel,
+ final MeasurementSpecification measurementSpecification) {
+ super(rmModel, measurementSpecification);
+ }
+
+ private RuntimeMeasurement getLastMeasurement() {
+ return this.getPRMMeasurement();
+ }
+ }
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimEngineFactoryMock.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimEngineFactoryMock.java
new file mode 100644
index 000000000..aed3a370e
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimEngineFactoryMock.java
@@ -0,0 +1,95 @@
+package org.palladiosimulator.simulizar.slidingwindow.tests.utils;
+
+import java.util.Observer;
+
+import de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator;
+import de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimProcessDelegator;
+import de.uka.ipd.sdq.simulation.abstractsimengine.IEntity;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimEngineFactory;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimEvent;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimProcess;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimRunnable;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationControl;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel;
+import de.uka.ipd.sdq.simulation.abstractsimengine.SimCondition;
+
+final class SimEngineFactoryMock implements ISimEngineFactory {
+
+ @Override
+ public void setModel(ISimulationModel model) {
+
+ }
+
+ @Override
+ public ISimulationControl createSimulationControl() {
+ return new ISimulationControl() {
+
+ private double simTime = Double.MAX_VALUE;
+
+ @Override
+ public void stop() {
+ }
+
+ @Override
+ public void start() {
+ }
+
+ @Override
+ public void setMaxSimTime(long simTime) {
+ this.simTime = simTime;
+ }
+
+ @Override
+ public boolean isRunning() {
+ //this mock is always running, whether or not it is has been started
+ return true;
+ }
+
+ @Override
+ public double getCurrentSimulationTime() {
+ //always return the specified max simulation time here
+ return simTime;
+ }
+
+ @Override
+ public void addTimeObserver(Observer observer) {
+ }
+
+ @Override
+ public void addStopCondition(SimCondition maxMeasurementsStopCondition) {
+ }
+ };
+ }
+
+ @Override
+ public ISimProcess createSimProcess(
+ AbstractSimProcessDelegator myProcess, String name) {
+ return null;
+ }
+
+ @Override
+ public ISimEvent createSimEvent(
+ ISimRunnable myEvent, String name) {
+ return new ISimEvent() {
+
+ @Override
+ public void schedule(E entity, double delay) {
+ }
+
+ @Override
+ public void removeEvent() {
+ }
+
+ @Override
+ public double scheduledAtTime() {
+ return 0;
+ }
+ };
+ }
+
+ @Override
+ public IEntity createEntity(AbstractSimEntityDelegator e, String name) {
+ return null;
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimuComModelMock.java b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimuComModelMock.java
new file mode 100644
index 000000000..1bfbe30d9
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.slidingwindow.tests/src/org/palladiosimulator/simulizar/slidingwindow/tests/utils/SimuComModelMock.java
@@ -0,0 +1,136 @@
+package org.palladiosimulator.simulizar.slidingwindow.tests.utils;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.rules.TemporaryFolder;
+import org.palladiosimulator.edp2.impl.RepositoryManager;
+import org.palladiosimulator.edp2.models.Repository.Repository;
+import org.palladiosimulator.edp2.repository.local.LocalDirectoryRepositoryHelper;
+import org.palladiosimulator.experimentanalysis.SlidingWindow;
+import org.palladiosimulator.probeframework.ProbeFrameworkContext;
+import org.palladiosimulator.probeframework.calculator.ExtensibleCalculatorFactoryDelegatingFactory;
+import org.palladiosimulator.simulizar.simulationevents.PeriodicallyTriggeredSimulationEntity;
+import org.palladiosimulator.simulizar.slidingwindow.impl.SimulizarSlidingWindow;
+
+import de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager;
+import de.uka.ipd.sdq.simucomframework.SimuComConfig;
+import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
+import de.uka.ipd.sdq.simucomframework.simucomstatus.SimuComStatus;
+import de.uka.ipd.sdq.simucomframework.simucomstatus.SimucomstatusFactory;
+import de.uka.ipd.sdq.simulation.abstractsimengine.ISimEventFactory;
+
+public class SimuComModelMock extends SimuComModel {
+
+ private static Repository repo = null;
+ private static String repoId = null;
+
+ private static SimuComModelMock instance = null;
+
+ private static void createRepository(TemporaryFolder repoFolder) throws IOException {
+ repo = LocalDirectoryRepositoryHelper.initializeLocalDirectoryRepository(repoFolder.newFolder("testRepo"));
+ repoId = repo.getId();
+ RepositoryManager.addRepository(RepositoryManager.getCentralRepository(), repo);
+ }
+
+ private static void deleteRepository() {
+ RepositoryManager.removeRepository(RepositoryManager.getCentralRepository(), repo);
+ repo = null;
+ repoId = null;
+ }
+
+ private static Map createMockedConfiguration() {
+
+ final Map configuration = new HashMap();
+ configuration.put(SimuComConfig.SIMULATE_FAILURES, false);
+ configuration.put(SimuComConfig.SIMULATE_LINKING_RESOURCES, false);
+ configuration.put(SimuComConfig.VERBOSE_LOGGING, false);
+ configuration.put(SimuComConfig.VARIATION_ID, SimuComConfig.DEFAULT_VARIATION_NAME);
+ configuration.put(SimuComConfig.SIMULATOR_ID, "de.uka.ipd.sdq.codegen.simucontroller.simulizar");
+ configuration.put(SimuComConfig.EXPERIMENT_RUN, SimuComConfig.DEFAULT_EXPERIMENT_RUN);
+ configuration.put(SimuComConfig.SIMULATION_TIME, SimuComConfig.DEFAULT_SIMULATION_TIME);
+ configuration.put(SimuComConfig.MAXIMUM_MEASUREMENT_COUNT, SimuComConfig.DEFAULT_MAXIMUM_MEASUREMENT_COUNT);
+ configuration.put(SimuComConfig.PERSISTENCE_RECORDER_NAME, "Experiment Data Persistency & Presentation (EDP2)");
+ configuration.put(SimuComConfig.USE_FIXED_SEED, false);
+ configuration.put("EDP2RepositoryID", repoId);
+
+ return configuration;
+ }
+
+ private static SimuComStatus createSimuComStatus() {
+ return SimucomstatusFactory.eINSTANCE.createSimuComStatus();
+ }
+
+ public void triggerMockWindowMoveOn(final SimulizarSlidingWindow window) {
+ new MockWindowMoveOnTriggeredEvent(this.getSimEngineFactory(), window).triggerInternal();
+ }
+
+ public static SimuComModel obtainMockModel(TemporaryFolder repoFolder, IResourceTableManager resourceTableManager) throws IOException {
+ if (instance == null) {
+ createRepository(repoFolder);
+ instance = new SimuComModelMock(resourceTableManager);
+ }
+ return instance;
+ }
+
+ public static void releaseMockModel() {
+ if (instance != null) {
+ deleteRepository();
+ instance = null;
+ }
+ }
+
+ private SimuComModelMock(IResourceTableManager resourceTableManager) {
+ super(new SimuComConfig(createMockedConfiguration(), false), createSimuComStatus(), new SimEngineFactoryMock(),
+ false, new ProbeFrameworkContext(new ExtensibleCalculatorFactoryDelegatingFactory())
+ , resourceTableManager);
+ }
+
+ private static class MockWindowMoveOnTriggeredEvent extends PeriodicallyTriggeredSimulationEntity {
+ private final SimulizarSlidingWindow window;
+
+ private MockWindowMoveOnTriggeredEvent(final ISimEventFactory eventFactory, final SimulizarSlidingWindow window) {
+ super(eventFactory, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
+ this.window = window;
+ }
+
+ private Method obtainMoveOnMethod() {
+ Method moveOnMethod = null;
+ try {
+ moveOnMethod = SlidingWindow.class.getDeclaredMethod("moveOn", new Class[0]);
+ } catch (final NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (final SecurityException e) {
+ e.printStackTrace();
+ }
+ return moveOnMethod;
+ }
+
+ private void invokeMoveOn() {
+ // dirty hack;)
+ final Method moveOnMethod = obtainMoveOnMethod();
+ if (moveOnMethod != null) {
+ moveOnMethod.setAccessible(true);
+ try {
+ moveOnMethod.invoke(this.window, new Object[0]);
+ } catch (final IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (final IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ } else {
+ throw new NoSuchMethodError("Method not found: moveOn() of class " + this.window.getClass().getName());
+ }
+ }
+
+ @Override
+ protected void triggerInternal() {
+ invokeMoveOn();
+ }
+ }
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/.classpath b/tests/org.palladiosimulator.simulizar.tests/.classpath
new file mode 100644
index 000000000..9099bea15
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/.classpath
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.tests/.enable_dagger_annotation_processing b/tests/org.palladiosimulator.simulizar.tests/.enable_dagger_annotation_processing
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/org.palladiosimulator.simulizar.tests/.gitignore b/tests/org.palladiosimulator.simulizar.tests/.gitignore
new file mode 100644
index 000000000..e674f805b
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+*.html
\ No newline at end of file
diff --git a/tests/org.palladiosimulator.simulizar.tests/.project b/tests/org.palladiosimulator.simulizar.tests/.project
new file mode 100644
index 000000000..04cf5fc68
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/.project
@@ -0,0 +1,34 @@
+
+
+ org.palladiosimulator.simulizar.tests
+
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.xtext.ui.shared.xtextNature
+
+
diff --git a/tests/org.palladiosimulator.simulizar.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.palladiosimulator.simulizar.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..6558ab78f
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=17
diff --git a/tests/org.palladiosimulator.simulizar.tests/META-INF/MANIFEST.MF b/tests/org.palladiosimulator.simulizar.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..83aa02410
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SimuLizar Tests
+Bundle-SymbolicName: org.palladiosimulator.simulizar.tests;singleton:=true
+Bundle-Version: 5.2.0.qualifier
+Bundle-Vendor: palladiosimulator.org
+Bundle-RequiredExecutionEnvironment: JavaSE-17
+Fragment-Host: org.palladiosimulator.simulizar
+Require-Bundle: org.eclipse.xtext.xbase.lib,
+ org.eclipse.xtend.lib,
+ org.eclipse.xtend.lib.macro,
+ org.palladiosimulator.simulizar.reconfiguration.qvto;bundle-version="5.1.0",
+ org.palladiosimulator.edp2.repository.local;bundle-version="4.3.0",
+ org.palladiosimulator.pcm.resources;bundle-version="4.3.0",
+ de.uka.ipd.sdq.simulation.abstractsimengine.desmoj;bundle-version="4.3.0",
+ de.uka.ipd.sdq.errorhandling;bundle-version="4.3.0",
+ tools.mdsd.library.standalone.initialization;bundle-version="0.1.0",
+ de.desmoj;bundle-version="2.3.3",
+ tools.mdsd.junit5utils;bundle-version="0.1.0",
+ org.palladiosimulator.examples.package;bundle-version="4.3.0",
+ org.palladiosimulator.simulizar.test.commons;bundle-version="5.1.0",
+ org.palladiosimulator.simulizar.events,
+ org.palladiosimulator.simulizar.monitorrepository.feedthrough;bundle-version="5.1.0"
+Import-Package: com.google.common.util.concurrent.internal;version="1.0.1",
+ net.bytebuddy.dynamic.loading;version="1.6.0",
+ org.hamcrest;version="2.2.0",
+ org.hamcrest.collection;version="2.2.0",
+ org.hamcrest.core;version="2.2.0",
+ org.junit.jupiter.api;version="5.4.2",
+ org.junit.jupiter.api.extension;version="5.4.2",
+ org.junit.jupiter.api.function;version="5.4.2",
+ org.junit.jupiter.api.io;version="5.4.2",
+ org.junit.jupiter.params;version="5.4.2",
+ org.junit.jupiter.params.provider;version="5.4.2",
+ org.junit.platform.commons;version="1.4.0",
+ org.junit.platform.commons.support;version="1.4.0",
+ org.mockito,
+ org.mockito.invocation,
+ org.mockito.junit.jupiter,
+ org.mockito.stubbing,
+ org.objenesis;version="2.6.0"
diff --git a/tests/org.palladiosimulator.simulizar.tests/build.properties b/tests/org.palladiosimulator.simulizar.tests/build.properties
new file mode 100644
index 000000000..c867a950d
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/build.properties
@@ -0,0 +1,7 @@
+source.. = src/,\
+ xtend-gen/,\
+ src-gen/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ testmodels/
diff --git a/tests/org.palladiosimulator.simulizar.tests/org.palladiosimulator.simulizar.tests.launch b/tests/org.palladiosimulator.simulizar.tests/org.palladiosimulator.simulizar.tests.launch
new file mode 100644
index 000000000..a4cda0730
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/org.palladiosimulator.simulizar.tests.launch
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/GenericExtensionComponentTest.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/GenericExtensionComponentTest.java
new file mode 100644
index 000000000..89e7ba8f3
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/GenericExtensionComponentTest.java
@@ -0,0 +1,160 @@
+package org.palladiosimulator.simulizar.di.extension;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsEmptyCollection.empty;
+import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+import org.palladiosimulator.simulizar.modelobserver.IModelObserver;
+import org.palladiosimulator.simulizar.runtimestate.RuntimeStateEntityObserver;
+
+import com.google.common.collect.ImmutableSet;
+
+class GenericExtensionComponentTest {
+
+ @Test
+ void testComponentWithoutExtension() {
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ });
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), is(empty()));
+ }
+
+ @Test
+ void testSingleExtension() {
+ var observer = new IModelObserver() {
+ };
+
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver() {
+ return observer;
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(observer));
+ }
+
+ @Test
+ void testMultipleSingleExtension() {
+ var observer = new IModelObserver() {
+ };
+ var observer2 = new IModelObserver() {
+ };
+ var observer3 = new IModelObserver() {
+ };
+
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver1() {
+ return observer;
+ }
+
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver2() {
+ return observer2;
+ }
+
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver3() {
+ return observer3;
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(observer, observer2, observer3));
+ }
+
+ @Test
+ void testSetExtension() {
+ var observer = new IModelObserver() {
+ };
+ var observer2 = new IModelObserver() {
+ };
+ var observer3 = new IModelObserver() {
+ };
+
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public Set provideObservers() {
+ return ImmutableSet.of(observer, observer2, observer3);
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(observer, observer2, observer3));
+ }
+
+
+ @Test
+ void testCombineSingleAndSetExtension() {
+ var observer = new IModelObserver() {
+ };
+ var observer2 = new IModelObserver() {
+ };
+ var observer3 = new IModelObserver() {
+ };
+ var observer4 = new IModelObserver() {
+ };
+ var observer5 = new IModelObserver() {
+ };
+
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public Set provideObservers() {
+ return ImmutableSet.of(observer, observer2);
+ }
+
+ @SuppressWarnings("unused")
+ public Set provideObservers2() {
+ return ImmutableSet.of(observer3);
+ }
+
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver4() {
+ return observer4;
+ }
+
+ @SuppressWarnings("unused")
+ public IModelObserver provideObserver5() {
+ return observer5;
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(observer, observer2, observer3, observer4, observer5));
+ }
+
+ static class MergedExtensionType implements IModelObserver, RuntimeStateEntityObserver {
+ @Override
+ public void initialize() {
+ }
+ }
+
+ @Test
+ void testExtentionWithTwoTypesAdheresToStaticTypeSignature() {
+ var mergedExtension = new MergedExtensionType();
+
+ var underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public MergedExtensionType provide() {
+ return mergedExtension;
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(mergedExtension));
+ assertThat(underTest.getExtensions(RuntimeStateEntityObserver.class).get(), containsInAnyOrder(mergedExtension));
+
+ underTest = new GenericExtensionComponent(new ExtensionComponent() {
+ @SuppressWarnings("unused")
+ public IModelObserver provide() {
+ return mergedExtension;
+ }
+ });
+
+ assertThat(underTest.getExtensions(IModelObserver.class).get(), containsInAnyOrder(mergedExtension));
+ assertThat(underTest.getExtensions(RuntimeStateEntityObserver.class).get(), is(empty()));
+
+
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestExtensionComponentDepencencyResolution.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestExtensionComponentDepencencyResolution.java
new file mode 100644
index 000000000..804c459f1
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestExtensionComponentDepencencyResolution.java
@@ -0,0 +1,88 @@
+package org.palladiosimulator.simulizar.di.extension;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsEmptyCollection.empty;
+import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+import static org.hamcrest.collection.IsIterableWithSize.iterableWithSize;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentA;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentB;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentC;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentA;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentB;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentC;
+import org.palladiosimulator.simulizar.di.extension.sample.ModuleA;
+
+import com.google.common.collect.ImmutableSet;
+
+import dagger.Component;
+
+class TestExtensionComponentDepencencyResolution {
+
+ @Test
+ void testNoExtensionNoErrors() {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(), ImmutableSet.of());
+ assertThat(underTest.getExtensionComponents(), is(empty()));
+ }
+
+ @Test
+ void testSingleComponentNoDependencies() throws Exception {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(),
+ ImmutableSet.of(DaggerComponentA.factory()));
+ var result = underTest.getExtensionComponents();
+ assertThat(result, containsInAnyOrder(instanceOf(ComponentA.class)));
+ }
+
+ @Test
+ void testSimpleComponentDependencies() throws Exception {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(),
+ ImmutableSet.of(DaggerComponentA.factory(), DaggerComponentB.factory()));
+ var result = underTest.getExtensionComponents();
+ assertThat(result, containsInAnyOrder(instanceOf(ComponentA.class), instanceOf(ComponentB.class)));
+ }
+
+ @Test
+ void testBootstrappedComponentDependencies() throws Exception {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(DaggerComponentA.create()),
+ ImmutableSet.of(DaggerComponentB.factory(), DaggerComponentC.factory()));
+ var result = underTest.getExtensionComponents();
+ assertThat(result, containsInAnyOrder(instanceOf(ComponentB.class), instanceOf(ComponentC.class)));
+ }
+
+ @Test
+ void testMissingDependenciesDoNotCauseErrors() throws Exception {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(),
+ ImmutableSet.of(DaggerComponentB.factory(), DaggerComponentC.factory()));
+ var result = underTest.getExtensionComponents();
+ assertThat(result, is(iterableWithSize(0)));
+
+ underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(),
+ ImmutableSet.of(DaggerComponentA.factory(), DaggerComponentC.factory()));
+ result = underTest.getExtensionComponents();
+ assertThat(result, containsInAnyOrder(instanceOf(ComponentA.class)));
+ }
+
+ // We need to introduce the dependency in a subclass, as otherwise dagger will detect the cycle during compile-time
+ @Component(dependencies = ComponentB.class, modules = ModuleA.class)
+ public static interface AWithDependencyToB extends ComponentA {
+ @Component.Factory
+ public static interface Factory extends ExtensionComponent.Factory {
+ AWithDependencyToB create(ComponentB b);
+ }
+ }
+
+ @Test
+ void testCyclesAreDetected() throws Exception {
+ var underTest = new ExtensionComponentDependencyResolution(ImmutableSet.of(),
+ ImmutableSet.of(DaggerComponentB.factory(), DaggerTestExtensionComponentDepencencyResolution_AWithDependencyToB.factory()));
+
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ underTest.getExtensionComponents();
+ });
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestGenericComponentFactory.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestGenericComponentFactory.java
new file mode 100644
index 000000000..88b0731e6
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/TestGenericComponentFactory.java
@@ -0,0 +1,73 @@
+package org.palladiosimulator.simulizar.di.extension;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.isA;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
+
+import org.junit.jupiter.api.Test;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentA;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentB;
+import org.palladiosimulator.simulizar.di.extension.sample.ComponentC;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentA;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentA2;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentB;
+import org.palladiosimulator.simulizar.di.extension.sample.DaggerComponentC;
+
+import com.google.common.collect.ImmutableList;
+
+class TestGenericComponentFactory {
+
+ @Test
+ void testNoDependencies() {
+ var factory = DaggerComponentA.factory();
+ var underTest = new GenericComponentFactory(factory);
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of());
+ }
+
+ @Test
+ void testDependenciesToOneComponent() {
+ var factory = DaggerComponentB.factory();
+ var underTest = new GenericComponentFactory(factory);
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of(ComponentA.class));
+ var componentA = DaggerComponentA.factory().create();
+ underTest.fulfillRequirement(() -> componentA);
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of());
+ var created = underTest.get();
+ assertThat(created, isA(ComponentB.class));
+ }
+
+ @Test
+ void testMultipleDependencies() {
+ var factory = DaggerComponentC.factory();
+ var underTest = new GenericComponentFactory(factory);
+ assertThat(underTest.getUnfullfilledRequirements(), containsInAnyOrder(ComponentA.class, ComponentB.class));
+ var componentA = DaggerComponentA.factory().create();
+ underTest.fulfillRequirement(() -> componentA);
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of(ComponentB.class));
+ underTest.fulfillRequirement(() -> DaggerComponentB.factory().create(componentA));
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of());
+ var created = underTest.get();
+ assertThat(created, isA(ComponentC.class));
+ assertThat(created.name(), is("A"));
+ }
+
+ @Test
+ void testDependencyToSuperComponent() {
+ var factory = DaggerComponentC.factory();
+ var underTest = new GenericComponentFactory(factory);
+ assertThat(underTest.getUnfullfilledRequirements(), containsInAnyOrder(ComponentA.class, ComponentB.class));
+ var componentA = DaggerComponentA2.factory().create();
+ underTest.fulfillRequirement(() -> componentA);
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of(ComponentB.class));
+ underTest.fulfillRequirement(() -> DaggerComponentB.factory().create(componentA));
+ assertIterableEquals(underTest.getUnfullfilledRequirements(), ImmutableList.of());
+ var created = underTest.get();
+ assertThat(created, isA(ComponentC.class));
+ assertThat(created.name(), is("A2"));
+ }
+
+
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA.java
new file mode 100644
index 000000000..689edd5be
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA.java
@@ -0,0 +1,19 @@
+package org.palladiosimulator.simulizar.di.extension.sample;
+
+import javax.inject.Named;
+
+import org.palladiosimulator.simulizar.di.extension.ExtensionComponent;
+
+import dagger.Component;
+
+@Component(modules = ModuleA.class)
+public interface ComponentA extends ExtensionComponent {
+
+ @Named("name") String name();
+
+ @Component.Factory
+ public static interface Factory extends ExtensionComponent.Factory {
+ ComponentA create();
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA2.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA2.java
new file mode 100644
index 000000000..cd5e4346a
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentA2.java
@@ -0,0 +1,27 @@
+package org.palladiosimulator.simulizar.di.extension.sample;
+
+import javax.inject.Named;
+
+import org.palladiosimulator.simulizar.di.extension.ExtensionComponent;
+
+import dagger.Component;
+import dagger.Provides;
+
+@Component(modules = ComponentA2.Module.class)
+public interface ComponentA2 extends ComponentA {
+
+ @Component.Factory
+ public static interface Factory extends ExtensionComponent.Factory {
+ ComponentA2 create();
+ }
+
+ @dagger.Module
+ public static interface Module {
+ @Named("name")
+ @Provides
+ static String provideName() {
+ return "A2";
+ }
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentB.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentB.java
new file mode 100644
index 000000000..9afa19ef3
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentB.java
@@ -0,0 +1,15 @@
+package org.palladiosimulator.simulizar.di.extension.sample;
+
+import org.palladiosimulator.simulizar.di.extension.ExtensionComponent;
+
+import dagger.Component;
+
+@Component(dependencies = ComponentA.class)
+public interface ComponentB extends ExtensionComponent{
+
+ @Component.Factory
+ public static interface Factory extends ExtensionComponent.Factory {
+ ComponentB create(ComponentA compA);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentC.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentC.java
new file mode 100644
index 000000000..da677b715
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ComponentC.java
@@ -0,0 +1,19 @@
+package org.palladiosimulator.simulizar.di.extension.sample;
+
+import javax.inject.Named;
+
+import org.palladiosimulator.simulizar.di.extension.ExtensionComponent;
+
+import dagger.Component;
+
+@Component(dependencies = { ComponentA.class, ComponentB.class} )
+public interface ComponentC extends ExtensionComponent {
+
+ @Named("name") String name();
+
+ @Component.Factory
+ public static interface Factory extends ExtensionComponent.Factory {
+ ComponentC create(ComponentA a, ComponentB b);
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ModuleA.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ModuleA.java
new file mode 100644
index 000000000..c8e40b9b7
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/di/extension/sample/ModuleA.java
@@ -0,0 +1,17 @@
+package org.palladiosimulator.simulizar.di.extension.sample;
+
+import javax.inject.Named;
+
+import dagger.Module;
+import dagger.Provides;
+
+@Module
+public interface ModuleA {
+
+ @Named("name")
+ @Provides
+ static String provideName() {
+ return "A";
+ }
+
+}
diff --git a/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/interpreter/linking/impl/DemandCalculatorTestBase.java b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/interpreter/linking/impl/DemandCalculatorTestBase.java
new file mode 100644
index 000000000..a1039948b
--- /dev/null
+++ b/tests/org.palladiosimulator.simulizar.tests/src/org/palladiosimulator/simulizar/interpreter/linking/impl/DemandCalculatorTestBase.java
@@ -0,0 +1,98 @@
+package org.palladiosimulator.simulizar.interpreter.linking.impl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.function.Supplier;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+import org.palladiosimulator.simulizar.interpreter.linking.ITransmissionPayloadDemandCalculator;
+
+import de.uka.ipd.sdq.probfunction.math.IRandomGenerator;
+import de.uka.ipd.sdq.probfunction.math.impl.ProbabilityFunctionFactoryImpl;
+import de.uka.ipd.sdq.simucomframework.variables.EvaluationProxy;
+import de.uka.ipd.sdq.simucomframework.variables.cache.StoExCache;
+import de.uka.ipd.sdq.simucomframework.variables.stackframe.SimulatedStackframe;
+import tools.mdsd.junit5utils.extensions.PlatformStandaloneExtension;
+
+@ExtendWith(PlatformStandaloneExtension.class)
+abstract class DemandCalculatorTestBase {
+ protected enum TestCases {
+ EMPTY(() -> new SimulatedStackframe<>()),
+
+ STACKFRAME_WITH_SINGLE_ELEMENT_WITH_BYTESIZE_100(() -> {
+ var res = new SimulatedStackframe<>();
+ res.addValue("some.variable.with.BYTESIZE", 100);
+ return res;
+ }),
+
+ STACKFRAME_WITH_THREE_ELEMENTS_WITH_BYTESIZE_100_200_NONE(() -> {
+ var res = new SimulatedStackframe<>();
+ res.addValue("some.variable.with.BYTESIZE", 100);
+ res.addValue("some.variable.with.another.BYTESIZE", new EvaluationProxy("200", res));
+ res.addValue("some.value.without.bytesize.characterization", 300);
+ return res;
+ }),
+
+ STACKFRAME_WITH_THREE_ELEMENTS_WITH_INNER_BYTESIZES(() -> {
+ var res = new SimulatedStackframe<>();
+ res.addValue("some.variable.with.BYTESIZE", 100);
+ res.addValue("some.variable.with.another.INNER.BYTESIZE", 100);
+ res.addValue("some.value.without.bytesize.characterization", 100);
+ res.addValue("some.value.without.bytesize.characterization.BYTESIZE", 100);
+ return res;
+ }),
+
+ STACKFRAME_WITH_THREE_ELEMENTS_WITH_INNER_BYTESIZES_WITH_STREAM(() -> {
+ var res = new SimulatedStackframe<>();
+ res.addValue("some.variable.with.BYTESIZE", 100);
+ res.addValue("some.variable.with.another.INNER.BYTESIZE", 100);
+ res.addValue("some.value.without.bytesize.characterization", 100);
+ res.addValue("some.value.without.bytesize.characterization.BYTESIZE", 100);
+ res.addValue("stream.BYTESIZE", 100);
+ return res;
+ });
+
+
+ private SimulatedStackframe