Search in sources :

Example 1 with RmiStageTimeMeasurement

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);
    }
}
Also used : RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) StageTimeMeasurement(com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement) RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 2 with RmiStageTimeMeasurement

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;
}
Also used : RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) StageTimeMeasurement(com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement) RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) LaunchStatisticsService(com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService)

Example 3 with RmiStageTimeMeasurement

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));
        }
    }
}
Also used : RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) StageTimeMeasurement(com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement) RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement)

Example 4 with RmiStageTimeMeasurement

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);
}
Also used : RmiStageTimeMeasurement(com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

RmiStageTimeMeasurement (com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement)4 StageTimeMeasurement (com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 LaunchStatisticsService (com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 NullAndEmptySource (org.junit.jupiter.params.provider.NullAndEmptySource)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1