New event strategy (#380)
* Add notfication overview for remote events Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Refactor css for notification button Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Remove todo Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - Style notfication button (css) - Add i18n message keys - Add switch slider for auto refresh event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Insert Label in MenuItem for displaying occurred events Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * - Style notfication button (css) - Add i18n message keys - Add switch slider for auto refresh event - Insert Label in MenuItem for displaying occurred events Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Solve merge conflicts and add menu item counter Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * CSS refactor Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Adapt JUnit test for events, because constructor is changed Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Skip delete event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - Insert Id for notification menu - Enable push mechanism for target and ds tag and add notfications - Fix several typos Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Add update ui events for tags and add different id's for menue item Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Insert push for SoftwareModule Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Set button enablement Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Add Software module update push event Add unit test software module push events Adapt test for software push event Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Close window and set pop id Update the target table to set the new icon Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * - several code improvements - Correct license header Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Update vaadin version Rename the base entity and redefine constructors unread counter was not correct Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Closebox of notificationButton is invisible: Insert height for HorizontalLayout of NotificationUnreadButton Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Add software modules to the new event types Signed-off-by: SirWayne <dennis.melzer@bosch-si.com> * Introduce animation in unreadNotificationButton Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com> * Fix close on safari Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Add publish events direct to the tag entities. Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
ccc23bf634
commit
2dec35915c
@@ -34,7 +34,8 @@ public class DistributionSetDeletedEvent extends RemoteIdEvent {
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public DistributionSetDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
public DistributionSetDeletedEvent(final String tenant, final Long entityId, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, entityClass, applicationId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,14 @@ public class DistributionSetTagDeletedEvent extends RemoteIdEvent {
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param entityClass
|
||||
* the entity class
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
|
||||
public DistributionSetTagDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
public DistributionSetTagDeletedEvent(final String tenant, final Long entityId, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, entityClass, applicationId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ public class RemoteIdEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
private Long entityId;
|
||||
|
||||
private String entityClass;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
@@ -32,14 +34,25 @@ public class RemoteIdEvent extends RemoteTenantAwareEvent {
|
||||
* the entity Id
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityClass
|
||||
* the entity class
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
protected RemoteIdEvent(final Long entityId, final String tenant, final String applicationId) {
|
||||
protected RemoteIdEvent(final Long entityId, final String tenant, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
this.entityClass = entityClass;
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entityClass
|
||||
*/
|
||||
public String getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
public Long getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* Defines the remote event of deleting a {@link SoftwareModule}.
|
||||
*/
|
||||
public class SoftwareModuleDeletedEvent extends RemoteIdEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SoftwareModuleDeletedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for json serialization.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param entityClass
|
||||
* the entity class
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public SoftwareModuleDeletedEvent(final String tenant, final Long entityId, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, entityClass, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,11 +32,14 @@ public class TargetDeletedEvent extends RemoteIdEvent {
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param entityClass
|
||||
* the entity class
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
public TargetDeletedEvent(final String tenant, final Long entityId, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, entityClass, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,10 +32,13 @@ public class TargetTagDeletedEvent extends RemoteIdEvent {
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param entityClass
|
||||
* the entity class
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetTagDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
public TargetTagDeletedEvent(final String tenant, final Long entityId, final String entityClass,
|
||||
final String applicationId) {
|
||||
super(entityId, tenant, entityClass, applicationId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ public class RemoteEntityEvent<E extends TenantAwareBaseEntity> extends RemoteId
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String entityClass;
|
||||
|
||||
private transient E entity;
|
||||
|
||||
/**
|
||||
@@ -50,18 +48,10 @@ public class RemoteEntityEvent<E extends TenantAwareBaseEntity> extends RemoteId
|
||||
* the origin application id
|
||||
*/
|
||||
protected RemoteEntityEvent(final E baseEntity, final String applicationId) {
|
||||
super(baseEntity.getId(), baseEntity.getTenant(), applicationId);
|
||||
this.entityClass = baseEntity.getClass().getName();
|
||||
super(baseEntity.getId(), baseEntity.getTenant(), baseEntity.getClass().getName(), applicationId);
|
||||
this.entity = baseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entityClass
|
||||
*/
|
||||
public String getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public E getEntity() {
|
||||
if (entity == null) {
|
||||
@@ -73,7 +63,7 @@ public class RemoteEntityEvent<E extends TenantAwareBaseEntity> extends RemoteId
|
||||
@SuppressWarnings("unchecked")
|
||||
private E reloadEntityFromRepository() {
|
||||
try {
|
||||
final Class<E> clazz = (Class<E>) ClassUtils.getClass(entityClass);
|
||||
final Class<E> clazz = (Class<E>) ClassUtils.getClass(getEntityClass());
|
||||
return EventEntityManagerHolder.getInstance().getEventEntityManager().findEntity(getTenant(), getEntityId(),
|
||||
clazz);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Defines the remote event of creating a new {@link SoftwareModule}.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleCreatedEvent extends RemoteEntityEvent<SoftwareModule> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SoftwareModuleCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* the software module
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public SoftwareModuleCreatedEvent(final SoftwareModule baseEntity, final String applicationId) {
|
||||
super(baseEntity, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
* Defines the remote event for updating a {@link SoftwareModule}.
|
||||
*
|
||||
*/
|
||||
public class SoftwareModuleUpdatedEvent extends RemoteEntityEvent<SoftwareModule> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SoftwareModuleUpdatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* the software module
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public SoftwareModuleUpdatedEvent(final SoftwareModule baseEntity, final String applicationId) {
|
||||
super(baseEntity, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.Optional;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DownloadProgressEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
@@ -28,6 +29,8 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdateE
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutGroupCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutGroupUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
@@ -87,6 +90,10 @@ public class EventType {
|
||||
|
||||
// download
|
||||
TYPES.put(20, DownloadProgressEvent.class);
|
||||
|
||||
TYPES.put(21, SoftwareModuleCreatedEvent.class);
|
||||
TYPES.put(22, SoftwareModuleDeletedEvent.class);
|
||||
TYPES.put(23, SoftwareModuleUpdatedEvent.class);
|
||||
}
|
||||
|
||||
private int value;
|
||||
|
||||
@@ -274,8 +274,10 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
distributionSetRepository.deleteByIdIn(toHardDelete);
|
||||
}
|
||||
|
||||
Arrays.stream(distributionSetIDs).forEach(dsId -> eventPublisher.publishEvent(
|
||||
new DistributionSetDeletedEvent(tenantAware.getCurrentTenant(), dsId, applicationContext.getId())));
|
||||
Arrays.stream(distributionSetIDs)
|
||||
.forEach(dsId -> eventPublisher
|
||||
.publishEvent(new DistributionSetDeletedEvent(tenantAware.getCurrentTenant(), dsId,
|
||||
JpaDistributionSet.class.getName(), applicationContext.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,27 +19,16 @@ import org.eclipse.hawkbit.repository.TagManagement;
|
||||
import org.eclipse.hawkbit.repository.builder.GenericTagUpdate;
|
||||
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.TagUpdate;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.jpa.builder.JpaTagCreate;
|
||||
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag;
|
||||
import org.eclipse.hawkbit.repository.jpa.rsql.RSQLUtility;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
|
||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -69,18 +58,6 @@ public class JpaTagManagement implements TagManagement {
|
||||
@Autowired
|
||||
private DistributionSetRepository distributionSetRepository;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private AfterTransactionCommitExecutor afterCommit;
|
||||
|
||||
@Autowired
|
||||
private TenantAware tenantAware;
|
||||
|
||||
@Autowired
|
||||
private VirtualPropertyReplacer virtualPropertyReplacer;
|
||||
|
||||
@@ -100,12 +77,7 @@ public class JpaTagManagement implements TagManagement {
|
||||
throw new EntityAlreadyExistsException();
|
||||
}
|
||||
|
||||
final TargetTag save = targetTagRepository.save(targetTag);
|
||||
|
||||
afterCommit.afterCommit(
|
||||
() -> eventPublisher.publishEvent(new TargetTagCreatedEvent(save, applicationContext.getId())));
|
||||
|
||||
return save;
|
||||
return targetTagRepository.save(targetTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,11 +87,8 @@ public class JpaTagManagement implements TagManagement {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
final Collection<JpaTagCreate> targetTags = (Collection) tt;
|
||||
|
||||
final List<TargetTag> save = Collections.unmodifiableList(targetTags.stream()
|
||||
return Collections.unmodifiableList(targetTags.stream()
|
||||
.map(ttc -> targetTagRepository.save(ttc.buildTargetTag())).collect(Collectors.toList()));
|
||||
afterCommit.afterCommit(() -> save.forEach(
|
||||
tag -> eventPublisher.publishEvent(new TargetTagCreatedEvent(tag, applicationContext.getId()))));
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,9 +105,6 @@ public class JpaTagManagement implements TagManagement {
|
||||
// finally delete the tag itself
|
||||
targetTagRepository.deleteByName(targetTagName);
|
||||
|
||||
afterCommit.afterCommit(() -> eventPublisher.publishEvent(
|
||||
new TargetTagDeletedEvent(tenantAware.getCurrentTenant(), tag.getId(), applicationContext.getId())));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,10 +146,7 @@ public class JpaTagManagement implements TagManagement {
|
||||
update.getDescription().ifPresent(tag::setDescription);
|
||||
update.getColour().ifPresent(tag::setColour);
|
||||
|
||||
final TargetTag save = targetTagRepository.save(tag);
|
||||
afterCommit.afterCommit(() -> eventPublisher
|
||||
.publishEvent(new TargetTagUpdateEvent(save, EventPublisherHolder.getInstance().getApplicationId())));
|
||||
return save;
|
||||
return targetTagRepository.save(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,10 +163,7 @@ public class JpaTagManagement implements TagManagement {
|
||||
update.getDescription().ifPresent(tag::setDescription);
|
||||
update.getColour().ifPresent(tag::setColour);
|
||||
|
||||
final DistributionSetTag save = distributionSetTagRepository.save(tag);
|
||||
afterCommit.afterCommit(() -> eventPublisher.publishEvent(
|
||||
new DistributionSetTagUpdateEvent(save, EventPublisherHolder.getInstance().getApplicationId())));
|
||||
return save;
|
||||
return distributionSetTagRepository.save(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,11 +183,7 @@ public class JpaTagManagement implements TagManagement {
|
||||
throw new EntityAlreadyExistsException();
|
||||
}
|
||||
|
||||
final DistributionSetTag save = distributionSetTagRepository.save(distributionSetTag);
|
||||
|
||||
afterCommit.afterCommit(() -> eventPublisher
|
||||
.publishEvent(new DistributionSetTagCreatedEvent(save, applicationContext.getId())));
|
||||
return save;
|
||||
return distributionSetTagRepository.save(distributionSetTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -238,12 +194,9 @@ public class JpaTagManagement implements TagManagement {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
final Collection<JpaTagCreate> creates = (Collection) dst;
|
||||
|
||||
final List<DistributionSetTag> save = Collections.unmodifiableList(
|
||||
return Collections.unmodifiableList(
|
||||
creates.stream().map(create -> distributionSetTagRepository.save(create.buildDistributionSetTag()))
|
||||
.collect(Collectors.toList()));
|
||||
afterCommit.afterCommit(() -> save.forEach(tag -> eventPublisher
|
||||
.publishEvent(new DistributionSetTagCreatedEvent(tag, applicationContext.getId()))));
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,10 +211,6 @@ public class JpaTagManagement implements TagManagement {
|
||||
});
|
||||
|
||||
distributionSetTagRepository.deleteByName(tagName);
|
||||
|
||||
afterCommit.afterCommit(
|
||||
() -> eventPublisher.publishEvent(new DistributionSetTagDeletedEvent(tenantAware.getCurrentTenant(),
|
||||
tag.getId(), applicationContext.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -216,8 +216,8 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
public void deleteTargets(final Collection<Long> targetIDs) {
|
||||
targetRepository.deleteByIdIn(targetIDs);
|
||||
|
||||
targetIDs.forEach(targetId -> eventPublisher.publishEvent(
|
||||
new TargetDeletedEvent(tenantAware.getCurrentTenant(), targetId, applicationContext.getId())));
|
||||
targetIDs.forEach(targetId -> eventPublisher.publishEvent(new TargetDeletedEvent(tenantAware.getCurrentTenant(),
|
||||
targetId, JpaTarget.class.getName(), applicationContext.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -347,14 +347,14 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
new DistributionSetUpdateEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
|
||||
if (isSoftDeleted(descriptorEvent)) {
|
||||
publishEventWithEventPublisher(new DistributionSetDeletedEvent(getTenant(), getId(),
|
||||
publishEventWithEventPublisher(new DistributionSetDeletedEvent(getTenant(), getId(), getClass().getName(),
|
||||
EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDeleteEvent(final DescriptorEvent descriptorEvent) {
|
||||
publishEventWithEventPublisher(new DistributionSetDeletedEvent(getTenant(), getId(),
|
||||
publishEventWithEventPublisher(new DistributionSetDeletedEvent(getTenant(), getId(), getClass().getName(),
|
||||
EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,13 @@ import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
|
||||
import org.eclipse.persistence.descriptors.DescriptorEvent;
|
||||
|
||||
/**
|
||||
* A {@link DistributionSetTag} is used to describe DistributionSet attributes
|
||||
@@ -30,7 +35,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
@Table(name = "sp_distributionset_tag", indexes = {
|
||||
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||
"name", "tenant" }, name = "uk_ds_tag"))
|
||||
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag {
|
||||
public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag, EventAwareEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaDistributionSet.class, fetch = FetchType.LAZY)
|
||||
@@ -75,4 +80,24 @@ public class JpaDistributionSetTag extends JpaTag implements DistributionSetTag
|
||||
|
||||
return Collections.unmodifiableList(assignedToDistributionSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireCreateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(
|
||||
new DistributionSetTagCreatedEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(
|
||||
new DistributionSetTagUpdateEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDeleteEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new DistributionSetTagDeletedEvent(
|
||||
getTenant(), getId(), getClass().getName(), EventPublisherHolder.getInstance().getApplicationId()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,17 @@ import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
|
||||
import org.eclipse.persistence.annotations.CascadeOnDelete;
|
||||
import org.eclipse.persistence.descriptors.DescriptorEvent;
|
||||
|
||||
/**
|
||||
* Base Software Module that is supported by OS level provisioning mechanism on
|
||||
@@ -52,7 +57,7 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
|
||||
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for
|
||||
// sub entities
|
||||
@SuppressWarnings("squid:S2160")
|
||||
public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule {
|
||||
public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implements SoftwareModule, EventAwareEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToOne
|
||||
@@ -191,4 +196,22 @@ public class JpaSoftwareModule extends AbstractJpaNamedVersionedEntity implement
|
||||
return Collections.unmodifiableList(assignedTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireCreateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(
|
||||
new SoftwareModuleCreatedEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(
|
||||
new SoftwareModuleUpdatedEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDeleteEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new SoftwareModuleDeletedEvent(getTenant(),
|
||||
getId(), getClass().getName(), EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Persistable<Lon
|
||||
|
||||
@Override
|
||||
public void fireDeleteEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(
|
||||
new TargetDeletedEvent(getTenant(), getId(), EventPublisherHolder.getInstance().getApplicationId()));
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new TargetDeletedEvent(getTenant(), getId(),
|
||||
getClass().getName(), EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,13 @@ import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetTagDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdateEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
|
||||
import org.eclipse.persistence.descriptors.DescriptorEvent;
|
||||
|
||||
/**
|
||||
* A {@link TargetTag} is used to describe Target attributes and use them also
|
||||
@@ -30,7 +35,7 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
@Table(name = "sp_target_tag", indexes = {
|
||||
@Index(name = "sp_idx_target_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||
"name", "tenant" }, name = "uk_targ_tag"))
|
||||
public class JpaTargetTag extends JpaTag implements TargetTag {
|
||||
public class JpaTargetTag extends JpaTag implements TargetTag, EventAwareEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ManyToMany(mappedBy = "tags", targetEntity = JpaTarget.class, fetch = FetchType.LAZY)
|
||||
@@ -73,4 +78,24 @@ public class JpaTargetTag extends JpaTag implements TargetTag {
|
||||
return Collections.unmodifiableList(assignedToTargets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireCreateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher()
|
||||
.publishEvent(new TargetTagCreatedEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher()
|
||||
.publishEvent(new TargetTagUpdateEvent(this, EventPublisherHolder.getInstance().getApplicationId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDeleteEvent(final DescriptorEvent descriptorEvent) {
|
||||
EventPublisherHolder.getInstance().getEventPublisher().publishEvent(new TargetTagDeletedEvent(getTenant(),
|
||||
getId(), getClass().getName(), EventPublisherHolder.getInstance().getApplicationId()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@ public class RemoteIdEventTest extends AbstractRemoteEventTest {
|
||||
|
||||
private static final long ENTITY_ID = 1L;
|
||||
|
||||
private static String TENANT = "tenant";
|
||||
|
||||
private static String ENTIY_CLASS = "EntityClass";
|
||||
|
||||
private static String NODE = "Node";
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the is ds id correct reloaded")
|
||||
public void testDistributionSetDeletedEvent() {
|
||||
@@ -53,30 +59,43 @@ public class RemoteIdEventTest extends AbstractRemoteEventTest {
|
||||
assertAndCreateRemoteEvent(TargetTagDeletedEvent.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module id is correct reloaded")
|
||||
public void testSoftwareModuleDeletedEvent() {
|
||||
assertAndCreateRemoteEvent(SoftwareModuleDeletedEvent.class);
|
||||
}
|
||||
|
||||
protected void assertAndCreateRemoteEvent(final Class<? extends RemoteIdEvent> eventType) {
|
||||
|
||||
final Constructor<?> constructor = Arrays.stream(eventType.getDeclaredConstructors())
|
||||
.filter(con -> con.getParameterCount() == 3).findAny()
|
||||
.filter(con -> con.getParameterCount() == 4).findAny()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Given event is not RemoteIdEvent compatible"));
|
||||
|
||||
try {
|
||||
final RemoteIdEvent event = (RemoteIdEvent) constructor.newInstance("tenant", ENTITY_ID, "Node");
|
||||
assertEntity(ENTITY_ID, event);
|
||||
final RemoteIdEvent event = (RemoteIdEvent) constructor.newInstance(TENANT, ENTITY_ID, ENTIY_CLASS, NODE);
|
||||
assertEntity(event);
|
||||
} catch (final ReflectiveOperationException e) {
|
||||
fail("Exception should not happen " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected RemoteIdEvent assertEntity(final long id, final RemoteIdEvent event) {
|
||||
assertThat(event.getEntityId()).isSameAs(id);
|
||||
protected RemoteIdEvent assertEntity(final RemoteIdEvent event) {
|
||||
assertThat(event.getEntityId()).isSameAs(ENTITY_ID);
|
||||
|
||||
RemoteIdEvent underTestCreatedEvent = (RemoteIdEvent) createProtoStuffEvent(event);
|
||||
assertThat(underTestCreatedEvent.getEntityId()).isEqualTo(id);
|
||||
assertDeserializeEvent(underTestCreatedEvent);
|
||||
|
||||
underTestCreatedEvent = (RemoteIdEvent) createJacksonEvent(event);
|
||||
assertThat(underTestCreatedEvent.getEntityId()).isEqualTo(id);
|
||||
assertDeserializeEvent(underTestCreatedEvent);
|
||||
|
||||
return underTestCreatedEvent;
|
||||
}
|
||||
|
||||
private void assertDeserializeEvent(final RemoteIdEvent underTestCreatedEvent) {
|
||||
assertThat(underTestCreatedEvent.getEntityId()).isEqualTo(ENTITY_ID);
|
||||
assertThat(underTestCreatedEvent.getTenant()).isEqualTo(TENANT);
|
||||
assertThat(underTestCreatedEvent.getEntityClass()).isEqualTo(ENTIY_CLASS);
|
||||
assertThat(underTestCreatedEvent.getOriginService()).isEqualTo(NODE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
* Test the remote entity events.
|
||||
*/
|
||||
@Features("Component Tests - Repository")
|
||||
@Stories("Test SoftwareModuleCreatedEvent, SoftwareModuleUpdatedEvent")
|
||||
public class SoftwareModuleEventTest extends AbstractRemoteEntityEventTest<SoftwareModule> {
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module entity reloading by remote created event works")
|
||||
public void testTargetCreatedEvent() {
|
||||
assertAndCreateRemoteEvent(SoftwareModuleCreatedEvent.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module entity reloading by remote updated event works")
|
||||
public void testTargetUpdatedEvent() {
|
||||
assertAndCreateRemoteEvent(SoftwareModuleUpdatedEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoftwareModule createEntity() {
|
||||
return testdataFactory.createSoftwareModuleApp();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEv
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
@@ -48,7 +49,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1) })
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
||||
public void controllerAddsActionStatus() {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
Target savedTarget = testdataFactory.createTarget();
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
@@ -260,7 +261,8 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
@ExpectEvents({ @Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 5),
|
||||
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2) })
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
|
||||
public void findTargetByControllerIDWithDetails() {
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("test");
|
||||
final DistributionSet set2 = testdataFactory.createDistributionSet("test2");
|
||||
|
||||
@@ -16,13 +16,17 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.SoftwareModuleDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.jpa.event.RepositoryEntityEventTest.RepositoryTestConfiguration;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.fest.assertions.api.Assertions;
|
||||
import org.junit.Before;
|
||||
@@ -110,6 +114,42 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(dsDeletedEvent.getEntityId()).isEqualTo(createDistributionSet.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module created event is published when a software module has been created")
|
||||
public void softwareModuleCreatedEventIsPublished() throws InterruptedException {
|
||||
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
|
||||
|
||||
final SoftwareModuleCreatedEvent softwareModuleCreatedEvent = eventListener
|
||||
.waitForEvent(SoftwareModuleCreatedEvent.class, 1, TimeUnit.SECONDS);
|
||||
assertThat(softwareModuleCreatedEvent).isNotNull();
|
||||
assertThat(softwareModuleCreatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module update event is published when a software module has been updated")
|
||||
public void softwareModuleUpdateEventIsPublished() throws InterruptedException {
|
||||
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
|
||||
softwareManagement
|
||||
.updateSoftwareModule(entityFactory.softwareModule().update(softwareModule.getId()).description("New"));
|
||||
|
||||
final SoftwareModuleUpdatedEvent softwareModuleUpdatedEvent = eventListener
|
||||
.waitForEvent(SoftwareModuleUpdatedEvent.class, 1, TimeUnit.SECONDS);
|
||||
assertThat(softwareModuleUpdatedEvent).isNotNull();
|
||||
assertThat(softwareModuleUpdatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies that the software module deleted event is published when a software module has been deleted")
|
||||
public void softwareModuleDeletedEventIsPublished() throws InterruptedException {
|
||||
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
|
||||
softwareManagement.deleteSoftwareModule(softwareModule.getId());
|
||||
|
||||
final SoftwareModuleDeletedEvent softwareModuleDeletedEvent = eventListener
|
||||
.waitForEvent(SoftwareModuleDeletedEvent.class, 1, TimeUnit.SECONDS);
|
||||
assertThat(softwareModuleDeletedEvent).isNotNull();
|
||||
assertThat(softwareModuleDeletedEvent.getEntityId()).isEqualTo(softwareModule.getId());
|
||||
}
|
||||
|
||||
public static class RepositoryTestConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user