getInboundMessagesByTimeIntervalAndBodyType(
return new GetterResult<>(this.getQueryResult(messageContentQuery), present);
}
+ /**
+ * Retrieves all incoming messages which match any of the provided body element QNames and that were received before the given
+ * timestamp and with the same sequenceId.
+ *
+ *
+ * Messages are sorted by MdibVersion on the inner join result.
+ *
+ * @param sequenceId SequenceId attribute value to filter for
+ * @param finishTimestamp timestamp to filter out reports with a higher value
+ * @param reportTypes to match message against
+ * @return container with stream of all matching inbound {@linkplain MessageContent}s
+ * @throws IOException if storage is closed
+ */
+ public GetterResult getInboundMessagesByTimestampAndBodyType(
+ final String sequenceId, final long finishTimestamp, final QName... reportTypes) throws IOException {
+ if (this.closed.get()) {
+ LOG.error(GET_INBOUND_MESSAGE_BY_TIMESTAMP_CALLED_ON_CLOSED_STORAGE);
+ throw new IOException(GET_INBOUND_MESSAGE_BY_TIMESTAMP_CALLED_ON_CLOSED_STORAGE);
+ }
+
+ for (final QName qname : reportTypes) {
+ if (!this.checkElementSupportsMdibVersionSorting(qname)) {
+ final String localErrorMessage = String.format(FILTERING_FOR_GIVEN_ELEMENT_NAME_NOT_IMPLEMENTED, qname);
+ this.testRunObserver.invalidateTestRun(localErrorMessage);
+ throw new UnsupportedOperationException(localErrorMessage);
+ }
+ }
+
+ final CriteriaQuery messageContentQuery;
+ try (final Session session = sessionFactory.openSession()) {
+ session.beginTransaction();
+
+ final CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();
+ messageContentQuery = criteriaBuilder.createQuery(MessageContent.class);
+ final Root messageContentRoot = messageContentQuery.from(MessageContent.class);
+ messageContentQuery.select(messageContentRoot);
+
+ final Subquery mdibVersionGroupSubQuery =
+ messageContentQuery.subquery(MdibVersionGroupEntity.class);
+ final Root mdibVersionGroupEntityRoot =
+ mdibVersionGroupSubQuery.from(MdibVersionGroupEntity.class);
+ mdibVersionGroupSubQuery.select(mdibVersionGroupEntityRoot);
+ final List bodyElementPredicates = new ArrayList<>();
+
+ for (final QName bodyElement : reportTypes) {
+ bodyElementPredicates.add(criteriaBuilder.and(
+ criteriaBuilder.equal(
+ mdibVersionGroupEntityRoot.get(MdibVersionGroupEntity_.bodyElement),
+ bodyElement.toString()),
+ criteriaBuilder.equal(
+ mdibVersionGroupEntityRoot.get(MdibVersionGroupEntity_.sequenceId), sequenceId)));
+ }
+
+ mdibVersionGroupSubQuery.where(criteriaBuilder.and(
+ criteriaBuilder.equal(
+ mdibVersionGroupEntityRoot.get(MdibVersionGroupEntity_.messageContent),
+ messageContentRoot.get(MessageContent_.incId)),
+ criteriaBuilder.or(bodyElementPredicates.toArray(new Predicate[0]))));
+
+ messageContentQuery.where(criteriaBuilder.and(
+ criteriaBuilder.lt(messageContentRoot.get(MessageContent_.nanoTimestamp), finishTimestamp),
+ criteriaBuilder.and(
+ criteriaBuilder.equal(
+ messageContentRoot.get(MessageContent_.direction),
+ CommunicationLog.Direction.INBOUND),
+ criteriaBuilder.exists(mdibVersionGroupSubQuery))));
+
+ messageContentQuery.orderBy(criteriaBuilder.asc(messageContentRoot
+ .join(MessageContent_.mdibVersionGroups)
+ .get(MdibVersionGroupEntity_.mdibVersion)));
+ }
+
+ final boolean present;
+ try (final Stream countingStream = this.getQueryResult(messageContentQuery)) {
+ present = countingStream.findAny().isPresent();
+ }
+
+ return new GetterResult<>(this.getQueryResult(messageContentQuery), present);
+ }
+
/**
* Retrieves all manipulation data which match any of the provided manipulation names.
*
@@ -1697,7 +1779,7 @@ public GetterResult getManipulationDataByManipulation(final St
*
* Manipulations are sorted by their timestamp.
*
- * @param parameter of the manipulation
+ * @param parameter of the manipulation
* @param manipulationName to match manipulation data against
* @return container with stream of all matching {@linkplain ManipulationData}s
* @throws IOException if storage is closed
@@ -1820,6 +1902,7 @@ private void transmit(final List results) {
/**
* Get the number of messages detected by the MessageStorage where the encoding could not be determined.
+ *
* @return the count
*/
public long getMessageEncodingErrorCount() {
@@ -1828,6 +1911,7 @@ public long getMessageEncodingErrorCount() {
/**
* Get the number of messages detected by the MessageStorage where the MIME type has an unexpected value.
+ *
* @return the count
*/
public long getInvalidMimeTypeErrorCount() {
diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTest.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTest.java
index 5b26b299..35b60852 100644
--- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTest.java
+++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTest.java
@@ -7,10 +7,12 @@
package com.draeger.medical.sdccc.tests.biceps.invariant;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import com.draeger.medical.sdccc.configuration.EnabledTestConfig;
+import com.draeger.medical.sdccc.configuration.TestSuiteConfig;
import com.draeger.medical.sdccc.manipulation.precondition.impl.ManipulationPreconditions;
import com.draeger.medical.sdccc.messages.MessageStorage;
import com.draeger.medical.sdccc.messages.mapping.ManipulationData;
@@ -23,25 +25,25 @@
import com.draeger.medical.sdccc.tests.util.ImpliedValueUtil;
import com.draeger.medical.sdccc.tests.util.ManipulationParameterUtil;
import com.draeger.medical.sdccc.tests.util.NoTestData;
+import com.draeger.medical.sdccc.tests.util.guice.MdibHistorianFactory;
import com.draeger.medical.sdccc.util.Constants;
+import com.draeger.medical.sdccc.util.TestRunObserver;
import com.draeger.medical.t2iapi.ResponseTypes;
-import java.io.ByteArrayInputStream;
+import com.google.inject.Key;
+import com.google.inject.name.Names;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
-import org.somda.sdc.biceps.model.message.AbstractMetricReport;
-import org.somda.sdc.biceps.model.message.AbstractReport;
-import org.somda.sdc.biceps.model.message.WaveformStream;
+import org.somda.sdc.biceps.common.storage.PreprocessingException;
+import org.somda.sdc.biceps.consumer.access.RemoteMdibAccess;
+import org.somda.sdc.biceps.model.participant.AbstractMetricState;
import org.somda.sdc.biceps.model.participant.ComponentActivation;
import org.somda.sdc.biceps.model.participant.MetricCategory;
-import org.somda.sdc.dpws.soap.MarshallingService;
-import org.somda.sdc.dpws.soap.SoapUtil;
-import org.somda.sdc.dpws.soap.exception.MarshallingException;
+import org.somda.sdc.glue.consumer.report.ReportProcessingException;
/**
* BICEPS participant model state part tests (ch. 5.4).
@@ -51,26 +53,22 @@ public class InvariantParticipantModelStatePartTest extends InjectorTestBase {
"No setMetricStatus manipulation for metrics with category %s performed, test failed.";
public static final String NO_SUCCESSFUL_MANIPULATION =
"No successful setMetricStatus manipulation seen, test failed.";
- public static final String NO_REPORT_IN_TIME_INTERVAL =
- "No metric reports or waveform streams for %s manipulation found between %s and %s, test failed.";
- public static final String NO_REPORT_WITH_EXPECTED_HANDLE =
- "No metric reports or waveform streams with metric handle %s found, test failed.";
- public static final String NO_REPORT_WITH_EXPECTED_ACTIVATION_STATE =
- "No metric reports or waveform streams containing the metric handle %s with the expected activation state"
- + " %s found, test failed.";
+ public static final String NO_REPORT_IN_TIME = "No reports until timestamp %s found, test failed.";
+ public static final String NO_METRIC_WITH_EXPECTED_HANDLE = "No metric with handle %s found, test failed.";
public static final String WRONG_ACTIVATION_STATE =
"The manipulated activation state for metric %s should be %s but is %s";
- private static final long BUFFER = TimeUnit.NANOSECONDS.convert(5, TimeUnit.SECONDS);
+ private long buffer;
private MessageStorage messageStorage;
- private MarshallingService marshalling;
- private SoapUtil soapUtil;
+ private MdibHistorianFactory mdibHistorianFactory;
@BeforeEach
void setUp() {
this.messageStorage = getInjector().getInstance(MessageStorage.class);
final var riInjector = getInjector().getInstance(TestClient.class).getInjector();
- this.marshalling = riInjector.getInstance(MarshallingService.class);
- this.soapUtil = riInjector.getInstance(SoapUtil.class);
+ final var timeBufferInSeconds = getInjector()
+ .getInstance(Key.get(long.class, Names.named(TestSuiteConfig.TEST_BICEPS_547_TIME_INTERVAL)));
+ buffer = TimeUnit.NANOSECONDS.convert(timeBufferInSeconds, TimeUnit.SECONDS);
+ this.mdibHistorianFactory = riInjector.getInstance(MdibHistorianFactory.class);
}
@Test
@@ -360,7 +358,7 @@ void testRequirement54717() throws NoTestData {
private void testRequirement547(final MetricCategory category, final ComponentActivation activation)
throws NoTestData {
- final var successfulReportsSeen = new AtomicBoolean(false);
+ final var successfulManipulationSeen = new AtomicBoolean(false);
try (final var manipulations = messageStorage.getManipulationDataByParametersAndManipulation(
ManipulationParameterUtil.buildMetricStatusManipulationParameterDataWithoutHandle(category, activation),
Constants.MANIPULATION_NAME_SET_METRIC_STATUS)) {
@@ -370,18 +368,18 @@ private void testRequirement547(final MetricCategory category, final ComponentAc
.getStream()
.filter(it -> it.getResult().equals(ResponseTypes.Result.RESULT_SUCCESS))
.forEachOrdered(it -> {
- successfulReportsSeen.getAndSet(true);
- checkAssociatedReport(it, activation);
+ successfulManipulationSeen.getAndSet(true);
+ checkAssociatedMetric(it, activation);
});
} catch (IOException e) {
fail(e);
// unreachable
throw new RuntimeException(e);
}
- assertTestData(successfulReportsSeen.get(), NO_SUCCESSFUL_MANIPULATION);
+ assertTestData(successfulManipulationSeen.get(), NO_SUCCESSFUL_MANIPULATION);
}
- private void checkAssociatedReport(
+ private void checkAssociatedMetric(
final ManipulationData manipulationData, final ComponentActivation expectedActivationState) {
final var manipulationParameter = manipulationData.getParameters();
final var manipulatedHandle = manipulationParameter.stream()
@@ -389,112 +387,47 @@ private void checkAssociatedReport(
.map(ManipulationParameter::getParameterValue)
.findFirst()
.orElseThrow();
- try (final var relevantReports = messageStorage.getInboundMessagesByTimeIntervalAndBodyType(
- manipulationData.getStartTimestamp(),
- manipulationData.getFinishTimestamp() + BUFFER,
- Constants.MSG_EPISODIC_METRIC_REPORT,
- Constants.MSG_WAVEFORM_STREAM)) {
- assertTestData(
- relevantReports.areObjectsPresent(),
- String.format(
- NO_REPORT_IN_TIME_INTERVAL,
- manipulationData.getMethodName(),
- manipulationData.getStartTimestamp(),
- manipulationData.getFinishTimestamp()));
+ final var sequenceId = manipulationParameter.stream()
+ .filter(it -> it.getParameterName().equals(Constants.MANIPULATION_PARAMETER_SEQUENCE_ID))
+ .map(ManipulationParameter::getParameterValue)
+ .findFirst()
+ .orElseThrow();
- final var relevantReport = relevantReports
- .getStream()
- .map(it -> {
- try {
- final var message = marshalling.unmarshal(
- new ByteArrayInputStream(it.getBody().getBytes(StandardCharsets.UTF_8)));
- final var metricReportOpt = soapUtil.getBody(message, AbstractMetricReport.class);
- if (metricReportOpt.isEmpty()) {
- final var waveformOpt = soapUtil.getBody(message, WaveformStream.class);
- return waveformOpt.orElseThrow();
- } else {
- return metricReportOpt.orElseThrow();
- }
- } catch (MarshallingException e) {
- fail("Error unmarshalling MessageContent " + e);
- // unreachable
- throw new RuntimeException(e);
- }
- })
- .filter(it -> isReportRelevant(it, manipulatedHandle))
- .findFirst();
+ final var historian = mdibHistorianFactory.createMdibHistorian(
+ messageStorage, getInjector().getInstance(TestRunObserver.class));
- assertTrue(relevantReport.isPresent(), String.format(NO_REPORT_WITH_EXPECTED_HANDLE, manipulatedHandle));
+ final var endTimestamp = manipulationData.getFinishTimestamp() + buffer;
+ try (final var history = historian.uniqueEpisodicReportBasedHistoryUntilTimestamp(sequenceId, endTimestamp)) {
+ try (final var historyNext =
+ historian.uniqueEpisodicReportBasedHistoryUntilTimestamp(sequenceId, endTimestamp)) {
- final var reportWithExpectedActivationStateSeen = isActivationStateAsExpected(
- relevantReport.orElseThrow(), manipulatedHandle, expectedActivationState);
+ RemoteMdibAccess first = history.next();
+ RemoteMdibAccess second = historyNext.next();
+ // skip the first entry so that history and historyNext are off by one entry
+ final var skippedElement = historyNext.next();
+ assertNotNull(skippedElement, String.format(NO_REPORT_IN_TIME, endTimestamp));
- assertTrue(
- reportWithExpectedActivationStateSeen,
- String.format(
- NO_REPORT_WITH_EXPECTED_ACTIVATION_STATE, manipulatedHandle, expectedActivationState));
- } catch (IOException | NoTestData e) {
- fail(e);
- // unreachable
- throw new RuntimeException(e);
- }
- }
-
- private boolean isReportRelevant(final AbstractReport report, final String manipulatedHandle) {
- boolean present = false;
- if (report instanceof AbstractMetricReport) {
- for (var part : ((AbstractMetricReport) report).getReportPart()) {
- if (part.getMetricState().stream()
- .anyMatch(state -> state.getDescriptorHandle().equals(manipulatedHandle))) {
- present = true;
+ // fast-forward to last mdib state before the end timestamp
+ while (second != null) {
+ first = history.next();
+ second = historyNext.next();
}
- }
- } else if (report instanceof WaveformStream) {
- present = ((WaveformStream) report)
- .getState().stream().anyMatch(it -> it.getDescriptorHandle().equals(manipulatedHandle));
- }
- return present;
- }
-
- private boolean isActivationStateAsExpected(
- final AbstractReport report,
- final String manipulatedHandle,
- final ComponentActivation expectedActivationState) {
-
- final var relevantMetricPresent = new AtomicBoolean(false);
- if (report instanceof final AbstractMetricReport metricReport) {
- for (var part : metricReport.getReportPart()) {
- final var state = part.getMetricState().stream()
- .filter(it -> it.getDescriptorHandle().equals(manipulatedHandle))
- .findFirst();
- state.ifPresent(abstractMetricState -> {
- relevantMetricPresent.set(true);
- Assertions.assertEquals(
- expectedActivationState,
- ImpliedValueUtil.getMetricActivation(abstractMetricState),
- String.format(
- WRONG_ACTIVATION_STATE,
- manipulatedHandle,
- expectedActivationState,
- ImpliedValueUtil.getMetricActivation(abstractMetricState)));
- });
- }
- } else if (report instanceof final WaveformStream waveform) {
- final var state = waveform.getState().stream()
- .filter(it -> it.getDescriptorHandle().equals(manipulatedHandle))
- .findFirst();
- state.ifPresent(abstractMetricState -> {
- relevantMetricPresent.set(true);
+ final var relevantMetricStateOpt = first.getState(manipulatedHandle, AbstractMetricState.class);
+ assertTrue(
+ relevantMetricStateOpt.isPresent(),
+ String.format(NO_METRIC_WITH_EXPECTED_HANDLE, manipulatedHandle));
+ final var relevantMetricState = relevantMetricStateOpt.orElseThrow();
Assertions.assertEquals(
expectedActivationState,
- ImpliedValueUtil.getMetricActivation(abstractMetricState),
+ ImpliedValueUtil.getMetricActivation(relevantMetricState),
String.format(
WRONG_ACTIVATION_STATE,
manipulatedHandle,
expectedActivationState,
- ImpliedValueUtil.getMetricActivation(abstractMetricState)));
- });
+ ImpliedValueUtil.getMetricActivation(relevantMetricState)));
+ }
+ } catch (ReportProcessingException | PreprocessingException e) {
+ fail(e);
}
- return relevantMetricPresent.get();
}
}
diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/ManipulationParameterUtil.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/ManipulationParameterUtil.java
index 6cc52823..1f653ba4 100644
--- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/ManipulationParameterUtil.java
+++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/ManipulationParameterUtil.java
@@ -159,14 +159,19 @@ public static ManipulationParameterData buildMetricQualityValidityManipulationPa
/**
* Build manipulation parameter data containing the handle, category and activation of the metric to set the status for.
*
+ * @param sequenceId in which the manipulation is performed
* @param handle of the metric
* @param category of the metric
* @param activation of the metric
* @return the manipulation parameter data
*/
public static ManipulationParameterData buildMetricStatusManipulationParameterData(
- final String handle, final MetricCategory category, final ComponentActivation activation) {
+ final String sequenceId,
+ final String handle,
+ final MetricCategory category,
+ final ComponentActivation activation) {
return new ManipulationParameterData(List.of(
+ new ImmutablePair<>(Constants.MANIPULATION_PARAMETER_SEQUENCE_ID, sequenceId),
new ImmutablePair<>(Constants.MANIPULATION_PARAMETER_HANDLE, handle),
new ImmutablePair<>(Constants.MANIPULATION_PARAMETER_METRIC_CATEGORY, category.value()),
new ImmutablePair<>(Constants.MANIPULATION_PARAMETER_COMPONENT_ACTIVATION, activation.value())));
diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java
index 332563b8..f098a17d 100644
--- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java
+++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java
@@ -275,6 +275,75 @@ private HistorianResult getHistorianResultForEpisodicReportBasedHistory(
}
}
+ /**
+ * Generates an mdib history for a sequence id using the first available GetMdibResponse for said sequence id and
+ * all related episodic reports until the specified timestamp, exclusive.
+ *
+ * @param sequenceId of the sequence to generate history for
+ * @param timestamp to retrieve reports for, exclusive
+ * @return a new result based on episodic reports
+ * @throws PreprocessingException if converting the initial mdib fails
+ * @throws ReportProcessingException if applying reports fails
+ */
+ public HistorianResult uniqueEpisodicReportBasedHistoryUntilTimestamp(final String sequenceId, final long timestamp)
+ throws PreprocessingException, ReportProcessingException {
+ final var storage = createNewStorage(sequenceId);
+ final var reportProcessor = reportProcessorProvider.get();
+ reportProcessor.startApplyingReportsOnMdib(storage, null);
+ final var mdibVersionPredicate =
+ new InitialMdibVersionPredicateWithUUID(ImpliedValueUtil.getMdibVersion(storage.getMdibVersion()));
+
+ try {
+ final var messages = messageStorage.getInboundMessagesByTimestampAndBodyType(
+ sequenceId, timestamp, Constants.RELEVANT_REPORT_BODIES.toArray(new QName[0]));
+ var preStream = messages.getStream()
+ .sequential() // the stateful filter operation below is not threadsafe
+ .map(this::unmarshallReportKeepUUID)
+ .filter(report -> sequenceId.equals(report.getLeft().getSequenceId()))
+ .filter(mdibVersionPredicate);
+
+ preStream = filterReportDuplicates(preStream);
+
+ final var stream = preStream.map(pair -> {
+ final var report = pair.getLeft();
+ try {
+ final var cmp = ImpliedValueUtil.getMdibVersion(storage.getMdibVersion())
+ .compareTo(ImpliedValueUtil.getReportMdibVersion(report));
+ if (cmp > 0) {
+ fail("Cannot apply report older than current storage."
+ + " Storage " + ImpliedValueUtil.getMdibVersion(storage.getMdibVersion())
+ + " Report " + ImpliedValueUtil.getReportMdibVersion(report)
+ + " " + report.getClass().getSimpleName());
+ } else if (cmp == 0) {
+ LOG.debug("Cannot apply report of equal mdib version. This means that another report with the"
+ + " same version has already been applied, and is expected behavior when e.g."
+ + " descriptors update, as both a report for description and state will arrive.");
+ }
+ LOG.debug(
+ "Applying report with mdib version {}, type {}",
+ ImpliedValueUtil.getReportMdibVersion(report),
+ report.getClass().getSimpleName());
+ reportProcessor.processReport(report);
+ } catch (final Exception e) {
+ fail(e);
+ }
+ return storage;
+ });
+
+ // initial mdib stream
+ final var initialMdibStream = Stream.of(storage);
+ return new HistorianResult(messages, Stream.concat(initialMdibStream, stream));
+ } catch (IOException e) {
+ final var errorMessage = "Error while trying to retrieve reports from storage";
+ LOG.error("{}: {}", errorMessage, e.getMessage());
+ LOG.debug("{}", errorMessage, e);
+ testRunObserver.invalidateTestRun(errorMessage, e);
+ fail(e);
+ // unreachable code, silence warnings
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Retrieves all episodic reports for a given sequence id.
*
@@ -389,7 +458,7 @@ private Stream> filterReportDuplicates(
*
* @param sequenceId of the sequence to retrieve reports for
* @param maximumMdibVersion maximum mdib version to retrieve for the reports
- * @param bodyTypes to match messages against
+ * @param bodyTypes to match messages against
* @return list of the reports
*/
public Stream getAllReportsWithLowerMdibVersion(
@@ -410,6 +479,35 @@ public Stream getAllReportsWithLowerMdibVersion(
}
}
+ // TODO javadoc and maybe instead of getting all reports with lowertimestamp get the storage directly. So dont apply
+ // every report manually but provide a result
+ public Stream getAllReportsWithLowerTimestamp(
+ final String sequenceId,
+ @Nullable final BigInteger minimumMdibVersion,
+ final long maximumTimestamp,
+ final QName... bodyTypes) {
+ try {
+ final var messages =
+ messageStorage.getInboundMessagesByTimestampAndBodyType(sequenceId, maximumTimestamp, bodyTypes);
+
+ var iter = messages.getStream()
+ .sequential() // the stateful filter operation below is not thread-safe
+ .map(this::unmarshallReportKeepUUID);
+ if (minimumMdibVersion != null) {
+ iter = iter.filter(it ->
+ ImpliedValueUtil.getReportMdibVersion(it.getLeft()).compareTo(minimumMdibVersion) >= 1);
+ }
+ return filterReportDuplicates(iter).map(Pair::getLeft);
+ } catch (IOException e) {
+ final var errorMessage = "Error while trying to retrieve reports from storage";
+ LOG.error("{}: {}", errorMessage, e.getMessage());
+ LOG.debug("{}", errorMessage, e);
+ fail(e);
+ // unreachable, silence warnings
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Applies a report on a stored mdib.
*
diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java b/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java
index 433701ad..c9308c7c 100644
--- a/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java
+++ b/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java
@@ -222,6 +222,7 @@ public final class Constants {
// Manipulation Data for Hibernation
public static final String MANIPULATION_PARAMETER_HANDLE = "Handle";
+ public static final String MANIPULATION_PARAMETER_SEQUENCE_ID = "SequenceId";
public static final String MANIPULATION_PARAMETER_LOCATION_DETAIL = "LocationDetail";
public static final String MANIPULATION_PARAMETER_CONTEXT_ASSOCIATION = "ContextAssociation";
public static final String MANIPULATION_PARAMETER_ALERT_ACTIVATION = "AlertActivation";
diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/manipulation/precondition/impl/ManipulationPreconditionsTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/manipulation/precondition/impl/ManipulationPreconditionsTest.java
index 4f49d163..199b5142 100644
--- a/sdccc/src/test/java/com/draeger/medical/sdccc/manipulation/precondition/impl/ManipulationPreconditionsTest.java
+++ b/sdccc/src/test/java/com/draeger/medical/sdccc/manipulation/precondition/impl/ManipulationPreconditionsTest.java
@@ -25,6 +25,7 @@
import com.draeger.medical.sdccc.manipulation.Manipulations;
import com.draeger.medical.sdccc.sdcri.testclient.TestClient;
import com.draeger.medical.sdccc.tests.test_util.InjectorUtil;
+import com.draeger.medical.sdccc.util.MdibBuilder;
import com.draeger.medical.sdccc.util.TestRunObserver;
import com.draeger.medical.t2iapi.ResponseTypes;
import com.google.inject.AbstractModule;
@@ -184,7 +185,7 @@ void setUp() throws IOException {
mockSystemSignalActivationVis = mock(SystemSignalActivation.class);
mockEntity = mock(MdibEntity.class);
mockEntity2 = mock(MdibEntity.class);
- mockMdibAccess = mock(MdibAccess.class);
+ mockMdibAccess = mock(MdibAccess.class, Answers.RETURNS_DEEP_STUBS);
mockTestClient = mock(TestClient.class, Answers.RETURNS_DEEP_STUBS);
when(mockTestClient.getSdcRemoteDevice()).thenReturn(mockDevice);
@@ -844,147 +845,6 @@ void testAssociateNewLocationForHandleSameStateTwice() {
}
}
- @Test
- @DisplayName("testMetricStatusManipulationMSRMTActivationStateSHTDNGood: Set ActivationState "
- + "of all MSRMT-Metrics to SHTDN.")
- void testMetricStatusManipulationMSRMTActivationStateSHTDNGood() {
-
- // given
-
- final ComponentActivation startActivationState = ComponentActivation.ON;
- final MetricCategory metricCategory = MetricCategory.MSRMT;
- final ComponentActivation activationState = ComponentActivation.SHTDN;
- final String metricStateHandle = "metricStateHandle";
-
- setupMetricStatusManipulation(metricCategory, metricStateHandle);
-
- when(mockManipulations.setComponentActivation(metricStateHandle, startActivationState))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
- when(mockManipulations.setMetricStatus(metricStateHandle, metricCategory, activationState))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
-
- // when
-
- final boolean result =
- ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN.manipulation(injector);
-
- // then
-
- assertTrue(result);
- assertFalse(
- testRunObserver.isInvalid(),
- "Test run should not have been invalidated. Reason(s): " + testRunObserver.getReasons());
- verify(mockManipulations).setComponentActivation(metricStateHandle, startActivationState);
- verify(mockManipulations).setMetricStatus(metricStateHandle, metricCategory, activationState);
- }
-
- @Test
- @DisplayName(
- "MetricStatusManipulationMSRMTActivationStateSHTDN: The precondition does not fail if setComponentActivation is not supported by all metrics.")
- void testMetricStatusManipulationMSRMTActivationStateSHTDNAllowNotSupported1() {
- metricMockSetup(
- MetricCategory.MSRMT, METRIC_HANDLE, SOME_HANDLE, ComponentActivation.ON, ComponentActivation.SHTDN);
-
- // let one metric not support setComponentActivation manipulation
- when(mockManipulations.setComponentActivation(eq(SOME_HANDLE), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_NOT_SUPPORTED);
-
- when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
- .thenReturn(List.of(mockEntity2, mockEntity));
-
- assertTrue(ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN.manipulation(injector));
-
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, ComponentActivation.ON);
- verify(mockManipulations).setComponentActivation(SOME_HANDLE, ComponentActivation.ON);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, MetricCategory.MSRMT, ComponentActivation.SHTDN);
- }
-
- @Test
- @DisplayName(
- "MetricStatusManipulationMSRMTActivationStateSHTDN: The precondition does not fail if setMetricStatus is not supported by all metrics.")
- void testMetricStatusManipulationMSRMTActivationStateSHTDNAllowNotSupported2() {
- metricMockSetup(
- MetricCategory.MSRMT, METRIC_HANDLE, SOME_HANDLE, ComponentActivation.ON, ComponentActivation.SHTDN);
-
- // let one metric not support setMetricStatus manipulation
- when(mockManipulations.setMetricStatus(
- eq(SOME_HANDLE), any(MetricCategory.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_NOT_SUPPORTED);
-
- when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
- .thenReturn(List.of(mockEntity2, mockEntity));
-
- assertTrue(ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN.manipulation(injector));
-
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, ComponentActivation.ON);
- verify(mockManipulations).setComponentActivation(SOME_HANDLE, ComponentActivation.ON);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, MetricCategory.MSRMT, ComponentActivation.SHTDN);
- }
-
- @Test
- @DisplayName("testMetricStatusManipulationMSRMTActivationStateSHTDNBad: First Manipulation failed.")
- void testMetricStatusManipulationMSRMTActivationStateSHTDNBadFirstManipulationFailed() {
-
- // given
-
- final ComponentActivation startActivationState = ComponentActivation.ON;
- final MetricCategory metricCategory = MetricCategory.MSRMT;
- final ComponentActivation activationState = ComponentActivation.SHTDN;
- final String metricStateHandle = "metricStateHandle";
-
- setupMetricStatusManipulation(metricCategory, metricStateHandle);
-
- when(mockManipulations.setComponentActivation(metricStateHandle, startActivationState))
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
- when(mockManipulations.setMetricStatus(metricStateHandle, metricCategory, activationState))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
-
- // when
-
- final boolean result =
- ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN.manipulation(injector);
-
- // then
- assertFalse(result);
- verify(mockManipulations).setComponentActivation(metricStateHandle, startActivationState);
- }
-
- @Test
- @DisplayName("testMetricStatusManipulationMSRMTActivationStateSHTDNBad: Second Manipulation Failed.")
- void testMetricStatusManipulationMSRMTActivationStateSHTDNBadSecondManipulationFailed() {
-
- // given
- final ComponentActivation startActivationState = ComponentActivation.ON;
- final MetricCategory metricCategory = MetricCategory.MSRMT;
- final ComponentActivation activationState = ComponentActivation.SHTDN;
- final String metricStateHandle = "metricStateHandle";
-
- setupMetricStatusManipulation(metricCategory, metricStateHandle);
-
- when(mockManipulations.setComponentActivation(metricStateHandle, startActivationState))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
- when(mockManipulations.setMetricStatus(metricStateHandle, metricCategory, activationState))
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
-
- // when
- final boolean result =
- ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN.manipulation(injector);
-
- // then
- assertFalse(result);
- verify(mockManipulations).setComponentActivation(metricStateHandle, startActivationState);
- verify(mockManipulations).setMetricStatus(metricStateHandle, metricCategory, activationState);
- }
-
- private void setupMetricStatusManipulation(final MetricCategory metricCategory, final String metricStateHandle) {
- when(mockDevice.getMdibAccess()).thenReturn(mockMdibAccess);
- when(mockMdibAccess.findEntitiesByType(AbstractMetricDescriptor.class)).thenReturn(List.of(mockEntity));
- when(mockEntity.getDescriptor(AbstractMetricDescriptor.class)).thenReturn(Optional.of(mockMetricDescriptor));
- when(mockMetricDescriptor.getMetricCategory()).thenReturn(metricCategory);
- when(mockEntity.getStates(AbstractMetricState.class)).thenReturn(List.of(mockMetricState));
- when(mockMetricState.getDescriptorHandle()).thenReturn(metricStateHandle);
- }
-
private void alertConditionPresenceManipulationSetup() {
when(mockDevice.getMdibAccess()).thenReturn(mockMdibAccess);
when(mockMdibAccess.findEntitiesByType(AlertConditionDescriptor.class))
@@ -1372,102 +1232,66 @@ void testSetActivationStateForAlertSystemWrongActivationState() {
assertTrue(testRunObserver.isInvalid(), "Test run should have been invalid.");
}
- private void metricMockSetup(
+ @SuppressWarnings("SameParameterValue")
+ private void setMetricStatusSetup(
final MetricCategory category,
final String metricHandle,
- final String secondMetricHandle,
- final ComponentActivation startingState,
+ final String otherMetricHandle,
final ComponentActivation endState) {
// create mock metric
when(mockMetricDescriptor.getHandle()).thenReturn(metricHandle);
when(mockMetricDescriptor.getMetricCategory()).thenReturn(category);
when(mockMetricState.getDescriptorHandle()).thenReturn(metricHandle);
- when(mockMetricState.getActivationState()).thenReturn(startingState).thenReturn(endState);
+ when(mockMetricState.getActivationState()).thenReturn(endState);
// create second mock metric
- when(mockMetricDescriptor2.getHandle()).thenReturn(secondMetricHandle);
+ when(mockMetricDescriptor2.getHandle()).thenReturn(otherMetricHandle);
when(mockMetricDescriptor2.getMetricCategory()).thenReturn(category);
- when(mockMetricState2.getDescriptorHandle()).thenReturn(secondMetricHandle);
- when(mockMetricState2.getActivationState()).thenReturn(startingState).thenReturn(endState);
+ when(mockMetricState2.getDescriptorHandle()).thenReturn(otherMetricHandle);
+ when(mockMetricState2.getActivationState()).thenReturn(endState);
// create mock entities to hold the states
when(mockEntity.getHandle()).thenReturn(metricHandle);
when(mockEntity.getDescriptor(AbstractMetricDescriptor.class)).thenReturn(Optional.of(mockMetricDescriptor));
when(mockEntity.getStates(AbstractMetricState.class)).thenReturn(List.of(mockMetricState));
- when(mockEntity2.getHandle()).thenReturn(secondMetricHandle);
+ when(mockEntity2.getHandle()).thenReturn(otherMetricHandle);
when(mockEntity2.getDescriptor(AbstractMetricDescriptor.class)).thenReturn(Optional.of(mockMetricDescriptor2));
when(mockEntity2.getStates(AbstractMetricState.class)).thenReturn(List.of(mockMetricState2));
- // make setComponentActivation return true for the manipulations and false afterwards
- when(mockManipulations.setComponentActivation(any(String.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
-
- // make setMetricStatus return true for the manipulations and false afterwards
+ when(mockDevice.getMdibAccess().getMdibVersion().getSequenceId()).thenReturn(MdibBuilder.DEFAULT_SEQUENCE_ID);
+ when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
+ .thenReturn(List.of(mockEntity, mockEntity2));
+ // let setMetricStatus manipulation for first handle be successful
when(mockManipulations.setMetricStatus(
- any(String.class), any(MetricCategory.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
- }
-
- @SuppressWarnings("SameParameterValue")
- private void setMetricStatusSetup(
- final MetricCategory category,
- final String metricHandle,
- final ComponentActivation startingState,
- final ComponentActivation endState) {
- // create mock metric
- when(mockMetricDescriptor.getHandle()).thenReturn(metricHandle);
- when(mockMetricDescriptor.getMetricCategory()).thenReturn(category);
- when(mockMetricState.getDescriptorHandle()).thenReturn(metricHandle);
- when(mockMetricState.getActivationState()).thenReturn(startingState).thenReturn(endState);
-
- // make setComponentActivation return true for the manipulations and false afterwards
- when(mockManipulations.setComponentActivation(any(String.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
-
- // make setMetricStatus return true for the manipulations and false afterwards
+ eq(MdibBuilder.DEFAULT_SEQUENCE_ID), eq(metricHandle), eq(category), eq(endState)))
+ .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
+ // let setMetricStatus manipulation for second handle be successful
when(mockManipulations.setMetricStatus(
- any(String.class), any(MetricCategory.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_SUCCESS)
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
-
- // create mock entities to hold the states
- when(mockEntity.getHandle()).thenReturn(metricHandle);
- when(mockEntity.getDescriptor(AbstractMetricDescriptor.class)).thenReturn(Optional.of(mockMetricDescriptor));
- when(mockEntity.getStates(AbstractMetricState.class)).thenReturn(List.of(mockMetricState));
- when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
- .thenReturn(List.of(mockEntity));
+ eq(MdibBuilder.DEFAULT_SEQUENCE_ID), eq(otherMetricHandle), eq(category), eq(endState)))
+ .thenReturn(ResponseTypes.Result.RESULT_SUCCESS);
}
// the argument source for the setMetricStatus preconditions
// 1. the specific method of the precondition to be tested
// 2. the metric category
- // 3. the component activation of the metric before the setMetricStatus manipulation
// 4. the expected component activation after the setMetricStatus manipulation finished successfully
- private static Stream metricStatusManipulationXActivationStateXArguments() {
+ private static Stream metricStatusManipulationXActivationStateYArguments() {
return Stream.of(
// arguments for MetricStatusManipulationXActivationStateON preconditions
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateON::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.OFF,
ComponentActivation.ON),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateON::manipulation,
MetricCategory.CLC,
- ComponentActivation.OFF,
ComponentActivation.ON),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateON::manipulation,
MetricCategory.SET,
- ComponentActivation.OFF,
ComponentActivation.ON),
// arguments for MetricStatusManipulationXActivationStateNOTRDY preconditions
Arguments.of(
@@ -1475,21 +1299,18 @@ private static Stream metricStatusManipulationXActivationStateXArgume
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateNOTRDY
::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.OFF,
ComponentActivation.NOT_RDY),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateNOTRDY
::manipulation,
MetricCategory.CLC,
- ComponentActivation.OFF,
ComponentActivation.NOT_RDY),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateNOTRDY
::manipulation,
MetricCategory.SET,
- ComponentActivation.OFF,
ComponentActivation.NOT_RDY),
// arguments for MetricStatusManipulationXActivationStateSTNDBY preconditions
Arguments.of(
@@ -1497,21 +1318,18 @@ private static Stream metricStatusManipulationXActivationStateXArgume
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSTNDBY
::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.ON,
ComponentActivation.STND_BY),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateSTNDBY
::manipulation,
MetricCategory.CLC,
- ComponentActivation.ON,
ComponentActivation.STND_BY),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateSTNDBY
::manipulation,
MetricCategory.SET,
- ComponentActivation.ON,
ComponentActivation.STND_BY),
// arguments for MetricStatusManipulationXActivationStateSHTDN preconditions
Arguments.of(
@@ -1519,38 +1337,32 @@ private static Stream metricStatusManipulationXActivationStateXArgume
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateSHTDN
::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.ON,
ComponentActivation.SHTDN),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateSHTDN::manipulation,
MetricCategory.CLC,
- ComponentActivation.ON,
ComponentActivation.SHTDN),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateSHTDN::manipulation,
MetricCategory.SET,
- ComponentActivation.ON,
ComponentActivation.SHTDN),
// arguments for MetricStatusManipulationXActivationStateOFF preconditions
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateOFF::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.ON,
ComponentActivation.OFF),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateOFF::manipulation,
MetricCategory.CLC,
- ComponentActivation.ON,
ComponentActivation.OFF),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateOFF::manipulation,
MetricCategory.SET,
- ComponentActivation.ON,
ComponentActivation.OFF),
// arguments for MetricStatusManipulationXActivationStateFAIL preconditions
Arguments.of(
@@ -1558,124 +1370,79 @@ private static Stream metricStatusManipulationXActivationStateXArgume
ManipulationPreconditions.MetricStatusManipulationMSRMTActivationStateFAIL
::manipulation,
MetricCategory.MSRMT,
- ComponentActivation.ON,
ComponentActivation.FAIL),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationCLCActivationStateFAIL::manipulation,
MetricCategory.CLC,
- ComponentActivation.ON,
ComponentActivation.FAIL),
Arguments.of(
(Function)
ManipulationPreconditions.MetricStatusManipulationSETActivationStateFAIL::manipulation,
MetricCategory.SET,
- ComponentActivation.ON,
ComponentActivation.FAIL));
}
- @DisplayName("The precondition is successful when setComponentActivation and setMetricStatus work as intended")
- @ParameterizedTest
- @MethodSource("metricStatusManipulationXActivationStateXArguments")
- void testMetricStatusManipulationXActivationStateXGood(
- final Function manipulation,
- final MetricCategory category,
- final ComponentActivation startActivation,
- final ComponentActivation expectedActivation) {
- setMetricStatusSetup(category, METRIC_HANDLE, startActivation, expectedActivation);
- assertTrue(manipulation.apply(injector));
-
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, startActivation);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, category, expectedActivation);
- }
-
- @DisplayName("The precondition does not fail if setComponentActivation is not supported by all metrics.")
+ @DisplayName("The precondition is successful when setMetricStatus work as intended")
@ParameterizedTest
- @MethodSource("metricStatusManipulationXActivationStateXArguments")
- void testMetricStatusManipulationXActivationStateXAllowNotSupported1(
+ @MethodSource("metricStatusManipulationXActivationStateYArguments")
+ void testMetricStatusManipulationXActivationStateYGood(
final Function manipulation,
final MetricCategory category,
- final ComponentActivation startActivation,
final ComponentActivation expectedActivation) {
- metricMockSetup(category, METRIC_HANDLE, SOME_HANDLE, startActivation, expectedActivation);
-
- // let one metric not support setComponentActivation manipulation
- when(mockManipulations.setComponentActivation(eq(SOME_HANDLE), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_NOT_SUPPORTED);
-
- when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
- .thenReturn(List.of(mockEntity2, mockEntity));
+ setMetricStatusSetup(category, METRIC_HANDLE, SOME_HANDLE, expectedActivation);
assertTrue(manipulation.apply(injector));
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, startActivation);
- verify(mockManipulations).setComponentActivation(SOME_HANDLE, startActivation);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, category, expectedActivation);
+ verify(mockManipulations)
+ .setMetricStatus(MdibBuilder.DEFAULT_SEQUENCE_ID, METRIC_HANDLE, category, expectedActivation);
+ verify(mockManipulations)
+ .setMetricStatus(MdibBuilder.DEFAULT_SEQUENCE_ID, SOME_HANDLE, category, expectedActivation);
}
@DisplayName("The precondition does not fail if setMetricStatus is not supported by all metrics.")
@ParameterizedTest
- @MethodSource("metricStatusManipulationXActivationStateXArguments")
- void testMetricStatusManipulationXActivationStateXAllowNotSupported2(
+ @MethodSource("metricStatusManipulationXActivationStateYArguments")
+ void testMetricStatusManipulationXActivationStateYAllowNotSupported2(
final Function manipulation,
final MetricCategory category,
- final ComponentActivation startActivation,
final ComponentActivation expectedActivation) {
- metricMockSetup(category, METRIC_HANDLE, SOME_HANDLE, startActivation, expectedActivation);
+ setMetricStatusSetup(category, METRIC_HANDLE, SOME_HANDLE, expectedActivation);
// let one metric not support setMetricStatus manipulation
when(mockManipulations.setMetricStatus(
- eq(SOME_HANDLE), any(MetricCategory.class), any(ComponentActivation.class)))
+ any(String.class), eq(SOME_HANDLE), any(MetricCategory.class), any(ComponentActivation.class)))
.thenReturn(ResponseTypes.Result.RESULT_NOT_SUPPORTED);
- when(mockDevice.getMdibAccess().findEntitiesByType(AbstractMetricDescriptor.class))
- .thenReturn(List.of(mockEntity2, mockEntity));
-
assertTrue(manipulation.apply(injector));
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, startActivation);
- verify(mockManipulations).setComponentActivation(SOME_HANDLE, startActivation);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, category, expectedActivation);
- }
-
- @DisplayName("The precondition fails when setComponentActivation failed.")
- @ParameterizedTest
- @MethodSource("metricStatusManipulationXActivationStateXArguments")
- void testMetricStatusManipulationXActivationStateXBadFirstManipulationFailed(
- final Function manipulation,
- final MetricCategory category,
- final ComponentActivation startActivation,
- final ComponentActivation expectedActivation) {
- setMetricStatusSetup(category, METRIC_HANDLE, startActivation, expectedActivation);
-
- // let setComponentActivation fail
- when(mockManipulations.setComponentActivation(any(String.class), any(ComponentActivation.class)))
- .thenReturn(ResponseTypes.Result.RESULT_FAIL);
-
- assertFalse(manipulation.apply(injector));
-
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, startActivation);
+ verify(mockManipulations)
+ .setMetricStatus(MdibBuilder.DEFAULT_SEQUENCE_ID, METRIC_HANDLE, category, expectedActivation);
+ verify(mockManipulations)
+ .setMetricStatus(MdibBuilder.DEFAULT_SEQUENCE_ID, SOME_HANDLE, category, expectedActivation);
}
@DisplayName("The precondition fails when setMetricStatus failed.")
@ParameterizedTest
- @MethodSource("metricStatusManipulationXActivationStateXArguments")
- void testMetricStatusManipulationXActivationStateXBadSecondManipulationFailed(
+ @MethodSource("metricStatusManipulationXActivationStateYArguments")
+ void testMetricStatusManipulationXActivationStateYBadSecondManipulationFailed(
final Function manipulation,
final MetricCategory category,
- final ComponentActivation startActivation,
final ComponentActivation expectedActivation) {
- setMetricStatusSetup(category, METRIC_HANDLE, startActivation, expectedActivation);
+ setMetricStatusSetup(category, METRIC_HANDLE, SOME_HANDLE, expectedActivation);
// let setMetricStatus fail
when(mockManipulations.setMetricStatus(
- any(String.class), any(MetricCategory.class), any(ComponentActivation.class)))
+ any(String.class),
+ any(String.class),
+ any(MetricCategory.class),
+ any(ComponentActivation.class)))
.thenReturn(ResponseTypes.Result.RESULT_FAIL);
assertFalse(manipulation.apply(injector));
- verify(mockManipulations).setComponentActivation(METRIC_HANDLE, startActivation);
- verify(mockManipulations).setMetricStatus(METRIC_HANDLE, category, expectedActivation);
+ verify(mockManipulations)
+ .setMetricStatus(MdibBuilder.DEFAULT_SEQUENCE_ID, METRIC_HANDLE, category, expectedActivation);
}
@Test
diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTestTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTestTest.java
index 4903e90d..245f9505 100644
--- a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTestTest.java
+++ b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelStatePartTestTest.java
@@ -13,11 +13,11 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.draeger.medical.biceps.model.message.AbstractMetricReport;
import com.draeger.medical.biceps.model.participant.ComponentActivation;
import com.draeger.medical.biceps.model.participant.MetricAvailability;
import com.draeger.medical.biceps.model.participant.MetricCategory;
import com.draeger.medical.dpws.soap.model.Envelope;
+import com.draeger.medical.sdccc.configuration.TestSuiteConfig;
import com.draeger.medical.sdccc.marshalling.MarshallingUtil;
import com.draeger.medical.sdccc.messages.Message;
import com.draeger.medical.sdccc.messages.MessageStorage;
@@ -36,6 +36,8 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.name.Names;
import jakarta.xml.bind.JAXBElement;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -76,6 +78,7 @@ public class InvariantParticipantModelStatePartTestTest {
private static final String SET_METRIC_HANDLE2 = "someSetStringMetric2";
private static final String CLC_METRIC_HANDLE = "someClcStringMetric";
private static final String CLC_METRIC_HANDLE2 = "someClcStringMetric2";
+ private static final String SOME_NON_EXISTENT_HANDLE = "someNonExistentHandle";
private static final String SEQUENCE_ID = MdibBuilder.DEFAULT_SEQUENCE_ID;
private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(10);
@@ -86,7 +89,6 @@ public class InvariantParticipantModelStatePartTestTest {
private static final long TIMESTAMP_FINISH2 = 1800;
private static final long TIMESTAMP_IN_INTERVAL = 1500;
private static final long TIMESTAMP_IN_INTERVAL2 = 1550;
- private static final long TIMESTAMP_NOT_IN_INTERVAL = TimeUnit.NANOSECONDS.convert(10, TimeUnit.SECONDS);
private static MessageStorageUtil messageStorageUtil;
private static MdibBuilder mdibBuilder;
private static MessageBuilder messageBuilder;
@@ -97,6 +99,8 @@ public class InvariantParticipantModelStatePartTestTest {
private SoapMarshalling marshalling;
private DatatypeFactory datatypeFactory;
+ private long buffer;
+
@BeforeAll
static void setupMarshalling() {
final Injector marshallingInjector = MarshallingUtil.createMarshallingTestInjector(true);
@@ -132,6 +136,9 @@ protected void configure() {
datatypeFactory = DatatypeFactory.newInstance();
+ buffer = TimeUnit.NANOSECONDS.convert(
+ injector.getInstance(Key.get(long.class, Names.named(TestSuiteConfig.TEST_BICEPS_547_TIME_INTERVAL))),
+ TimeUnit.SECONDS);
testClass = new InvariantParticipantModelStatePartTest();
testClass.setUp();
}
@@ -156,6 +163,7 @@ public void testRequirement547NotIgnoringParameters() throws Exception {
messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
// Component activation should be ON to be relevant for testRequirement54700.
@@ -195,25 +203,17 @@ public void testRequirement54700NoTestData() {
*/
@Test
public void testRequirement54700NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54700);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
@@ -225,23 +225,19 @@ public void testRequirement54700NoSuccessfulManipulation() throws Exception {
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54700WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ // the test expects manipulations with metric category msrmt
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category msrmt in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54700);
assertTrue(error.getMessage()
.contains(String.format(
@@ -250,274 +246,190 @@ public void testRequirement54700BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with a timestamp less than the manipulation
+ * end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54700NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.ON);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54700();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54700);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests if the test passes if for each 'setMetricStatus' manipulation for metrics with category 'Msrmt' only
- * WaveformStream messages exist that contain the expected handle and were received within the time interval
- * of the manipulation.
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700GoodWaveforms() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- RTSA_METRIC_HANDLE,
+ public void testRequirement54700NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
-
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var waveformStream = buildWaveformStream(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, RTSA_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, waveformStream));
-
- testClass.testRequirement54700();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54700);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54700BadWrongActivation() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
-
- testClass.testRequirement54700();
- }
-
- /**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54700BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ // the metric has the wrong activation state, ComponentActivation.ON is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54700);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54700Good() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54700);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54700();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54700BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54700GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be on
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ MSRMT_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.ON);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54700);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.ON,
- ComponentActivation.OFF)));
+ testClass.testRequirement54700();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp
+ * is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54700GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // another report for the same metric with the wrong activation state but a smaller mdib version should not
+ // fail the test
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement54700();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp
+ * is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54700BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // another report for the same metric with the wrong activation state but a bigger mdib version should
+ // fail the test
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54700);
}
@@ -537,25 +449,17 @@ public void testRequirement5471NoTestData() {
*/
@Test
public void testRequirement5471NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement5471);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
@@ -567,23 +471,19 @@ public void testRequirement5471NoSuccessfulManipulation() throws Exception {
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5471WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ // the test expects manipulations with metric category msrmt
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category msrmt in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement5471);
assertTrue(error.getMessage()
.contains(String.format(
@@ -592,274 +492,188 @@ public void testRequirement5471BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation
+ * end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5471NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- final var unrelatedPart =
- buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement5471();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5471);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests if the test passes if for each 'setMetricStatus' manipulation for metrics with category 'Msrmt' only
- * WaveformStream messages exist that contain the expected handle and were received within the time interval
- * of the manipulation.
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471GoodWaveforms() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- RTSA_METRIC_HANDLE,
+ public void testRequirement5471NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var waveformStream = buildWaveformStream(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, RTSA_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, waveformStream));
-
- testClass.testRequirement5471();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5471);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5471BadWrongActivation() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
-
- testClass.testRequirement5471();
- }
-
- /**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement5471BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ // the metric has the wrong activation state, ComponentActivation.NOT_RDY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement5471);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5471Good() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5471);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement5471();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5471BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5471GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be on
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ MSRMT_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5471);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.NOT_RDY,
- ComponentActivation.OFF)));
+ testClass.testRequirement5471();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp
+ * is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5471GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement5471();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp
+ * is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5471BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement5471);
}
@@ -879,25 +693,17 @@ public void testRequirement5472NoTestData() {
*/
@Test
public void testRequirement5472NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement5472);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
@@ -909,23 +715,19 @@ public void testRequirement5472NoSuccessfulManipulation() throws Exception {
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5472WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ // the test expects manipulations with metric category msrmt
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category msrmt in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement5472);
assertTrue(error.getMessage()
.contains(String.format(
@@ -934,241 +736,184 @@ public void testRequirement5472BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5472NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement5472();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5472);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE2,
+ public void testRequirement5472NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
-
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement5472();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5472);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5472BadWrongActivation() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.STND_BY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement5472);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5472Good() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5472);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement5472();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5472BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5472GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be stndby
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ MSRMT_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.STND_BY);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5472);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.STND_BY,
- ComponentActivation.OFF)));
+ testClass.testRequirement5472();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5472GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement5472();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5472BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement5472);
}
@@ -1188,25 +933,17 @@ public void testRequirement5473NoTestData() {
*/
@Test
public void testRequirement5473NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement5473);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
@@ -1218,23 +955,19 @@ public void testRequirement5473NoSuccessfulManipulation() throws Exception {
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5473WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ // the test expects manipulations with metric category msrmt
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category msrmt in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement5473);
assertTrue(error.getMessage()
.contains(String.format(
@@ -1243,241 +976,184 @@ public void testRequirement5473BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5473NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement5473();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE2,
+ public void testRequirement5473NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
-
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement5473();
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5473BadWrongActivation() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
- }
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.SHTDN is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ ComponentActivation.OFF)));
+ }
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5473Good() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement5473();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5473BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5473GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be shtdn
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ MSRMT_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.SHTDN);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5473);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.SHTDN,
- ComponentActivation.OFF)));
+ testClass.testRequirement5473();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5473GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement5473();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5473BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.SHTDN);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement5473);
}
@@ -1497,25 +1173,17 @@ public void testRequirement5474NoTestData() {
*/
@Test
public void testRequirement5474NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement5474);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
@@ -1527,23 +1195,19 @@ public void testRequirement5474NoSuccessfulManipulation() throws Exception {
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5474WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ // the test expects manipulations with metric category msrmt
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category msrmt in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement5474);
assertTrue(error.getMessage()
.contains(String.format(
@@ -1552,685 +1216,600 @@ public void testRequirement5474BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5474NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
+ }
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.OFF);
+ /**
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement5474NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
+ }
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ /**
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement5474BadWrongActivation() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.OFF is expected
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ ComponentActivation.ON)));
+ }
+ /**
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement5474Good() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement5474();
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5474GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
MSRMT_METRIC_HANDLE2,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
messageStorageUtil.addManipulation(
storage,
TIMESTAMP_START2,
TIMESTAMP_FINISH2,
ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ parameters2);
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.OFF);
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement5474();
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5474GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ testClass.testRequirement5474();
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5474BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ assertThrows(AssertionError.class, testClass::testRequirement5474);
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
- *
- * @throws Exception on any exception
+ * Tests whether no test data fails the test.
*/
@Test
- public void testRequirement5474BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be OFF
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5474);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.OFF,
- ComponentActivation.ON)));
+ public void testRequirement5475NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement5475);
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5475NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- // should not fail the test, since the first report in the time interval is relevant for the test
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement5474();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5475);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Test whether the test fails, when no manipulation data with category 'Msrmt' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5474BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5475WrongMetricCategory() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
+ // the test expects manipulations with metric category msrmt
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- assertThrows(AssertionError.class, testClass::testRequirement5474);
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5475);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION,
+ MetricCategory.MSRMT)));
}
/**
- * Tests whether no test data fails the test.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
+ *
+ * @throws Exception on any exception
*/
@Test
- public void testRequirement5475NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement5475);
+ public void testRequirement5475NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
+ public void testRequirement5475NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5475);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Msrmt' is in storage.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- // no manipulation with category msrmt in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5475);
+ public void testRequirement5475BadWrongActivation() throws Exception {
+ requirement547SetUp(
+ MSRMT_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.FAIL is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION,
- MetricCategory.MSRMT)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ ComponentActivation.OFF)));
}
/**
* Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Msrmt' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * with category 'Msrmt' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5475Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.FAIL);
-
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement5475();
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Msrmt'.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5475GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
MSRMT_METRIC_HANDLE2,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
messageStorageUtil.addManipulation(
storage,
TIMESTAMP_START2,
TIMESTAMP_FINISH2,
ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ parameters2);
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.FAIL);
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.FAIL);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement5475();
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5475GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ testClass.testRequirement5475();
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5475BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
MSRMT_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ MSRMT_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE2, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ assertThrows(AssertionError.class, testClass::testRequirement5475);
+ }
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, MSRMT_METRIC_HANDLE)));
+ /**
+ * Tests whether no test data fails the test.
+ */
+ @Test
+ public void testRequirement54760NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement54760);
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be FAIL
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ public void testRequirement54760NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5475);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- MSRMT_METRIC_HANDLE,
- ComponentActivation.FAIL,
- ComponentActivation.ON)));
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement54760);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
+ public void testRequirement54760WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ // the test expects manipulations with metric category SET
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- // should not fail the test, since the first report in the time interval is relevant for the test
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement5475();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement54760);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5475BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.FAIL);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
-
- assertThrows(AssertionError.class, testClass::testRequirement5475);
- }
-
- /**
- * Tests whether no test data fails the test.
- */
- @Test
- public void testRequirement54760NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement54760);
+ public void testRequirement54760NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54760NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(NoTestData.class, testClass::testRequirement54760);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- // no manipulation with category set in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement54760);
+ public void testRequirement54760BadWrongActivation() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.ON is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ ComponentActivation.OFF)));
}
/**
* Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54760Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedReportPart =
- buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.ON);
- final var relatedReportPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- final var unrelatedReportPart2 =
- buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.ON);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, unrelatedReportPart, relatedReportPart, unrelatedReportPart2);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement54760();
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54760GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+
final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
SET_METRIC_HANDLE2,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
@@ -2241,308 +1820,235 @@ public void testRequirement54760GoodOverlappingTimeInterval() throws Exception {
ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.ON);
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.ON);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement54760();
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54760GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ testClass.testRequirement54760();
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54760BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
+ assertThrows(AssertionError.class, testClass::testRequirement54760);
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
- *
- * @throws Exception on any exception
+ * Tests whether no test data fails the test.
*/
@Test
- public void testRequirement54760BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be on
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54760);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- SET_METRIC_HANDLE,
- ComponentActivation.ON,
- ComponentActivation.OFF)));
+ public void testRequirement5477NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement5477);
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5477NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- // should not fail the test, since the first report in the time interval is relevant for the test
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement54760();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5477);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54760BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5477WrongMetricCategory() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
+ // the test expects manipulations with metric category SET
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- assertThrows(AssertionError.class, testClass::testRequirement54760);
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5477);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
}
/**
- * Tests whether no test data fails the test.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
+ *
+ * @throws Exception on any exception
*/
@Test
- public void testRequirement5477NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement5477);
+ public void testRequirement5477NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5477NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5477);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- // no manipulation with category set in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5477);
+ public void testRequirement5477BadWrongActivation() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.NOT_RDY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ ComponentActivation.OFF)));
}
/**
* Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5477Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- final var unrelatedPart =
- buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- final var unrelatedPart2 =
- buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.NOT_RDY);
-
- final var metricReport =
- buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart, unrelatedPart2);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement5477();
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5477GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
SET_METRIC_HANDLE2,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
@@ -2553,309 +2059,235 @@ public void testRequirement5477GoodOverlappingTimeInterval() throws Exception {
ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement5477();
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5477GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ testClass.testRequirement5477();
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5477BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ SET_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ assertThrows(AssertionError.class, testClass::testRequirement5477);
+ }
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
+ /**
+ * Tests whether no test data fails the test.
+ */
+ @Test
+ public void testRequirement5478NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement5478);
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5478NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be NotRdy
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5477);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- SET_METRIC_HANDLE,
- ComponentActivation.NOT_RDY,
- ComponentActivation.OFF)));
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5478);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5478WrongMetricCategory() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- // should not fail the test, since the first report in the time interval is relevant for the test
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ // the test expects manipulations with metric category SET
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement5477();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement5478);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5477BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5478NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
-
- assertThrows(AssertionError.class, testClass::testRequirement5477);
- }
-
- /**
- * Tests whether no test data fails the test.
- */
- @Test
- public void testRequirement5478NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement5478);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5478NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5478NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5478);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5478BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- // no manipulation with category set in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement5478);
+ public void testRequirement5478BadWrongActivation() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.STND_BY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.SET)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ ComponentActivation.OFF)));
}
/**
* Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5478Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- final var unrelatedPart =
- buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.STND_BY);
- final var unrelatedPart2 =
- buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
-
- final var metricReport =
- buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart, unrelatedPart2);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement5478();
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5478GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
SET_METRIC_HANDLE2,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
@@ -2866,175 +2298,59 @@ public void testRequirement5478GoodOverlappingTimeInterval() throws Exception {
ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.STND_BY);
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.STND_BY);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement5478();
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement5478BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
- }
-
- /**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5478NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5478GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
- }
-
- /**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement5478BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be stndby
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5478);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- SET_METRIC_HANDLE,
- ComponentActivation.STND_BY,
- ComponentActivation.OFF)));
- }
-
- /**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement5478GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement5478();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5478BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement5478);
}
@@ -3054,53 +2370,41 @@ public void testRequirement5479NoTestData() {
*/
@Test
public void testRequirement5479NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement5479);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
+ public void testRequirement5479WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ // the test expects manipulations with metric category SET
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category set in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement5479);
assertTrue(error.getMessage()
.contains(String.format(
@@ -3108,245 +2412,184 @@ public void testRequirement5479BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5479NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.SHTDN);
- final var unrelatedPart2 =
- buildMetricReportPart(BigInteger.ONE, MSRMT_METRIC_HANDLE, ComponentActivation.STND_BY);
-
- final var metricReport =
- buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart, unrelatedPart2);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement5479();
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5479);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement5479NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement5479();
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement5479);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5479BadWrongActivation() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.SHTDN is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement5479);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5479Good() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5479);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement5479();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement5479BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement5479GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be shtdn
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ SET_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.SHTDN);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement5479);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- SET_METRIC_HANDLE,
- ComponentActivation.SHTDN,
- ComponentActivation.OFF)));
+ testClass.testRequirement5479();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5479GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement5479();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement5479BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement5479);
}
@@ -3366,55 +2609,41 @@ public void testRequirement54710NoTestData() {
*/
@Test
public void testRequirement54710NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54710);
- assertTrue(
- error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION),
- error.getMessage());
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54710BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
+ public void testRequirement54710WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ // the test expects manipulations with metric category SET
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category SET in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54710);
assertTrue(error.getMessage()
.contains(String.format(
@@ -3422,240 +2651,184 @@ public void testRequirement54710BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54710Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54710NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.OFF);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54710);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
+ }
- testClass.testRequirement54710();
+ /**
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement54710NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54710);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54710GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54710BadWrongActivation() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54710();
- }
-
- /**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54710BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ // the metric has the wrong activation state, ComponentActivation.OFF is expected
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54710);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ ComponentActivation.ON)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54710NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54710Good() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54710);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54710();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54710BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54710GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be OFF
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ SET_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54710);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- SET_METRIC_HANDLE,
- ComponentActivation.OFF,
- ComponentActivation.ON)));
+ testClass.testRequirement54710();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54710GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement54710();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54710BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54710);
}
@@ -3675,55 +2848,41 @@ public void testRequirement54711NoTestData() {
*/
@Test
public void testRequirement54711NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54711);
- assertTrue(
- error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION),
- error.getMessage());
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Set' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'SET' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
+ public void testRequirement54711WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ // the test expects manipulations with metric category SET
org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category SET in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54711);
assertTrue(error.getMessage()
.contains(String.format(
@@ -3731,481 +2890,310 @@ public void testRequirement54711BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Set' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54711NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.FAIL);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54711();
- }
-
- /**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Set'.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54711GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54711();
- }
-
- /**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54711BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
SET_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ ComponentActivation.FAIL,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54711);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54711NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54711);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, SET_METRIC_HANDLE)));
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54711BadWrongActivation() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be FAIL
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.FAIL is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54711);
assertTrue(error.getMessage()
.contains(String.format(
InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
SET_METRIC_HANDLE,
ComponentActivation.FAIL,
- ComponentActivation.ON)));
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'SET' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54711Good() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- // should not fail the test, since the first report in the time interval is relevant for the test
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
testClass.testRequirement54711();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54711BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54711GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
SET_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
-
- assertThrows(AssertionError.class, testClass::testRequirement54711);
- }
-
- /**
- * Tests whether no test data fails the test.
- */
- @Test
- public void testRequirement547120NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement547120);
- }
-
- /**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement547120NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- // add manipulation data with result fail
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ SET_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
messageStorageUtil.addManipulation(
storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE2, ComponentActivation.FAIL);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(NoTestData.class, testClass::testRequirement547120);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ testClass.testRequirement54711();
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ public void testRequirement54711GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- // no manipulation with category clc in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement547120);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.CLC)));
+ testClass.testRequirement54711();
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ public void testRequirement54711BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
+ SET_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.ON);
-
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SET_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- testClass.testRequirement547120();
+ assertThrows(AssertionError.class, testClass::testRequirement54711);
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
- *
- * @throws Exception on any exception
+ * Tests whether no test data fails the test.
*/
@Test
- public void testRequirement547120GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement547120();
+ public void testRequirement547120NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement547120);
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement547120NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement547120);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ }
- final var error = assertThrows(AssertionError.class, testClass::testRequirement547120);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ /**
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement547120WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ // the test expects manipulations with metric category CLC
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement547120);
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.CLC)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement547120NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement547120);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
+ }
+ /**
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement547120NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement547120);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement547120BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be on
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.ON is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement547120);
assertTrue(error.getMessage()
.contains(String.format(
@@ -4216,304 +3204,235 @@ public void testRequirement547120BadWrongActivationInFollowingReport() throws Ex
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
+ public void testRequirement547120Good() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement547120();
+ }
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ /**
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement547120GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.ON);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement547120();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement547120BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement547120GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.ON);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
-
- assertThrows(AssertionError.class, testClass::testRequirement547120);
- }
- /**
- * Tests whether no test data fails the test.
- */
- @Test
- public void testRequirement54713NoTestData() {
- assertThrows(NoTestData.class, testClass::testRequirement54713);
+ testClass.testRequirement547120();
}
/**
- * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement547120BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.ON,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- final var error = assertThrows(NoTestData.class, testClass::testRequirement54713);
- assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
+ assertThrows(AssertionError.class, testClass::testRequirement547120);
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
- *
- * @throws Exception on any exception
+ * Tests whether no test data fails the test.
*/
@Test
- public void testRequirement54713BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- MSRMT_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.MSRMT,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- // no manipulation with category clc in storage
- final var error = assertThrows(NoTestData.class, testClass::testRequirement54713);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.CLC)));
+ public void testRequirement54713NoTestData() {
+ assertThrows(NoTestData.class, testClass::testRequirement54713);
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails when no manipulation data with ResponseTypes.Result.RESULT_SUCCESS is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54713NoSuccessfulManipulation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- final var unrelatedPart =
- buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
-
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement54713();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement54713);
+ assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54713WrongMetricCategory() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ // the test expects manipulations with metric category CLC
+ org.somda.sdc.biceps.model.participant.MetricCategory.SET,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- testClass.testRequirement54713();
+ final var error = assertThrows(NoTestData.class, testClass::testRequirement54713);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_SET_METRIC_STATUS_MANIPULATION, MetricCategory.CLC)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54713NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54713);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
+ public void testRequirement54713NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54713);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54713BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be not_rdy
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.NOT_RDY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54713);
assertTrue(error.getMessage()
.contains(String.format(
@@ -4524,62 +3443,109 @@ public void testRequirement54713BadWrongActivationInFollowingReport() throws Exc
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
+ public void testRequirement54713Good() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54713();
+ }
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ /**
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement54713GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.NOT_RDY);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement54713();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54713BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54713GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.NOT_RDY);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
+
+ testClass.testRequirement54713();
+ }
- // the first report in the time interval has the wrong activation state
+ /**
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement54713BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.NOT_RDY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.NOT_RDY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54713);
}
@@ -4599,53 +3565,41 @@ public void testRequirement54714NoTestData() {
*/
@Test
public void testRequirement54714NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54714);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54714WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ // the test expects manipulations with metric category CLC
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category clc in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54714);
assertTrue(error.getMessage()
.contains(String.format(
@@ -4653,175 +3607,71 @@ public void testRequirement54714BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54714Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START,
- TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.STND_BY);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54714();
- }
-
- /**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54714NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
-
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54714();
- }
-
- /**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
- *
- * @throws Exception on any exception
- */
- @Test
- public void testRequirement54714BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ ComponentActivation.STND_BY,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54714);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
+ public void testRequirement54714NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.STND_BY);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54714);
assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54714BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // activation state should be stndby
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.STND_BY is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54714);
assertTrue(error.getMessage()
.contains(String.format(
@@ -4832,62 +3682,109 @@ public void testRequirement54714BadWrongActivationInFollowingReport() throws Exc
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
+ public void testRequirement54714Good() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54714();
+ }
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ /**
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement54714GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.STND_BY);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
testClass.testRequirement54714();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54714BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54714GoodMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.STND_BY);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
+
+ testClass.testRequirement54714();
+ }
- // the first report in the time interval has the wrong activation state
+ /**
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
+ *
+ * @throws Exception on any exception
+ */
+ @Test
+ public void testRequirement54714BadMultipleReportsInInterval() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.STND_BY,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ SET_METRIC_HANDLE,
+ ComponentActivation.STND_BY,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54714);
}
@@ -4907,53 +3804,41 @@ public void testRequirement54715NoTestData() {
*/
@Test
public void testRequirement54715NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54715);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54715WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ // the test expects manipulations with metric category CLC
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category clc in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54715);
assertTrue(error.getMessage()
.contains(String.format(
@@ -4961,241 +3846,184 @@ public void testRequirement54715BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54715NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.SHTDN);
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, unrelatedPart, relatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54715();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54715);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
+ public void testRequirement54715NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
-
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54715();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54715);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54715BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.SHTDN is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54715);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54715Good() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.SHTDN);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54715);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54715();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54715BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54715GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be shtdn
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.SHTDN);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54715);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- CLC_METRIC_HANDLE,
- ComponentActivation.SHTDN,
- ComponentActivation.OFF)));
+ testClass.testRequirement54715();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54715GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement54715();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54715BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.SHTDN);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.SHTDN,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.SHTDN,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54715);
}
@@ -5215,53 +4043,41 @@ public void testRequirement54716NoTestData() {
*/
@Test
public void testRequirement54716NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54716);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54716WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ // the test expects manipulations with metric category CLC
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category clc in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54716);
assertTrue(error.getMessage()
.contains(String.format(
@@ -5269,242 +4085,184 @@ public void testRequirement54716BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54716NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.OFF);
-
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54716();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54716);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
+ public void testRequirement54716NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54716();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54716);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54716BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.OFF is expected
+ ComponentActivation.ON,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54716);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ ComponentActivation.ON)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54716Good() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.OFF);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54716);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54716();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54716BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54716GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be OFF
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54716);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- CLC_METRIC_HANDLE,
- ComponentActivation.OFF,
- ComponentActivation.ON)));
+ testClass.testRequirement54716();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54716GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement54716();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54716BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.OFF);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
+ org.somda.sdc.biceps.model.participant.ComponentActivation.OFF,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54716);
}
@@ -5524,53 +4282,41 @@ public void testRequirement54717NoTestData() {
*/
@Test
public void testRequirement54717NoSuccessfulManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- // add manipulation data with result fail
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ // no manipulation with result success
+ ResponseTypes.Result.RESULT_FAIL,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_FAIL,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(NoTestData.class, testClass::testRequirement54717);
assertTrue(error.getMessage().contains(InvariantParticipantModelStatePartTest.NO_SUCCESSFUL_MANIPULATION));
}
/**
- * Test whether the test fails, when no manipulation data with category 'Clc' is in storage.
+ * Test whether the test fails, when no manipulation data with category 'CLC' is in storage.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717BadWrongMetricCategory() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- SET_METRIC_HANDLE,
+ public void testRequirement54717WrongMetricCategory() throws Exception {
+ requirement547SetUp(
+ CLC_METRIC_HANDLE,
+ // the test expects manipulations with metric category CLC
org.somda.sdc.biceps.model.participant.MetricCategory.SET,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, SET_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- // no manipulation with category clc in storage
final var error = assertThrows(NoTestData.class, testClass::testRequirement54717);
assertTrue(error.getMessage()
.contains(String.format(
@@ -5578,242 +4324,184 @@ public void testRequirement54717BadWrongMetricCategory() throws Exception {
}
/**
- * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
- * with category 'Clc' a metric report containing the manipulated metric with the expected activation state exists
- * and is in the time interval of the manipulation data.
+ * Tests whether the test fails, when no metric report is present with timestamp less than the manipulation end timestamp + buffer.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717Good() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54717NoReportUntilEndTimestamp() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var relatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
- final var unrelatedPart = buildMetricReportPart(BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.FAIL);
-
- final var metricReport = buildMetricReport(SEQUENCE_ID, BigInteger.ONE, relatedPart, unrelatedPart);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- testClass.testRequirement54717();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ // the timestamp of the report is not < manipulation end timestamp + buffer
+ TIMESTAMP_FINISH + buffer);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54717);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME, TIMESTAMP_FINISH + buffer)));
}
/**
- * Tests whether the test correctly retrieves the first relevant report in the time interval for each manipulation
- * data with category 'Clc'.
- *
+ * Tests whether the test fails, when the handle in the manipulation data parameters is unknown.
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717GoodOverlappingTimeInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE,
- org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
-
- final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
- CLC_METRIC_HANDLE2,
+ public void testRequirement54717NoMetricWithExpectedHandle() throws Exception {
+ requirement547SetUp(
+ // this handle is not present in mdib
+ SOME_NON_EXISTENT_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters2);
-
- messageStorageUtil.addManipulation(
- storage,
- TIMESTAMP_START2,
- TIMESTAMP_FINISH2,
- ResponseTypes.Result.RESULT_SUCCESS,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
-
- testClass.testRequirement54717();
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ final var error = assertThrows(AssertionError.class, testClass::testRequirement54717);
+ assertTrue(error.getMessage()
+ .contains(String.format(
+ InvariantParticipantModelStatePartTest.NO_METRIC_WITH_EXPECTED_HANDLE,
+ SOME_NON_EXISTENT_HANDLE)));
}
/**
- * Tests whether the test fails, when no metric report is present in the time interval of a manipulation data.
+ * Tests whether the test fails, when the metric has not the expected activation state after the manipulation.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717BadNoMetricReportFollowingManipulation() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54717BadWrongActivation() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // this metric report is not in the time interval of the setMetricStatus manipulation
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_NOT_IN_INTERVAL, metricReport));
-
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ // the metric has the wrong activation state, ComponentActivation.FAIL is expected
+ ComponentActivation.OFF,
+ TIMESTAMP_IN_INTERVAL);
final var error = assertThrows(AssertionError.class, testClass::testRequirement54717);
- assertTrue(error.getCause() instanceof NoTestData);
- assertTrue(error.getCause()
- .getMessage()
+ assertTrue(error.getMessage()
.contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_IN_TIME_INTERVAL,
- methodName,
- TIMESTAMP_START,
- TIMESTAMP_FINISH)));
+ InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ ComponentActivation.OFF)));
}
/**
- * Tests whether the test fails, when no reports with the expected handle from the manipulation data are in storage.
+ * Tests whether the test passes, when for each manipulation data for 'setMetricStatus' manipulations and metrics
+ * with category 'CLC' a metric with the expected activation state exists and is in the time interval of the manipulation data.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717NoReportsWithExpectedHandle() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54717Good() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(
- storage,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
TIMESTAMP_START,
TIMESTAMP_FINISH,
- result,
- Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
- parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.FAIL);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
-
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54717);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.NO_REPORT_WITH_EXPECTED_HANDLE, CLC_METRIC_HANDLE)));
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ testClass.testRequirement54717();
}
/**
- * Tests whether the test fails, when the metric from the manipulation data has the wrong activation state in the
- * following metric report.
+ * Tests whether the test correctly checks the metric with the handle from the manipulation data parameter.
*
* @throws Exception on any exception
*/
@Test
- public void testRequirement54717BadWrongActivationInFollowingReport() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ public void testRequirement54717GoodOverlappingTimeInterval() throws Exception {
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
- // activation state should be FAIL
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ final var parameters2 = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ CLC_METRIC_HANDLE2,
+ org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
+ messageStorageUtil.addManipulation(
+ storage,
+ TIMESTAMP_START2,
+ TIMESTAMP_FINISH2,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ Constants.MANIPULATION_NAME_SET_METRIC_STATUS,
+ parameters2);
+ final var metricReport2 = buildMetricReport(
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE2, ComponentActivation.FAIL);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
- final var error = assertThrows(AssertionError.class, testClass::testRequirement54717);
- assertTrue(error.getMessage()
- .contains(String.format(
- InvariantParticipantModelStatePartTest.WRONG_ACTIVATION_STATE,
- CLC_METRIC_HANDLE,
- ComponentActivation.FAIL,
- ComponentActivation.ON)));
+ testClass.testRequirement54717();
}
/**
- * Tests whether the test retrieves the first metric report in the time interval of a manipulation data.
+ * Tests whether the test passes when the last update of the activation state of the metric until the end timestamp is as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54717GoodMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- // good report in time interval
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
- // should not fail the test, since the first report in the time interval is relevant for the test
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport2));
+ SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
testClass.testRequirement54717();
}
/**
- * Tests whether the test do not pass when the first report in the time interval is bad, even if followed by a
- * report that would pass the test.
+ * Tests whether the test fails when the last update of the activation state of the metric until the end timestamp is not as expected.
*
* @throws Exception on any exception
*/
@Test
public void testRequirement54717BadMultipleReportsInInterval() throws Exception {
- final var initial = buildMdib(SEQUENCE_ID);
- messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
-
- final var result = ResponseTypes.Result.RESULT_SUCCESS;
- final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
- final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ requirement547SetUp(
CLC_METRIC_HANDLE,
org.somda.sdc.biceps.model.participant.MetricCategory.CLC,
- org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL);
- messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
-
- final var metricReport = buildMetricReport(
- SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.FAIL);
+ org.somda.sdc.biceps.model.participant.ComponentActivation.FAIL,
+ ResponseTypes.Result.RESULT_SUCCESS,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ CLC_METRIC_HANDLE,
+ ComponentActivation.FAIL,
+ TIMESTAMP_IN_INTERVAL);
+ // add another report for the same metric handle with the wrong activation state
final var metricReport2 = buildMetricReport(
- SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.ON);
-
- // the first report in the time interval has the wrong activation state
+ SEQUENCE_ID, BigInteger.valueOf(10), BigInteger.ONE, CLC_METRIC_HANDLE, ComponentActivation.OFF);
messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport2));
- messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL2, metricReport));
assertThrows(AssertionError.class, testClass::testRequirement54717);
}
@@ -5950,27 +4638,6 @@ private Envelope buildMdib(final String sequenceId) {
ActionConstants.getResponseAction(ActionConstants.ACTION_GET_MDIB), getMdibResponse);
}
- private AbstractMetricReport.ReportPart buildMetricReportPart(
- final BigInteger metricVersion, final String metricHandle, final ComponentActivation activation) {
- final var metricState = mdibBuilder.buildStringMetricState(metricHandle);
- metricState.setStateVersion(metricVersion);
- metricState.setActivationState(activation);
-
- final var reportPart = messageBuilder.buildAbstractMetricReportReportPart();
- reportPart.getMetricState().add(metricState);
- return reportPart;
- }
-
- private Envelope buildMetricReport(
- final String sequenceId, final BigInteger mdibVersion, final AbstractMetricReport.ReportPart... parts) {
- final var report = messageBuilder.buildEpisodicMetricReport(sequenceId);
- report.setMdibVersion(mdibVersion);
- for (var part : parts) {
- report.getReportPart().add(part);
- }
- return messageBuilder.createSoapMessageWithBody(ActionConstants.ACTION_EPISODIC_METRIC_REPORT, report);
- }
-
private Envelope buildMetricReport(
final String sequenceId,
final BigInteger mdibVersion,
@@ -5991,19 +4658,75 @@ private Envelope buildMetricReport(
return messageBuilder.createSoapMessageWithBody(ActionConstants.ACTION_EPISODIC_METRIC_REPORT, report);
}
- private Envelope buildWaveformStream(
- final String sequenceId,
- final BigInteger mdibVersion,
- final BigInteger metricVersion,
- final String metricHandle,
- final ComponentActivation activation) {
+ private void noSuccessfulManipulationBiceps547Setup(
+ final String manipulationHandle,
+ final org.somda.sdc.biceps.model.participant.MetricCategory metricCategory,
+ final org.somda.sdc.biceps.model.participant.ComponentActivation activation,
+ final ComponentActivation reportActivation)
+ throws Exception {
+ requirement547SetUp(
+ manipulationHandle,
+ metricCategory,
+ activation,
+ ResponseTypes.Result.RESULT_FAIL,
+ TIMESTAMP_START,
+ TIMESTAMP_FINISH,
+ manipulationHandle,
+ reportActivation,
+ TIMESTAMP_IN_INTERVAL);
+ }
- final var metricState = mdibBuilder.buildRealTimeSampleArrayMetricState(metricHandle);
- metricState.setStateVersion(metricVersion);
- metricState.setActivationState(activation);
+ private void wrongMetricCategorySetup(
+ final String manipulationHandle,
+ final org.somda.sdc.biceps.model.participant.MetricCategory wrongMetricCategory,
+ final org.somda.sdc.biceps.model.participant.ComponentActivation manipulationActivation,
+ final ComponentActivation expectedActivation)
+ throws Exception {
+ final var initial = buildMdib(SEQUENCE_ID);
+ messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
+
+ final var result = ResponseTypes.Result.RESULT_SUCCESS;
+ final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
+ final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ SEQUENCE_ID, manipulationHandle, wrongMetricCategory, manipulationActivation);
+ messageStorageUtil.addManipulation(storage, TIMESTAMP_START, TIMESTAMP_FINISH, result, methodName, parameters);
+
+ final var metricReport =
+ buildMetricReport(SEQUENCE_ID, BigInteger.ONE, BigInteger.ONE, manipulationHandle, expectedActivation);
+ messageStorageUtil.addMessage(storage, buildTestMessage(TIMESTAMP_IN_INTERVAL, metricReport));
+ }
+
+ private void requirement547SetUp(
+ final String manipulationParameterHandle,
+ final org.somda.sdc.biceps.model.participant.MetricCategory manipulationParameterCategory,
+ final org.somda.sdc.biceps.model.participant.ComponentActivation manipulationParameterActivation,
+ final ResponseTypes.Result manipulationResult,
+ final long manipulationStartTimestamp,
+ final long manipulationEndTimestamp,
+ final String metricReportHandle,
+ final ComponentActivation metricReportActivation,
+ final long metricReportTimestamp)
+ throws Exception {
+ final var initial = buildMdib(SEQUENCE_ID);
+ messageStorageUtil.addInboundSecureHttpMessage(storage, initial);
- final var waveform = messageBuilder.buildWaveformStream(sequenceId, List.of(metricState));
- waveform.setMdibVersion(mdibVersion);
- return messageBuilder.createSoapMessageWithBody(ActionConstants.ACTION_WAVEFORM_STREAM, waveform);
+ final var methodName = Constants.MANIPULATION_NAME_SET_METRIC_STATUS;
+ final var parameters = ManipulationParameterUtil.buildMetricStatusManipulationParameterData(
+ MdibBuilder.DEFAULT_SEQUENCE_ID,
+ manipulationParameterHandle,
+ manipulationParameterCategory,
+ manipulationParameterActivation);
+ messageStorageUtil.addManipulation(
+ storage,
+ manipulationStartTimestamp,
+ manipulationEndTimestamp,
+ manipulationResult,
+ methodName,
+ parameters);
+
+ // activation state should be on
+ final var metricReport = buildMetricReport(
+ SEQUENCE_ID, BigInteger.TWO, BigInteger.ONE, metricReportHandle, metricReportActivation);
+ messageStorageUtil.addMessage(storage, buildTestMessage(metricReportTimestamp, metricReport));
}
}