Merge branch 'master' into feature_target_filtering_supports_overdue
Conflicts: hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaTargetManagement.java
This commit is contained in:
@@ -106,7 +106,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(findActionsWithStatusCountByTarget).as("wrong action size").hasSize(1);
|
||||
assertThat(findActionsWithStatusCountByTarget.get(0).getActionStatusCount()).as("wrong action status size")
|
||||
.isEqualTo(3L);
|
||||
.isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -842,8 +842,8 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
||||
// assign ds to create an action
|
||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
||||
ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||
target.getControllerId());
|
||||
ds.getId(), ActionType.SOFT,
|
||||
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME, target.getControllerId());
|
||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||
// verify preparation
|
||||
Action findAction = deploymentManagement.findAction(action.getId());
|
||||
@@ -865,8 +865,8 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
||||
// assign ds to create an action
|
||||
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
|
||||
ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||
target.getControllerId());
|
||||
ds.getId(), ActionType.FORCED,
|
||||
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME, target.getControllerId());
|
||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
|
||||
// verify perparation
|
||||
Action findAction = deploymentManagement.findAction(action.getId());
|
||||
|
||||
@@ -396,14 +396,14 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
// create a DS
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("testDs");
|
||||
// initial opt lock revision must be zero
|
||||
assertThat(ds.getOptLockRevision()).isEqualTo(1L);
|
||||
assertThat(ds.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
// create an DS meta data entry
|
||||
final DistributionSetMetadata dsMetadata = distributionSetManagement
|
||||
.createDistributionSetMetadata(new JpaDistributionSetMetadata(knownKey, ds, knownValue));
|
||||
|
||||
DistributionSet changedLockRevisionDS = distributionSetManagement.findDistributionSetById(ds.getId());
|
||||
assertThat(changedLockRevisionDS.getOptLockRevision()).isEqualTo(2L);
|
||||
assertThat(changedLockRevisionDS.getOptLockRevision()).isEqualTo(2);
|
||||
|
||||
// modifying the meta data value
|
||||
dsMetadata.setValue(knownUpdateValue);
|
||||
@@ -419,7 +419,7 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
// module so opt lock
|
||||
// revision must be three
|
||||
changedLockRevisionDS = distributionSetManagement.findDistributionSetById(ds.getId());
|
||||
assertThat(changedLockRevisionDS.getOptLockRevision()).isEqualTo(3L);
|
||||
assertThat(changedLockRevisionDS.getOptLockRevision()).isEqualTo(3);
|
||||
assertThat(changedLockRevisionDS.getLastModifiedAt()).isGreaterThan(0L);
|
||||
|
||||
// verify updated meta data contains the updated value
|
||||
|
||||
@@ -848,7 +848,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
final SoftwareModule ah = softwareManagement
|
||||
.createSoftwareModule(new JpaSoftwareModule(appType, "agent-hub", "1.0.1", null, ""));
|
||||
|
||||
assertThat(ah.getOptLockRevision()).isEqualTo(1L);
|
||||
assertThat(ah.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
final SoftwareModuleMetadata swMetadata1 = new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1);
|
||||
|
||||
@@ -858,7 +858,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
.createSoftwareModuleMetadata(Lists.newArrayList(swMetadata1, swMetadata2));
|
||||
|
||||
final SoftwareModule changedLockRevisionModule = softwareManagement.findSoftwareModuleById(ah.getId());
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(2L);
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(2);
|
||||
|
||||
assertThat(softwareModuleMetadata).hasSize(2);
|
||||
assertThat(softwareModuleMetadata.get(0)).isNotNull();
|
||||
@@ -900,7 +900,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
final SoftwareModule ah = softwareManagement
|
||||
.createSoftwareModule(new JpaSoftwareModule(appType, "agent-hub", "1.0.1", null, ""));
|
||||
// initial opt lock revision must be 1
|
||||
assertThat(ah.getOptLockRevision()).isEqualTo(1L);
|
||||
assertThat(ah.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
// create an software module meta data entry
|
||||
final List<SoftwareModuleMetadata> softwareModuleMetadata = softwareManagement.createSoftwareModuleMetadata(
|
||||
@@ -910,7 +910,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
// because we are modifying the
|
||||
// base software module
|
||||
SoftwareModule changedLockRevisionModule = softwareManagement.findSoftwareModuleById(ah.getId());
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(2L);
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(2);
|
||||
|
||||
// modifying the meta data value
|
||||
softwareModuleMetadata.get(0).setValue(knownUpdateValue);
|
||||
@@ -925,7 +925,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
// module so opt lock
|
||||
// revision must be two
|
||||
changedLockRevisionModule = softwareManagement.findSoftwareModuleById(ah.getId());
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(3L);
|
||||
assertThat(changedLockRevisionModule.getOptLockRevision()).isEqualTo(3);
|
||||
|
||||
// verify updated meta data contains the updated value
|
||||
assertThat(updated).isNotNull();
|
||||
|
||||
@@ -735,7 +735,8 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("a");
|
||||
|
||||
targAssigned = deploymentManagement.assignDistributionSet(ds, targAssigned).getAssignedEntity();
|
||||
targAssigned = Lists
|
||||
.newLinkedList(deploymentManagement.assignDistributionSet(ds, targAssigned).getAssignedEntity());
|
||||
targInstalled = deploymentManagement.assignDistributionSet(ds, targInstalled).getAssignedEntity();
|
||||
targInstalled = sendUpdateActionStatusToTargets(ds, targInstalled, Status.FINISHED, "installed");
|
||||
|
||||
@@ -863,7 +864,7 @@ public class TargetManagementSearchTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
private List<Target> sendUpdateActionStatusToTargets(final DistributionSet dsA, final Iterable<Target> targs,
|
||||
final Status status, final String... msgs) {
|
||||
final List<Target> result = new ArrayList<Target>();
|
||||
final List<Target> result = new ArrayList<>();
|
||||
for (final Target t : targs) {
|
||||
final List<Action> findByTarget = actionRepository.findByTarget((JpaTarget) t);
|
||||
for (final Action action : findByTarget) {
|
||||
|
||||
@@ -541,28 +541,30 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
@Test
|
||||
@Description("Tests the assigment of tags to the a single target.")
|
||||
public void targetTagAssignment() {
|
||||
Target t1 = testdataFactory.generateTarget("id-1", "blablub");
|
||||
final Target t1 = testdataFactory.generateTarget("id-1", "blablub");
|
||||
final int noT2Tags = 4;
|
||||
final int noT1Tags = 3;
|
||||
final List<TargetTag> t1Tags = tagManagement
|
||||
.createTargetTags(testdataFactory.generateTargetTags(noT1Tags, "tag1"));
|
||||
t1.getTags().addAll(t1Tags);
|
||||
t1 = targetManagement.createTarget(t1);
|
||||
|
||||
Target t2 = testdataFactory.generateTarget("id-2", "blablub");
|
||||
t1Tags.forEach(tag -> ((JpaTarget) t1).addTag(tag));
|
||||
|
||||
targetManagement.createTarget(t1);
|
||||
final Target t2 = testdataFactory.generateTarget("id-2", "blablub");
|
||||
final List<TargetTag> t2Tags = tagManagement
|
||||
.createTargetTags(testdataFactory.generateTargetTags(noT2Tags, "tag2"));
|
||||
t2.getTags().addAll(t2Tags);
|
||||
t2 = targetManagement.createTarget(t2);
|
||||
|
||||
t1 = targetManagement.findTargetByControllerID(t1.getControllerId());
|
||||
assertThat(t1.getTags()).as("Tag size is wrong").hasSize(noT1Tags).containsAll(t1Tags);
|
||||
assertThat(t1.getTags()).as("Tag size is wrong").hasSize(noT1Tags)
|
||||
t2Tags.forEach(tag -> ((JpaTarget) t2).addTag(tag));
|
||||
targetManagement.createTarget(t2);
|
||||
|
||||
final Target t11 = targetManagement.findTargetByControllerID(t1.getControllerId());
|
||||
assertThat(t11.getTags()).as("Tag size is wrong").hasSize(noT1Tags).containsAll(t1Tags);
|
||||
assertThat(t11.getTags()).as("Tag size is wrong").hasSize(noT1Tags)
|
||||
.doesNotContain(Iterables.toArray(t2Tags, TargetTag.class));
|
||||
|
||||
t2 = targetManagement.findTargetByControllerID(t2.getControllerId());
|
||||
assertThat(t2.getTags()).as("Tag size is wrong").hasSize(noT2Tags).containsAll(t2Tags);
|
||||
assertThat(t2.getTags()).as("Tag size is wrong").hasSize(noT2Tags)
|
||||
final Target t21 = targetManagement.findTargetByControllerID(t2.getControllerId());
|
||||
assertThat(t21.getTags()).as("Tag size is wrong").hasSize(noT2Tags).containsAll(t2Tags);
|
||||
assertThat(t21.getTags()).as("Tag size is wrong").hasSize(noT2Tags)
|
||||
.doesNotContain(Iterables.toArray(t1Tags, TargetTag.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -32,7 +31,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
@Stories("RSQL filter actions")
|
||||
public class RSQLActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
private Target target;
|
||||
private JpaTarget target;
|
||||
private JpaAction action;
|
||||
|
||||
@Before
|
||||
@@ -42,7 +41,7 @@ public class RSQLActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
targetManagement.createTarget(target);
|
||||
action = new JpaAction();
|
||||
action.setActionType(ActionType.SOFT);
|
||||
target.getActions().add(action);
|
||||
target.addAction(action);
|
||||
action.setTarget(target);
|
||||
actionRepository.save(action);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -51,7 +50,7 @@ public class RSQLActionFieldsTest extends AbstractJpaIntegrationTest {
|
||||
newAction.setActive(i % 2 == 0);
|
||||
newAction.setTarget(target);
|
||||
actionRepository.save(newAction);
|
||||
target.getActions().add(newAction);
|
||||
target.addAction(newAction);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user