Extend event for entity events (#1250)

* Extend event information by it's first interface class and improve constructing the event by providing the directly only.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Check if entity interface is assignable from TenantAwareBaseEntity.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>
This commit is contained in:
Michael Herdt
2022-04-25 15:39:44 +02:00
committed by GitHub
parent 0e6ef2e468
commit 59932b1d6f
38 changed files with 98 additions and 58 deletions

View File

@@ -18,6 +18,8 @@ import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -32,7 +34,7 @@ public class RemoteIdEventTest extends AbstractRemoteEventTest {
private static String TENANT = "tenant";
private static String ENTIY_CLASS = "EntityClass";
private static Class<? extends TenantAwareBaseEntity> ENTITY_CLASS = JpaAction.class;
private static String NODE = "Node";
@@ -56,7 +58,7 @@ public class RemoteIdEventTest extends AbstractRemoteEventTest {
@Description("Verifies that the target id is correct reloaded")
public void testTargetDeletedEvent() {
final TargetDeletedEvent deletedEvent = new TargetDeletedEvent(TENANT, ENTITY_ID, CONTROLLER_ID, ADDRESS,
ENTIY_CLASS, NODE);
ENTITY_CLASS, NODE);
assertEntity(deletedEvent);
}
@@ -85,7 +87,7 @@ public class RemoteIdEventTest extends AbstractRemoteEventTest {
.orElseThrow(() -> new IllegalArgumentException("Given event is not RemoteIdEvent compatible"));
try {
final RemoteIdEvent event = (RemoteIdEvent) constructor.newInstance(TENANT, ENTITY_ID, ENTIY_CLASS, NODE);
final RemoteIdEvent event = (RemoteIdEvent) constructor.newInstance(TENANT, ENTITY_ID, ENTITY_CLASS, NODE);
assertEntity(event);
} catch (final ReflectiveOperationException e) {
fail("Exception should not happen " + e.getMessage());