use of com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement in project abort-mission by nagyesta.
the class LaunchStatisticsServiceIntegrationTest method testInsertStageTimeMeasurementShouldInsertUniqueRecordsWhenCalledWithoutCollision.
@ParameterizedTest
@MethodSource("noCollisionInsertDataProvider")
void testInsertStageTimeMeasurementShouldInsertUniqueRecordsWhenCalledWithoutCollision(final Map<String, List<StageTimeMeasurement>> input) throws RemoteException {
// given
final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
// when
for (final Map.Entry<String, List<StageTimeMeasurement>> entry : input.entrySet()) {
final String key = entry.getKey();
final List<StageTimeMeasurement> measurementList = entry.getValue();
for (final StageTimeMeasurement measurement : measurementList) {
final boolean isCountdown = CLASS_ONLY.equals(measurement.getTestCaseId());
underTest.insertStageTimeMeasurement(contextName, key, isCountdown, new RmiStageTimeMeasurement(measurement));
}
}
// then
for (final Map.Entry<String, List<StageTimeMeasurement>> entry : input.entrySet()) {
final String matcherName = entry.getKey();
final List<StageTimeMeasurement> measurements = entry.getValue();
final TreeSet<UUID> actual = this.service.fetchAllMeasurementsForMatcher(matcherName).stream().map(RmiStageTimeMeasurement::getLaunchId).collect(Collectors.toCollection(TreeSet::new));
final TreeSet<UUID> expected = measurements.stream().map(StageTimeMeasurement::getLaunchId).collect(Collectors.toCollection(TreeSet::new));
Assertions.assertIterableEquals(expected, actual);
}
}
use of com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement in project abort-mission by nagyesta.
the class RmiBackedLaunchTelemetryDataSourceIntegrationTest method fetchAllMeasurements.
private List<StageTimeMeasurement> fetchAllMeasurements() throws RemoteException {
final List<StageTimeMeasurement> list = new ArrayList<>();
final LaunchStatisticsService serviceOuter = service;
for (final String s : service.fetchAllMatcherNames()) {
final List<RmiStageTimeMeasurement> rmiStageTimeMeasurements = serviceOuter.fetchAllMeasurementsForMatcher(s);
for (final RmiStageTimeMeasurement rmiStageTimeMeasurement : rmiStageTimeMeasurements) {
final StageTimeMeasurement toStageTimeMeasurement = rmiStageTimeMeasurement.toStageTimeMeasurement();
list.add(toStageTimeMeasurement);
}
}
return list;
}
use of com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement in project abort-mission by nagyesta.
the class AbstractInMemoryDataSourceIntegrationTest method insertAll.
protected void insertAll(final Map<String, List<StageTimeMeasurement>> input) throws RemoteException {
for (final Map.Entry<String, List<StageTimeMeasurement>> entry : input.entrySet()) {
final String matcherName = entry.getKey();
final List<StageTimeMeasurement> measurementList = entry.getValue();
for (final StageTimeMeasurement measurement : measurementList) {
final boolean isCountdown = CLASS_ONLY.equals(measurement.getTestCaseId());
service.insertStageTimeMeasurement(contextName, matcherName, isCountdown, new RmiStageTimeMeasurement(measurement));
}
}
}
use of com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement in project abort-mission by nagyesta.
the class LaunchStatisticsServiceIntegrationTest method testFetchMeasurementsForMatcherShouldReturnNoMeasurementsWhenCalledWithUnknownMatcher.
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = { METHOD_PREFIX, CLASS_NAME, MATCHER_PREFIX })
void testFetchMeasurementsForMatcherShouldReturnNoMeasurementsWhenCalledWithUnknownMatcher(final String lookup) throws RemoteException {
// given
final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
final RmiStageTimeMeasurement measurement = new RmiStageTimeMeasurement(generateMeasurement(1));
insertSingleMeasurement(MATCHER_PREFIX + 1, measurement);
// when
final List<RmiStageTimeMeasurement> actual = underTest.fetchMeasurementsFor(CONTEXT_NAME, lookup, false);
// then
Assertions.assertNotNull(actual);
Assertions.assertIterableEquals(Collections.emptyList(), actual);
}
Aggregations