diff options
Diffstat (limited to 'ONAP-REST/src')
24 files changed, 633 insertions, 1145 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java index fd1a6b73b..4b1c810af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,99 +21,45 @@ package org.onap.policy.rest.jpa; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; - import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; -import java.io.Serializable; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /** * The persistent class for the RainyDayTreatment database table. - * */ @Entity -@Table(name="RainyDayTreatments") -@NamedQuery(name="RainyDayTreatments.findAll", query="SELECT e FROM RainyDayTreatments e") +@Table(name = "RainyDayTreatments") +@NamedQuery(name = "RainyDayTreatments.findAll", query = "SELECT e FROM RainyDayTreatments e") +@Getter +@Setter +@NoArgsConstructor public class RainyDayTreatments implements Serializable { - /** - * - */ private static final long serialVersionUID = -2491410352490381323L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="bbid", nullable=false, length=255) + @Column(name = "bbid", nullable = false, length = 255) @OrderBy("asc") private String bbid; - @Column(name="workstep", nullable=true, length=255) + @Column(name = "workstep", nullable = true, length = 255) private String workstep; - @Column(name="treatments", nullable=true, length=1028) + @Column(name = "treatments", nullable = true, length = 1028) private String treatments; - - public RainyDayTreatments() { - // Empty constructor - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - /** - * @return the bbid - */ - public String getBbid() { - return bbid; - } - - /** - * @param bbid the bbid to set - */ - public void setBbid(String bbid) { - this.bbid = bbid; - } - - /** - * @return the workstep - */ - public String getWorkstep() { - return workstep; - } - - /** - * @param workstep the workstep to set - */ - public void setWorkstep(String workstep) { - this.workstep = workstep; - } - - /** - * @return the treatments - */ - public String getTreatments() { - return treatments; - } - - /** - * @param treatments the treatments to set - */ - public void setTreatments(String treatments) { - this.treatments = treatments; - } - - }
\ No newline at end of file diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java index 0cb339adf..b7662539c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,47 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="RemoteCatalogValues") -@NamedQuery(name="RemoteCatalogValues.findAll", query="SELECT e FROM RemoteCatalogValues e ") +@Table(name = "RemoteCatalogValues") +@NamedQuery(name = "RemoteCatalogValues.findAll", query = "SELECT e FROM RemoteCatalogValues e ") +@Getter +@Setter public class RemoteCatalogValues implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="value") + @Column(name = "value") private String value; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java index 8239d4ef8..3f7c89ec0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import java.util.Date; @@ -39,106 +39,63 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class RiskType. + */ @Entity -@Table(name="RiskType") -@NamedQuery(name="RiskType.findAll", query="SELECT e FROM RiskType e ") +@Table(name = "RiskType") +@NamedQuery(name = "RiskType.findAll", query = "SELECT e FROM RiskType e ") +@Getter +@Setter public class RiskType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false, unique=true) + @Column(name = "name", nullable = false, unique = true) @OrderBy("asc") private String name; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - public String getRiskName() { - return this.name; - } - - public void setRiskName(String riskName) { - this.name = riskName; - - } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java index 905648d5c..aa2ae75bc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,8 +18,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.rest.jpa; +import com.att.research.xacml.api.Identifier; + import java.io.Serializable; import javax.persistence.Column; @@ -30,11 +34,17 @@ import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; -import com.att.research.xacml.api.Identifier; +import lombok.Getter; +import lombok.Setter; +/** + * The Class RuleAlgorithms. + */ @Entity -@Table(name="RuleAlgorithms") -@NamedQuery(name="RuleAlgorithms.findAll", query="SELECT d FROM RuleAlgorithms d") +@Table(name = "RuleAlgorithms") +@NamedQuery(name = "RuleAlgorithms.findAll", query = "SELECT d FROM RuleAlgorithms d") +@Getter +@Setter public class RuleAlgorithms implements Serializable { private static final long serialVersionUID = 1L; @@ -43,48 +53,47 @@ public class RuleAlgorithms implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="is_standard", nullable=false) + @Column(name = "is_standard", nullable = false) private char isStandard; - @Column(name="xacml_id", nullable=false, unique=true, length=255) + @Column(name = "xacml_id", nullable = false, unique = true, length = 255) private String xacmlId; - @Column(name="short_name", nullable=false, length=64) + @Column(name = "short_name", nullable = false, length = 64) private String shortName; + /** + * Instantiates a new rule algorithms. + * + * @param id the id + * @param standard the standard + */ public RuleAlgorithms(Identifier id, char standard) { if (id != null) { this.xacmlId = id.stringValue(); } this.isStandard = standard; } + + /** + * Instantiates a new rule algorithms. + * + * @param id the id + */ public RuleAlgorithms(Identifier id) { this(id, RuleAlgorithms.STANDARD); } + /** + * Instantiates a new rule algorithms. + */ public RuleAlgorithms() { this(null, RuleAlgorithms.STANDARD); } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public char getIsStandard() { - return this.isStandard; - } - - public void setIsStandard(char isStandard) { - this.isStandard = isStandard; - } - @Transient public boolean isStandard() { return this.isStandard == RuleAlgorithms.STANDARD; @@ -94,21 +103,4 @@ public class RuleAlgorithms implements Serializable { public boolean isCustom() { return this.isStandard == RuleAlgorithms.CUSTOM; } - - public String getXacmlId() { - return this.xacmlId; - } - - public void setXacmlId(String xacmlId) { - this.xacmlId = xacmlId; - } - - public String getShortName() { - return shortName; - } - - public void setShortName(String shortName) { - this.shortName = shortName; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java index adc61506b..9663fd954 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,55 +32,29 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="SafePolicyWarning") -@NamedQuery(name="SafePolicyWarning.findAll", query="SELECT e FROM SafePolicyWarning e ") +@Table(name = "SafePolicyWarning") +@NamedQuery(name = "SafePolicyWarning.findAll", query = "SELECT e FROM SafePolicyWarning e ") +@Getter +@Setter public class SafePolicyWarning implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="message") - private String message ; - - @Column(name="riskType") - private String riskType ; - - public String getRiskType() { - return riskType; - } - public void setRiskType(String riskType) { - this.riskType = riskType; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - public void setName(String name) { - this.name = name; - - } + @Column(name = "message") + private String message; + @Column(name = "riskType") + private String riskType; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java index c1d6c0174..fe1c6ac4c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,45 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="securityzone") -@NamedQuery(name="SecurityZone.findAll", query="SELECT e FROM SecurityZone e ") +@Table(name = "securityzone") +@NamedQuery(name = "SecurityZone.findAll", query = "SELECT e FROM SecurityZone e ") +@Getter +@Setter public class SecurityZone implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String zoneName; - @Column(name="value") + @Column(name = "value") private String zoneValue; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } - - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - - } - public String getZoneValue() { - return this.zoneValue; - } - - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java index 33243b0a5..9be6b2ebf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,92 +32,38 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="servicegroup") -@NamedQuery(name="ServiceList.findAll", query="SELECT e FROM ServiceList e ") +@Table(name = "servicegroup") +@NamedQuery(name = "ServiceList.findAll", query = "SELECT e FROM ServiceList e ") +@Getter +@Setter public class ServiceList implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String serviceName; - @Column(name="description") - private String serviceDesc; + @Column(name = "description") + private String serviceDescription; - @Column(name="type") + @Column(name = "type") private String serviceType; - @Column(name="transportprotocol") - private String serviceTrasProtocol; + @Column(name = "transportprotocol") + private String serviceTransportProtocol; - @Column(name="appprotocol ") + @Column(name = "appprotocol ") private String serviceAppProtocol; - @Column(name="ports") + @Column(name = "ports") private String servicePorts; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getServiceName() { - return this.serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - - } - - public String getServiceDescription() { - return this.serviceDesc; - } - - public void setServiceDescription(String serviceDesc) { - this.serviceDesc = serviceDesc; - - } - - public String getServiceType() { - return this.serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getServiceTransProtocol() { - return this.serviceTrasProtocol; - } - - public void setServiceTransProtocol(String serviceTrasProtocol) { - this.serviceTrasProtocol = serviceTrasProtocol; - - } - - public String getServiceAppProtocol() { - return this.serviceAppProtocol; - } - - public void setServiceAppProtocol(String serviceAppProtocol) { - this.serviceAppProtocol = serviceAppProtocol; - - } - public String getServicePorts() { - return this.servicePorts; - } - - public void setServicePorts(String servicePorts) { - this.servicePorts = servicePorts; - - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDb.java index 9dbfc52ee..9b8845fea 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDb.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.rest.jpa; import java.io.Serializable; @@ -32,47 +34,62 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; + /** - * The persistent class for the system log database table. - * -*/ + * The persistent class for the system log database table. + */ @Entity -@Table(name="SystemLogDB") -@NamedQuery(name="SystemLogDB.findAll", query="SELECT o FROM SystemLogDB o") -public class SystemLogDB implements Serializable { +@Table(name = "SystemLogDb") +@NamedQuery(name = "SystemLogDb.findAll", query = "SELECT o FROM SystemLogDb o") +@Getter +@Setter +public class SystemLogDb implements Serializable { private static final long serialVersionUID = 1L; - @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="type", nullable=false) + @Column(name = "type", nullable = false) private String type; - @Column(name="system", nullable=false, length=255) + @Column(name = "system", nullable = false, length = 255) private String system; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; - @Column(name="remote", nullable=false, length=255) + @Column(name = "remote", nullable = false, length = 255) private String remote; - @Column(name="logtype", nullable=false, length=255) + @Column(name = "logtype", nullable = false, length = 255) private String logtype; @Temporal(TemporalType.TIMESTAMP) - @Column(name="date", nullable=false, updatable=false) + @Column(name = "date", nullable = false, updatable = false) private Date date; - public SystemLogDB() { + /** + * Instantiates a new system log db. + */ + public SystemLogDb() { super(); } - public SystemLogDB(int id, String system, String description, String remote, - String type, String logtype) { + /** + * Instantiates a new system log db. + * + * @param id the id + * @param system the system + * @param description the description + * @param remote the remote + * @param type the type + * @param logtype the logtype + */ + public SystemLogDb(int id, String system, String description, String remote, String type, String logtype) { this.id = id; this.system = system; this.description = description; @@ -80,62 +97,4 @@ public class SystemLogDB implements Serializable { this.type = type; this.logtype = logtype; } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getDate(){ - return this.date; - } - - public void setDate(Date date){ - this.date = date; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - - } - - public String getSystem() { - return this.system; - } - - public void setSystem(String system) { - this.system = system; - } - - public String getRemote() { - return this.remote; - } - - public void setRemote(String remote) { - this.remote = remote; - - } - public String getLogtype() { - return this.logtype; - } - - public void setLogtype(String logtype) { - this.logtype = logtype; - - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index a87cf2a6b..63dce9390 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,209 +39,97 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class TermList. + */ @Entity -@Table(name="TERM") -@NamedQuery(name="TermList.findAll", query="SELECT e FROM TermList e") +@Table(name = "TERM") +@NamedQuery(name = "TermList.findAll", query = "SELECT e FROM TermList e") +@Getter +@Setter public class TermList implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="termName", nullable=false) + @Column(name = "termName", nullable = false) @OrderBy("asc") private String termName; - @Column(name="description") - private String termDescription; + @Column(name = "description") + private String description; - @Column(name="fromzone") + @Column(name = "fromzone") private String fromZone; - @Column(name="tozone") + @Column(name = "tozone") private String toZone; - @Column(name="srcIPList") - private String srcIPList; + @Column(name = "srcIPList") + private String srcIpList; - @Column(name="destIPList") - private String destIPList; + @Column(name = "destIPList") + private String destIpList; - @Column(name="protocolList") + @Column(name = "protocolList") private String protocolList; - @Column(name="portList") + @Column(name = "portList") private String portList; - @Column(name="srcPortList") + @Column(name = "srcPortList") private String srcPortList; - @Column(name="destPortList") + @Column(name = "destPortList") private String destPortList; - @Column(name="action") + @Column(name = "action") private String action; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; + /** + * Instantiates a new term list. + */ public TermList() { this.modifiedDate = new Date(); } - public Date getCreatedDate() { - return this.createdDate; - } - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTermName() { - return this.termName; - } - - public void setTermName(String termName) { - this.termName = termName; - } - - public String getTermDescription() { - return this.termDescription; - } - - public void setDescription(String termDescription) { - this.termDescription = termDescription; - } - - public String getFromZone() { - return this.fromZone; - } - - public void setFromZones(String fromZone) { - this.fromZone = fromZone; - } - - public String getToZone() { - return this.toZone; - } - - public void setToZones(String toZone) { - this.toZone = toZone; - } - - public String getSrcIPList() { - return this.srcIPList; - } - - public void setSrcIPList(String srcIPList) { - this.srcIPList = srcIPList; - } - - public String getDestIPList() { - return this.destIPList; - } - - public void setDestIPList(String destIPList) { - this.destIPList = destIPList; - } - - public String getProtocolList() { - return this.protocolList; - } - - public void setProtocolList(String protocolList) { - this.protocolList = protocolList; - } - - public String getPortList() { - return this.portList; - } - - public void setPortList(String portList) { - this.portList = portList; - } - - public String getSrcPortList() { - return this.srcPortList; - } - - public void setSrcPortList(String srcPortList) { - this.srcPortList = srcPortList; - } - - public String getDestPortList() { - return this.destPortList; - } - - public void setDestPortList(String destPortList) { - this.destPortList = destPortList; - } - - - public String getAction() { - return this.action; - } - - public void setAction(String action) { - this.action = action; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java index da1438010..38d14f848 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,6 +21,10 @@ package org.onap.policy.rest.jpa; +import com.att.research.xacml.api.Identifier; +import com.att.research.xacml.std.IdentifierImpl; +import com.fasterxml.jackson.annotation.JsonBackReference; + import java.io.Serializable; import javax.persistence.Column; @@ -29,44 +34,29 @@ import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; -import com.att.research.xacml.api.Identifier; -import com.att.research.xacml.std.IdentifierImpl; -import com.fasterxml.jackson.annotation.JsonBackReference; +import lombok.Getter; +import lombok.Setter; @Entity @Table(name = "UserInfo") -@NamedQuery(name="UserInfo.findAll", query="SELECT u FROM UserInfo u ") +@NamedQuery(name = "UserInfo.findAll", query = "SELECT u FROM UserInfo u ") +@Getter +@Setter public class UserInfo implements Serializable { private static final long serialVersionUID = 1L; @Id - @Column(name="loginid", nullable=false, length=45) + @Column(name = "loginid", nullable = false, length = 45) private String userLoginId; @Column(name = "name", nullable = false, unique = true) private String userName; - public UserInfo(){ + public UserInfo() { this.userLoginId = userName; } - public String getUserLoginId() { - return userLoginId; - } - - public void setUserLoginId(String loginid) { - this.userLoginId = loginid; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - @Transient @JsonBackReference public Identifier getIdentiferByUserId() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java index aee187e6f..070cf7a56 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,10 +39,18 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; + +/** + * The Class VarbindDictionary. + */ @Entity -@Table(name="VarbindDictionary") +@Table(name = "VarbindDictionary") @NamedQuery(name = "VarbindDictionary.findAll", query = "Select v FROM VarbindDictionary v") -public class VarbindDictionary implements Serializable{ +@Getter +@Setter +public class VarbindDictionary implements Serializable { private static final long serialVersionUID = 1L; @Id @@ -48,7 +58,7 @@ public class VarbindDictionary implements Serializable{ @Column(name = "Id") private int id; - @Column(name ="varbind_Name", nullable = false, unique = true) + @Column(name = "varbind_Name", nullable = false, unique = true) @OrderBy("asc") private String varbindName; @@ -56,104 +66,46 @@ public class VarbindDictionary implements Serializable{ private String varbindDescription; @Column(name = "varbind_oid", nullable = false) - private String varbindOID; + private String varbindOid; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; + /** + * Instantiates a new varbind dictionary. + */ public VarbindDictionary() { this.setModifiedDate(new Date()); } - - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVarbindName() { - return varbindName; - } - - public void setVarbindName(String varbindName) { - this.varbindName = varbindName; - } - - public String getVarbindDescription() { - return varbindDescription; - } - - public void setVarbindDescription(String varbindDescription) { - this.varbindDescription = varbindDescription; - } - - public String getVarbindOID() { - return varbindOID; - } - - public void setVarbindOID(String varbindOID) { - this.varbindOID = varbindOID; - } - - public Date getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public Date getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VmType.java index 463e51709..51c3f657d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VmType.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,47 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; @Entity -@Table(name="VMType") -@NamedQuery(name="VMType.findAll", query="SELECT e FROM VMType e ") -public class VMType implements Serializable { +@Table(name = "VmType") +@NamedQuery(name = "VmType.findAll", query = "SELECT e FROM VmType e ") +@Getter +@Setter +public class VmType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="name", nullable=false) + @Column(name = "name", nullable = false) @OrderBy("asc") private String name; - @Column(name="description") + @Column(name = "description") private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VnfType.java index 3d7c7f67b..1a5c679af 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VnfType.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,111 +39,70 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; - +/** + * The Class VnfType. + */ @Entity -@Table(name="VNFType") -@NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ") -public class VNFType implements Serializable { +@Table(name = "VnfType") +@NamedQuery(name = "VnfType.findAll", query = "SELECT v FROM VnfType v ") +@Getter +@Setter +public class VnfType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="vnf_type", nullable=false, unique=true) + @Column(name = "vnf_type", nullable = false, unique = true) @OrderBy("asc") - private String vnftype; + private String type; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public VNFType() { + /** + * Instantiates a new VNF type. + */ + public VnfType() { this.modifiedDate = new Date(); } - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - - public String getVnftype() { - return vnftype; - } - - public void setVnftype(String vnftype) { - this.vnftype = vnftype; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VsclAction.java index e5aac971d..5506bc5b3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VsclAction.java @@ -3,6 +3,7 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -37,111 +39,71 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.Getter; +import lombok.Setter; +/** + * The Class VsclAction. + */ @Entity -@Table(name="VSCLAction") -@NamedQuery(name="VSCLAction.findAll", query="SELECT v FROM VSCLAction v ") -public class VSCLAction implements Serializable { +@Table(name = "VsclAction") +@NamedQuery(name = "VsclAction.findAll", query = "SELECT v FROM VsclAction v ") +@Getter +@Setter +public class VsclAction implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="vscl_action", nullable=false, unique=true) + @Column(name = "vscl_action", nullable = false, unique = true) @OrderBy("asc") - private String vsclaction; + private String action; @Temporal(TemporalType.TIMESTAMP) - @Column(name="created_date", updatable=false) + @Column(name = "created_date", updatable = false) private Date createdDate; - @Column(name="description", nullable=true, length=2048) + @Column(name = "description", nullable = true, length = 2048) private String description; @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) + @Column(name = "modified_date", nullable = false) private Date modifiedDate; @ManyToOne(optional = false) - @JoinColumn(name="created_by") + @JoinColumn(name = "created_by") private UserInfo userCreatedBy; @ManyToOne(optional = false) - @JoinColumn(name="modified_by") + @JoinColumn(name = "modified_by") private UserInfo userModifiedBy; - public VSCLAction() { + /** + * Instantiates a new vscl action. + */ + public VsclAction() { this.setModifiedDate(new Date()); } - public UserInfo getUserCreatedBy() { - return userCreatedBy; - } - - public void setUserCreatedBy(UserInfo userCreatedBy) { - this.userCreatedBy = userCreatedBy; - } - - public UserInfo getUserModifiedBy() { - return userModifiedBy; - } - - public void setUserModifiedBy(UserInfo userModifiedBy) { - this.userModifiedBy = userModifiedBy; - } - + /** + * Pre persist. + */ @PrePersist - public void prePersist() { + public void prePersist() { Date date = new Date(); this.createdDate = date; this.modifiedDate = date; } + /** + * Pre update. + */ @PreUpdate public void preUpdate() { this.modifiedDate = new Date(); } - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - - public String getVsclaction() { - return vsclaction; - } - - public void setVsclaction(String vsclaction) { - this.vsclaction = vsclaction; - } - - - public Date getCreatedDate() { - return this.createdDate; - } - - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getModifiedDate() { - return this.modifiedDate; - } - - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java index 9f2cbfdf1..5c288a8a6 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,13 +20,8 @@ */ package org.onap.policy.rest.jpa; -/* - * - * - * */ import java.io.Serializable; -import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; @@ -36,70 +32,29 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + @Entity @Table(name = "WatchPolicyNotificationTable") -@NamedQuery(name="WatchPolicyNotificationTable.findAll", query="SELECT e FROM WatchPolicyNotificationTable e ") -public class WatchPolicyNotificationTable implements Serializable{ +@NamedQuery(name = "WatchPolicyNotificationTable.findAll", query = "SELECT e FROM WatchPolicyNotificationTable e ") +@Getter +@Setter +@EqualsAndHashCode +public class WatchPolicyNotificationTable implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="policyName", nullable=false, unique=true) + @Column(name = "policyName", nullable = false, unique = true) @OrderBy("asc") private String policyName; - @Column(name="loginIds", nullable=false, unique=true) + @Column(name = "loginIds", nullable = false, unique = true) @OrderBy("asc") private String loginIds; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getLoginIds() { - return loginIds; - } - - public void setLoginIds(String loginIds) { - this.loginIds = loginIds; - } - - @Override - public int hashCode() { - return Objects.hash(id, policyName, loginIds); - } - - @Override - public boolean equals(Object obj) { - if(obj == null){ - return false; - } - if(obj == this){ - return true; - } - if(!(obj instanceof WatchPolicyNotificationTable)){ - return false; - } - - return id == ((WatchPolicyNotificationTable)obj).id && - policyName.equals(((WatchPolicyNotificationTable)obj).policyName) && - loginIds.equals(((WatchPolicyNotificationTable)obj).loginIds); - } - - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java index 58c1a275a..71252ed05 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java @@ -3,13 +3,14 @@ * ONAP-REST * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,8 +20,7 @@ */ package org.onap.policy.rest.jpa; -/* - */ + import java.io.Serializable; import javax.persistence.Column; @@ -32,45 +32,26 @@ import javax.persistence.NamedQuery; import javax.persistence.OrderBy; import javax.persistence.Table; +import lombok.Getter; +import lombok.Setter; + @Entity -@Table(name="zone") -@NamedQuery(name="Zone.findAll", query="SELECT e FROM Zone e ") +@Table(name = "zone") +@NamedQuery(name = "Zone.findAll", query = "SELECT e FROM Zone e ") +@Getter +@Setter public class Zone implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name="id") + @Column(name = "id") private int id; - @Column(name="zonename", nullable=false) + @Column(name = "zonename", nullable = false) @OrderBy("asc") private String zoneName; - @Column(name="zonevalue") + @Column(name = "zonevalue") private String zoneValue; - - public int getId() { - return this.id; - } - - public void setId(int id) { - this.id = id; - } - public String getZoneName() { - return this.zoneName; - } - - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - - } - public String getZoneValue() { - return this.zoneValue; - } - - public void setZoneValue(String zoneValue) { - this.zoneValue = zoneValue; - } - } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java index 47456106b..3cedd2312 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java @@ -24,6 +24,8 @@ package org.onap.policy.rest.daoimpl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -53,7 +55,7 @@ import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.PolicyRoles; import org.onap.policy.rest.jpa.PolicyVersion; -import org.onap.policy.rest.jpa.SystemLogDB; +import org.onap.policy.rest.jpa.SystemLogDb; import org.onap.policy.rest.jpa.UserInfo; import org.onap.policy.rest.jpa.WatchPolicyNotificationTable; import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder; @@ -70,7 +72,7 @@ public class PolicyValidationDaoImplTest { /** * Set up all unit tests. - * + * * @throws SQLException on SQL exceptions */ @BeforeClass @@ -98,13 +100,13 @@ public class PolicyValidationDaoImplTest { PolicyValidationDaoImpl.setSessionfactory(sessionFactory); // PolicyController.setLogTableLimit("1"); // HibernateSession.setSession(sessionFactory); - SystemLogDB data1 = new SystemLogDB(); + SystemLogDb data1 = new SystemLogDb(); data1.setDate(new Date()); data1.setLogtype("INFO"); data1.setRemote("Test"); data1.setSystem("Test"); data1.setType("Test"); - SystemLogDB data2 = new SystemLogDB(); + SystemLogDb data2 = new SystemLogDb(); data2.setDate(new Date()); data2.setLogtype("error"); data2.setRemote("Test"); @@ -332,6 +334,64 @@ public class PolicyValidationDaoImplTest { assertTrue(dataCur.size() == 1); assertTrue(dataCur.get(0) instanceof WatchPolicyNotificationTable); assertEquals(watch, dataCur.get(0)); + + WatchPolicyNotificationTable table0 = new WatchPolicyNotificationTable(); + WatchPolicyNotificationTable table1 = new WatchPolicyNotificationTable(); + assertEquals(table0, table0); + assertEquals(table0, table1); + assertNotEquals(table0, null); + String helloString = "Hello"; + Object helloObject = helloString; + assertNotEquals(table0, helloObject); + + table0.setId(1); + assertNotEquals(table0, table1); + table1.setId(1); + assertEquals(table0, table1); + + table0.setPolicyName("GoToOz"); + assertNotEquals(table0, table1); + table1.setPolicyName("GoToOz"); + assertEquals(table0, table1); + table1.setPolicyName(null); + assertNotEquals(table0, table1); + table0.setPolicyName(null); + assertEquals(table0, table1); + table1.setPolicyName("GoToOz"); + assertNotEquals(table0, table1); + table0.setPolicyName("GoToOz"); + assertEquals(table0, table1); + assertEquals(table0, table1); + table1.setPolicyName("InOz"); + assertNotEquals(table0, table1); + table0.setPolicyName("InOz"); + assertEquals(table0, table1); + + table0.setLoginIds("Wizard"); + assertNotEquals(table0, table1); + table1.setLoginIds("Wizard"); + assertEquals(table0, table1); + table1.setLoginIds(null); + assertNotEquals(table0, table1); + table0.setLoginIds(null); + assertEquals(table0, table1); + table0.setLoginIds("Wizard"); + assertNotEquals(table0, table1); + table1.setLoginIds("Wizard"); + assertEquals(table0, table1); + table1.setLoginIds(null); + table1.setLoginIds("Witch"); + assertNotEquals(table0, table1); + table0.setLoginIds("Witch"); + assertEquals(table0, table1); + + assertNotNull(table0.hashCode()); + assertNotNull(table1.hashCode()); + assertEquals(table0.hashCode(), table0.hashCode()); + + table0.setLoginIds("Witci"); + assertNotEquals(table0, table1); + assertNotEquals(table0.hashCode(), table1.hashCode()); } /* @@ -453,6 +513,7 @@ public class PolicyValidationDaoImplTest { UserInfo userInfo = new UserInfo(); userInfo.setUserLoginId("TestID"); userInfo.setUserName("Test"); + assertEquals("Test", userInfo.getIdentiferByUserId().getUri().getPath()); commonClassDao.save(userInfo); List<String> multipleData = new ArrayList<>(); multipleData.add("TestID:Test1"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java index 3967bb48e..501c7fd92 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java @@ -289,6 +289,13 @@ public class ActionDictionaryJpaTest { data.setXacmlId("Test"); assertTrue("Test".equals(data.getXacmlId())); data.toString(); + + RuleAlgorithms ra0 = new RuleAlgorithms(new DummyIdentifier()); + assertTrue(ra0.isStandard()); + assertFalse(ra0.isCustom()); + RuleAlgorithms ra1 = new RuleAlgorithms(new DummyIdentifier(), 'C'); + assertFalse(ra1.isStandard()); + assertTrue(ra1.isCustom()); } @Test diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java index 96a00f934..00fba8ca6 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java @@ -57,13 +57,13 @@ public class ClosedLoopPolicyDictionaryJpaTest { */ @Test public void testVsclAction() { - VSCLAction data = new VSCLAction(); + VsclAction data = new VsclAction(); data.preUpdate(); data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setVsclaction("Test"); - assertTrue("Test".equals(data.getVsclaction())); + data.setAction("Test"); + assertTrue("Test".equals(data.getAction())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); @@ -81,13 +81,13 @@ public class ClosedLoopPolicyDictionaryJpaTest { */ @Test public void testVnfType() { - VNFType data = new VNFType(); + VnfType data = new VnfType(); data.preUpdate(); data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setVnftype("Test"); - assertTrue("Test".equals(data.getVnftype())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); @@ -138,8 +138,8 @@ public class ClosedLoopPolicyDictionaryJpaTest { assertTrue("Test".equals(data.getVarbindName())); data.setVarbindDescription("Test"); assertTrue("Test".equals(data.getVarbindDescription())); - data.setVarbindOID("Test"); - assertTrue("Test".equals(data.getVarbindOID())); + data.setVarbindOid("Test"); + assertTrue("Test".equals(data.getVarbindOid())); data.setCreatedDate(new Date()); assertTrue(data.getCreatedDate() != null); data.setModifiedDate(new Date()); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java index caeb808d8..a6505a3f6 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java @@ -178,8 +178,8 @@ public class CommonDictionaryJpaTest { data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); - data.setRiskName("Test"); - assertTrue("Test".equals(data.getRiskName())); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setCreatedDate(new Date()); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java index cee9dde78..42df1c93d 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java @@ -240,8 +240,8 @@ public class FwDictionaryJpaTest { assertTrue("Test".equals(data.getServiceDescription())); data.setServiceType("Test"); assertTrue("Test".equals(data.getServiceType())); - data.setServiceTransProtocol("Test"); - assertTrue("Test".equals(data.getServiceTransProtocol())); + data.setServiceTransportProtocol("Test"); + assertTrue("Test".equals(data.getServiceTransportProtocol())); data.setServiceAppProtocol("Test"); assertTrue("Test".equals(data.getServiceAppProtocol())); data.setServicePorts("Test"); @@ -261,15 +261,15 @@ public class FwDictionaryJpaTest { data.setTermName("Test"); assertTrue("Test".equals(data.getTermName())); data.setDescription("Test"); - assertTrue("Test".equals(data.getTermDescription())); - data.setFromZones("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setFromZone("Test"); assertTrue("Test".equals(data.getFromZone())); - data.setToZones("Test"); + data.setToZone("Test"); assertTrue("Test".equals(data.getToZone())); - data.setSrcIPList("Test"); - assertTrue("Test".equals(data.getSrcIPList())); - data.setDestIPList("Test"); - assertTrue("Test".equals(data.getDestIPList())); + data.setSrcIpList("Test"); + assertTrue("Test".equals(data.getSrcIpList())); + data.setDestIpList("Test"); + assertTrue("Test".equals(data.getDestIpList())); data.setProtocolList("Test"); assertTrue("Test".equals(data.getProtocolList())); data.setPortList("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java index 1fcc7baa6..174d63506 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java @@ -247,7 +247,7 @@ public class MicroServiceDictionaryJpaTest { */ @Test public void testVmType() { - VMType data = new VMType(); + VmType data = new VmType(); data.setId(1); assertTrue(1 == data.getId()); data.setName("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java index b392b6f5a..a55ff8d6e 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java @@ -21,7 +21,9 @@ package org.onap.policy.rest.jpa; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -130,256 +132,261 @@ public class PolicyEntityJpaTest { PolicyEntity entity0 = new PolicyEntity(); PolicyEntity entity1 = new PolicyEntity(); - assertTrue(entity0.equals(entity0)); - assertTrue(entity0.equals(entity1)); - assertFalse(entity0.equals(null)); + assertEquals(entity0, entity0); + assertEquals(entity0, entity1); + assertNotEquals(entity0, null); String helloString = "Hello"; Object helloObject = helloString; - assertFalse(entity0.equals(helloObject)); + assertNotEquals(entity0, helloObject); entity0.setPolicyId(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyId(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyId(2); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyId(2); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyName("GoToOz"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyName("GoToOz"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName("GoToOz"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName("GoToOz"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyName("GoToOzNow"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyName("GoToOzNow"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setScope("All"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setScope("All"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope("All"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope("All"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setScope("AllIn"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setScope("AllIn"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setVersion(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setVersion(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyVersion(1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyVersion(1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyVersion(2); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyVersion(2); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setPolicyData("SomeData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setPolicyData("SomeData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData("SomeData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData("SomeData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setPolicyData("SomeMoreData"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setPolicyData("SomeMoreData"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ConfigurationDataEntity cde0 = new ConfigurationDataEntity(); entity0.setConfigurationDataEntity(cde0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setConfigurationDataEntity(cde0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setConfigurationDataEntity(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setConfigurationDataEntity(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ConfigurationDataEntity cde1 = new ConfigurationDataEntity(); entity1.setConfigurationDataEntity(cde1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setConfigurationDataEntity(cde1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ActionBodyEntity abe0 = new ActionBodyEntity(); entity0.setActionBodyEntity(abe0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setActionBodyEntity(abe0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setActionBodyEntity(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setActionBodyEntity(abe0); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(abe0); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); ActionBodyEntity abe1 = new ActionBodyEntity(); entity1.setActionBodyEntity(abe1); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setActionBodyEntity(abe1); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDescription("Description"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDescription("Description"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDescription(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDescription("Description"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription("Description"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDescription("Description Extra"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDescription("Description Extra"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleted(true); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleted(true); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleted(false); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleted(false); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeleteReasonCode("NoReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeleteReasonCode("NoReason"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode("NoReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode("NoReason"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDeleteReasonCode("NoOtherReason"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeleteReasonCode("NoOtherReason"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setCreatedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setCreatedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setCreatedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setCreatedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedDate(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setCreatedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setCreatedDate(new Date(123456L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setCreatedDate(new Date(123456L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setModifiedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setModifiedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setModifiedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setModifiedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedDate(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setModifiedDate(new Date(12345L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(new Date(12345L)); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setModifiedDate(new Date(123456L)); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setModifiedDate(new Date(123456L)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity0.setDeletedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity1.setDeletedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeletedBy(null); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy(null); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); entity1.setDeletedBy("Dorothy"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy("Dorothy"); - assertTrue(entity0.equals(entity1)); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); + assertEquals(entity0, entity1); entity1.setDeletedBy("Toto"); - assertFalse(entity0.equals(entity1)); + assertNotEquals(entity0, entity1); entity0.setDeletedBy("Toto"); - assertTrue(entity0.equals(entity1)); + assertEquals(entity0, entity1); assertNotNull(entity0.hashCode()); assertNotNull(entity1.hashCode()); + assertEquals(entity0.hashCode(), entity0.hashCode()); + + entity0.setDeletedBy("Totp"); + assertNotEquals(entity0, entity1); + assertNotEquals(entity0.hashCode(), entity1.hashCode()); } /** @@ -405,7 +412,9 @@ public class PolicyEntityJpaTest { assertTrue(data.isDeleted()); assertTrue(data.getCreatedDate() != null); assertTrue(data.getModifiedDate() != null); - data.equals(new ConfigurationDataEntity()); + String helloString = "Hello"; + Object helloObject = helloString; + assertNotEquals(data, helloObject); data.hashCode(); } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java index 26d47a2fc..f56e55783 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java @@ -21,7 +21,8 @@ package org.onap.policy.rest.jpa; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -116,97 +117,102 @@ public class PolicyUtilsJpaTest { PolicyVersion version0 = new PolicyVersion(); PolicyVersion version1 = new PolicyVersion(); - assertTrue(version0.equals(version0)); - assertTrue(version0.equals(version1)); - assertFalse(version0.equals(null)); + assertEquals(version0, version0); + assertEquals(version0, version1); + assertNotEquals(version0, null); String helloString = "Hello"; Object helloObject = helloString; - assertFalse(version0.equals(helloObject)); + assertNotEquals(version0, helloObject); version0.setId(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setId(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setActiveVersion(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setActiveVersion(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setCreatedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setCreatedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedBy(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedBy(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setCreatedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setCreatedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedDate(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedDate(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setCreatedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setCreatedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setHigherVersion(1); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setHigherVersion(1); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setModifiedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setModifiedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedBy(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedBy(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedBy("Dorothy"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedBy("Dorothy"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setModifiedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setModifiedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedDate(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedDate(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setModifiedDate(new Date(12345L)); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setModifiedDate(new Date(12345L)); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version0.setPolicyName("GoToOz"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version1.setPolicyName("GoToOz"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setPolicyName(null); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setPolicyName(null); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); version1.setPolicyName("GoToOz"); - assertFalse(version0.equals(version1)); + assertNotEquals(version0, version1); version0.setPolicyName("GoToOz"); - assertTrue(version0.equals(version1)); + assertEquals(version0, version1); assertNotNull(version0.hashCode()); assertNotNull(version1.hashCode()); + assertEquals(version0.hashCode(), version0.hashCode()); + + version0.setPolicyName("GoToOy"); + assertNotEquals(version0, version1); + assertNotEquals(version0.hashCode(), version1.hashCode()); } /** * Test system log DB. */ @Test - public void testSystemLogDB() { - SystemLogDB data = new SystemLogDB(); - new SystemLogDB(1, "", "", "", "", ""); + public void testSystemLogDb() { + SystemLogDb data = new SystemLogDb(); + new SystemLogDb(1, "", "", "", "", ""); data.setId(1); assertTrue(1 == data.getId()); data.setDescription("Test"); |