Java Code Examples for reactor.bus.Event#wrap()

The following examples show how to use reactor.bus.Event#wrap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StopFreeIpaHandlerTest.java    From cloudbreak with Apache License 2.0 6 votes vote down vote up
@Test
public void testWhenFreeIpaDescribeTellsFreeIpaIsNotStoppableThenExceptionComesAndNoStopEventHappens() {
    String envCrn = "someCrnValue";
    EnvironmentDto environmentDto = createEnvironmentDto();
    environmentDto.setResourceCrn(envCrn);
    Event<EnvironmentDto> environmentDtoEvent = Event.wrap(environmentDto);

    when(mockDescribeFreeIpaResponse.getStatus()).thenReturn(Status.DELETED_ON_PROVIDER_SIDE);
    when(freeIpaService.describe(envCrn)).thenReturn(Optional.of(mockDescribeFreeIpaResponse));

    underTest.accept(environmentDtoEvent);

    verify(freeIpaService, times(1)).describe(any());
    verify(freeIpaService, times(1)).describe(envCrn);
    verify(eventSender, times(1)).sendEvent(any(), any());
    verify(eventSender, times(1)).sendEvent(any(EnvStopFailedEvent.class), eq(environmentDtoEvent.getHeaders()));
}
 
Example 2
Source File: StopFreeIpaHandlerTest.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldStopFreeipaGivenEnvironmentWithoutParent() {
    EnvironmentDto environmentDto = createEnvironmentDto();
    Event<EnvironmentDto> environmentDtoEvent = Event.wrap(environmentDto);

    underTest.accept(environmentDtoEvent);

    verify(freeIpaPollerService).stopAttachedFreeipaInstances(any(), any());
    verifyEnvStopEvent(environmentDtoEvent);
}
 
Example 3
Source File: StopFreeIpaHandlerTest.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotStopFreeipaGivenEnvironmentWithParent() {
    EnvironmentDto environmentDto = createEnvironmentDto();
    environmentDto.setParentEnvironmentCrn("crn:parent");
    Event<EnvironmentDto> environmentDtoEvent = Event.wrap(environmentDto);

    underTest.accept(environmentDtoEvent);

    verify(freeIpaPollerService, times(0)).stopAttachedFreeipaInstances(any(), any());
    verifyEnvStopEvent(environmentDtoEvent);
}