From 9849205beaab397972bd13c09d3b11136b3347c2 Mon Sep 17 00:00:00 2001 From: Kai Zimmermann Date: Mon, 28 Mar 2016 09:59:24 +0200 Subject: [PATCH] Re-applied base entity based equals hashcode policy --- .../hawkbit/repository/model/Action.java | 86 +------------ .../repository/model/ActionStatus.java | 37 +----- .../model/ActionWithStatusCount.java | 23 ++-- .../hawkbit/repository/model/Artifact.java | 29 +---- .../repository/model/AssignmentResult.java | 14 +-- .../model/CustomSoftwareModule.java | 13 +- .../repository/model/DistributionSet.java | 15 --- .../model/DistributionSetIdName.java | 27 +--- .../model/DistributionSetMetadata.java | 75 +++++++---- .../repository/model/DistributionSetTag.java | 17 +-- .../repository/model/DistributionSetType.java | 33 +---- .../model/DistributionSetTypeElement.java | 36 +----- ...istributionSetTypeElementCompositeKey.java | 39 ------ .../model/DsMetadataCompositeKey.java | 37 +----- .../repository/model/ExternalArtifact.java | 14 +-- .../model/ExternalArtifactProvider.java | 31 +---- .../repository/model/LocalArtifact.java | 25 +--- .../hawkbit/repository/model/NamedEntity.java | 41 +----- .../model/NamedVersionedEntity.java | 30 ++++- .../hawkbit/repository/model/Rollout.java | 108 ++++------------ .../repository/model/RolloutGroup.java | 30 ++++- .../repository/model/SoftwareModule.java | 4 +- .../model/SoftwareModuleIdName.java | 18 --- .../model/SoftwareModuleMetadata.java | 10 +- .../repository/model/SoftwareModuleType.java | 50 ++++---- .../model/SwMetadataCompositeKey.java | 14 +-- .../eclipse/hawkbit/repository/model/Tag.java | 34 +++-- .../hawkbit/repository/model/Target.java | 25 +--- .../repository/model/TargetFilterQuery.java | 41 +++--- .../repository/model/TargetIdName.java | 33 +---- .../hawkbit/repository/model/TargetInfo.java | 117 +++++------------- .../hawkbit/repository/model/TargetTag.java | 15 +-- .../repository/model/TargetUpdateStatus.java | 5 - .../model/TenantAwareBaseEntity.java | 8 +- .../repository/model/TenantConfiguration.java | 16 +-- .../repository/model/TenantMetaData.java | 23 +--- .../org/eclipse/hawkbit/TestDataUtil.java | 2 +- .../hawkbit/repository/ActionTest.java | 2 - 38 files changed, 289 insertions(+), 888 deletions(-) diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Action.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Action.java index bca57efa5..aeb4e64d8 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Action.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Action.java @@ -127,55 +127,30 @@ public class Action extends TenantAwareBaseEntity implements Comparable return status == Status.CANCELING || status == Status.CANCELED; } - /** - * @param active - * the active to set - */ public void setActive(final boolean active) { this.active = active; } - /** - * @return the status - */ public Status getStatus() { return status; } - /** - * @param status - * the status to set - */ public void setStatus(final Status status) { this.status = status; } - /** - * @return the downloadProgressPercent - */ public int getDownloadProgressPercent() { return downloadProgressPercent; } - /** - * @param downloadProgressPercent - * the downloadProgressPercent to set - */ public void setDownloadProgressPercent(final int downloadProgressPercent) { this.downloadProgressPercent = downloadProgressPercent; } - /** - * @return the active - */ public boolean isActive() { return active; } - /** - * @param actionType - * the actionType to set - */ public void setActionType(final ActionType actionType) { this.actionType = actionType; } @@ -187,69 +162,38 @@ public class Action extends TenantAwareBaseEntity implements Comparable return actionType; } - /** - * @return the actionStatus - */ public List getActionStatus() { return actionStatus; } - /** - * @param target - * the target to set - */ public void setTarget(final Target target) { this.target = target; } - /** - * @return the target - */ public Target getTarget() { return target; } - /** - * @return the forcedTime - */ public long getForcedTime() { return forcedTime; } - /** - * @param forcedTime - * the forcedTime to set - */ public void setForcedTime(final long forcedTime) { this.forcedTime = forcedTime; } - /** - * @return the rolloutGroup - */ public RolloutGroup getRolloutGroup() { return rolloutGroup; } - /** - * @param rolloutGroup - * the rolloutGroup to set - */ public void setRolloutGroup(final RolloutGroup rolloutGroup) { this.rolloutGroup = rolloutGroup; } - /** - * @return the rollout - */ public Rollout getRollout() { return rollout; } - /** - * @param rollout - * the rollout to set - */ public void setRollout(final Rollout rollout) { this.rollout = rollout; } @@ -311,42 +255,25 @@ public class Action extends TenantAwareBaseEntity implements Comparable } @Override - public int hashCode() { // NOSONAR - as this is generated + public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); - result = prime * result + (active ? 1231 : 1237); - result = prime * result + (int) (forcedTime ^ (forcedTime >>> 32)); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + (isHitAutoForceTime(System.currentTimeMillis()) ? 1231 : 1237); + result = prime * result + this.getClass().getName().hashCode(); return result; } @Override - public boolean equals(final Object obj) { // NOSONAR - as this is generated - + public boolean equals(final Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } - if (getClass() != obj.getClass()) { - return false; - } - final Action other = (Action) obj; - if (actionType != other.actionType) { - return false; - } - if (active != other.active) { - return false; - } - if (forcedTime != other.forcedTime) { - return false; - } - if (status != other.status) { + if (!(obj instanceof Action)) { return false; } + return true; } @@ -409,9 +336,6 @@ public class Action extends TenantAwareBaseEntity implements Comparable /** * The action type for this action relation. * - * - * - * */ public enum ActionType { FORCED, SOFT, TIMEFORCED; diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionStatus.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionStatus.java index 6409dc209..8493acfad 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionStatus.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionStatus.java @@ -60,7 +60,7 @@ public class ActionStatus extends TenantAwareBaseEntity { /** * Creates a new {@link ActionStatus} object. - * + * * @param action * the action for this action status * @param status @@ -76,7 +76,7 @@ public class ActionStatus extends TenantAwareBaseEntity { /** * Creates a new {@link ActionStatus} object. - * + * * @param action * the action for this action status * @param status @@ -144,10 +144,7 @@ public class ActionStatus extends TenantAwareBaseEntity { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((messages == null) ? 0 : messages.hashCode()); - result = prime * result + ((occurredAt == null) ? 0 : occurredAt.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + this.getClass().getName().hashCode(); return result; } @@ -159,34 +156,10 @@ public class ActionStatus extends TenantAwareBaseEntity { if (!super.equals(obj)) { return false; } - if (getClass() != obj.getClass()) { - return false; - } - final ActionStatus other = (ActionStatus) obj; - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - if (messages == null) { - if (other.messages != null) { - return false; - } - } else if (!messages.equals(other.messages)) { - return false; - } - if (occurredAt == null) { - if (other.occurredAt != null) { - return false; - } - } else if (!occurredAt.equals(other.occurredAt)) { - return false; - } - if (status != other.status) { + if (!(obj instanceof ActionStatus)) { return false; } + return true; } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionWithStatusCount.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionWithStatusCount.java index 7d01b9dd2..44beb194a 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionWithStatusCount.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ActionWithStatusCount.java @@ -15,9 +15,6 @@ import org.eclipse.hawkbit.repository.model.Action.Status; * Custom JPA Model for querying {@link Action} include the count of the * action's {@link ActionStatus}. * - * - * - * */ public class ActionWithStatusCount { private final Long actionStatusCount; @@ -37,7 +34,7 @@ public class ActionWithStatusCount { /** * JPA constructor, the parameter are the result set columns of the custom * query. - * + * * @param actionId * the ID of the action * @param actionType @@ -70,9 +67,9 @@ public class ActionWithStatusCount { final String rolloutName) { this.actionId = actionId; this.actionType = actionType; - this.actionActive = active; - this.actionForceTime = forcedTime; - this.actionStatus = status; + actionActive = active; + actionForceTime = forcedTime; + actionStatus = status; this.actionCreatedAt = actionCreatedAt; this.actionLastModifiedAt = actionLastModifiedAt; this.dsId = dsId; @@ -81,12 +78,12 @@ public class ActionWithStatusCount { this.actionStatusCount = actionStatusCount; this.rolloutName = rolloutName; - this.action = new Action(); - this.action.setActionType(actionType); - this.action.setActive(actionActive); - this.action.setForcedTime(actionForceTime); - this.action.setStatus(actionStatus); - this.action.setId(actionId); + action = new Action(); + action.setActionType(actionType); + action.setActive(actionActive); + action.setForcedTime(actionForceTime); + action.setStatus(actionStatus); + action.setId(actionId); } /** diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Artifact.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Artifact.java index 23c5de34f..c63974cbb 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Artifact.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Artifact.java @@ -58,9 +58,7 @@ public abstract class Artifact extends TenantAwareBaseEntity { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((md5Hash == null) ? 0 : md5Hash.hashCode()); - result = prime * result + ((sha1Hash == null) ? 0 : sha1Hash.hashCode()); - result = prime * result + ((size == null) ? 0 : size.hashCode()); + result = prime * result + this.getClass().getName().hashCode(); return result; } @@ -72,31 +70,10 @@ public abstract class Artifact extends TenantAwareBaseEntity { if (!super.equals(obj)) { return false; } - if (getClass() != obj.getClass()) { - return false; - } - final Artifact other = (Artifact) obj; - if (md5Hash == null) { - if (other.md5Hash != null) { - return false; - } - } else if (!md5Hash.equals(other.md5Hash)) { - return false; - } - if (sha1Hash == null) { - if (other.sha1Hash != null) { - return false; - } - } else if (!sha1Hash.equals(other.sha1Hash)) { - return false; - } - if (size == null) { - if (other.size != null) { - return false; - } - } else if (!size.equals(other.size)) { + if (!(obj instanceof Artifact)) { return false; } + return true; } } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/AssignmentResult.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/AssignmentResult.java index 05f812b06..eda0bb9bd 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/AssignmentResult.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/AssignmentResult.java @@ -9,10 +9,7 @@ package org.eclipse.hawkbit.repository.model; /** - * Generic assigment result bean. - * - * - * + * Generic assignment result bean. * */ public class AssignmentResult { @@ -36,23 +33,14 @@ public class AssignmentResult { total = assigned + alreadyAssigned; } - /** - * @return the assignedTargets - */ public int getAssigned() { return assigned; } - /** - * @return the total - */ public int getTotal() { return total; } - /** - * @return the alreadyAssigned - */ public int getAlreadyAssigned() { return alreadyAssigned; } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/CustomSoftwareModule.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/CustomSoftwareModule.java index b68f9df49..34aa8345a 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/CustomSoftwareModule.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/CustomSoftwareModule.java @@ -13,9 +13,6 @@ import java.io.Serializable; /** * Use to display software modules for the selected distribution. * - * - * - * */ public class CustomSoftwareModule implements Serializable { @@ -39,16 +36,10 @@ public class CustomSoftwareModule implements Serializable { this.assigned = assigned; } - /** - * @return the softwareModule - */ public SoftwareModule getSoftwareModule() { return softwareModule; } - /** - * @return the assigned - */ public boolean isAssigned() { return assigned; } @@ -63,7 +54,7 @@ public class CustomSoftwareModule implements Serializable { final int prime = 31; int result = 1; result = prime * result + (assigned ? 1231 : 1237); - result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode()); + result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode()); return result; } @@ -75,7 +66,7 @@ public class CustomSoftwareModule implements Serializable { if (obj == null) { return false; } - if (getClass() != obj.getClass()) { + if (!(obj instanceof CustomSoftwareModule)) { return false; } final CustomSoftwareModule other = (CustomSoftwareModule) obj; diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSet.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSet.java index c3eb49a2d..390421bf8 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSet.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSet.java @@ -160,11 +160,6 @@ public class DistributionSet extends NamedVersionedEntity { return actions; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; @@ -173,11 +168,6 @@ public class DistributionSet extends NamedVersionedEntity { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -234,11 +224,6 @@ public class DistributionSet extends NamedVersionedEntity { return installedAtTargets; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { return "DistributionSet [getName()=" + getName() + ", getOptLockRevision()=" + getOptLockRevision() diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetIdName.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetIdName.java index a7eb8e517..fd90e9d04 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetIdName.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetIdName.java @@ -39,9 +39,6 @@ public class DistributionSetIdName implements Serializable { this.version = version; } - /** - * @return the id - */ public Long getId() { return id; } @@ -50,40 +47,27 @@ public class DistributionSetIdName implements Serializable { return version; } - /** - * @return the name - */ public String getName() { return name; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override - public int hashCode() { // NOSONAR - as this is generated + public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (id == null ? 0 : id.hashCode()); return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override - public boolean equals(final Object obj) { // NOSONAR - as this is generated + public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } - if (getClass() != obj.getClass()) { + if (!(obj instanceof DistributionSetIdName)) { return false; } final DistributionSetIdName other = (DistributionSetIdName) obj; @@ -97,11 +81,6 @@ public class DistributionSetIdName implements Serializable { return true; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { // only return the ID because it's used in vaadin for setting the item diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetMetadata.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetMetadata.java index b0627f0db..e9597f60b 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetMetadata.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetMetadata.java @@ -33,10 +33,6 @@ import javax.persistence.Table; @Entity @Table(name = "sp_ds_metadata") public class DistributionSetMetadata implements Serializable { - - /** - * - */ private static final long serialVersionUID = 1L; @Id @@ -49,11 +45,11 @@ public class DistributionSetMetadata implements Serializable { @Id @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "ds_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_metadata_ds") ) + @JoinColumn(name = "ds_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_metadata_ds")) private DistributionSet distributionSet; public DistributionSetMetadata() { - + // Default constructor for JPA. } /** @@ -73,49 +69,74 @@ public class DistributionSetMetadata implements Serializable { return new DsMetadataCompositeKey(distributionSet, key); } - /** - * @return the key - */ public String getKey() { return key; } - /** - * @param key - * the key to set - */ public void setKey(final String key) { this.key = key; } - /** - * @param distributionSet - * the distributionSet to set - */ public void setDistributionSet(final DistributionSet distributionSet) { this.distributionSet = distributionSet; } - /** - * @return the value - */ public String getValue() { return value; } - /** - * @param value - * the value to set - */ public void setValue(final String value) { this.value = value; } - /** - * @return the distributionSet - */ public DistributionSet getDistributionSet() { return distributionSet; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (distributionSet == null ? 0 : distributionSet.hashCode()); + result = prime * result + (key == null ? 0 : key.hashCode()); + result = prime * result + (value == null ? 0 : value.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof DistributionSetMetadata)) { + return false; + } + final DistributionSetMetadata other = (DistributionSetMetadata) obj; + if (distributionSet == null) { + if (other.distributionSet != null) { + return false; + } + } else if (!distributionSet.equals(other.distributionSet)) { + return false; + } + if (key == null) { + if (other.key != null) { + return false; + } + } else if (!key.equals(other.key)) { + return false; + } + if (value == null) { + if (other.value != null) { + return false; + } + } else if (!value.equals(other.value)) { + return false; + } + return true; + } + } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTag.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTag.java index 63a858a7d..bdfc73f9d 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTag.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTag.java @@ -21,16 +21,11 @@ import javax.persistence.UniqueConstraint; * A {@link DistributionSetTag} is used to describe DistributionSet attributes * and use them also for filtering the DistributionSet list. * - * - * - * - * - * */ @Entity @Table(name = "sp_distributionset_tag", indexes = { @Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = { - "name", "tenant" }, name = "uk_ds_tag") ) + "name", "tenant" }, name = "uk_ds_tag")) public class DistributionSetTag extends Tag { private static final long serialVersionUID = 1L; @@ -69,11 +64,6 @@ public class DistributionSetTag extends Tag { return assignedToDistributionSet; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; @@ -82,11 +72,6 @@ public class DistributionSetTag extends Tag { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated if (this == obj) { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetType.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetType.java index 1d565f6ac..56fed270f 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetType.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetType.java @@ -84,7 +84,7 @@ public class DistributionSetType extends NamedEntity { public DistributionSetType(final String key, final String name, final String description, final String color) { super(name, description); this.key = key; - this.colour = color; + colour = color; } /** @@ -289,10 +289,7 @@ public class DistributionSetType extends NamedEntity { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((colour == null) ? 0 : colour.hashCode()); - result = prime * result + (deleted ? 1231 : 1237); - result = prime * result + ((elements == null) ? 0 : elements.hashCode()); - result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + this.getClass().getName().hashCode(); return result; } @@ -307,31 +304,7 @@ public class DistributionSetType extends NamedEntity { if (!(obj instanceof DistributionSetType)) { return false; } - final DistributionSetType other = (DistributionSetType) obj; - if (colour == null) { - if (other.colour != null) { - return false; - } - } else if (!colour.equals(other.colour)) { - return false; - } - if (deleted != other.deleted) { - return false; - } - if (elements == null) { - if (other.elements != null) { - return false; - } - } else if (!elements.equals(other.elements)) { - return false; - } - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - return false; - } + return true; } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElement.java index 38baf52c7..ce8501fec 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElement.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElement.java @@ -65,7 +65,7 @@ public class DistributionSetTypeElement implements Serializable { public DistributionSetTypeElement(final DistributionSetType dsType, final SoftwareModuleType smType, final boolean mandatory) { super(); - this.key = new DistributionSetTypeElementCompositeKey(dsType, smType); + key = new DistributionSetTypeElementCompositeKey(dsType, smType); this.dsType = dsType; this.smType = smType; this.mandatory = mandatory; @@ -100,37 +100,7 @@ public class DistributionSetTypeElement implements Serializable { } @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + (mandatory ? 1231 : 1237); - return result; + public String toString() { + return "DistributionSetTypeElement [mandatory=" + mandatory + ", dsType=" + dsType + ", smType=" + smType + "]"; } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof DistributionSetTypeElement)) { - return false; - } - final DistributionSetTypeElement other = (DistributionSetTypeElement) obj; - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - return false; - } - if (mandatory != other.mandatory) { - return false; - } - return true; - } - } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElementCompositeKey.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElementCompositeKey.java index 1f71d007e..2ee1aba0d 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElementCompositeKey.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DistributionSetTypeElementCompositeKey.java @@ -61,43 +61,4 @@ public class DistributionSetTypeElementCompositeKey implements Serializable { public void setSmType(final Long smType) { this.smType = smType; } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((dsType == null) ? 0 : dsType.hashCode()); - result = prime * result + ((smType == null) ? 0 : smType.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof DistributionSetTypeElementCompositeKey)) { - return false; - } - final DistributionSetTypeElementCompositeKey other = (DistributionSetTypeElementCompositeKey) obj; - if (dsType == null) { - if (other.dsType != null) { - return false; - } - } else if (!dsType.equals(other.dsType)) { - return false; - } - if (smType == null) { - if (other.smType != null) { - return false; - } - } else if (!smType.equals(other.smType)) { - return false; - } - return true; - } - } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DsMetadataCompositeKey.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DsMetadataCompositeKey.java index f26a66ab9..a23595679 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DsMetadataCompositeKey.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/DsMetadataCompositeKey.java @@ -13,24 +13,19 @@ import java.io.Serializable; /** * The DistributionSet Metadata composite key which contains the meta data key * and the ID of the DistributionSet itself. - * + * * * */ public final class DsMetadataCompositeKey implements Serializable { - /** - * - */ private static final long serialVersionUID = 1L; private String key; private Long distributionSet; - /** - * - */ public DsMetadataCompositeKey() { + // Default constructor for JPA. } /** @@ -44,55 +39,31 @@ public final class DsMetadataCompositeKey implements Serializable { this.key = key; } - /** - * @return the key - */ public String getKey() { return key; } - /** - * @param key - * the key to set - */ public void setKey(final String key) { this.key = key; } - /** - * @return the distributionSet - */ public Long getDistributionSet() { return distributionSet; } - /** - * @param distributionSet - * the distributionSet to set - */ public void setDistributionSet(final Long distributionSet) { this.distributionSet = distributionSet; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((distributionSet == null) ? 0 : distributionSet.hashCode()); - result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + (distributionSet == null ? 0 : distributionSet.hashCode()); + result = prime * result + (key == null ? 0 : key.hashCode()); return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated // code diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifact.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifact.java index 35e0c4e99..2369d000b 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifact.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifact.java @@ -36,7 +36,7 @@ public class ExternalArtifact extends Artifact { private static final long serialVersionUID = 1L; @ManyToOne - @JoinColumn(name = "provider", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_art_to_ext_provider") ) + @JoinColumn(name = "provider", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_art_to_ext_provider")) private ExternalArtifactProvider externalArtifactProvider; @Column(name = "url_suffix", length = 512) @@ -44,7 +44,7 @@ public class ExternalArtifact extends Artifact { // CascadeType.PERSIST as we register ourself at the BSM @ManyToOne(optional = false, cascade = { CascadeType.PERSIST }) - @JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_external_assigned_sm") ) + @JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_external_assigned_sm")) private SoftwareModule softwareModule; /** @@ -127,11 +127,6 @@ public class ExternalArtifact extends Artifact { this.urlSuffix = urlSuffix; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { // NOSONAR - as this is generated final int prime = 31; @@ -140,11 +135,6 @@ public class ExternalArtifact extends Artifact { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated if (this == obj) { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifactProvider.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifactProvider.java index 56d92c8e1..6733074c6 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifactProvider.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/ExternalArtifactProvider.java @@ -15,11 +15,8 @@ import javax.persistence.Table; /** * External repositories for artifact storage. The SP server provides URLs for - * the targets to download rom these external ressources but does not access - * thenm itself. - * - * - * + * the targets to download from these external resources but does not access + * them itself. * */ @Table(name = "sp_external_provider", indexes = { @@ -60,41 +57,22 @@ public class ExternalArtifactProvider extends NamedEntity { basePath = ""; } - /** - * @return the basePath - */ public String getBasePath() { return basePath; } - /** - * @return the defaultSuffix - */ public String getDefaultSuffix() { return defaultSuffix; } - /** - * @param basePath - * the basePath to set - */ public void setBasePath(final String basePath) { this.basePath = basePath; } - /** - * @param defaultSuffix - * the defaultSuffix to set - */ public void setDefaultSuffix(final String defaultSuffix) { this.defaultSuffix = defaultSuffix; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { // NOSONAR - as this is generated final int prime = 31; @@ -103,11 +81,6 @@ public class ExternalArtifactProvider extends NamedEntity { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated if (this == obj) { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/LocalArtifact.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/LocalArtifact.java index baa4ee1f0..b8f5d3369 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/LocalArtifact.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/LocalArtifact.java @@ -46,7 +46,7 @@ public class LocalArtifact extends Artifact { private String filename; @ManyToOne(optional = false, cascade = { CascadeType.PERSIST }) - @JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_assigned_sm") ) + @JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_assigned_sm")) private SoftwareModule softwareModule; /** @@ -73,11 +73,6 @@ public class LocalArtifact extends Artifact { this.filename = filename; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { // NOSONAR - as this is generated final int prime = 31; @@ -86,11 +81,6 @@ public class LocalArtifact extends Artifact { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated if (this == obj) { @@ -106,33 +96,20 @@ public class LocalArtifact extends Artifact { return true; } - /** - * @return the softwareModule - */ @Override public SoftwareModule getSoftwareModule() { return softwareModule; } - /** - * @param softwareModule - * the softwareModule to set - */ public final void setSoftwareModule(final SoftwareModule softwareModule) { this.softwareModule = softwareModule; this.softwareModule.addArtifact(this); } - /** - * @return the gridFsFileName - */ public String getGridFsFileName() { return gridFsFileName; } - /** - * @return the filename - */ public String getFilename() { return filename; } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedEntity.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedEntity.java index 3ee2387ed..e14d88161 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedEntity.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedEntity.java @@ -34,7 +34,7 @@ public abstract class NamedEntity extends TenantAwareBaseEntity { /** * Parameterized constructor. - * + * * @param name * of the {@link NamedEntity} * @param description @@ -60,43 +60,4 @@ public abstract class NamedEntity extends TenantAwareBaseEntity { public void setName(final String name) { this.name = name; } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final NamedEntity other = (NamedEntity) obj; - if (description == null) { - if (other.description != null) { - return false; - } - } else if (!description.equals(other.description)) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; - } - } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedVersionedEntity.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedVersionedEntity.java index 77819ed46..0806f19e6 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedVersionedEntity.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/NamedVersionedEntity.java @@ -14,11 +14,6 @@ import javax.persistence.MappedSuperclass; /** * Extension for {@link NamedEntity} that are versioned. * - * - * - * - * - * */ @MappedSuperclass public abstract class NamedVersionedEntity extends NamedEntity { @@ -29,7 +24,7 @@ public abstract class NamedVersionedEntity extends NamedEntity { /** * parameterized constructor. - * + * * @param name * of the entity * @param version @@ -53,4 +48,27 @@ public abstract class NamedVersionedEntity extends NamedEntity { this.version = version; } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof NamedVersionedEntity)) { + return false; + } + + return true; + } + } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Rollout.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Rollout.java index 83e541ed5..6001af86b 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Rollout.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Rollout.java @@ -36,20 +36,20 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType; @Entity @Table(name = "sp_rollout", indexes = { @Index(name = "sp_idx_rollout_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = { - "name", "tenant" }, name = "uk_rollout") ) + "name", "tenant" }, name = "uk_rollout")) public class Rollout extends NamedEntity { private static final long serialVersionUID = 1L; @OneToMany(targetEntity = RolloutGroup.class) - @JoinColumn(name = "rollout", insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollout_rolloutgroup") ) + @JoinColumn(name = "rollout", insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollout_rolloutgroup")) private List rolloutGroups; @Column(name = "target_filter", length = 1024, nullable = false) private String targetFilterQuery; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolltout_ds") ) + @JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolltout_ds")) private DistributionSet distributionSet; @Column(name = "status") @@ -79,159 +79,86 @@ public class Rollout extends NamedEntity { @Transient private transient TotalTargetCountStatus totalTargetCountStatus; - /** - * @return the distributionSet - */ public DistributionSet getDistributionSet() { return distributionSet; } - /** - * @param distributionSet - * the distributionSet to set - */ public void setDistributionSet(final DistributionSet distributionSet) { this.distributionSet = distributionSet; } - /** - * @return the rolloutGroups - */ public List getRolloutGroups() { return rolloutGroups; } - /** - * @param rolloutGroups - * the rolloutGroups to set - */ public void setRolloutGroups(final List rolloutGroups) { this.rolloutGroups = rolloutGroups; } - /** - * @return the targetFilterQuery - */ public String getTargetFilterQuery() { return targetFilterQuery; } - /** - * @param targetFilterQuery - * the targetFilterQuery to set - */ public void setTargetFilterQuery(final String targetFilterQuery) { this.targetFilterQuery = targetFilterQuery; } - /** - * @return the status - */ public RolloutStatus getStatus() { return status; } - /** - * @param status - * the status to set - */ public void setStatus(final RolloutStatus status) { this.status = status; } - /** - * @return the lastCheck - */ public long getLastCheck() { return lastCheck; } - /** - * @param lastCheck - * the lastCheck to set - */ public void setLastCheck(final long lastCheck) { this.lastCheck = lastCheck; } - /** - * @return the actionType - */ public ActionType getActionType() { return actionType; } - /** - * @param actionType - * the actionType to set - */ public void setActionType(final ActionType actionType) { this.actionType = actionType; } - /** - * @return the forcedTime - */ public long getForcedTime() { return forcedTime; } - /** - * @param forcedTime - * the forcedTime to set - */ public void setForcedTime(final long forcedTime) { this.forcedTime = forcedTime; } - /** - * @return the totalTargets - */ public long getTotalTargets() { return totalTargets; } - /** - * @param totalTargets - * the totalTargets to set - */ public void setTotalTargets(final long totalTargets) { this.totalTargets = totalTargets; } - /** - * @return the rolloutGroupsTotal - */ public int getRolloutGroupsTotal() { return rolloutGroupsTotal; } - /** - * @param rolloutGroupsTotal - * the rolloutGroupsTotal to set - */ public void setRolloutGroupsTotal(final int rolloutGroupsTotal) { this.rolloutGroupsTotal = rolloutGroupsTotal; } - /** - * @return the rolloutGroupsCreated - */ public int getRolloutGroupsCreated() { return rolloutGroupsCreated; } - /** - * @param rolloutGroupsCreated - * the rolloutGroupsCreated to set - */ public void setRolloutGroupsCreated(final int rolloutGroupsCreated) { this.rolloutGroupsCreated = rolloutGroupsCreated; } - /** - * @return the totalTargetCountStatus - */ public TotalTargetCountStatus getTotalTargetCountStatus() { if (totalTargetCountStatus == null) { totalTargetCountStatus = new TotalTargetCountStatus(totalTargets); @@ -239,10 +166,6 @@ public class Rollout extends NamedEntity { return totalTargetCountStatus; } - /** - * @param totalTargetCountStatus - * the totalTargetCountStatus to set - */ public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) { this.totalTargetCountStatus = totalTargetCountStatus; } @@ -256,7 +179,7 @@ public class Rollout extends NamedEntity { /** * - * @author Michael Hirsch + * State machine for rollout. * */ public enum RolloutStatus { @@ -308,4 +231,27 @@ public class Rollout extends NamedEntity { */ ERROR_STARTING; } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof Rollout)) { + return false; + } + + return true; + } } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroup.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroup.java index dcb95b254..2a57e48d3 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroup.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroup.java @@ -34,13 +34,13 @@ import javax.persistence.UniqueConstraint; @Entity @Table(name = "sp_rolloutgroup", indexes = { @Index(name = "sp_idx_rolloutgroup_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = { - "name", "rollout", "tenant" }, name = "uk_rolloutgroup") ) + "name", "rollout", "tenant" }, name = "uk_rolloutgroup")) public class RolloutGroup extends NamedEntity { private static final long serialVersionUID = 1L; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "rollout", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolloutgroup_rollout") ) + @JoinColumn(name = "rollout", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolloutgroup_rollout")) private Rollout rollout; @Column(name = "status") @@ -210,8 +210,7 @@ public class RolloutGroup extends NamedEntity { } /** - * - * @author Michael Hirsch + * Rollout goup state machine. * */ public enum RolloutGroupStatus { @@ -478,4 +477,27 @@ public class RolloutGroup extends NamedEntity { } } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof RolloutGroup)) { + return false; + } + + return true; + } + } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModule.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModule.java index 7b0c03c0e..99a57a2c4 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModule.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModule.java @@ -241,8 +241,8 @@ public class SoftwareModule extends NamedVersionedEntity { @Override public String toString() { - return "SoftwareModule [deleted=" + deleted + ", getVersion()=" + getVersion() + ", getOptLockRevision()=" - + getOptLockRevision() + ", getId()=" + getId() + ", getType()=" + getType().getName() + "]"; + return "SoftwareModule [deleted=" + deleted + ", name=" + getName() + ", version=" + getVersion() + + ", revision=" + getOptLockRevision() + ", Id=" + getId() + ", type=" + getType().getName() + "]"; } @Override diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleIdName.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleIdName.java index 8658de3c8..c59d42c5f 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleIdName.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleIdName.java @@ -13,8 +13,6 @@ import java.io.Serializable; /** * To hold software module name and Id. * - * - * */ public class SoftwareModuleIdName implements Serializable { @@ -35,25 +33,14 @@ public class SoftwareModuleIdName implements Serializable { this.name = name; } - /** - * @return the id - */ public Long getId() { return id; } - /** - * @return the name - */ public String getName() { return name; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() {// NOSONAR - as this is generated final int prime = 31; @@ -62,11 +49,6 @@ public class SoftwareModuleIdName implements Serializable { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) {// NOSONAR - as this is generated if (this == obj) { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleMetadata.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleMetadata.java index 4ffbd2c10..b314edbe6 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleMetadata.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleMetadata.java @@ -29,10 +29,6 @@ import javax.persistence.Table; @Entity @Table(name = "sp_sw_metadata") public class SoftwareModuleMetadata implements Serializable { - - /** - * - */ private static final long serialVersionUID = 1L; @Id @@ -106,9 +102,9 @@ public class SoftwareModuleMetadata implements Serializable { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); + result = prime * result + (key == null ? 0 : key.hashCode()); + result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode()); + result = prime * result + (value == null ? 0 : value.hashCode()); return result; } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleType.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleType.java index 49427b9ea..bf34a6f33 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleType.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SoftwareModuleType.java @@ -17,9 +17,6 @@ import javax.persistence.UniqueConstraint; /** * Type of a software modules. * - * - * - * */ @Entity @Table(name = "sp_software_module_type", indexes = { @@ -28,9 +25,6 @@ import javax.persistence.UniqueConstraint; @UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"), @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") }) public class SoftwareModuleType extends NamedEntity { - /** - * - */ private static final long serialVersionUID = 1L; @Column(name = "type_key", nullable = false, length = 64) @@ -92,48 +86,26 @@ public class SoftwareModuleType extends NamedEntity { super(); } - /** - * @return the key - */ public String getKey() { return key; } - /** - * @return the max - */ public int getMaxAssignments() { return maxAssignments; } - /** - * @return the deleted - */ public boolean isDeleted() { return deleted; } - /** - * @param deleted - * the deleted to set - */ public void setDeleted(final boolean deleted) { this.deleted = deleted; } - /** - * - * @return the software type color - */ public String getColour() { return colour; } - /** - * - * @param colour - * the col - */ public void setColour(final String colour) { this.colour = colour; } @@ -143,4 +115,26 @@ public class SoftwareModuleType extends NamedEntity { return "SoftwareModuleType [key=" + key + ", getName()=" + getName() + ", getId()=" + getId() + "]"; } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof SoftwareModuleType)) { + return false; + } + + return true; + } } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SwMetadataCompositeKey.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SwMetadataCompositeKey.java index f76cac155..90b3779a1 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SwMetadataCompositeKey.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/SwMetadataCompositeKey.java @@ -69,25 +69,15 @@ public final class SwMetadataCompositeKey implements Serializable { this.softwareModule = softwareModule; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode()); + result = prime * result + (key == null ? 0 : key.hashCode()); + result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode()); return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated // code diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Tag.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Tag.java index c03a02f3e..8775ef458 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Tag.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Tag.java @@ -14,14 +14,9 @@ import javax.persistence.MappedSuperclass; import org.springframework.hateoas.Identifiable; /** - * A Tag can be used as describing and organisational meta information for any + * A Tag can be used as describing and organizational meta information for any * kind of entity. * - * - * - * - * - * */ @MappedSuperclass public abstract class Tag extends NamedEntity implements Identifiable { @@ -57,14 +52,31 @@ public abstract class Tag extends NamedEntity implements Identifiable { this.colour = colour; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { return "Tag [getOptLockRevision()=" + getOptLockRevision() + ", getId()=" + getId() + "]"; } + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof Tag)) { + return false; + } + + return true; + } } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Target.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Target.java index 07a97ebcf..62713dc3f 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Target.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/Target.java @@ -56,11 +56,6 @@ import org.springframework.data.domain.Persistable; * {@link TargetStatus#REGISTERED}, i.e. a target {@link DistributionSet} . *

* - * - * - * - * - * */ @Entity @Table(name = "sp_target", indexes = { @@ -117,7 +112,7 @@ public class Target extends NamedEntity implements Persistable { /** * Constructor. - * + * * @param controllerId * controller ID of the {@link Target} */ @@ -182,25 +177,14 @@ public class Target extends NamedEntity implements Persistable { this.assignedDistributionSet = assignedDistributionSet; } - /** - * @param controllerId - * the controllerId to set - */ public void setControllerId(final String controllerId) { this.controllerId = controllerId; } - /** - * @param tags - * the tags to set - */ public void setTags(final Set tags) { this.tags = tags; } - /** - * @return the actions - */ public List getActions() { return actions; } @@ -209,11 +193,6 @@ public class Target extends NamedEntity implements Persistable { return new TargetIdName(getId(), getControllerId(), getName()); } - /* - * (non-Javadoc) - * - * @see org.springframework.data.domain.Persistable#isNew() - */ @Override @Transient public boolean isNew() { @@ -263,7 +242,7 @@ public class Target extends NamedEntity implements Persistable { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetFilterQuery.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetFilterQuery.java index 80721a3d2..7f01e0b59 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetFilterQuery.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetFilterQuery.java @@ -57,32 +57,25 @@ public class TargetFilterQuery extends TenantAwareBaseEntity { } @Override - public boolean equals(final Object obj) {// NOSONAR - as this is generated - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TargetFilterQuery other = (TargetFilterQuery) obj; - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.getClass().getName().hashCode(); + return result; } @Override - public int hashCode() { // NOSONAR - as this is generated - final int prime = 31; - int result = 1; - result = prime * result + (name == null ? 0 : name.hashCode()); - return result; + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof TargetFilterQuery)) { + return false; + } + + return true; } } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetIdName.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetIdName.java index f06fa8cf0..91542a422 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetIdName.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetIdName.java @@ -39,61 +39,39 @@ public class TargetIdName implements Serializable { this.name = name; } - /** - * @return the controller id - */ public String getControllerId() { return controllerId; } - /** - * @return the name - */ public String getName() { return name; } - /** - * @param id - * the id to set - */ public void setControllerId(final String id) { - this.controllerId = id; + controllerId = id; } - /** - * @param name - * the name to set - */ public void setName(final String name) { this.name = name; } - /** - * @return the targetId - */ public long getTargetId() { return targetId; } /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + (int) (targetId ^ (targetId >>> 32)); + result = prime * result + (int) (targetId ^ targetId >>> 32); return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -112,11 +90,6 @@ public class TargetIdName implements Serializable { return true; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { // only return the ID because it's used in vaadin for setting the item diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetInfo.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetInfo.java index 09d9fed28..2eb7cc385 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetInfo.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetInfo.java @@ -54,19 +54,11 @@ import org.springframework.data.domain.Persistable; * modifying the {@link Target} itself when a controller reports it's * {@link #lastTargetQuery} for example. * - * - * - * */ @Table(name = "sp_target_info", indexes = { @Index(name = "sp_idx_target_info_02", columnList = "target_id,update_status") }) @Entity -// @DynamicUpdate public class TargetInfo implements Persistable, Serializable { - - /** - * - */ private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(TargetInfo.class); @@ -81,9 +73,6 @@ public class TargetInfo implements Persistable, Serializable { @OneToOne(cascade = { CascadeType.MERGE, CascadeType.REMOVE }, fetch = FetchType.LAZY, targetEntity = Target.class) @JoinColumn(name = "target_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_stat_targ")) @MapsId - // use deprecated annotation until HHH-8862 is fixed - // @SuppressWarnings( "deprecation" ) - // @org.hibernate.annotations.ForeignKey( name = "fk_targ_stat_targ" ) private Target target; @Column(name = "address", length = 512) @@ -111,9 +100,7 @@ public class TargetInfo implements Persistable, Serializable { @MapKeyColumn(name = "attribute_key", nullable = false, length = 32) @CollectionTable(name = "sp_target_attributes", joinColumns = { @JoinColumn(name = "target_id") }, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_attrib_target")) - // use deprecated annotation until HHH-8862 is fixed - // @org.hibernate.annotations.ForeignKey( name = "fk_targ_attrib_target" ) private final Map controllerAttributes = Collections.synchronizedMap(new HashMap()); // set default request controller attributes to true, because we want to @@ -124,7 +111,7 @@ public class TargetInfo implements Persistable, Serializable { /** * Constructor for {@link TargetStatus}. - * + * * @param target * related to this status. */ @@ -138,21 +125,11 @@ public class TargetInfo implements Persistable, Serializable { targetId = null; } - /* - * (non-Javadoc) - * - * @see org.springframework.data.domain.Persistable#getId() - */ @Override public Long getId() { return targetId; } - /* - * (non-Javadoc) - * - * @see org.springframework.data.domain.Persistable#isNew() - */ @Override @Transient public boolean isNew() { @@ -198,114 +175,62 @@ public class TargetInfo implements Persistable, Serializable { this.address = address; } - /** - * @return the targetId - */ public Long getTargetId() { return targetId; } - /** - * @param targetId - * the targetId to set - */ public void setTargetId(final Long targetId) { this.targetId = targetId; } - /** - * @return the target - */ public Target getTarget() { return target; } - /** - * @param target - * the target to set - */ public void setTarget(final Target target) { this.target = target; } - /** - * @return the lastTargetQuery - */ public Long getLastTargetQuery() { return lastTargetQuery; } - /** - * @param lastTargetQuery - * the lastTargetQuery to set - */ public void setLastTargetQuery(final Long lastTargetQuery) { this.lastTargetQuery = lastTargetQuery; } - /** - * @param requestControllerAttributes - * the requestControllerAttributes to set - */ public void setRequestControllerAttributes(final boolean requestControllerAttributes) { this.requestControllerAttributes = requestControllerAttributes; } - /** - * @return the controllerAttributes - */ public Map getControllerAttributes() { return controllerAttributes; } - /** - * @return the requestControllerAttributes - */ public boolean isRequestControllerAttributes() { return requestControllerAttributes; } - /** - * @return the installationDate - */ public Long getInstallationDate() { return installationDate; } - /** - * @param installationDate - * the installationDate to set - */ public void setInstallationDate(final Long installationDate) { this.installationDate = installationDate; } - /** - * @return the updateStatus - */ public TargetUpdateStatus getUpdateStatus() { return updateStatus; } - /** - * @param updateStatus - * the updateStatus to set - */ public void setUpdateStatus(final TargetUpdateStatus updateStatus) { this.updateStatus = updateStatus; } - /** - * @return the installedDistributionSet - */ public DistributionSet getInstalledDistributionSet() { return installedDistributionSet; } - /** - * @param installedDistributionSet - * the installedDistributionSet to set - */ public void setInstalledDistributionSet(final DistributionSet installedDistributionSet) { this.installedDistributionSet = installedDistributionSet; } @@ -338,8 +263,6 @@ public class TargetInfo implements Persistable, Serializable { * The poll time object which holds all the necessary information around the * target poll time, e.g. the last poll time, the next poll time and the * overdue poll time. - * - * * */ public static final class PollStatus { @@ -359,7 +282,7 @@ public class TargetInfo implements Persistable, Serializable { /** * calculates if the target poll time is overdue and the target has not * been polled in the configured poll time interval. - * + * * @return {@code true} if the current time is after the poll time * overdue date otherwise {@code false}. */ @@ -386,15 +309,41 @@ public class TargetInfo implements Persistable, Serializable { return currentDate; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ @Override public String toString() { return "PollTime [lastPollDate=" + lastPollDate + ", nextPollDate=" + nextPollDate + ", overdueDate=" + overdueDate + ", currentDate=" + currentDate + "]"; } } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (target == null ? 0 : target.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof TargetInfo)) { + return false; + } + final TargetInfo other = (TargetInfo) obj; + if (target == null) { + if (other.target != null) { + return false; + } + } else if (!target.equals(other.target)) { + return false; + } + return true; + } + } diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetTag.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetTag.java index 781bf9d16..90a246b61 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetTag.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetTag.java @@ -30,7 +30,7 @@ import javax.persistence.UniqueConstraint; @Entity @Table(name = "sp_target_tag", indexes = { @Index(name = "sp_idx_target_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = { - "name", "tenant" }, name = "uk_targ_tag") ) + "name", "tenant" }, name = "uk_targ_tag")) public class TargetTag extends Tag { private static final long serialVersionUID = 1L; @@ -65,18 +65,10 @@ public class TargetTag extends Tag { super(); } - /** - * @return the assignedToTargets - */ public List getAssignedToTargets() { return assignedToTargets; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; @@ -85,11 +77,6 @@ public class TargetTag extends Tag { return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { if (this == obj) { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetUpdateStatus.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetUpdateStatus.java index cecbf8339..7721dabda 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetUpdateStatus.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TargetUpdateStatus.java @@ -13,11 +13,6 @@ package org.eclipse.hawkbit.repository.model; * status. A {@link Target} can have only one status. independent of the number * of {@link UpdateAction}s that have to be applied. * - * - * - * - * - * */ public enum TargetUpdateStatus { diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantAwareBaseEntity.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantAwareBaseEntity.java index 755ab793e..ea223e2d7 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantAwareBaseEntity.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantAwareBaseEntity.java @@ -76,22 +76,22 @@ public abstract class TenantAwareBaseEntity extends BaseEntity { } @Override - public int hashCode() { // NOSONAR - as this is generated + public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((tenant == null) ? 0 : tenant.hashCode()); + result = prime * result + (tenant == null ? 0 : tenant.hashCode()); return result; } @Override - public boolean equals(final Object obj) { // NOSONAR - as this is generated + public boolean equals(final Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } - if (getClass() != obj.getClass()) { + if (!(obj instanceof TenantAwareBaseEntity)) { return false; } final TenantAwareBaseEntity other = (TenantAwareBaseEntity) obj; diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantConfiguration.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantConfiguration.java index 972ea1ffe..c35cea1c7 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantConfiguration.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantConfiguration.java @@ -27,10 +27,6 @@ import javax.persistence.UniqueConstraint; @Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key", "tenant" }, name = "uk_tenant_key")) public class TenantConfiguration extends TenantAwareBaseEntity implements Serializable { - - /** - * - */ private static final long serialVersionUID = 1L; @Column(name = "conf_key", length = 128) @@ -89,24 +85,14 @@ public class TenantConfiguration extends TenantAwareBaseEntity implements Serial this.value = value; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + (key == null ? 0 : key.hashCode()); return result; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { // NOSONAR - as this is generated // code diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantMetaData.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantMetaData.java index 35c7466be..e347a855c 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantMetaData.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/model/TenantMetaData.java @@ -24,7 +24,7 @@ import javax.persistence.UniqueConstraint; * Tenant entity with meta data that is configured globally for the entire * tenant. This entity is not tenant aware to allow the system to access it * through the {@link EntityManager} even before the actual tenant exists. - * + * * Entities owned by the tenant are based on {@link TenantAwareBaseEntity}. * */ @@ -82,8 +82,7 @@ public class TenantMetaData extends BaseEntity { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((defaultDsType == null) ? 0 : defaultDsType.hashCode()); - result = prime * result + ((tenant == null) ? 0 : tenant.hashCode()); + result = prime * result + this.getClass().getName().hashCode(); return result; } @@ -95,24 +94,10 @@ public class TenantMetaData extends BaseEntity { if (!super.equals(obj)) { return false; } - if (getClass() != obj.getClass()) { - return false; - } - final TenantMetaData other = (TenantMetaData) obj; - if (defaultDsType == null) { - if (other.defaultDsType != null) { - return false; - } - } else if (!defaultDsType.equals(other.defaultDsType)) { - return false; - } - if (tenant == null) { - if (other.tenant != null) { - return false; - } - } else if (!tenant.equals(other.tenant)) { + if (!(obj instanceof TenantMetaData)) { return false; } + return true; } } diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/TestDataUtil.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/TestDataUtil.java index b2fa1f735..1787d29e4 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/TestDataUtil.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/TestDataUtil.java @@ -95,7 +95,7 @@ public class TestDataUtil { return distributionSetManagement.createDistributionSet( buildDistributionSet(suffix != null && suffix.length() > 0 ? suffix : "DS", version, findOrCreateDistributionSetType(distributionSetManagement, "ecl_os_app_jvm", - "OC mandatory App/JVM optional", mand, opt), + "OS mandatory App/JVM optional", mand, opt), os, jvm, ah).setRequiredMigrationStep(isRequiredMigrationStep)); } diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/ActionTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/ActionTest.java index 9bd532b5e..937a544a7 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/ActionTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/ActionTest.java @@ -33,12 +33,10 @@ public class ActionTest { final Action timeforcedAction = new Action(); timeforcedAction.setActionType(ActionType.TIMEFORCED); timeforcedAction.setForcedTime(timeForceTimeAt); - final int knownHashCode = timeforcedAction.hashCode(); assertThat(timeforcedAction.isForce()).isFalse(); // wait until timeforce time is hit Thread.sleep(sleepTime + 100); assertThat(timeforcedAction.isForce()).isTrue(); - assertThat(timeforcedAction.hashCode()).isNotEqualTo(knownHashCode); } }