Search in sources :

Example 11 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class DependencyMatcherTest method testMatchesShouldUseExactMatchWhenCalledWithString.

@ParameterizedTest
@MethodSource("inputProvider")
void testMatchesShouldUseExactMatchWhenCalledWithString(final boolean matches, final String dependency) {
    // given
    final MissionHealthCheckMatcher underTest = MissionHealthCheckMatcherBuilder.builder().dependencyWith(dependency).extractor(new StringDependencyNameExtractor()).build();
    // when
    final boolean actual = underTest.matches(MATCHING_DEPENDENCY);
    // then
    assertEquals(matches, actual);
}
Also used : StringDependencyNameExtractor(com.github.nagyesta.abortmission.core.extractor.impl.StringDependencyNameExtractor) MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class DependencyMatcherTest method testMatchesShouldThrowExceptionWhenCalledWithUnsupportedInput.

@ParameterizedTest
@NullSource
@MethodSource("unsupportedComponentProvider")
void testMatchesShouldThrowExceptionWhenCalledWithUnsupportedInput(final Object invalidInput) {
    // given
    final MissionHealthCheckMatcher underTest = MissionHealthCheckMatcherBuilder.builder().dependencyWith(MATCHING_DEPENDENCY).extractor(new StringDependencyNameExtractor()).build();
    // when
    final boolean actual = underTest.matches(invalidInput);
    // then
    assertFalse(actual);
}
Also used : StringDependencyNameExtractor(com.github.nagyesta.abortmission.core.extractor.impl.StringDependencyNameExtractor) MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) NullSource(org.junit.jupiter.params.provider.NullSource)

Example 13 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingAndMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingAndMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().and(A_CLASS_MATCHER).andAtLast(A_DEPENDENCY_MATCHER).build();
    // then
    assertEquals(AND, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(AND.name()));
    assertTrue(actual.getName().contains(REGEX));
    assertTrue(actual.getName().contains(NAME));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 14 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingEnvVariableMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingEnvVariableMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().envVariable(NAME).valuePattern(REGEX).build();
    // then
    assertEquals(ENVIRONMENT, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(NAME));
    assertTrue(actual.getName().contains(REGEX));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 15 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingDependencyMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingDependencyMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().dependency(NAME).build();
    // then
    assertEquals(DEPENDENCY, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(NAME));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Aggregations

MissionHealthCheckMatcher (com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher)47 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)29 MethodSource (org.junit.jupiter.params.provider.MethodSource)21 Test (org.junit.jupiter.api.Test)15 Registry (java.rmi.registry.Registry)7 StageTimeMeasurement (com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement)5 MissionHealthCheckEvaluator (com.github.nagyesta.abortmission.core.healthcheck.MissionHealthCheckEvaluator)4 LaunchStatisticsService (com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService)3 RemoteException (java.rmi.RemoteException)3 NullSource (org.junit.jupiter.params.provider.NullSource)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 InOrder (org.mockito.InOrder)3 TagDependencyNameExtractor (com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor)2 DependencyNameExtractor (com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor)2 StringDependencyNameExtractor (com.github.nagyesta.abortmission.core.extractor.impl.StringDependencyNameExtractor)2 StageStatisticsCollectorFactory (com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory)2 StageStatisticsSnapshot (com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot)2 MissionStatisticsCollector (com.github.nagyesta.abortmission.core.healthcheck.impl.MissionStatisticsCollector)2 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2