Add Target Poll Event in Service Events (#2981)
* Add Target Poll Event in Service Events Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * Target poll event to service event Signed-off-by: strailov <Stanislav.Trailov@bosch.io> --------- Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
committed by
GitHub
parent
5aafdaca6f
commit
ba3a08e560
@@ -45,6 +45,7 @@ import org.eclipse.hawkbit.repository.event.ApplicationEventFilter;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManager;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.service.TargetPollServiceEvent;
|
||||
import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
|
||||
import org.eclipse.hawkbit.repository.jpa.aspects.ExceptionMappingAspectHandler;
|
||||
import org.eclipse.hawkbit.repository.jpa.autocleanup.AutoActionCleanup;
|
||||
@@ -277,7 +278,9 @@ public class JpaRepositoryConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ApplicationEventFilter applicationEventFilter(final RepositoryProperties repositoryProperties) {
|
||||
return e -> e instanceof TargetPollEvent && !repositoryProperties.isPublishTargetPollEvent();
|
||||
return e ->
|
||||
(e instanceof TargetPollEvent || e instanceof TargetPollServiceEvent)
|
||||
&& !repositoryProperties.isPublishTargetPollEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.eclipse.hawkbit.repository.event.remote.service.TargetAssignDistribut
|
||||
import org.eclipse.hawkbit.repository.event.remote.service.TargetAttributesRequestedServiceEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.service.TargetCreatedServiceEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.service.TargetDeletedServiceEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.service.TargetPollServiceEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
@@ -78,7 +79,8 @@ class ServiceEventsTest {
|
||||
CancelTargetAssignmentEvent.class,
|
||||
TargetAttributesRequestedEvent.class,
|
||||
ActionCreatedEvent.class,
|
||||
ActionUpdatedEvent.class
|
||||
ActionUpdatedEvent.class,
|
||||
TargetPollEvent.class
|
||||
);
|
||||
assertEquals(EventPublisherHolder.SERVICE_EVENTS, expected);
|
||||
}
|
||||
@@ -130,6 +132,14 @@ class ServiceEventsTest {
|
||||
verify(streamBridge).send(eq("group"), any(CancelTargetAssignmentServiceEvent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTargetPollEventIsSent() {
|
||||
TargetPollEvent event = new TargetPollEvent();
|
||||
publisher.publishEvent(event);
|
||||
verify(streamBridge).send("fanout", event);
|
||||
verify(streamBridge).send(eq("group"), any(TargetPollServiceEvent.class));
|
||||
}
|
||||
|
||||
private Action mockAction() {
|
||||
final Action actionMock = mock(Action.class);
|
||||
final Target targetMock = mock(Target.class);
|
||||
|
||||
Reference in New Issue
Block a user