summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-persistence/plugins-persistence-jpa
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-persistence/plugins-persistence-jpa')
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java101
-rw-r--r--plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java101
2 files changed, 28 insertions, 174 deletions
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java
index f1561c2b8..98a4c5738 100644
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java
+++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,11 @@ import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.commons.lang3.builder.CompareToBuilder;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
@@ -36,6 +42,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
*/
@Entity
@Table(name = "ArtifactKeyTestEntity")
+@Getter
+@Setter
+@ToString
+@EqualsAndHashCode(callSuper = false)
public class ArtifactKeyTestEntity extends AxConcept {
private static final long serialVersionUID = -2962570563281067896L;
@@ -78,28 +88,11 @@ public class ArtifactKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
/**
- * Sets the key.
- *
- * @param key the new key
- */
- public void setKey(final AxArtifactKey key) {
- this.key = key;
- }
-
- /**
* Check set key.
*
* @return true, if successful
@@ -109,24 +102,6 @@ public class ArtifactKeyTestEntity extends AxConcept {
}
/**
- * Gets the double value.
- *
- * @return the double value
- */
- public double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the double value.
- *
- * @param doubleValue the new double value
- */
- public void setDoubleValue(final double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -146,14 +121,6 @@ public class ArtifactKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public String toString() {
- return "ArtifactKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
final Object copyObject = ((target == null) ? new ArtifactKeyTestEntity() : target);
if (copyObject instanceof ArtifactKeyTestEntity) {
@@ -174,42 +141,6 @@ public class ArtifactKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((key == null) ? 0 : key.hashCode());
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj;
- if (key == null) {
- if (other.key != null) {
- return false;
- }
- } else if (!key.equals(other.key)) {
- return false;
- }
- return (Double.compare(doubleValue, other.doubleValue) == 0);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
if (otherObj == null) {
return -1;
@@ -221,13 +152,9 @@ public class ArtifactKeyTestEntity extends AxConcept {
return -1;
}
final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj;
- if (key == null) {
- if (other.key != null) {
- return 1;
- }
- } else if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- return Double.compare(doubleValue, other.doubleValue);
+ return new CompareToBuilder()
+ .append(key, other.key)
+ .append(doubleValue, other.doubleValue)
+ .toComparison();
}
}
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java
index afeeb84fd..cadc9b8db 100644
--- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java
+++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,11 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.commons.lang3.builder.CompareToBuilder;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
@@ -38,6 +44,10 @@ import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
*/
@Entity
@Table(name = "ReferenceKeyTestEntity")
+@Getter
+@Setter
+@ToString
+@EqualsAndHashCode(callSuper = false)
public class ReferenceKeyTestEntity extends AxConcept {
private static final long serialVersionUID = -2962570563281067895L;
@@ -81,28 +91,11 @@ public class ReferenceKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public AxReferenceKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
/**
- * Sets the key.
- *
- * @param key the new key
- */
- public void setKey(final AxReferenceKey key) {
- this.key = key;
- }
-
- /**
* Check set key.
*
* @return true, if successful
@@ -112,24 +105,6 @@ public class ReferenceKeyTestEntity extends AxConcept {
}
/**
- * Gets the double value.
- *
- * @return the double value
- */
- public double getDoubleValue() {
- return doubleValue;
- }
-
- /**
- * Sets the double value.
- *
- * @param doubleValue the new double value
- */
- public void setDoubleValue(final double doubleValue) {
- this.doubleValue = doubleValue;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -149,14 +124,6 @@ public class ReferenceKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public String toString() {
- return "ReferenceKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxConcept copyTo(final AxConcept target) {
final Object copyObject = ((target == null) ? new ReferenceKeyTestEntity() : target);
if (copyObject instanceof ReferenceKeyTestEntity) {
@@ -177,42 +144,6 @@ public class ReferenceKeyTestEntity extends AxConcept {
* {@inheritDoc}.
*/
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((key == null) ? 0 : key.hashCode());
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj;
- if (key == null) {
- if (other.key != null) {
- return false;
- }
- } else if (!key.equals(other.key)) {
- return false;
- }
- return (Double.compare(doubleValue, other.doubleValue) == 0);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public int compareTo(final AxConcept otherObj) {
if (otherObj == null) {
return -1;
@@ -224,13 +155,9 @@ public class ReferenceKeyTestEntity extends AxConcept {
return -1;
}
final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj;
- if (key == null) {
- if (other.key != null) {
- return 1;
- }
- } else if (!key.equals(other.key)) {
- return key.compareTo(other.key);
- }
- return Double.compare(doubleValue, other.doubleValue);
+ return new CompareToBuilder()
+ .append(key, other.key)
+ .append(doubleValue, other.doubleValue)
+ .toComparison();
}
}