Fix AmqpMessageDispatcherServiceTest.testSendCancelRequest - set action tenant (#2098)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-22 17:36:07 +02:00
committed by GitHub
parent 9df68e2d97
commit 4de34eacc3
12 changed files with 42 additions and 61 deletions

View File

@@ -66,7 +66,7 @@ public class BaseAmqpService {
return ObjectUtils.isEmpty(message.getBody());
}
protected static final void logAndThrowMessageError(final Message message, final String error) {
protected static void logAndThrowMessageError(final Message message, final String error) {
log.debug("Warning! \"{}\" reported by message: {}", error, message);
throw new AmqpRejectAndDontRequeueException(error);
}

View File

@@ -90,4 +90,4 @@ public class DelayedRequeueExceptionStrategy extends ConditionalRejectingErrorHa
cause instanceof MessageConversionException ||
cause instanceof MessageHandlingException;
}
}
}

View File

@@ -27,8 +27,7 @@ public class MessageConversionExceptionHandler extends AbstractAmqpErrorHandler<
@Override
public String getErrorMessage(Throwable throwable) {
final String errorMessage = super.getErrorMessage(throwable);
//since the detailed error message lies in the first parent of current throwable we retrieve it
// and append it to the errorMessage
// since the detailed error message lies in the first parent of current throwable we retrieve it and append it to the errorMessage
final Optional<String> detailedErrorMessage = getFirstAncestralErrorMessage(throwable.getCause());
return detailedErrorMessage.isPresent() ? (detailedErrorMessage.get() + errorMessage) : errorMessage;
}

View File

@@ -224,6 +224,7 @@ class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
void testSendCancelRequest() {
final Action action = mock(Action.class);
when(action.getId()).thenReturn(1L);
when(action.getTenant()).thenReturn(TENANT);
when(action.getTarget()).thenReturn(testTarget);
final CancelTargetAssignmentEvent cancelTargetAssignmentDistributionSetEvent = new CancelTargetAssignmentEvent(
action, serviceMatcher.getBusId());