Fix NPE push Management UI on events (#543)

* NEP check on event.getEntity . Performance optimization on DS table.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix event tests.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* used method reference.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-06-20 17:20:22 +02:00
committed by GitHub
parent 2383aff5bf
commit 648123c1d7
11 changed files with 100 additions and 34 deletions

View File

@@ -0,0 +1,37 @@
/**
* 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.DistributionSet;
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 DistributionSetCreatedEvent")
public class DistributionSetCreatedEventTest extends AbstractRemoteEntityEventTest<DistributionSet> {
@Test
@Description("Verifies that the distribution set entity reloading by remote created event works")
public void testDistributionSetCreatedEvent() {
assertAndCreateRemoteEvent(DistributionSetCreatedEvent.class);
}
@Override
protected DistributionSet createEntity() {
return distributionSetManagement.createDistributionSet(entityFactory.distributionSet().create()
.name("incomplete").version("2").description("incomplete").type("os"));
}
}

View File

@@ -19,14 +19,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
* Test the remote entity events.
*/
@Features("Component Tests - Repository")
@Stories("Test DistributionSetCreatedEvent and DistributionSetUpdateEvent")
public class DistributionSetEventTest extends AbstractRemoteEntityEventTest<DistributionSet> {
@Test
@Description("Verifies that the distribution set entity reloading by remote created event works")
public void testDistributionSetCreatedEvent() {
assertAndCreateRemoteEvent(DistributionSetCreatedEvent.class);
}
@Stories("Test DistributionSetUpdateEvent")
public class DistributionSetUpdatedEventTest extends AbstractRemoteEntityEventTest<DistributionSet> {
@Test
@Description("Verifies that the distribution set entity reloading by remote updated event works")
@@ -34,6 +28,13 @@ public class DistributionSetEventTest extends AbstractRemoteEntityEventTest<Dist
assertAndCreateRemoteEvent(DistributionSetUpdatedEvent.class);
}
@Override
protected RemoteEntityEvent<?> createRemoteEvent(final DistributionSet baseEntity,
final Class<? extends RemoteEntityEvent<?>> eventType) {
return new DistributionSetUpdatedEvent(baseEntity, "1", true);
}
@Override
protected DistributionSet createEntity() {
return distributionSetManagement.createDistributionSet(entityFactory.distributionSet().create()