From 031cca7c1cea4dad0b37446d3ae2565aa7494f73 Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Tue, 1 Mar 2016 17:12:59 +0100 Subject: [PATCH 01/22] Removed sleep. Signed-off-by: Kai Zimmermann --- .../simulator/amqp/SpReceiverService.java | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java index 6f0ac732e..ee8ae1a0e 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java @@ -13,7 +13,6 @@ import java.util.Map; import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey; import org.eclipse.hawkbit.dmf.amqp.api.MessageType; -import org.eclipse.hawkbit.dmf.json.model.ActionStatus; import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest; import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice; import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater; @@ -139,31 +138,25 @@ public class SpReceiverService extends ReceiverService { DownloadAndUpdateRequest.class); final Long actionId = downloadAndUpdateRequest.getActionId(); - try { - Thread.sleep(1_000); - } catch (final InterruptedException e) { - LOGGER.error("Sleep interrupted", e); - } - - spSenderService.sendActionStatusMessage(tenant, ActionStatus.RUNNING, - "device Simulator retrieved update request. proceeding with simulation.", actionId); - deviceUpdater.startUpdate(tenant, thingId, actionId, downloadAndUpdateRequest.getSoftwareModules().get(0) - .getModuleVersion(), new UpdaterCallback() { - @Override - public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) { - switch (device.getResponseStatus()) { - case SUCCESSFUL: - spSenderService.finishUpdateProcess(new SimulatedUpdate(device.getTenant(), device.getId(), - actionId), "Simulation complete!"); - break; - case ERROR: - spSenderService.finishUpdateProcessWithError(new SimulatedUpdate(device.getTenant(), - device.getId(), actionId), "Simulation complete with error!"); - break; - default: - break; - } - } - }); + deviceUpdater.startUpdate(tenant, thingId, actionId, + downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), new UpdaterCallback() { + @Override + public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) { + switch (device.getResponseStatus()) { + case SUCCESSFUL: + spSenderService.finishUpdateProcess( + new SimulatedUpdate(device.getTenant(), device.getId(), actionId), + "Simulation complete!"); + break; + case ERROR: + spSenderService.finishUpdateProcessWithError( + new SimulatedUpdate(device.getTenant(), device.getId(), actionId), + "Simulation complete with error!"); + break; + default: + break; + } + } + }); } } From b7f94891a4e792fdbde780ee159a664c221e9306 Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Thu, 3 Mar 2016 10:15:59 +0100 Subject: [PATCH 02/22] Migrated to lambda --- .../simulator/amqp/SpReceiverService.java | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java index ee8ae1a0e..1c314d56f 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java @@ -14,9 +14,7 @@ import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey; import org.eclipse.hawkbit.dmf.amqp.api.MessageType; import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest; -import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice; import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater; -import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater.UpdaterCallback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.Message; @@ -139,23 +137,20 @@ public class SpReceiverService extends ReceiverService { final Long actionId = downloadAndUpdateRequest.getActionId(); deviceUpdater.startUpdate(tenant, thingId, actionId, - downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), new UpdaterCallback() { - @Override - public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) { - switch (device.getResponseStatus()) { - case SUCCESSFUL: - spSenderService.finishUpdateProcess( - new SimulatedUpdate(device.getTenant(), device.getId(), actionId), - "Simulation complete!"); - break; - case ERROR: - spSenderService.finishUpdateProcessWithError( - new SimulatedUpdate(device.getTenant(), device.getId(), actionId), - "Simulation complete with error!"); - break; - default: - break; - } + downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), (device, actionId1) -> { + switch (device.getResponseStatus()) { + case SUCCESSFUL: + spSenderService.finishUpdateProcess( + new SimulatedUpdate(device.getTenant(), device.getId(), actionId1), + "Simulation complete!"); + break; + case ERROR: + spSenderService.finishUpdateProcessWithError( + new SimulatedUpdate(device.getTenant(), device.getId(), actionId1), + "Simulation complete with error!"); + break; + default: + break; } }); } From cfe83755771f548816fea728eeadc4e6c805189a Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Thu, 3 Mar 2016 10:16:19 +0100 Subject: [PATCH 03/22] Made update execution more random --- .../org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java index 075f30ba0..2ea86fcde 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java @@ -63,7 +63,7 @@ public class DeviceSimulatorUpdater { device.setSwversion(swVersion); eventbus.post(new InitUpdate(device)); threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback), - 2000, TimeUnit.MILLISECONDS); + (new Random().nextInt(10_000) + 2000), TimeUnit.MILLISECONDS); } private static final class DeviceSimulatorUpdateThread implements Runnable { From e731543313b663ae02327882897134aa1822c78f Mon Sep 17 00:00:00 2001 From: Jonathan Philip Knoblauch Date: Thu, 3 Mar 2016 10:52:55 +0100 Subject: [PATCH 04/22] Fix for sonar rule: Fields and methods should not have conflicting names Signed-off-by: Jonathan Philip Knoblauch --- .../CreateUpdateSoftwareTypeLayout.java | 8 +- .../artifacts/state/ArtifactUploadState.java | 16 ++-- .../CreateUpdateDistSetTypeLayout.java | 4 +- .../state/ManageDistUIState.java | 16 ++-- .../DistributionAddUpdateWindowLayout.java | 30 ++++---- .../management/state/ManagementUIState.java | 20 ++--- .../rollout/AddUpdateRolloutWindowLayout.java | 76 ++++++++++--------- ...yTokenAuthenticationConfigurationItem.java | 7 +- 8 files changed, 88 insertions(+), 89 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java index b79b53ae0..dc6d1081e 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtype/CreateUpdateSoftwareTypeLayout.java @@ -438,17 +438,17 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C if (permChecker.hasUpdateDistributionPermission()) { optionValues.add(updateType.getValue()); } - createOptionGroup(optionValues); + createOptionGroupByValues(optionValues); } private void singleMultiOptionGroup() { final List optionValues = new ArrayList<>(); optionValues.add(singleAssign.getValue()); optionValues.add(multiAssign.getValue()); - assignOptionGroup(optionValues); + assignOptionGroupByValues(optionValues); } - private void createOptionGroup(final List tagOptions) { + private void createOptionGroupByValues(final List tagOptions) { createOptiongroup = new OptionGroup("", tagOptions); createOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL); createOptiongroup.addStyleName("custom-option-group"); @@ -458,7 +458,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C } } - private void assignOptionGroup(final List tagOptions) { + private void assignOptionGroupByValues(final List tagOptions) { assignOptiongroup = new OptionGroup("", tagOptions); assignOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL); assignOptiongroup.addStyleName("custom-option-group"); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadState.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadState.java index 62a09c83b..a502b341c 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadState.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/state/ArtifactUploadState.java @@ -50,9 +50,9 @@ public class ArtifactUploadState implements Serializable { private boolean swTypeFilterClosed = Boolean.FALSE; - private boolean isSwModuleTableMaximized = Boolean.FALSE; + private boolean swModuleTableMaximized = Boolean.FALSE; - private boolean isArtifactDetailsMaximized = Boolean.FALSE; + private boolean artifactDetailsMaximized = Boolean.FALSE; private final Set selectedDeleteSWModuleTypes = new HashSet<>(); @@ -152,15 +152,15 @@ public class ArtifactUploadState implements Serializable { * @return the isSwModuleTableMaximized */ public boolean isSwModuleTableMaximized() { - return isSwModuleTableMaximized; + return swModuleTableMaximized; } /** * @param isSwModuleTableMaximized * the isSwModuleTableMaximized to set */ - public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) { - this.isSwModuleTableMaximized = isSwModuleTableMaximized; + public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) { + this.swModuleTableMaximized = swModuleTableMaximized; } public Set getSelectedDeleteSWModuleTypes() { @@ -171,15 +171,15 @@ public class ArtifactUploadState implements Serializable { * @return the isArtifactDetailsMaximized */ public boolean isArtifactDetailsMaximized() { - return isArtifactDetailsMaximized; + return artifactDetailsMaximized; } /** * @param isArtifactDetailsMaximized * the isArtifactDetailsMaximized to set */ - public void setArtifactDetailsMaximized(final boolean isArtifactDetailsMaximized) { - this.isArtifactDetailsMaximized = isArtifactDetailsMaximized; + public void setArtifactDetailsMaximized(final boolean artifactDetailsMaximized) { + this.artifactDetailsMaximized = artifactDetailsMaximized; } /** diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/disttype/CreateUpdateDistSetTypeLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/disttype/CreateUpdateDistSetTypeLayout.java index 4fed0dd4b..8d609f628 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/disttype/CreateUpdateDistSetTypeLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/disttype/CreateUpdateDistSetTypeLayout.java @@ -555,10 +555,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co if (permChecker.hasUpdateDistributionPermission()) { optionValues.add(updateDistType.getValue()); } - createOptionGroup(optionValues); + createOptionGroupByValues(optionValues); } - private void createOptionGroup(final List typeOptions) { + private void createOptionGroupByValues(final List typeOptions) { createOptiongroup = new OptionGroup("", typeOptions); createOptiongroup.setId(SPUIDefinitions.CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID); createOptiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/state/ManageDistUIState.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/state/ManageDistUIState.java index 7e06a4171..ce31f649b 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/state/ManageDistUIState.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/state/ManageDistUIState.java @@ -62,9 +62,9 @@ public class ManageDistUIState implements Serializable { private final Map deleteSofwareModulesList = new HashMap<>(); - private boolean isSwModuleTableMaximized = Boolean.FALSE; + private boolean swModuleTableMaximized = Boolean.FALSE; - private boolean isDsTableMaximized = Boolean.FALSE; + private boolean dsTableMaximized = Boolean.FALSE; private final Map assignedSoftwareModuleDetails = new HashMap<>(); @@ -219,7 +219,7 @@ public class ManageDistUIState implements Serializable { * @return boolean */ public boolean isDsTableMaximized() { - return isDsTableMaximized; + return dsTableMaximized; } /*** @@ -227,8 +227,8 @@ public class ManageDistUIState implements Serializable { * * @param isDsModuleTableMaximized */ - public void setDsTableMaximized(final boolean isDsModuleTableMaximized) { - isDsTableMaximized = isDsModuleTableMaximized; + public void setDsTableMaximized(final boolean dsModuleTableMaximized) { + dsTableMaximized = dsModuleTableMaximized; } public Map getAssignedSoftwareModuleDetails() { @@ -239,15 +239,15 @@ public class ManageDistUIState implements Serializable { * @return the isSwModuleTableMaximized */ public boolean isSwModuleTableMaximized() { - return isSwModuleTableMaximized; + return swModuleTableMaximized; } /** * @param isSwModuleTableMaximized * the isSwModuleTableMaximized to set */ - public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) { - this.isSwModuleTableMaximized = isSwModuleTableMaximized; + public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) { + this.swModuleTableMaximized = swModuleTableMaximized; } /** diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java index dfdbcd9de..21914778e 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java @@ -94,8 +94,8 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { @Autowired private transient TenantMetaDataRepository tenantMetaDataRepository; - private Button saveDistribution; - private Button discardDistribution; + private Button saveDistributionButton; + private Button discardDistributionButton; private TextField distNameTextField; private TextField distVersionTextField; private Label madatoryLabel; @@ -103,7 +103,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { private CheckBox reqMigStepCheckbox; private ComboBox distsetTypeNameComboBox; private boolean editDistribution = Boolean.FALSE; - private Long editDistId = null; + private Long editDistId; private Window addDistributionWindow; private String originalDistName; private String originalDistVersion; @@ -131,9 +131,9 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeFull(); buttonsLayout.setStyleName("dist-buttons-horz-layout"); - buttonsLayout.addComponents(saveDistribution, discardDistribution); - buttonsLayout.setComponentAlignment(saveDistribution, Alignment.BOTTOM_LEFT); - buttonsLayout.setComponentAlignment(discardDistribution, Alignment.BOTTOM_RIGHT); + buttonsLayout.addComponents(saveDistributionButton, discardDistributionButton); + buttonsLayout.setComponentAlignment(saveDistributionButton, Alignment.BOTTOM_LEFT); + buttonsLayout.setComponentAlignment(discardDistributionButton, Alignment.BOTTOM_RIGHT); buttonsLayout.addStyleName("window-style"); /* @@ -186,14 +186,14 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { reqMigStepCheckbox.setId(SPUIComponetIdProvider.DIST_ADD_MIGRATION_CHECK); /* save or update button */ - saveDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true, + saveDistributionButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true, FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class); - saveDistribution.addClickListener(event -> saveDistribution()); + saveDistributionButton.addClickListener(event -> saveDistribution()); /* close button */ - discardDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", true, - FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class); - discardDistribution.addClickListener(event -> discardDistribution()); + discardDistributionButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", + true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class); + discardDistributionButton.addClickListener(event -> discardDistribution()); } /** @@ -216,7 +216,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { } private void enableSaveButton() { - saveDistribution.setEnabled(true); + saveDistributionButton.setEnabled(true); } private DistributionSetType getDefaultDistributionSetType() { @@ -226,7 +226,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { } private void disableSaveButton() { - saveDistribution.setEnabled(false); + saveDistributionButton.setEnabled(false); } private void saveDistribution() { @@ -415,7 +415,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR); descTextArea.clear(); reqMigStepCheckbox.clear(); - saveDistribution.setEnabled(true); + saveDistributionButton.setEnabled(true); removeListeners(); changedComponents.clear(); } @@ -497,7 +497,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { public void populateValuesOfDistribution(final Long editDistId) { this.editDistId = editDistId; editDistribution = Boolean.TRUE; - saveDistribution.setEnabled(false); + saveDistributionButton.setEnabled(false); final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId); if (distSet != null) { distNameTextField.setValue(distSet.getName()); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/state/ManagementUIState.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/state/ManagementUIState.java index 28fb4635f..3184bf923 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/state/ManagementUIState.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/state/ManagementUIState.java @@ -62,20 +62,20 @@ public class ManagementUIState implements Serializable { private boolean distTagFilterClosed = true; - private Long targetsTruncated = null; + private Long targetsTruncated; private final AtomicLong targetsCountAll = new AtomicLong(); - private boolean isDsTableMaximized = Boolean.FALSE; + private boolean dsTableMaximized = Boolean.FALSE; // Contains ID and NAme of last selected target private DistributionSetIdName lastSelectedDsIdName; // Contains list of ID and Names of all the selected Targets private Set selectedDsIdName = Collections.emptySet(); - private boolean isTargetTableMaximized = Boolean.FALSE; + private boolean targetTableMaximized = Boolean.FALSE; - private boolean isActionHistoryMaximized = Boolean.FALSE; + private boolean actionHistoryMaximized = Boolean.FALSE; private boolean noDataAvilableTarget = Boolean.FALSE; @@ -255,11 +255,11 @@ public class ManagementUIState implements Serializable { } public boolean isDsTableMaximized() { - return isDsTableMaximized; + return dsTableMaximized; } public void setDsTableMaximized(final boolean isDsTableMaximized) { - this.isDsTableMaximized = isDsTableMaximized; + this.dsTableMaximized = isDsTableMaximized; } public DistributionSetIdName getLastSelectedDsIdName() { @@ -282,7 +282,7 @@ public class ManagementUIState implements Serializable { * @return the isTargetTableMaximized */ public boolean isTargetTableMaximized() { - return isTargetTableMaximized; + return targetTableMaximized; } /** @@ -290,14 +290,14 @@ public class ManagementUIState implements Serializable { * the isTargetTableMaximized to set */ public void setTargetTableMaximized(final boolean isTargetTableMaximized) { - this.isTargetTableMaximized = isTargetTableMaximized; + this.targetTableMaximized = isTargetTableMaximized; } /** * @return the isActionHistoryMaximized */ public boolean isActionHistoryMaximized() { - return isActionHistoryMaximized; + return actionHistoryMaximized; } /** @@ -305,7 +305,7 @@ public class ManagementUIState implements Serializable { * the isActionHistoryMaximized to set */ public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) { - this.isActionHistoryMaximized = isActionHistoryMaximized; + this.actionHistoryMaximized = isActionHistoryMaximized; } /** diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java index d0cddfb19..3a1deaf65 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java @@ -128,7 +128,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private TextArea description; - private Button saveRollout; + private Button saveRolloutBtn; private Button discardRolllout; @@ -138,7 +138,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private Window addUpdateRolloutWindow; - private Boolean editRollout; + private Boolean editRolloutBtn; private Rollout rolloutForEdit; @@ -167,7 +167,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { * Reset the field values. */ public void resetComponents() { - editRollout = Boolean.FALSE; + editRolloutBtn = Boolean.FALSE; rolloutName.clear(); targetFilterQuery.clear(); resetFields(); @@ -212,7 +212,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { final HorizontalLayout groupLayout = new HorizontalLayout(); groupLayout.setSizeFull(); groupLayout.addComponents(noOfGroups, groupSizeLabel); - groupLayout.setExpandRatio(noOfGroups, 1.0f); + groupLayout.setExpandRatio(noOfGroups, 1.0F); groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT); return groupLayout; } @@ -221,7 +221,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { final HorizontalLayout errorThresoldLayout = new HorizontalLayout(); errorThresoldLayout.setSizeFull(); errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup); - errorThresoldLayout.setExpandRatio(errorThreshold, 1.0f); + errorThresoldLayout.setExpandRatio(errorThreshold, 1.0F); return errorThresoldLayout; } @@ -229,9 +229,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { final HorizontalLayout targetFilterLayout = new HorizontalLayout(); targetFilterLayout.setSizeFull(); targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel); - targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71f); - targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70f); - targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29f); + targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71F); + targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70F); + targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29F); targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT); return targetFilterLayout; } @@ -240,7 +240,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { final HorizontalLayout triggerThresholdLayout = new HorizontalLayout(); triggerThresholdLayout.setSizeFull(); triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel()); - triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0f); + triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0F); return triggerThresholdLayout; } @@ -254,8 +254,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private HorizontalLayout getSaveDiscardButtonLayout() { final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeFull(); - buttonsLayout.addComponents(saveRollout, discardRolllout); - buttonsLayout.setComponentAlignment(saveRollout, Alignment.BOTTOM_LEFT); + buttonsLayout.addComponents(saveRolloutBtn, discardRolllout); + buttonsLayout.setComponentAlignment(saveRolloutBtn, Alignment.BOTTOM_LEFT); buttonsLayout.setComponentAlignment(discardRolllout, Alignment.BOTTOM_RIGHT); buttonsLayout.addStyleName("window-style"); return buttonsLayout; @@ -277,7 +277,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { description = createDescription(); errorThresholdOptionGroup = createErrorThresholdOptionGroup(); setDefaultSaveStartGroupOption(); - saveRollout = createSaveButton(); + saveRolloutBtn = createSaveButton(); discardRolllout = createDiscardButton(); actionTypeOptionGroupLayout.selectDefaultOption(); @@ -383,8 +383,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private Container createTargetFilterComboContainer() { final BeanQueryFactory targetFilterQF = new BeanQueryFactory<>( TargetFilterBeanQuery.class); - return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, - SPUILabelDefinitions.VAR_NAME), targetFilterQF); + return new LazyQueryContainer( + new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_NAME), + targetFilterQF); } @@ -410,7 +411,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { } private void onRolloutSave() { - if (editRollout) { + if (editRolloutBtn) { editRollout(); } else { createRollout(); @@ -422,8 +423,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { rolloutForEdit.setName(rolloutName.getValue()); rolloutForEdit.setDescription(description.getValue()); final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue(); - rolloutForEdit.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName - .getId())); + rolloutForEdit.setDistributionSet( + distributionSetManagement.findDistributionSetById(distributionSetIdName.getId())); rolloutForEdit.setActionType(getActionType()); rolloutForEdit.setForcedTime(getForcedTimeStamp()); final int amountGroup = Integer.parseInt(noOfGroups.getValue()); @@ -453,8 +454,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private long getForcedTimeStamp() { return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup() - .getValue()) == ActionTypeOption.AUTO_FORCED) ? actionTypeOptionGroupLayout.getForcedTimeDateField() - .getValue().getTime() : Action.NO_FORCE_TIME; + .getValue()) == ActionTypeOption.AUTO_FORCED) + ? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime() + : Action.NO_FORCE_TIME; } private ActionType getActionType() { @@ -487,8 +489,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { rolloutToCreate.setName(rolloutName.getValue()); rolloutToCreate.setDescription(description.getValue()); rolloutToCreate.setTargetFilterQuery(targetFilter); - rolloutToCreate.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName - .getId())); + rolloutToCreate + .setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName.getId())); rolloutToCreate.setActionType(getActionType()); rolloutToCreate.setForcedTime(getForcedTimeStamp()); @@ -499,8 +501,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private String getTargetFilterQuery() { if (null != targetFilterQueryCombo.getValue() && HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) { - final Item filterItem = targetFilterQueryCombo.getContainerDataSource().getItem( - targetFilterQueryCombo.getValue()); + final Item filterItem = targetFilterQueryCombo.getContainerDataSource() + .getItem(targetFilterQueryCombo.getValue()); return (String) filterItem.getItemProperty("query").getValue(); } return null; @@ -568,8 +570,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private boolean duplicateCheck() { if (rolloutManagement.findRolloutByName(getRolloutName()) != null) { - uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", - new Object[] { getRolloutName() })); + uiNotification.displayValidationError( + i18n.get("message.rollout.duplicate.check", new Object[] { getRolloutName() })); return false; } return true; @@ -580,9 +582,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { } private TextArea createDescription() { - final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", - ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"), - SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); + final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY, + false, null, i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH); descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID); descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); descriptionField.setSizeFull(); @@ -647,8 +648,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private Container createDsComboContainer() { final BeanQueryFactory distributionQF = new BeanQueryFactory<>(DistBeanQuery.class); - return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, - SPUILabelDefinitions.VAR_DIST_ID_NAME), distributionQF); + return new LazyQueryContainer( + new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME), + distributionQF); } @@ -682,8 +684,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { try { if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null || HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) { - uiNotification.displayValidationError(i18n - .get("message.rollout.noofgroups.or.targetfilter.missing")); + uiNotification + .displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing")); } else { new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); final int groupSize = getGroupSize(); @@ -708,8 +710,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { public void validate(final Object value) { try { new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); - new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100).validate(Integer - .valueOf(value.toString())); + new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100) + .validate(Integer.valueOf(value.toString())); } catch (final InvalidValueException ex) { throw ex; } @@ -723,8 +725,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { public void validate(final Object value) { try { new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); - new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500).validate(Integer - .valueOf(value.toString())); + new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500) + .validate(Integer.valueOf(value.toString())); } catch (final InvalidValueException ex) { throw ex; } @@ -740,7 +742,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { */ public void populateData(final Long rolloutId) { resetComponents(); - editRollout = Boolean.TRUE; + editRolloutBtn = Boolean.TRUE; rolloutForEdit = rolloutManagement.findRolloutById(rolloutId); rolloutName.setValue(rolloutForEdit.getName()); description.setValue(rolloutForEdit.getDescription()); diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/authentication/GatewaySecurityTokenAuthenticationConfigurationItem.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/authentication/GatewaySecurityTokenAuthenticationConfigurationItem.java index 6ae002263..20865494b 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/authentication/GatewaySecurityTokenAuthenticationConfigurationItem.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/authentication/GatewaySecurityTokenAuthenticationConfigurationItem.java @@ -87,7 +87,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac // hide text field until we support multiple gateway tokens for a tenant // MECS-830 gatewayTokenNameTextField.setVisible(false); - gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged()); + gatewayTokenNameTextField.addTextChangeListener(event -> doKeyNameChanged()); final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "", ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class); @@ -117,10 +117,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac } } - /** - * @return - */ - private void keyNameChanged() { + private void doKeyNameChanged() { keyNameChanged = true; notifyConfigurationChanged(); } From da66e81157555727ae725f7f98742323a537ae2c Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Thu, 3 Mar 2016 12:51:01 +0100 Subject: [PATCH 05/22] Set proper random generation. Signed-off-by: Kai Zimmermann --- .../eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java index 2ea86fcde..b8b5011aa 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java @@ -62,8 +62,9 @@ public class DeviceSimulatorUpdater { device.setProgress(0.0); device.setSwversion(swVersion); eventbus.post(new InitUpdate(device)); + threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback), - (new Random().nextInt(10_000) + 2000), TimeUnit.MILLISECONDS); + 2_000, TimeUnit.MILLISECONDS); } private static final class DeviceSimulatorUpdateThread implements Runnable { @@ -91,7 +92,7 @@ public class DeviceSimulatorUpdater { if (newProgress < 1.0) { threadPool.schedule( new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback), - rndSleep.nextInt(3000), TimeUnit.MILLISECONDS); + rndSleep.nextInt(5_000), TimeUnit.MILLISECONDS); } else { callback.updateFinished(device, actionId); } From 7fec5c8407683f240aeb758d4dcc560e84732a6f Mon Sep 17 00:00:00 2001 From: Jonathan Philip Knoblauch Date: Mon, 7 Mar 2016 10:07:06 +0100 Subject: [PATCH 06/22] Changed name saveDistributionButton to saveDistributionBtn and discardDistributionButton to discardDistributionBtn for consistency Signed-off-by: Jonathan Philip Knoblauch --- .../DistributionAddUpdateWindowLayout.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java index 21914778e..9bbc1c05d 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java @@ -94,8 +94,8 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { @Autowired private transient TenantMetaDataRepository tenantMetaDataRepository; - private Button saveDistributionButton; - private Button discardDistributionButton; + private Button saveDistributionBtn; + private Button discardDistributionBtn; private TextField distNameTextField; private TextField distVersionTextField; private Label madatoryLabel; @@ -131,9 +131,9 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeFull(); buttonsLayout.setStyleName("dist-buttons-horz-layout"); - buttonsLayout.addComponents(saveDistributionButton, discardDistributionButton); - buttonsLayout.setComponentAlignment(saveDistributionButton, Alignment.BOTTOM_LEFT); - buttonsLayout.setComponentAlignment(discardDistributionButton, Alignment.BOTTOM_RIGHT); + buttonsLayout.addComponents(saveDistributionBtn, discardDistributionBtn); + buttonsLayout.setComponentAlignment(saveDistributionBtn, Alignment.BOTTOM_LEFT); + buttonsLayout.setComponentAlignment(discardDistributionBtn, Alignment.BOTTOM_RIGHT); buttonsLayout.addStyleName("window-style"); /* @@ -186,14 +186,14 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { reqMigStepCheckbox.setId(SPUIComponetIdProvider.DIST_ADD_MIGRATION_CHECK); /* save or update button */ - saveDistributionButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true, + saveDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true, FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class); - saveDistributionButton.addClickListener(event -> saveDistribution()); + saveDistributionBtn.addClickListener(event -> saveDistribution()); /* close button */ - discardDistributionButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", + discardDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class); - discardDistributionButton.addClickListener(event -> discardDistribution()); + discardDistributionBtn.addClickListener(event -> discardDistribution()); } /** @@ -216,7 +216,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { } private void enableSaveButton() { - saveDistributionButton.setEnabled(true); + saveDistributionBtn.setEnabled(true); } private DistributionSetType getDefaultDistributionSetType() { @@ -226,7 +226,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { } private void disableSaveButton() { - saveDistributionButton.setEnabled(false); + saveDistributionBtn.setEnabled(false); } private void saveDistribution() { @@ -415,7 +415,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR); descTextArea.clear(); reqMigStepCheckbox.clear(); - saveDistributionButton.setEnabled(true); + saveDistributionBtn.setEnabled(true); removeListeners(); changedComponents.clear(); } @@ -497,7 +497,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout { public void populateValuesOfDistribution(final Long editDistId) { this.editDistId = editDistId; editDistribution = Boolean.TRUE; - saveDistributionButton.setEnabled(false); + saveDistributionBtn.setEnabled(false); final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId); if (distSet != null) { distNameTextField.setValue(distSet.getName()); From f4791743ce51d6684c9326e39f57310d217848db Mon Sep 17 00:00:00 2001 From: SirWayne Date: Mon, 7 Mar 2016 12:18:18 +0100 Subject: [PATCH 07/22] Add test case description Signed-off-by: SirWayne --- .../eclipse/hawkbit/amqp/BaseAmqpService.java | 1 + .../repository/DeploymentManagementTest.java | 14 +- .../hawkbit/repository/TagManagementTest.java | 124 ++++++++++-------- .../rsql/RSQLDistributionSetFieldTest.java | 2 +- .../resource/SoftwareModuleResourceTest.java | 2 +- .../hawkbit/ui/components/ProxyTarget.java | 22 +--- 6 files changed, 79 insertions(+), 86 deletions(-) diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java index f418937e3..897f1ae62 100644 --- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java +++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java @@ -99,6 +99,7 @@ public class BaseAmqpService { final Object value = header.get(key); if (value == null) { logAndThrowMessageError(message, errorMessageIfNull); + return null; } return value.toString(); } diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java index 6427ca8a2..9530a61c3 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java @@ -50,7 +50,6 @@ import com.google.common.eventbus.Subscribe; import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Features; -import ru.yandex.qatools.allure.annotations.Issue; import ru.yandex.qatools.allure.annotations.Stories; /** @@ -781,12 +780,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest { targ = targetManagement.findTargetByControllerID(targ.getControllerId()); - assertEquals(0, deploymentManagement.findActiveActionsByTarget(targ).size()); - assertEquals(1, deploymentManagement.findInActiveActionsByTarget(targ).size()); + assertEquals("active target actions are wrong", 0, deploymentManagement.findActiveActionsByTarget(targ).size()); + assertEquals("active actions are wrong", 1, deploymentManagement.findInActiveActionsByTarget(targ).size()); - assertEquals(TargetUpdateStatus.IN_SYNC, targ.getTargetInfo().getUpdateStatus()); - assertEquals(dsA, targ.getAssignedDistributionSet()); - assertEquals(dsA, targ.getTargetInfo().getInstalledDistributionSet()); + assertEquals("tagret update status is not correct", TargetUpdateStatus.IN_SYNC, + targ.getTargetInfo().getUpdateStatus()); + assertEquals("wrong assigned ds", dsA, targ.getAssignedDistributionSet()); + assertEquals("wrong installed ds", dsA, targ.getTargetInfo().getInstalledDistributionSet()); targs = deploymentManagement.assignDistributionSet(dsB.getId(), new String[] { "target-id-A" }) .getAssignedTargets(); @@ -796,7 +796,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest { assertEquals("active actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size()); assertEquals("target status is wrong", TargetUpdateStatus.PENDING, targetManagement.findTargetByControllerID(targ.getControllerId()).getTargetInfo().getUpdateStatus()); - assertEquals(dsB, targ.getAssignedDistributionSet()); + assertEquals("wrong assigned ds", dsB, targ.getAssignedDistributionSet()); assertEquals("Installed ds is wrong", dsA.getId(), targetManagement.findTargetByControllerIDWithDetails(targ.getControllerId()).getTargetInfo() .getInstalledDistributionSet().getId()); diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java index b8a4db598..b1c2cf3e3 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java @@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository; import static org.fest.assertions.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.util.List; @@ -22,6 +23,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.Tag; import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TargetTag; +import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; @@ -42,6 +44,11 @@ public class TagManagementTest extends AbstractIntegrationTest { LOG = LoggerFactory.getLogger(TagManagementTest.class); } + @Before + public void setup() { + assertThat(targetTagRepository.findAll()).as("Not tags should be available").isEmpty(); + } + @Test @Description("Full DS tag lifecycle tested. Create tags, assign them to sets and delete the tags.") public void createAndAssignAndDeleteDistributionSetTags() { @@ -88,7 +95,7 @@ public class TagManagementTest extends AbstractIntegrationTest { // search for not deleted distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) .setTagNames(Lists.newArrayList(tagA.getName())); - assertEquals( + assertEquals("filter works not correct", dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) @@ -96,7 +103,7 @@ public class TagManagementTest extends AbstractIntegrationTest { distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) .setTagNames(Lists.newArrayList(tagB.getName())); - assertEquals( + assertEquals("filter works not correct", dsBs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) @@ -104,7 +111,7 @@ public class TagManagementTest extends AbstractIntegrationTest { distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) .setTagNames(Lists.newArrayList(tagC.getName())); - assertEquals( + assertEquals("filter works not correct", dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) @@ -112,22 +119,22 @@ public class TagManagementTest extends AbstractIntegrationTest { distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) .setTagNames(Lists.newArrayList(tagX.getName())); - assertEquals(0, distributionSetManagement + assertEquals("filter works not correct", 0, distributionSetManagement .findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements()); - assertEquals(5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); + assertEquals("wrong tag size", 5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); tagManagement.deleteDistributionSetTag(tagY.getName()); - assertEquals(4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); + assertEquals("wrong tag size", 4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); tagManagement.deleteDistributionSetTag(tagX.getName()); - assertEquals(3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); + assertEquals("wrong tag size", 3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); tagManagement.deleteDistributionSetTag(tagB.getName()); - assertEquals(2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); + assertEquals("wrong tag size", 2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) .setTagNames(Lists.newArrayList(tagA.getName())); - assertEquals( + assertEquals("filter works not correct", dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) @@ -135,12 +142,12 @@ public class TagManagementTest extends AbstractIntegrationTest { distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) .setTagNames(Lists.newArrayList(tagB.getName())); - assertEquals(0, distributionSetManagement + assertEquals("filter works not correct", 0, distributionSetManagement .findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements()); distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) .setTagNames(Lists.newArrayList(tagC.getName())); - assertEquals( + assertEquals("filter works not correct", dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) @@ -154,30 +161,27 @@ public class TagManagementTest extends AbstractIntegrationTest { @Test @Description("Ensures that all tags are retrieved through repository.") public void findAllTargetTags() { - assertThat(targetTagRepository.findAll()).isEmpty(); - final List tags = createTargetsWithTags(); assertThat(targetTagRepository.findAll()).isEqualTo(tagManagement.findAllTargetTags()).isEqualTo(tags) - .hasSize(20); + .as("Wrong tag size").hasSize(20); } @Test @Description("Ensures that a created tag is persisted in the repository as defined.") public void createTargetTag() { - assertThat(targetTagRepository.findAll()).isEmpty(); - final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour")); - assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2"); - assertThat(tagManagement.findTargetTag("kai1").getColour()).isEqualTo("colour"); - assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour"); + assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag founded") + .isEqualTo("kai2"); + assertThat(tagManagement.findTargetTag("kai1").getColour()).as("wrong tag founded").isEqualTo("colour"); + assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).as("wrong tag founded") + .isEqualTo("colour"); } @Test @Description("Ensures that a deleted tag is removed from the repository as defined.") public void deleteTargetTas() { - assertThat(targetTagRepository.findAll()).isEmpty(); // create test data final Iterable tags = createTargetsWithTags(); @@ -196,16 +200,13 @@ public class TagManagementTest extends AbstractIntegrationTest { assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getTags()) .doesNotContain(toDelete); } - assertThat(targetTagRepository.findOne(toDelete.getId())).isNull(); - assertThat(tagManagement.findAllTargetTags()).hasSize(19); + assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be founded").isNull(); + assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(19); } @Test @Description("Tests the name update of a target tag.") public void updateTargetTag() { - assertThat(targetTagRepository.findAll()).isEmpty(); - - // create test data final List tags = createTargetsWithTags(); // change data @@ -216,95 +217,105 @@ public class TagManagementTest extends AbstractIntegrationTest { tagManagement.updateTargetTag(savedAssigned); // check data - assertThat(tagManagement.findAllTargetTags()).hasSize(tags.size()); - assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123"); - assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2); + assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(tags.size()); + assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).as("wrong target tag is saved") + .isEqualTo("test123"); + assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()) + .as("wrong target tag is saved").isEqualTo(2); } @Test @Description("Ensures that a created tag is persisted in the repository as defined.") public void createDistributionSetTag() { - assertThat(distributionSetTagRepository.findAll()).isEmpty(); - final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour")); - assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2"); - assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).isEqualTo("colour"); - assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour"); + assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag founded") + .isEqualTo("kai2"); + assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).as("wrong tag founded") + .isEqualTo("colour"); + assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).as("wrong tag founded") + .isEqualTo("colour"); } @Test @Description("Ensures that a created tags are persisted in the repository as defined.") public void createDistributionSetTags() { - assertThat(distributionSetTagRepository.findAll()).isEmpty(); - final List tags = createDsSetsWithTags(); - assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size()); + assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags created").hasSize(tags.size()); } @Test @Description("Ensures that a deleted tag is removed from the repository as defined.") public void deleteDistributionSetTag() { - assertThat(distributionSetTagRepository.findAll()).isEmpty(); - // create test data final Iterable tags = createDsSetsWithTags(); final DistributionSetTag toDelete = tags.iterator().next(); for (final DistributionSet set : distributionSetRepository.findAll()) { assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) - .contains(toDelete); + .as("Wrong tag founded").contains(toDelete); } // delete tagManagement.deleteDistributionSetTag(tags.iterator().next().getName()); // check - assertThat(distributionSetTagRepository.findOne(toDelete.getId())).isNull(); - assertThat(tagManagement.findAllDistributionSetTags()).hasSize(19); + assertThat(distributionSetTagRepository.findOne(toDelete.getId())).as("Deleted tag should be null").isNull(); + assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags after deletion").hasSize(19); for (final DistributionSet set : distributionSetRepository.findAll()) { assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) - .doesNotContain(toDelete); + .as("Wrong founded tags").doesNotContain(toDelete); } } - @Test(expected = EntityAlreadyExistsException.class) @Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).") public void failedDuplicateTargetTagNameException() { tagManagement.createTargetTag(new TargetTag("A")); - tagManagement.createTargetTag(new TargetTag("A")); + try { + tagManagement.createTargetTag(new TargetTag("A")); + fail("Excpeted EntityAlreadyExistsException"); + } catch (final EntityAlreadyExistsException e) { + } } - @Test(expected = EntityAlreadyExistsException.class) @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).") public void failedDuplicateTargetTagNameExceptionAfterUpdate() { tagManagement.createTargetTag(new TargetTag("A")); final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B")); tag.setName("A"); - tagManagement.updateTargetTag(tag); + try { + tagManagement.updateTargetTag(tag); + fail("Excpeted EntityAlreadyExistsException"); + } catch (final EntityAlreadyExistsException e) { + } } - @Test(expected = EntityAlreadyExistsException.class) @Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).") public void failedDuplicateDsTagNameException() { tagManagement.createDistributionSetTag(new DistributionSetTag("A")); - tagManagement.createDistributionSetTag(new DistributionSetTag("A")); + try { + tagManagement.createDistributionSetTag(new DistributionSetTag("A")); + fail("Excpeted EntityAlreadyExistsException"); + } catch (final EntityAlreadyExistsException e) { + } } - @Test(expected = EntityAlreadyExistsException.class) @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).") public void failedDuplicateDsTagNameExceptionAfterUpdate() { tagManagement.createDistributionSetTag(new DistributionSetTag("A")); final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B")); tag.setName("A"); - tagManagement.updateDistributionSetTag(tag); + try { + tagManagement.updateDistributionSetTag(tag); + fail("Excpeted EntityAlreadyExistsException"); + } catch (final EntityAlreadyExistsException e) { + } } @Test @Description("Tests the name update of a target tag.") public void updateDistributionSetTag() { - assertThat(distributionSetTagRepository.findAll()).isEmpty(); // create test data final List tags = createDsSetsWithTags(); @@ -317,20 +328,19 @@ public class TagManagementTest extends AbstractIntegrationTest { tagManagement.updateDistributionSetTag(savedAssigned); // check data - assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size()); - assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123"); + assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of ds tags").hasSize(tags.size()); + assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag founded") + .isEqualTo("test123"); } @Test @Description("Ensures that all tags are retrieved through repository.") public void findDistributionSetTagsAll() { - assertThat(distributionSetTagRepository.findAll()).isEmpty(); - final List tags = createDsSetsWithTags(); // test - assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size()); - assertThat(distributionSetTagRepository.findAll()).hasSize(20); + assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags").hasSize(tags.size()); + assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags").hasSize(20); } private List createTargetsWithTags() { diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java index 40d757d15..add5419ee 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java @@ -98,7 +98,7 @@ public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest { assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==true", 4); try { assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==noExist*", 0); - fail(); + fail("Excepted RSQLParameterSyntaxException"); } catch (final RSQLParameterSyntaxException e) { } assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "=in=(true)", 4); diff --git a/hawkbit-rest-resource/src/test/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResourceTest.java b/hawkbit-rest-resource/src/test/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResourceTest.java index cf93fcba7..0b8503d6b 100644 --- a/hawkbit-rest-resource/src/test/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResourceTest.java +++ b/hawkbit-rest-resource/src/test/java/org/eclipse/hawkbit/rest/resource/SoftwareModuleResourceTest.java @@ -311,7 +311,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo .andExpect(header().string("ETag", artifact.getSha1Hash())) .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn(); - assertTrue(Arrays.equals(result.getResponse().getContentAsByteArray(), random)); + assertTrue("Wrong response content", Arrays.equals(result.getResponse().getContentAsByteArray(), random)); final MvcResult result2 = mvc .perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java index 9a374f980..d85b2bc71 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/ProxyTarget.java @@ -38,11 +38,9 @@ public class ProxyTarget extends Target { private TargetIdName targetIdName; - private Long createdAt; + private String assignedDistNameVersion; - private String assignedDistNameVersion = null; - - private String installedDistNameVersion = null; + private String installedDistNameVersion; private String pollStatusToolTip; @@ -251,22 +249,6 @@ public class ProxyTarget extends Target { this.installedDistributionSet = installedDistributionSet; } - /** - * @return the createdAt - */ - @Override - public Long getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt - * the createdAt to set - */ - public void setCreatedAt(final Long createdAt) { - this.createdAt = createdAt; - } - /** * @return the targetIdName */ From cf48ef215a0f81a8744e63c22531691f8fefcbe8 Mon Sep 17 00:00:00 2001 From: Jonathan Philip Knoblauch Date: Mon, 7 Mar 2016 13:14:40 +0100 Subject: [PATCH 08/22] Changed names for editRollout boolean and discardRolllout Button Signed-off-by: Jonathan Philip Knoblauch --- .../ui/rollout/AddUpdateRolloutWindowLayout.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java index 3a1deaf65..cdcbbcede 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/AddUpdateRolloutWindowLayout.java @@ -130,7 +130,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private Button saveRolloutBtn; - private Button discardRolllout; + private Button discardRollloutBtn; private OptionGroup errorThresholdOptionGroup; @@ -138,7 +138,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private Window addUpdateRolloutWindow; - private Boolean editRolloutBtn; + private Boolean editRolloutEnabled; private Rollout rolloutForEdit; @@ -167,7 +167,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { * Reset the field values. */ public void resetComponents() { - editRolloutBtn = Boolean.FALSE; + editRolloutEnabled = Boolean.FALSE; rolloutName.clear(); targetFilterQuery.clear(); resetFields(); @@ -254,9 +254,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { private HorizontalLayout getSaveDiscardButtonLayout() { final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSizeFull(); - buttonsLayout.addComponents(saveRolloutBtn, discardRolllout); + buttonsLayout.addComponents(saveRolloutBtn, discardRollloutBtn); buttonsLayout.setComponentAlignment(saveRolloutBtn, Alignment.BOTTOM_LEFT); - buttonsLayout.setComponentAlignment(discardRolllout, Alignment.BOTTOM_RIGHT); + buttonsLayout.setComponentAlignment(discardRollloutBtn, Alignment.BOTTOM_RIGHT); buttonsLayout.addStyleName("window-style"); return buttonsLayout; } @@ -278,7 +278,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { errorThresholdOptionGroup = createErrorThresholdOptionGroup(); setDefaultSaveStartGroupOption(); saveRolloutBtn = createSaveButton(); - discardRolllout = createDiscardButton(); + discardRollloutBtn = createDiscardButton(); actionTypeOptionGroupLayout.selectDefaultOption(); totalTargetsLabel = createTotalTargetsLabel(); @@ -411,7 +411,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { } private void onRolloutSave() { - if (editRolloutBtn) { + if (editRolloutEnabled) { editRollout(); } else { createRollout(); @@ -742,7 +742,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent { */ public void populateData(final Long rolloutId) { resetComponents(); - editRolloutBtn = Boolean.TRUE; + editRolloutEnabled = Boolean.TRUE; rolloutForEdit = rolloutManagement.findRolloutById(rolloutId); rolloutName.setValue(rolloutForEdit.getName()); description.setValue(rolloutForEdit.getDescription()); From 43d01da309f2d81b62fc29a46cb7ccfa00e3317d Mon Sep 17 00:00:00 2001 From: SirWayne Date: Mon, 7 Mar 2016 13:35:26 +0100 Subject: [PATCH 09/22] Fix typo after pull request review Signed-off-by: SirWayne --- .../hawkbit/repository/TagManagementTest.java | 31 +++++++++---------- .../rsql/RSQLDistributionSetFieldTest.java | 2 +- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java index b1c2cf3e3..eb263b242 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TagManagementTest.java @@ -172,11 +172,9 @@ public class TagManagementTest extends AbstractIntegrationTest { public void createTargetTag() { final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour")); - assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag founded") - .isEqualTo("kai2"); - assertThat(tagManagement.findTargetTag("kai1").getColour()).as("wrong tag founded").isEqualTo("colour"); - assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).as("wrong tag founded") - .isEqualTo("colour"); + assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag ed").isEqualTo("kai2"); + assertThat(tagManagement.findTargetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour"); + assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).as("wrong tag found").isEqualTo("colour"); } @Test @@ -200,7 +198,7 @@ public class TagManagementTest extends AbstractIntegrationTest { assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getTags()) .doesNotContain(toDelete); } - assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be founded").isNull(); + assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be found").isNull(); assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(19); } @@ -229,11 +227,10 @@ public class TagManagementTest extends AbstractIntegrationTest { public void createDistributionSetTag() { final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour")); - assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag founded") + assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag found") .isEqualTo("kai2"); - assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).as("wrong tag founded") - .isEqualTo("colour"); - assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).as("wrong tag founded") + assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour"); + assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).as("wrong tag found") .isEqualTo("colour"); } @@ -254,7 +251,7 @@ public class TagManagementTest extends AbstractIntegrationTest { for (final DistributionSet set : distributionSetRepository.findAll()) { assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) - .as("Wrong tag founded").contains(toDelete); + .as("Wrong tag found").contains(toDelete); } // delete @@ -265,7 +262,7 @@ public class TagManagementTest extends AbstractIntegrationTest { assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags after deletion").hasSize(19); for (final DistributionSet set : distributionSetRepository.findAll()) { assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) - .as("Wrong founded tags").doesNotContain(toDelete); + .as("Wrong found tags").doesNotContain(toDelete); } } @@ -274,7 +271,7 @@ public class TagManagementTest extends AbstractIntegrationTest { tagManagement.createTargetTag(new TargetTag("A")); try { tagManagement.createTargetTag(new TargetTag("A")); - fail("Excpeted EntityAlreadyExistsException"); + fail("Expected EntityAlreadyExistsException"); } catch (final EntityAlreadyExistsException e) { } } @@ -286,7 +283,7 @@ public class TagManagementTest extends AbstractIntegrationTest { tag.setName("A"); try { tagManagement.updateTargetTag(tag); - fail("Excpeted EntityAlreadyExistsException"); + fail("Expected EntityAlreadyExistsException"); } catch (final EntityAlreadyExistsException e) { } } @@ -296,7 +293,7 @@ public class TagManagementTest extends AbstractIntegrationTest { tagManagement.createDistributionSetTag(new DistributionSetTag("A")); try { tagManagement.createDistributionSetTag(new DistributionSetTag("A")); - fail("Excpeted EntityAlreadyExistsException"); + fail("Expected EntityAlreadyExistsException"); } catch (final EntityAlreadyExistsException e) { } } @@ -308,7 +305,7 @@ public class TagManagementTest extends AbstractIntegrationTest { tag.setName("A"); try { tagManagement.updateDistributionSetTag(tag); - fail("Excpeted EntityAlreadyExistsException"); + fail("Expected EntityAlreadyExistsException"); } catch (final EntityAlreadyExistsException e) { } } @@ -329,7 +326,7 @@ public class TagManagementTest extends AbstractIntegrationTest { // check data assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of ds tags").hasSize(tags.size()); - assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag founded") + assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag found") .isEqualTo("test123"); } diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java index add5419ee..ea1db0ed8 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/rsql/RSQLDistributionSetFieldTest.java @@ -98,7 +98,7 @@ public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest { assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==true", 4); try { assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==noExist*", 0); - fail("Excepted RSQLParameterSyntaxException"); + fail("Expected RSQLParameterSyntaxException"); } catch (final RSQLParameterSyntaxException e) { } assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "=in=(true)", 4); From 8f35b758571075349a4964341f2959576857a9e3 Mon Sep 17 00:00:00 2001 From: Jonathan Philip Knoblauch Date: Mon, 7 Mar 2016 14:44:34 +0100 Subject: [PATCH 10/22] Removed unused target parameter in method forceQuitAction and change assertEquals to assertThat Signed-off-by: Jonathan Philip Knoblauch --- .../repository/DeploymentManagement.java | 2 +- .../repository/DeploymentManagementTest.java | 23 ++++++++++--------- .../hawkbit/rest/resource/TargetResource.java | 2 +- .../actionhistory/ActionHistoryTable.java | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/DeploymentManagement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/DeploymentManagement.java index e1976c9a6..aad0839cd 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/DeploymentManagement.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/DeploymentManagement.java @@ -572,7 +572,7 @@ public class DeploymentManagement { @Modifying @Transactional @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) - public Action forceQuitAction(@NotNull final Action action, @NotNull final Target target) { + public Action forceQuitAction(@NotNull final Action action) { final Action mergedAction = entityManager.merge(action); if (!mergedAction.isCancelingOrCanceled()) { diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java index 9530a61c3..ecf079c29 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/DeploymentManagementTest.java @@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository; import static org.fest.assertions.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import java.util.ArrayList; @@ -312,7 +311,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest { deploymentManagement.cancelAction(assigningAction, target); assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId()); - deploymentManagement.forceQuitAction(assigningAction, target); + deploymentManagement.forceQuitAction(assigningAction); assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId()); @@ -350,8 +349,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest { // force quit assignment try { - deploymentManagement.forceQuitAction(assigningAction, - targetManagement.findTargetByControllerID(target.getControllerId())); + deploymentManagement.forceQuitAction(assigningAction); fail("expected ForceQuitActionNotAllowedException"); } catch (final ForceQuitActionNotAllowedException ex) { } @@ -764,13 +762,16 @@ public class DeploymentManagementTest extends AbstractIntegrationTest { distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision()); // verifying that the assignment is correct - assertEquals("Active target actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size()); - assertEquals("Target actions are wrong", 1, deploymentManagement.findActionsByTarget(targ).size()); - assertEquals("Target status is wrong", TargetUpdateStatus.PENDING, targ.getTargetInfo().getUpdateStatus()); - assertEquals("Assigned ds is wrong", dsA, targ.getAssignedDistributionSet()); - assertEquals("Active ds is wrong", dsA, - deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet()); - assertNull("Installed ds should be null", targ.getTargetInfo().getInstalledDistributionSet()); + assertThat(deploymentManagement.findActiveActionsByTarget(targ).size()).as("Active target actions are wrong") + .isEqualTo(1); + assertThat(deploymentManagement.findActionsByTarget(targ).size()).as("Target actions are wrong").isEqualTo(1); + assertThat(targ.getTargetInfo().getUpdateStatus()).as("UpdateStatus of target is wrong") + .isEqualTo(TargetUpdateStatus.PENDING); + assertThat(targ.getAssignedDistributionSet()).as("Assigned distribution set of target is wrong").isEqualTo(dsA); + assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet()) + .as("Distribution set of actionn is wrong").isEqualTo(dsA); + assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet()) + .as("Installed distribution set of action should be null").isNotNull(); final Page updAct = actionRepository.findByDistributionSet(pageReq, dsA); final Action action = updAct.getContent().get(0); diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java index 69a38f87d..faa31a7cc 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/TargetResource.java @@ -209,7 +209,7 @@ public class TargetResource implements TargetRestApi { final Action action = findActionWithExceptionIfNotFound(actionId); if (force) { - this.deploymentManagement.forceQuitAction(action, target); + this.deploymentManagement.forceQuitAction(action); } else { this.deploymentManagement.cancelAction(action, target); } diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java index f8d53b1bf..c9fa8f39c 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java @@ -844,7 +844,7 @@ public class ActionHistoryTable extends TreeTable implements Handler { if (actionId != null) { final Action activeAction = deploymentManagement.findAction(actionId); try { - deploymentManagement.forceQuitAction(activeAction, target); + deploymentManagement.forceQuitAction(activeAction); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("Force Cancel action not allowed exception :{}", e); From b54f203fadbbe33359aa20c5bd1408531c3d0750 Mon Sep 17 00:00:00 2001 From: Jonathan Philip Knoblauch Date: Mon, 7 Mar 2016 17:54:26 +0100 Subject: [PATCH 11/22] Refactored the createAndStartRolloutInAsync test Signed-off-by: Jonathan Philip Knoblauch --- .../repository/RolloutManagementTest.java | 71 +++++++++------ .../utils/MultipleInvokeHelper.java | 91 +++++++++++++++++++ .../repository/utils/SuccessCondition.java | 24 +++++ 3 files changed, 157 insertions(+), 29 deletions(-) create mode 100644 hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/MultipleInvokeHelper.java create mode 100644 hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/SuccessCondition.java diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/RolloutManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/RolloutManagementTest.java index a405e7b7d..22f9ee8b4 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/RolloutManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/RolloutManagementTest.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; import org.eclipse.hawkbit.AbstractIntegrationTest; import org.eclipse.hawkbit.TestDataUtil; @@ -34,6 +35,8 @@ import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.rsql.RSQLUtility; +import org.eclipse.hawkbit.repository.utils.MultipleInvokeHelper; +import org.eclipse.hawkbit.repository.utils.SuccessCondition; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Description; @@ -859,7 +862,7 @@ public class RolloutManagementTest extends AbstractIntegrationTest { @Test @Description("Verify the creation and the start of a rollout in asynchronous mode.") - public void createAndStartRolloutInAsync() { + public void createAndStartRolloutInAsync() throws Exception { final int amountTargetsForRollout = 500; final int amountGroups = 5; @@ -883,31 +886,18 @@ public class RolloutManagementTest extends AbstractIntegrationTest { myRollout = rolloutManagement.createRolloutAsync(myRollout, amountGroups, conditions); - int counter = 1; - int counterMax = 10; - while (!isRolloutInGivenStatus(myRollout.getId(), RolloutStatus.READY) && (counter <= counterMax)) { - try { - Thread.sleep(500); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - counter++; - } + SuccessConditionRolloutStatus conditionRolloutTargetCount = new SuccessConditionRolloutStatus( + RolloutStatus.READY); + assertThat(MultipleInvokeHelper.doWithTimeout(new RolloutStatusCallable(myRollout.getId()), + conditionRolloutTargetCount, 15000, 500)).as("Rollout status").isNotNull(); myRollout = rolloutManagement.findRolloutById(myRollout.getId()); assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.READY); rolloutManagement.startRolloutAsync(myRollout); - counter = 1; - counterMax = 10; - while (!isRolloutInGivenStatus(myRollout.getId(), RolloutStatus.RUNNING) && counter <= counterMax) { - try { - Thread.sleep(500); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - counter++; - } + conditionRolloutTargetCount = new SuccessConditionRolloutStatus(RolloutStatus.RUNNING); + assertThat(MultipleInvokeHelper.doWithTimeout(new RolloutStatusCallable(myRollout.getId()), + conditionRolloutTargetCount, 15000, 500)).as("Rollout status").isNotNull(); myRollout = rolloutManagement.findRolloutById(myRollout.getId()); assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING); @@ -917,14 +907,6 @@ public class RolloutManagementTest extends AbstractIntegrationTest { validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus); } - private boolean isRolloutInGivenStatus(final Long rolloutID, final RolloutStatus status) { - final Rollout myRollout = rolloutManagement.findRolloutById(rolloutID); - if (myRollout.getStatus() == status) { - return true; - } - return false; - } - private void validateRolloutGroupActionStatus(final RolloutGroup rolloutGroup, final Map expectedTargetCountStatus) { final RolloutGroup rolloutGroupWithDetail = rolloutGroupManagement @@ -1021,4 +1003,35 @@ public class RolloutManagementTest extends AbstractIntegrationTest { return map; } + private static class SuccessConditionRolloutStatus implements SuccessCondition { + + private final RolloutStatus rolloutStatus; + + public SuccessConditionRolloutStatus(final RolloutStatus rolloutStatus) { + this.rolloutStatus = rolloutStatus; + } + + @Override + public boolean success(final RolloutStatus result) { + return result.equals(rolloutStatus); + } + } + + private class RolloutStatusCallable implements Callable { + + final Long rolloutId; + + RolloutStatusCallable(final Long rolloutId) { + this.rolloutId = rolloutId; + } + + @Override + public RolloutStatus call() throws Exception { + + final Rollout myRollout = rolloutManagement.findRolloutById(rolloutId); + return myRollout.getStatus(); + + } + } + } diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/MultipleInvokeHelper.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/MultipleInvokeHelper.java new file mode 100644 index 000000000..362636547 --- /dev/null +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/MultipleInvokeHelper.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2011-2016 Bosch Software Innovations GmbH, Germany. All rights reserved. + */ +package org.eclipse.hawkbit.repository.utils; + +import java.util.concurrent.Callable; + +/** + * Helper to call a request multiple times regarding a given condition until + * timeout is reached. + * + * @author Jonathan Knoblauch + * + */ +public final class MultipleInvokeHelper { + + /** + * Call with timeout until result is not null. + * + * @param callable + * class + * @param timeout + * value + * @param pollInterval + * value + * @return + * @throws Exception + */ + public static T doWithTimeoutUntilResultIsNotNull(final Callable callable, final long timeout, + final long pollInterval) throws Exception // NOPMD + { + return doWithTimeout(callable, new SuccessCondition() { + @Override + public boolean success(final T result) { + return result != null; + }; + }, timeout, pollInterval); + } + + /** + * Call with timeout. + * + * @param callable + * class + * @param successCondition + * class + * @param timeout + * value + * @param pollInterval + * value + * @return + * @throws Exception + */ + public static T doWithTimeout(final Callable callable, final SuccessCondition successCondition, + final long timeout, final long pollInterval) throws Exception // NOPMD + { + + if (pollInterval < 0) { + throw new IllegalArgumentException("pollInterval must non negative"); + } + + long duration = 0; + Exception exception = null; + T returnValue = null; + while (untilTimeoutReached(timeout, duration)) { + try { + returnValue = callable.call(); + // clear exception + exception = null; + } catch (final Exception ex) { + exception = ex; + } + Thread.sleep(pollInterval); + duration += pollInterval > 0 ? pollInterval : 1; + if (exception == null && successCondition.success(returnValue)) { + return returnValue; + } else { + returnValue = null; + } + } + if (exception != null) { + throw exception; + } + return returnValue; + } + + private static boolean untilTimeoutReached(final long timeout, final long duration) { + return duration <= timeout || timeout < 0; + } + +} diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/SuccessCondition.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/SuccessCondition.java new file mode 100644 index 000000000..a22cdbdfe --- /dev/null +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/utils/SuccessCondition.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2011-2015 Bosch Software Innovations GmbH, Germany. All rights reserved. + */ +package org.eclipse.hawkbit.repository.utils; + +/** + * SuccessCondition Interface. + * + * @author Dennis Melzer + * + * @param + * type of the value to get verified + */ +public interface SuccessCondition { + + /** + * The implementation of the success condition. + * + * @param result + * @return + */ + boolean success(final T result); + +} From 6c74c1186dbd95bc57ac1661ffc3e863d81c1b9f Mon Sep 17 00:00:00 2001 From: SirWayne Date: Tue, 8 Mar 2016 12:23:31 +0100 Subject: [PATCH 12/22] Create unit test for the json amqp message conversion Signed-off-by: SirWayne --- .../eclipse/hawkbit/amqp/BaseAmqpService.java | 8 +- .../amqp/AmqpMessageHandlerServiceTest.java | 1 + .../hawkbit/amqp/BaseAmqpServiceTest.java | 103 ++++++++++++++++++ 3 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java index 897f1ae62..8a054165b 100644 --- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java +++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java @@ -58,8 +58,8 @@ public class BaseAmqpService { * @return the converted object */ @SuppressWarnings("unchecked") - protected T convertMessage(final Message message, final Class clazz) { - if (message == null) { + public T convertMessage(final Message message, final Class clazz) { + if (message == null || message.getBody() == null) { return null; } message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME, @@ -78,8 +78,8 @@ public class BaseAmqpService { * @return the list of converted objects */ @SuppressWarnings("unchecked") - protected List convertMessageList(final Message message, final Class clazz) { - if (message == null) { + public List convertMessageList(final Message message, final Class clazz) { + if (message == null || message.getBody() == null) { return Collections.emptyList(); } message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME, diff --git a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java index 79a39a40a..9d6ae3ba7 100644 --- a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java +++ b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java @@ -116,6 +116,7 @@ public class AmqpMessageHandlerServiceTest { } + @Test @Description("Tests not allowed content-type in message") public void testWrongContentType() { final MessageProperties messageProperties = new MessageProperties(); diff --git a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java new file mode 100644 index 000000000..0bd8c164b --- /dev/null +++ b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/BaseAmqpServiceTest.java @@ -0,0 +1,103 @@ +/** + * 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.amqp; + +import static org.fest.assertions.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.hawkbit.dmf.json.model.ActionUpdateStatus; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.MessageProperties; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; + +import ru.yandex.qatools.allure.annotations.Description; +import ru.yandex.qatools.allure.annotations.Features; +import ru.yandex.qatools.allure.annotations.Stories; + +@RunWith(MockitoJUnitRunner.class) +@Features("Component Tests - Device Management Federation API") +@Stories("Base Amqp Service Test") +public class BaseAmqpServiceTest { + + @Mock + private RabbitTemplate rabbitTemplate; + + private BaseAmqpService baseAmqpService; + + @Before + public void setup() { + when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter()); + baseAmqpService = new BaseAmqpService(rabbitTemplate); + + } + + @Test + @Description("Verify that the message conversion works") + public void convertMessageTest() { + final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus(); + actionUpdateStatus.setActionId(1L); + actionUpdateStatus.setSoftwareModuleId(2L); + + final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatus, + new MessageProperties()); + ActionUpdateStatus convertedActionUpdateStatus = baseAmqpService.convertMessage(message, + ActionUpdateStatus.class); + + assertThat(convertedActionUpdateStatus).as("Converted Action Status is wrong") + .isEqualsToByComparingFields(actionUpdateStatus); + + convertedActionUpdateStatus = baseAmqpService.convertMessage(null, ActionUpdateStatus.class); + assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message is null").isNull(); + + convertedActionUpdateStatus = baseAmqpService.convertMessage(new Message(null, new MessageProperties()), + ActionUpdateStatus.class); + assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message body is null") + .isNull(); + } + + @Test + @Description("Verify that a conversion of a list from a message works") + public void convertMessageListTest() { + final List actionUpdateStatusList = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus(); + actionUpdateStatus.setActionId(Long.valueOf(i)); + actionUpdateStatus.setSoftwareModuleId(Long.valueOf(i)); + actionUpdateStatusList.add(actionUpdateStatus); + } + + final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatusList, + new MessageProperties()); + List convertedActionUpdateStatus = baseAmqpService.convertMessageList(message, + ActionUpdateStatus.class); + + assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong") + .hasSameClassAs(actionUpdateStatusList); + assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong") + .hasSameSizeAs(actionUpdateStatusList); + + convertedActionUpdateStatus = baseAmqpService.convertMessageList(null, ActionUpdateStatus.class); + assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message is null").isEmpty(); + + convertedActionUpdateStatus = baseAmqpService.convertMessageList(new Message(null, new MessageProperties()), + ActionUpdateStatus.class); + assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message body is null") + .isEmpty(); + } + +} From b1894e1d1db317c41bfd69e5f421e80329b4362d Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Tue, 8 Mar 2016 12:41:13 +0100 Subject: [PATCH 13/22] Removed libraries out of test that where already covered by compile and provided --- 3rd-dependencies/listDeps.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/3rd-dependencies/listDeps.sh b/3rd-dependencies/listDeps.sh index 3f6dddbd5..dfb5b942c 100755 --- a/3rd-dependencies/listDeps.sh +++ b/3rd-dependencies/listDeps.sh @@ -6,3 +6,6 @@ find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:test'|sor find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:provided'|sort|uniq > 3rd-dependencies/provided.txt find . -name dependencies.txt|while read i; do rm $i;done cd 3rd-dependencies/ +cat compile.txt provided.txt|cut -d':' -f1-4|while read i; do grep -h $i test.txt;done|sort|uniq|while read x; do sed -i.bak -e s/$x// test.txt ;done +sed -i.bak '/^[[:space:]]*$/d' test.txt +rm *.bak From 692a7fbdcacd1b552770c2b419e78ce638a916e1 Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Tue, 8 Mar 2016 13:41:18 +0100 Subject: [PATCH 14/22] Upgraded identified libs for 0.2 --- 3rd-dependencies/compile.txt | 141 ++++++++++++++++++++-------------- 3rd-dependencies/provided.txt | 10 +-- 3rd-dependencies/test.txt | 43 +++-------- 3 files changed, 100 insertions(+), 94 deletions(-) diff --git a/3rd-dependencies/compile.txt b/3rd-dependencies/compile.txt index c8c59904e..6969c7735 100644 --- a/3rd-dependencies/compile.txt +++ b/3rd-dependencies/compile.txt @@ -1,74 +1,95 @@ aopalliance:aopalliance:jar:1.0:compile - com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile - com.fasterxml.jackson.core:jackson-core:jar:2.5.0:compile - com.fasterxml.jackson.core:jackson-databind:jar:2.5.0:compile - com.fasterxml:classmate:jar:1.3.0:compile - com.google.guava:guava:jar:18.0:compile - com.h2database:h2:jar:1.4.186:compile + ch.qos.logback:logback-classic:jar:1.1.3:compile + ch.qos.logback:logback-core:jar:1.1.3:compile + com.fasterxml.jackson.core:jackson-annotations:jar:2.5.5:compile + com.fasterxml.jackson.core:jackson-core:jar:2.5.5:compile + com.fasterxml.jackson.core:jackson-databind:jar:2.5.5:compile + com.fasterxml:classmate:jar:1.1.0:compile + com.fasterxml:classmate:jar:1.2.0:compile + com.google.collections:google-collections:jar:1.0-rc2:compile + com.google.guava:guava:jar:19.0:compile + com.h2database:h2:jar:1.4.190:compile + com.jayway.jsonpath:json-path:jar:0.9.1:compile + com.netflix.feign:feign-core:jar:8.12.1:compile + com.netflix.feign:feign-core:jar:8.14.2:compile + com.netflix.feign:feign-jackson:jar:8.14.1:compile + com.netflix.feign:feign-ribbon:jar:8.1.1:compile + com.netflix.feign:feign-slf4j:jar:8.1.1:compile + com.netflix.ribbon:ribbon-core:jar:2.0.0:compile + com.netflix.ribbon:ribbon-httpclient:jar:2.0.0:compile + com.netflix.ribbon:ribbon-loadbalancer:jar:2.0.0:compile + com.netflix.ribbon:ribbon:jar:2.0.0:compile com.rabbitmq:amqp-client:jar:3.5.5:compile com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.7.vaadin1:compile com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile com.vaadin.external.google:guava:jar:16.0.1.vaadin1:compile com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:jar:0.0.10.vaadin1:compile - com.vaadin:vaadin-push:jar:7.5.7:compile - com.vaadin:vaadin-sass-compiler:jar:0.9.12:compile - com.vaadin:vaadin-server:jar:7.5.7:compile - com.vaadin:vaadin-shared:jar:7.5.7:compile + com.vaadin:vaadin-client-compiled:jar:7.6.3:compile + com.vaadin:vaadin-push:jar:7.6.3:compile + com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile + com.vaadin:vaadin-server:jar:7.6.3:compile + com.vaadin:vaadin-shared:jar:7.6.3:compile + com.vaadin:vaadin-spring-boot-starter:jar:1.0.0:compile com.vaadin:vaadin-spring-boot:jar:1.0.0:compile com.vaadin:vaadin-spring:jar:1.0.0:compile - com.vaadin:vaadin-themes:jar:7.5.7:compile + com.vaadin:vaadin-themes:jar:7.6.3:compile + com.yahoo.platform.yui:yuicompressor:jar:2.4.8:compile commons-io:commons-io:jar:2.4:compile cz.jirutka.rsql:rsql-parser:jar:2.0.0:compile + io.reactivex:rxjava:jar:1.0.11:compile io.springfox:springfox-core:jar:2.0.3:compile - io.springfox:springfox-schema:jar:2.0.3:compile - io.springfox:springfox-spi:jar:2.0.3:compile - io.springfox:springfox-spring-web:jar:2.0.3:compile - io.springfox:springfox-swagger-common:jar:2.0.3:compile - io.springfox:springfox-swagger2:jar:2.0.3:compile - io.swagger:swagger-annotations:jar:1.5.0:compile - io.swagger:swagger-models:jar:1.5.0:compile javax.servlet:javax.servlet-api:jar:3.1.0:compile javax.transaction:javax.transaction-api:jar:1.2:compile javax.validation:validation-api:jar:1.1.0.Final:compile joda-time:joda-time:jar:2.5:compile net._01001111:jlorem:jar:1.1:compile + net.minidev:json-smart:jar:1.2:compile org.apache.commons:commons-lang3:jar:3.4:compile org.apache.commons:commons-pool2:jar:2.2:compile org.apache.logging.log4j:log4j-api:jar:2.1:compile org.apache.logging.log4j:log4j-core:jar:2.1:compile org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile - org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile - org.apache.tomcat:tomcat-juli:jar:8.0.28:compile + org.apache.tomcat:tomcat-jdbc:jar:8.0.30:compile + org.apache.tomcat:tomcat-juli:jar:8.0.30:compile org.aspectj:aspectjrt:jar:1.8.5:compile org.aspectj:aspectjweaver:jar:1.8.5:compile - org.eclipse.persistence:javax.persistence:jar:2.1.0:compile - org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.6.0:compile - org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.0:compile - org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.0:compile - org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.6.0:compile - org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.6.0:compile + org.eclipse.persistence:javax.persistence:jar:2.1.1:compile + org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.6.2:compile + org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.2:compile + org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.2:compile + org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.6.2:compile + org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.6.2:compile org.flywaydb:flyway-core:jar:3.1:compile org.glassfish:javax.json:jar:1.0.4:compile - org.hibernate:hibernate-validator:jar:5.2.2.Final:compile + org.hibernate:hibernate-validator:jar:5.2.4.Final:compile org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile - org.jsoup:jsoup:jar:1.8.1:compile - org.mapstruct:mapstruct:jar:1.0.0.Beta4:compile - org.mongodb:mongo-java-driver:jar:3.0.2:compile + org.json:json:jar:20141113:compile + org.jsoup:jsoup:jar:1.8.3:compile + org.mongodb:mongo-java-driver:jar:3.2.2:compile org.objenesis:objenesis:jar:2.1:compile - org.slf4j:jcl-over-slf4j:jar:1.7.12:compile - org.slf4j:jul-to-slf4j:jar:1.7.12:compile - org.slf4j:slf4j-api:jar:1.7.7:compile + org.slf4j:jcl-over-slf4j:jar:1.7.13:compile + org.slf4j:jul-to-slf4j:jar:1.7.13:compile + org.slf4j:log4j-over-slf4j:jar:1.7.13:compile + org.slf4j:slf4j-api:jar:1.7.13:compile org.springframework.amqp:spring-amqp:jar:1.4.6.RELEASE:compile org.springframework.amqp:spring-rabbit:jar:1.4.6.RELEASE:compile - org.springframework.boot:spring-boot-autoconfigure:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter-aop:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter-web:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot-starter:jar:1.2.7.RELEASE:compile - org.springframework.boot:spring-boot:jar:1.2.7.RELEASE:compile + org.springframework.boot:spring-boot-autoconfigure:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-configuration-processor:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-aop:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-logging:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter-web:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot-starter:jar:1.2.8.RELEASE:compile + org.springframework.boot:spring-boot:jar:1.2.8.RELEASE:compile + org.springframework.cloud:spring-cloud-commons:jar:1.0.5.RELEASE:compile + org.springframework.cloud:spring-cloud-context:jar:1.0.5.RELEASE:compile + org.springframework.cloud:spring-cloud-netflix-core:jar:1.0.7.RELEASE:compile + org.springframework.cloud:spring-cloud-starter-feign:jar:1.0.6.RELEASE:compile + org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.0.6.RELEASE:compile + org.springframework.cloud:spring-cloud-starter:jar:1.0.5.RELEASE:compile org.springframework.data:spring-data-commons:jar:1.10.1.RELEASE:compile org.springframework.data:spring-data-jpa:jar:1.8.1.RELEASE:compile org.springframework.data:spring-data-mongodb:jar:1.7.1.RELEASE:compile @@ -77,29 +98,33 @@ org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:compile org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile org.springframework.retry:spring-retry:jar:1.1.2.RELEASE:compile - org.springframework.security:spring-security-aspects:jar:3.2.8.RELEASE:compile - org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:compile - org.springframework.security:spring-security-core:jar:3.2.8.RELEASE:compile - org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:compile - org.springframework:spring-aop:jar:4.1.8.RELEASE:compile - org.springframework:spring-aspects:jar:4.1.8.RELEASE:compile - org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - org.springframework:spring-context-support:jar:4.1.8.RELEASE:compile - org.springframework:spring-context:jar:4.1.8.RELEASE:compile - org.springframework:spring-core:jar:4.1.8.RELEASE:compile - org.springframework:spring-expression:jar:4.1.8.RELEASE:compile - org.springframework:spring-jdbc:jar:4.1.8.RELEASE:compile - org.springframework:spring-messaging:jar:4.1.8.RELEASE:compile - org.springframework:spring-orm:jar:4.1.8.RELEASE:compile - org.springframework:spring-tx:jar:4.1.8.RELEASE:compile - org.springframework:spring-web:jar:4.1.8.RELEASE:compile - org.springframework:spring-webmvc:jar:4.1.8.RELEASE:compile + org.springframework.security:spring-security-aspects:jar:3.2.9.RELEASE:compile + org.springframework.security:spring-security-config:jar:3.2.9.RELEASE:compile + org.springframework.security:spring-security-core:jar:3.2.9.RELEASE:compile + org.springframework.security:spring-security-crypto:jar:3.2.9.RELEASE:compile + org.springframework.security:spring-security-web:jar:3.2.9.RELEASE:compile + org.springframework:spring-aop:jar:4.1.9.RELEASE:compile + org.springframework:spring-aspects:jar:4.1.9.RELEASE:compile + org.springframework:spring-beans:jar:4.1.9.RELEASE:compile + org.springframework:spring-context-support:jar:4.1.9.RELEASE:compile + org.springframework:spring-context:jar:4.1.9.RELEASE:compile + org.springframework:spring-core:jar:4.1.9.RELEASE:compile + org.springframework:spring-expression:jar:4.1.9.RELEASE:compile + org.springframework:spring-jdbc:jar:4.1.9.RELEASE:compile + org.springframework:spring-messaging:jar:4.1.9.RELEASE:compile + org.springframework:spring-orm:jar:4.1.9.RELEASE:compile + org.springframework:spring-tx:jar:4.1.9.RELEASE:compile + org.springframework:spring-web:jar:4.1.9.RELEASE:compile + org.springframework:spring-webmvc:jar:4.1.9.RELEASE:compile org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.4.0.1:compile + org.vaadin.addons:contextmenu:jar:4.5:compile org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile org.vaadin.addons:tokenfield:jar:7.0.1:compile + org.vaadin.alump.distributionbar:dbar-addon:jar:1.2.0:compile org.vaadin.spring.addons:vaadin-spring-addon-eventbus:jar:0.0.6.RELEASE:compile org.vaadin.spring.extensions:vaadin-spring-ext-core:jar:0.0.6.RELEASE:compile org.vaadin.spring.extensions:vaadin-spring-ext-security:jar:0.0.6.RELEASE:compile org.w3c.css:sac:jar:1.3:compile org.yaml:snakeyaml:jar:1.14:compile redis.clients:jedis:jar:2.5.2:compile + rhino:js:jar:1.7R2:compile diff --git a/3rd-dependencies/provided.txt b/3rd-dependencies/provided.txt index 84074c22c..48ea20ba5 100644 --- a/3rd-dependencies/provided.txt +++ b/3rd-dependencies/provided.txt @@ -1,6 +1,6 @@ javax.servlet:javax.servlet-api:jar:3.1.0:provided - org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.28:provided - org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:provided - org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.28:provided - org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.28:provided - org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.7.RELEASE:provided + org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.30:provided + org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.30:provided + org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.30:provided + org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.30:provided + org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.8.RELEASE:provided diff --git a/3rd-dependencies/test.txt b/3rd-dependencies/test.txt index 83d519ac8..dc4f579ea 100644 --- a/3rd-dependencies/test.txt +++ b/3rd-dependencies/test.txt @@ -1,55 +1,36 @@ - com.fasterxml.jackson.core:jackson-core:jar:2.5.0:test - com.fasterxml.jackson.core:jackson-databind:jar:2.5.0:test com.github.fge:btf:jar:1.2:test com.github.fge:jackson-coreutils:jar:1.6:test com.github.fge:json-patch:jar:1.7:test com.github.fge:msg-simple:jar:1.1:test com.google.code.findbugs:jsr305:jar:2.0.1:test - com.h2database:h2:jar:1.4.186:test - com.jayway.jsonpath:json-path:jar:0.9.1:test + com.sun.jersey:jersey-client:jar:1.18.1:test + com.sun.jersey:jersey-core:jar:1.13:test commons-beanutils:commons-beanutils-core:jar:1.8.3:test - commons-io:commons-io:jar:2.4:test commons-logging:commons-logging:jar:1.1.1:test - de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.0:test - de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.0:test - io.swagger:swagger-annotations:jar:1.5.0:test + de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.2:test + de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.1:test javax.el:javax.el-api:jar:2.2.4:test junit:junit:jar:4.12:test net.java.dev.jna:jna-platform:jar:4.0.0:test - net.java.dev.jna:jna:jar:3.3.0:test net.java.dev.jna:jna:jar:4.0.0:test - net.java.dev.jna:jna:jar:platform:3.3.0:test - net.minidev:json-smart:jar:1.2:test org.apache.commons:commons-compress:jar:1.3:test - org.apache.commons:commons-lang3:jar:3.1:test org.apache.tika:tika-core:jar:1.7:test - org.aspectj:aspectjrt:jar:1.8.5:test org.atteo:evo-inflector:jar:1.2.1:test org.easytesting:fest-assert-core:jar:2.0M10:test org.easytesting:fest-assert:jar:1.4:test org.easytesting:fest-util:jar:1.2.5:test org.hamcrest:hamcrest-core:jar:1.3:test org.hamcrest:hamcrest-library:jar:1.3:test - org.json:json:jar:20141113:test org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.9.3:test - org.mariadb.jdbc:mariadb-java-client:jar:1.2.3:test + org.mariadb.jdbc:mariadb-java-client:jar:1.3.5:test org.mockito:mockito-core:jar:1.10.19:test - org.objenesis:objenesis:jar:2.1:test - org.springframework.boot:spring-boot-starter-test:jar:1.2.7.RELEASE:test + org.springframework.boot:spring-boot-starter-test:jar:1.2.8.RELEASE:test org.springframework.data:spring-data-rest-core:jar:2.3.1.RELEASE:test org.springframework.data:spring-data-rest-webmvc:jar:2.3.1.RELEASE:test - org.springframework.hateoas:spring-hateoas:jar:0.16.0.RELEASE:test - org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:test - org.springframework.security:spring-security-aspects:jar:3.2.8.RELEASE:test - org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:test - org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:test - org.springframework:spring-context-support:jar:4.1.8.RELEASE:test - org.springframework:spring-test:jar:4.1.8.RELEASE:test - org.springframework:spring-web:jar:4.1.8.RELEASE:test - org.springframework:spring-webmvc:jar:4.1.8.RELEASE:test - ru.yandex.qatools.allure:allure-java-adaptor-api:jar:1.4.15:test - ru.yandex.qatools.allure:allure-java-annotations:jar:1.4.15:test - ru.yandex.qatools.allure:allure-java-aspects:jar:1.4.15:test - ru.yandex.qatools.allure:allure-junit-adaptor:jar:1.4.15:test - ru.yandex.qatools.allure:allure-model:jar:1.4.15:test + org.springframework:spring-test:jar:4.1.9.RELEASE:test + ru.yandex.qatools.allure:allure-java-adaptor-api:jar:1.4.22:test + ru.yandex.qatools.allure:allure-java-annotations:jar:1.4.22:test + ru.yandex.qatools.allure:allure-java-aspects:jar:1.4.22:test + ru.yandex.qatools.allure:allure-junit-adaptor:jar:1.4.22:test + ru.yandex.qatools.allure:allure-model:jar:1.4.22:test ru.yandex.qatools.properties:properties-loader:jar:1.5:test From dd7f7d2a9dc8224943502338d09cf6b6e1a52ca8 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Tue, 8 Mar 2016 17:39:24 +0100 Subject: [PATCH 15/22] fix mgmt client startup with xml problem and not unique bean exception Signed-off-by: Michael Hirsch --- .../hawkbit/mgmt/client/ClientConfigurationProperties.java | 2 -- .../hawkbit-mgmt-api-client/src/main/resources/logback.xml | 3 --- 2 files changed, 5 deletions(-) diff --git a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/ClientConfigurationProperties.java b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/ClientConfigurationProperties.java index ead019247..68f35b550 100644 --- a/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/ClientConfigurationProperties.java +++ b/examples/hawkbit-mgmt-api-client/src/main/java/org/eclipse/hawkbit/mgmt/client/ClientConfigurationProperties.java @@ -9,14 +9,12 @@ package org.eclipse.hawkbit.mgmt.client; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; /** * Configuration bean which holds the configuration of the client e.g. the base * URL of the hawkbit-server and the credentials to use the RESTful Management * API. */ -@Component @ConfigurationProperties(prefix = "hawkbit") public class ClientConfigurationProperties { diff --git a/examples/hawkbit-mgmt-api-client/src/main/resources/logback.xml b/examples/hawkbit-mgmt-api-client/src/main/resources/logback.xml index 819566e0f..0174611e6 100644 --- a/examples/hawkbit-mgmt-api-client/src/main/resources/logback.xml +++ b/examples/hawkbit-mgmt-api-client/src/main/resources/logback.xml @@ -1,6 +1,3 @@ -