diff options
author | rb7147 <rb7147@att.com> | 2018-02-13 18:17:22 -0500 |
---|---|---|
committer | rb7147 <rb7147@att.com> | 2018-02-13 23:17:59 -0500 |
commit | 49048e277bba438cf6486c1229b53f608a7af114 (patch) | |
tree | 50c3b252ea07e91aa04e5df2087e7a69cf5266f8 /ONAP-REST/src | |
parent | 8baa15218033f9ab6741645eb380e17eb7d9c2dd (diff) |
Added Junits for Policy PAP-REST
Cleaned the unnecessary constructors and methods in onap-rest.
Added Junits for JPA Classes in ONAP-REST.
Issue-ID: POLICY-338
Change-Id: I7e4f928342315475db96d89e9ad3adac5cb7eb00
Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'ONAP-REST/src')
36 files changed, 1291 insertions, 634 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java index 7d46330f0..aeaa14a62 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,7 +38,6 @@ import javax.persistence.Table; public class ActionList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -53,26 +50,7 @@ public class ActionList implements Serializable { @Column(name="description") private String description; - - public ActionList() { - //An empty constructor - } - public ActionList(String string, String userid) { - this(domain); - - } - public ActionList(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } + public String getActionName() { return this.actionName; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java index c3673f336..4d31ec9e7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class AddressGroup implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -58,27 +54,6 @@ public class AddressGroup implements Serializable { @Column(name="description") private String description; - public AddressGroup() { - //An empty constructor - } - public AddressGroup(String string, String userid) { - this(domain); - - } - public AddressGroup(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java index 8dd2a5995..e1a6f5434 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -86,14 +86,6 @@ public class BRMSParamTemplate implements Serializable{ this.userCreatedBy = userCreatedBy; } - public BRMSParamTemplate(){ - //An empty constructor - } - - public BRMSParamTemplate(String userid){ - //An empty constructor - } - @PrePersist public void prePersist() { Date date = new Date(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java index 1b08c1cc5..baf3cbe49 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class DCAEUsers implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -54,28 +50,6 @@ public class DCAEUsers implements Serializable { @Column(name="description ") private String description ; - - - public DCAEUsers() { - //An empty constructor - } - public DCAEUsers(String string, String userid) { - this(domain); - - } - public DCAEUsers(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java index dc6960997..eb07943f3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class DCAEuuid implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,27 +51,6 @@ public class DCAEuuid implements Serializable { @Column(name="description") private String description; - - public DCAEuuid() { - //An empty constructor - } - public DCAEuuid(String string, String userid) { - this(domain); - - } - public DCAEuuid(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - public String getDescription() { return description; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java index e0ed676d7..ae3620294 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -127,13 +127,6 @@ public class DecisionSettings implements Serializable { } - public String getDecisionSettings(){ - return this.xacmlId; - } - - public String setDecisionSettings(){ - return this.xacmlId; - } @PrePersist public void prePersist() { Date date = new Date(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java index ed6981152..31ec31d21 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -99,18 +99,6 @@ public class FWTag implements Serializable { private static Log LOGGER = LogFactory.getLog(FWTag.class); - public FWTag(){ - //An empty constructor - } - - public FWTag(String string, String userid) { - this(string); - } - - public FWTag(String domain) { - this.fwTagName = domain; - } - @PrePersist public void prePersist() { Date date = new Date(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java index 6090558ae..708ebf591 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -83,19 +83,7 @@ public class FWTagPicker implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; - private static Log logger = LogFactory.getLog(FWTagPicker.class); - - public FWTagPicker(){ - //An empty constructor - } - - public FWTagPicker(String string, String userid) { - this(string); - } - - public FWTagPicker(String domain) { - this.tagPickerName = domain; - } + private static Log logger = LogFactory.getLog(FWTagPicker.class); @PrePersist public void prePersist() { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java index 5644d4a3d..8e1a83d5d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -38,8 +38,6 @@ import javax.persistence.Table; public class FirewallDictionaryList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -97,16 +95,4 @@ public class FirewallDictionaryList implements Serializable { public void setServiceList(String serviceList) { this.serviceList = serviceList; } - - public FirewallDictionaryList() { - //An empty constructor - } - - public FirewallDictionaryList(String string, String userid) { - this(domain); - } - public FirewallDictionaryList(String domain) { - this.parentItemName = domain; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java index 55c3bd6ef..51b321e32 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class GroupPolicyScopeList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -58,27 +54,6 @@ public class GroupPolicyScopeList implements Serializable { @Column(name="description") private String description; - public GroupPolicyScopeList() { - //An empty constructor - } - public GroupPolicyScopeList(String string, String userid) { - this(domain); - - } - public GroupPolicyScopeList(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java index 4d1560f0c..71df0391a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class GroupServiceList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,28 +51,6 @@ public class GroupServiceList implements Serializable { @Column(name="serviceList ") private String serviceList; - - public GroupServiceList() { - //An empty constructor - } - public GroupServiceList(String string, String userid) { - this(domain); - - } - public GroupServiceList(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java index 88db4dd53..816b9d010 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -29,8 +29,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -39,8 +37,6 @@ import javax.persistence.Table; public class MicroServiceAttribute implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -56,28 +52,6 @@ public class MicroServiceAttribute implements Serializable { @Column(name="modelName") private String modelName; - - public MicroServiceAttribute() { - //An empty constructor - } - public MicroServiceAttribute(String string, String userid) { - this(domain); - - } - public MicroServiceAttribute(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java index 90a066b83..f404af153 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class MicroServiceConfigName implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,28 +51,6 @@ public class MicroServiceConfigName implements Serializable { @Column(name="description ") private String description ; - - public MicroServiceConfigName() { - //An empty constructor - } - public MicroServiceConfigName(String string, String userid) { - this(domain); - - } - public MicroServiceConfigName(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java index 130de0a83..da7227511 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class MicroServiceLocation implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -54,28 +50,6 @@ public class MicroServiceLocation implements Serializable { @Column(name="description ") private String description ; - - - public MicroServiceLocation() { - //An empty constructor - } - public MicroServiceLocation(String string, String userid) { - this(domain); - - } - public MicroServiceLocation(String domain) { - //An empty constructor - } - - @PrePersist - public void prePersist() { - //An empty function - } - @PreUpdate - public void preUpdate() { - //An empty function - } - public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java index 699aa8ac4..f323251cc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -105,14 +105,6 @@ public class MicroServiceModels implements Serializable{ this.userCreatedBy = userCreatedBy; } - public MicroServiceModels(){ - //An empty constructor - } - - public MicroServiceModels(String userid){ - //An empty constructor - } - public String getAttributes() { return attributes; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java index 9f437ce28..32dd112f7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,7 +39,6 @@ import javax.persistence.Table; public class PolicyScopeClosedLoop implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -55,27 +52,6 @@ public class PolicyScopeClosedLoop implements Serializable { @Column(name="description ") private String description ; - public PolicyScopeClosedLoop() { - // Empty constructor - } - public PolicyScopeClosedLoop(String string, String userid) { - this(domain); - - } - public PolicyScopeClosedLoop(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java index 9d71600e9..10c3c74fd 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class PolicyScopeResource implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -54,27 +50,6 @@ public class PolicyScopeResource implements Serializable { @Column(name="description ") private String description ; - - public PolicyScopeResource() { - // Empty constructor - } - public PolicyScopeResource(String string, String userid) { - this(domain); - - } - public PolicyScopeResource(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java index ec95d1691..9d89b98b1 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,7 +39,6 @@ import javax.persistence.Table; public class PolicyScopeService implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -54,27 +51,6 @@ public class PolicyScopeService implements Serializable { @Column(name="description ") private String description ; - - public PolicyScopeService() { - // Empty constructor - } - public PolicyScopeService(String string, String userid) { - this(domain); - - } - public PolicyScopeService(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java index 92252b043..0367b0149 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class PolicyScopeType implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,27 +51,6 @@ public class PolicyScopeType implements Serializable { @Column(name="description ") private String description ; - public PolicyScopeType() { - // Empty constructor - } - public PolicyScopeType(String string, String userid) { - this(domain); - - } - public PolicyScopeType(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java index e696b1d06..64c892921 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class PortList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -53,32 +49,7 @@ public class PortList implements Serializable { @Column(name="description") private String description; -/* - @Temporal(TemporalType.TIMESTAMP) - @Column(name="modified_date", nullable=false) - private Date modifiedDate;*/ - - public PortList() { - // Empty constructor - } - public PortList(String string, String userid) { - this(domain); - - } - public PortList(String domain) { - // Empty constructor - } - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - - public int getId() { return this.id; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java index 16ef24cf7..4047143a1 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class PrefixList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -57,25 +53,6 @@ public class PrefixList implements Serializable { @Column(name="pl_value", nullable=false) private String prefixListValue; - public PrefixList() { - // Empty constructor - } - public PrefixList(String string, String userid) { - this(domain); - - } - public PrefixList(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } public String getPrefixListName() { return this.prefixListName; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java index b74bb4a57..7e96c4053 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class ProtocolList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -54,25 +50,6 @@ public class ProtocolList implements Serializable { @Column(name="description") private String description; - public ProtocolList() { - // Empty constructor - } - public ProtocolList(String string, String userid) { - this(domain); - - } - public ProtocolList(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } public String getProtocolName() { return this.protocolName; } 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 a65e41f2e..a533a70c1 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -52,8 +52,6 @@ import org.onap.policy.rest.XacmlAdminAuthorization; public class RiskType implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -99,18 +97,6 @@ public class RiskType implements Serializable { } private static Log LOGGER = LogFactory.getLog(RiskType.class); - - public RiskType() { - // Empty constructor - } - - public RiskType(String string, String userid) { - this(domain); - } - - public RiskType(String domain) { - this.name = domain; - } @PrePersist public void prePersist() { 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 8b017c006..4426cac60 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class SafePolicyWarning implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -63,27 +59,7 @@ public class SafePolicyWarning implements Serializable { } public void setRiskType(String riskType) { this.riskType = riskType; - } - public SafePolicyWarning() { - // Empty constructor - } - public SafePolicyWarning(String string, String userid) { - this(domain); - - } - public SafePolicyWarning(String domain) { - // Empty constructor } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; 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 cbbb8962e..30881337a 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class SecurityZone implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -53,28 +49,6 @@ public class SecurityZone implements Serializable { @Column(name="value") private String zoneValue; - - - public SecurityZone() { - // Empty constructor - } - public SecurityZone(String string, String userid) { - this(domain); - - } - public SecurityZone(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; 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 057b86992..e09dff07a 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class ServiceList implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -65,27 +61,6 @@ public class ServiceList implements Serializable { @Column(name="ports") private String servicePorts; - - public ServiceList() { - // Empty constructor - } - public ServiceList(String string, String userid) { - this(domain); - - } - public ServiceList(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; 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 356ecb7c9..98a4e58e7 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @@ -41,8 +39,6 @@ import javax.persistence.Table; public class VMType implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -55,27 +51,6 @@ public class VMType implements Serializable { @Column(name="description") private String description; - - public VMType() { - // Empty constructor - } - public VMType(String string, String userid) { - this(domain); - - } - public VMType(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public String getDescription() { return description; } 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 fe5d62adc..c8759acb7 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -30,8 +30,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; @Entity @@ -40,8 +38,6 @@ import javax.persistence.Table; public class Zone implements Serializable { private static final long serialVersionUID = 1L; - private static String domain; - @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") @@ -53,28 +49,6 @@ public class Zone implements Serializable { @Column(name="zonevalue") private String zoneValue; - - - public Zone() { - // Empty constructor - } - public Zone(String string, String userid) { - this(domain); - - } - public Zone(String domain) { - // Empty constructor - } - - @PrePersist - public void prePersist() { - // Empty function - } - @PreUpdate - public void preUpdate() { - // Empty function - } - public int getId() { return this.id; diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPAClasses.java new file mode 100644 index 000000000..af705967c --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPAClasses.java @@ -0,0 +1,249 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class ActionDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testActionDictionary(){ + ActionPolicyDict data = new ActionPolicyDict(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setAttributeName("Test"); + assertTrue("Test".equals(data.getAttributeName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setBody("Test"); + assertTrue("Test".equals(data.getBody())); + data.setHeader("Test"); + assertTrue("Test".equals(data.getHeader())); + data.setMethod("GET"); + assertTrue("GET".equals(data.getMethod())); + data.setType("JSON"); + assertTrue("JSON".equals(data.getType())); + data.setUrl("http://test.com"); + assertTrue("http://test.com".equals(data.getUrl())); + data.prePersist(); + data.preUpdate(); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testFunctionArgument(){ + FunctionArgument data = new FunctionArgument(); + data.setArgIndex(1); + assertTrue(1 == data.getArgIndex()); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setFunctionDefinition(new FunctionDefinition()); + assertTrue(data.getFunctionDefinition()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.isBag(); + data.toString(); + data.setIsBag(1); + assertTrue(1 == data.getIsBag()); + new FunctionArgument(data); + } + + @Test + public void testFunctionDefinition(){ + FunctionDefinition data = new FunctionDefinition(); + data.setArgLb(1); + assertTrue(1 == data.getArgLb()); + data.setArgUb(1); + assertTrue(1 == data.getArgUb()); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setFunctionArguments(new ArrayList<>()); + assertTrue(data.getFunctionArguments()!=null); + data.setHigherOrderArg_LB(1); + assertTrue(1 == data.getHigherOrderArg_LB()); + data.setHigherOrderArg_UB(1); + assertTrue(1 == data.getHigherOrderArg_UB()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setIsBagReturn(1); + assertTrue(1 == data.getIsBagReturn()); + data.setIsHigherOrder(1); + assertTrue(1 == data.getIsHigherOrder()); + data.setShortname("Test"); + assertTrue("Test".equals(data.getShortname())); + data.setXacmlid("Test"); + assertTrue("Test".equals(data.getXacmlid())); + data.toString(); + data.isBagReturn(); + data.isHigherOrder(); + data.addFunctionArgument(new FunctionArgument()); + data.removeFunctionArgument(new FunctionArgument()); + } + + @Test + public void testCategory(){ + Category data = new Category(); + new Category(null); + data.setAttributes(new HashSet<>()); + data.addAttribute(new Attribute()); + data.removeAttribute(new Attribute()); + data.isStandard(); + data.isCustom(); + Category.extractGrouping("urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"); + data.getIdentifer(); + data.toString(); + assertTrue(data.getAttributes()!=null); + data.setGrouping("Test"); + assertTrue("Test".equals(data.getGrouping())); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + } + + @Test + public void testConstraintType(){ + ConstraintType data = new ConstraintType(); + new ConstraintType("Test", "Test"); + ConstraintType.getRangeTypes(); + data.setAttributes(new HashSet<>()); + assertTrue(data.getAttributes()!=null); + data.setConstraintType("Test"); + assertTrue("Test".equals(data.getConstraintType())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setId(1); + assertTrue(1 == data.getId()); + } + + @Test + public void testConstraintValue(){ + ConstraintValue data = new ConstraintValue(); + data.clone(); + new ConstraintValue(new ConstraintValue()); + new ConstraintValue("Test","Test"); + data.setAttribute(new Attribute()); + assertTrue(data.getAttribute()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setProperty("Test"); + assertTrue("Test".equals(data.getProperty())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + } + + @Test + public void testObadvice(){ + Obadvice data = new Obadvice(); + new Obadvice(); + new Obadvice("Test", "Test"); + data.clone(); + data.addObadviceExpression(new ObadviceExpression()); + data.removeObadviceExpression(new ObadviceExpression()); + data.removeAllExpressions(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setFulfillOn("Test"); + assertTrue("Test".equals(data.getFulfillOn())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setObadviceExpressions(new HashSet<>()); + assertTrue(data.getObadviceExpressions()!=null); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + } + + @Test + public void testObadviceExpression(){ + ObadviceExpression data = new ObadviceExpression(); + data.clone(); + data.setAttribute(new Attribute()); + assertTrue(data.getAttribute()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setObadvice(new Obadvice()); + assertTrue(data.getObadvice()!=null); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + } + + @Test + public void testRuleAlgorithms(){ + RuleAlgorithms data = new RuleAlgorithms(); + data.isCustom(); + data.isStandard(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.toString(); + } + + @Test + public void testAttributeAssignment(){ + AttributeAssignment data = new AttributeAssignment(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setAttributeId(1); + assertTrue(1 == data.getAttributeId()); + data.setExpression("Test"); + assertTrue("Test".equals(data.getExpression())); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPAClasses.java new file mode 100644 index 000000000..1f09205fd --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPAClasses.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class BRMSDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testBRMSParamTemplate(){ + BRMSParamTemplate data = new BRMSParamTemplate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setRule("Test"); + assertTrue("Test".equals(data.getRule())); + data.setRuleName("Test"); + assertTrue("Test".equals(data.getRuleName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + } + + @Test + public void testBRMSController(){ + BRMSController data = new BRMSController(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setController("Test"); + assertTrue("Test".equals(data.getController())); + data.setControllerName("Test"); + assertTrue("Test".equals(data.getControllerName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testBRMSDependency(){ + BRMSDependency data = new BRMSDependency(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.setDependencyName("Test"); + assertTrue("Test".equals(data.getDependencyName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPAClasses.java index 93691e48b..4fd1d0cbd 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPAClasses.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ONAP-PAP-REST + * ONAP-REST * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class ClosedLoopPolicyClasses { +public class ClosedLoopPolicyDictionaryJPAClasses { - private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyClasses.class); + private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPAClasses.class); private UserInfo userInfo; @Before @@ -45,6 +45,9 @@ public class ClosedLoopPolicyClasses { @Test public void testVSCLAction(){ VSCLAction data = new VSCLAction(); + new VSCLAction("Test","Test"); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setVsclaction("Test"); @@ -64,6 +67,9 @@ public class ClosedLoopPolicyClasses { @Test public void testVNFType(){ VNFType data = new VNFType(); + new VNFType("Test","Test"); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setVnftype("Test"); @@ -83,6 +89,9 @@ public class ClosedLoopPolicyClasses { @Test public void testPEPOptions(){ PEPOptions data = new PEPOptions(); + new PEPOptions("Test","Test"); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setPepName("Test"); @@ -102,6 +111,9 @@ public class ClosedLoopPolicyClasses { @Test public void testVarbindDictionary(){ VarbindDictionary data = new VarbindDictionary(); + new VarbindDictionary("Test","Test"); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setVarbindName("Test"); @@ -123,6 +135,8 @@ public class ClosedLoopPolicyClasses { @Test public void testClosedLoopD2Services(){ ClosedLoopD2Services data = new ClosedLoopD2Services(); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setServiceName("Test"); @@ -142,6 +156,9 @@ public class ClosedLoopPolicyClasses { @Test public void testClosedLoopSite(){ ClosedLoopSite data = new ClosedLoopSite(); + new ClosedLoopSite("Test","Test"); + data.preUpdate(); + data.prePersist(); data.setId(1); assertTrue(1 == data.getId()); data.setSiteName("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPAClasses.java new file mode 100644 index 000000000..eded9ed79 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPAClasses.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; +import java.util.HashSet; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class CommonDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testAttribute(){ + Attribute data = new Attribute(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setCategoryBean(new Category()); + assertTrue(data.getCategoryBean()!=null); + data.setConstraintType(new ConstraintType()); + assertTrue(data.getConstraintType()!=null); + data.setConstraintValues(new HashSet<>()); + assertTrue(data.getConstraintValues()!=null); + data.addConstraintValue(new ConstraintValue()); + data.removeConstraintValue(new ConstraintValue()); + data.removeAllConstraintValues(); + data.preUpdate(); + data.prePersist(); + new Attribute("Test"); + new Attribute(new Attribute()); + data.setAttributeValue("Test"); + assertTrue("Test".equals(data.getAttributeValue())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setIsDesignator(true); + assertTrue(data.isDesignator()); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setMustBePresent(true); + assertTrue(data.isMustBePresent()); + data.setPriority("Test"); + assertTrue("Test".equals(data.getPriority())); + data.setSelectorPath("Test"); + assertTrue("Test".equals(data.getSelectorPath())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testOnapName(){ + OnapName data = new OnapName(); + data.preUpdate(); + data.prePersist(); + new OnapName("Test", "Test"); + data.setId(1); + assertTrue(1 == data.getId()); + data.setOnapName("Test"); + assertTrue("Test".equals(data.getOnapName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testRiskType(){ + RiskType data = new RiskType(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setRiskName("Test"); + assertTrue("Test".equals(data.getRiskName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testSafePolicyWarning(){ + SafePolicyWarning data = new SafePolicyWarning(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setMessage("Test"); + assertTrue("Test".equals(data.getMessage())); + data.setRiskType("Test"); + assertTrue("Test".equals(data.getRiskType())); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPAClasses.java new file mode 100644 index 000000000..3e7d23d90 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPAClasses.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class DecisionDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testDecisionSettings(){ + DecisionSettings data = new DecisionSettings(); + data.setId(1); + assertTrue(1 == data.getId()); + data.preUpdate(); + data.prePersist(); + new DecisionSettings("Test"); + new DecisionSettings(new DecisionSettings("Test"), "Test"); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setDatatypeBean(new Datatype()); + assertTrue(data.getDatatypeBean()!=null); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setMustBePresent(true); + assertTrue(data.isMustBePresent()); + data.setPriority("Test"); + assertTrue("Test".equals(data.getPriority())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testRainyDayTreatments(){ + RainyDayTreatments data = new RainyDayTreatments(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setBbid("Test"); + assertTrue("Test".equals(data.getBbid())); + data.setWorkstep("Test"); + assertTrue("Test".equals(data.getWorkstep())); + data.setTreatments("Test"); + assertTrue("Test".equals(data.getTreatments())); + } + +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPAClasses.java new file mode 100644 index 000000000..fa4c03872 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPAClasses.java @@ -0,0 +1,258 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class FWDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(FWDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testActionList(){ + ActionList data = new ActionList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setActionName("Test"); + assertTrue("Test".equals(data.getActionName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testPortList(){ + PortList data = new PortList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPortName("Test"); + assertTrue("Test".equals(data.getPortName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testProtocolList(){ + ProtocolList data = new ProtocolList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setProtocolName("Test"); + assertTrue("Test".equals(data.getProtocolName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testSecurityZone(){ + SecurityZone data = new SecurityZone(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setZoneName("Test"); + assertTrue("Test".equals(data.getZoneName())); + data.setZoneValue("Test"); + assertTrue("Test".equals(data.getZoneValue())); + } + + @Test + public void testZone(){ + Zone data = new Zone(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setZoneName("Test"); + assertTrue("Test".equals(data.getZoneName())); + data.setZoneValue("Test"); + assertTrue("Test".equals(data.getZoneValue())); + } + + @Test + public void testAddressGroup(){ + AddressGroup data = new AddressGroup(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getPrefixList())); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testPrefixList(){ + PrefixList data = new PrefixList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPrefixListName("Test"); + assertTrue("Test".equals(data.getPrefixListName())); + data.setPrefixListValue("Test"); + assertTrue("Test".equals(data.getPrefixListValue())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testFWDictionaryList(){ + FirewallDictionaryList data = new FirewallDictionaryList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParentItemName("Test"); + assertTrue("Test".equals(data.getParentItemName())); + data.setAddressList("Test"); + assertTrue("Test".equals(data.getAddressList())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getServiceList())); + } + + @Test + public void testFWTag(){ + FWTag data = new FWTag(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setFwTagName("Test"); + assertTrue("Test".equals(data.getFwTagName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setTagValues("Test"); + assertTrue("Test".equals(data.getTagValues())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testFWTagPicker(){ + FWTagPicker data = new FWTagPicker(); + data.preUpdate(); + data.prePersist(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setTagPickerName("Test"); + assertTrue("Test".equals(data.getTagPickerName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setNetworkRole("Test"); + assertTrue("Test".equals(data.getNetworkRole())); + data.setTagValues("Test"); + assertTrue("Test".equals(data.getTagValues())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testServiceList(){ + ServiceList data = new ServiceList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setServiceName("Test"); + assertTrue("Test".equals(data.getServiceName())); + data.setServiceDescription("Test"); + assertTrue("Test".equals(data.getServiceDescription())); + data.setServiceType("Test"); + assertTrue("Test".equals(data.getServiceType())); + data.setServiceTransProtocol("Test"); + assertTrue("Test".equals(data.getServiceTransProtocol())); + data.setServiceAppProtocol("Test"); + assertTrue("Test".equals(data.getServiceAppProtocol())); + data.setServicePorts("Test"); + assertTrue("Test".equals(data.getServicePorts())); + } + + @Test + public void testTermList(){ + TermList data = new TermList(); + data.preUpdate(); + data.prePersist(); + new TermList("Test", "Test"); + data.setId(1); + assertTrue(1 == data.getId()); + data.setTermName("Test"); + assertTrue("Test".equals(data.getTermName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getTermDescription())); + data.setFromZones("Test"); + assertTrue("Test".equals(data.getFromZone())); + data.setToZones("Test"); + assertTrue("Test".equals(data.getToZone())); + 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"); + assertTrue("Test".equals(data.getPortList())); + data.setSrcPortList("Test"); + assertTrue("Test".equals(data.getSrcPortList())); + data.setDestPortList("Test"); + assertTrue("Test".equals(data.getDestPortList())); + data.setAction("Test"); + assertTrue("Test".equals(data.getAction())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testGroupServiceList(){ + GroupServiceList data = new GroupServiceList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setServiceList("Test"); + assertTrue("Test".equals(data.getServiceList())); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPAClasses.java new file mode 100644 index 000000000..465d034bd --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPAClasses.java @@ -0,0 +1,183 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class MicroServiceDictionaryJPAClasses { + + private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testDCAEUsers(){ + DCAEUsers data = new DCAEUsers(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testDCAEuuid(){ + DCAEuuid data = new DCAEuuid(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + + @Test + public void testMSConfigName(){ + MicroServiceConfigName data = new MicroServiceConfigName(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testMSConfigLocation(){ + MicroServiceLocation data = new MicroServiceLocation(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testMSModels(){ + MicroServiceModels data = new MicroServiceModels(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setModelName("Test"); + assertTrue("Test".equals(data.getModelName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.setEnumValues("Test"); + assertTrue("Test".equals(data.getEnumValues())); + data.setAnnotation("Test"); + assertTrue("Test".equals(data.getAnnotation())); + data.setAttributes("Test"); + assertTrue("Test".equals(data.getAttributes())); + data.setRef_attributes("Test"); + assertTrue("Test".equals(data.getRef_attributes())); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setSub_attributes("Test"); + assertTrue("Test".equals(data.getSub_attributes())); + data.setVersion("Test"); + assertTrue("Test".equals(data.getVersion())); + } + + @Test + public void testMSAttributeDictionary(){ + MicroServiceAttribute data = new MicroServiceAttribute(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + data.setModelName("Test"); + assertTrue("Test".equals(data.getModelName())); + } + + @Test + public void testPolicyScopeService(){ + PolicyScopeService data = new PolicyScopeService(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeResource(){ + PolicyScopeResource data = new PolicyScopeResource(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeType(){ + PolicyScopeType data = new PolicyScopeType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeClosedLoop(){ + PolicyScopeClosedLoop data = new PolicyScopeClosedLoop(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescriptionValue("Test"); + assertTrue("Test".equals(data.getDescriptionValue())); + } + + @Test + public void testPolicyScopeGroupPolicyScopeList(){ + GroupPolicyScopeList data = new GroupPolicyScopeList(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getGroupName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setGroupList("Test"); + assertTrue("Test".equals(data.getGroupList())); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPAClasses.java new file mode 100644 index 000000000..96f107bfe --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPAClasses.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class PolicyEntityJPAClasses { + + private static Logger logger = FlexLogger.getLogger(PolicyEntityJPAClasses.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testPolicyGroupEntity(){ + PolicyGroupEntity data = new PolicyGroupEntity(); + data.setGroupKey(1); + assertTrue(1 == data.getGroupKey()); + data.setPolicyid(1); + assertTrue(1 == data.getPolicyid()); + } + + @Test + public void testPolicyDBDaoEntity(){ + PolicyDBDaoEntity data = new PolicyDBDaoEntity(); + data.prePersist(); + data.preUpdate(); + data.setPolicyDBDaoUrl("Test"); + assertTrue("Test".equals(data.getPolicyDBDaoUrl())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setUsername("Test"); + assertTrue("Test".equals(data.getUsername())); + data.setPassword("Test"); + assertTrue("Test".equals(data.getPassword())); + } + + @Test + public void testDatabaseLockEntity(){ + DatabaseLockEntity data = new DatabaseLockEntity(); + data.setKey(1); + assertTrue(1 == data.getKey()); + } + + @Test + public void testPolicyEntity(){ + PolicyEntity data = new PolicyEntity(); + data.prePersist(); + data.preUpdate(); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setPolicyData("Test"); + assertTrue("Test".equals(data.getPolicyData())); + data.setConfigurationData(new ConfigurationDataEntity()); + assertTrue(data.getConfigurationData()!=null); + data.setActionBodyEntity(new ActionBodyEntity()); + assertTrue(data.getActionBodyEntity()!=null); + data.setScope("Test"); + assertTrue("Test".equals(data.getScope())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setDeleted(true); + assertTrue(data.isDeleted()); + data.equals(new PolicyEntity()); + data.hashCode(); + } + + @Test + public void testActionBodyEntity(){ + ActionBodyEntity data = new ActionBodyEntity(); + data.prePersist(); + data.preUpdate(); + data.setActionBodyName("Test"); + assertTrue("Test".equals(data.getActionBodyName())); + data.setActionBody("Test"); + assertTrue("Test".equals(data.getActionBody())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setModifiedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.equals(new ConfigurationDataEntity()); + data.hashCode(); + } + + @Test + public void testConfigurationDataEntity(){ + ConfigurationDataEntity data = new ConfigurationDataEntity(); + data.prePersist(); + data.preUpdate(); + data.setConfigurationName("Test"); + assertTrue("Test".equals(data.getConfigurationName())); + data.setConfigType("Test"); + assertTrue("Test".equals(data.getConfigType())); + data.setConfigBody("Test"); + assertTrue("Test".equals(data.getConfigBody())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setModifiedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + data.equals(new ConfigurationDataEntity()); + data.hashCode(); + } + + @Test + public void testPdpEntity(){ + PdpEntity data = new PdpEntity(); + data.prePersist(); + data.preUpdate(); + data.setPdpId("Test"); + assertTrue("Test".equals(data.getPdpId())); + data.setPdpName("Test"); + assertTrue("Test".equals(data.getPdpName())); + data.setGroup(new GroupEntity()); + assertTrue(data.getGroup()!=null); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setJmxPort(1); + assertTrue(1 == data.getJmxPort()); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + } + + @Test + public void testGroupEntity(){ + GroupEntity data = new GroupEntity(); + data.prePersist(); + data.preUpdate(); + data.setGroupId("Test"); + assertTrue("Test".equals(data.getGroupId())); + data.setGroupName("Test"); + assertTrue("Test".equals(data.getgroupName())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setDefaultGroup(true); + assertTrue(data.isDefaultGroup()); + data.setDeleted(true); + assertTrue(data.isDeleted()); + assertTrue(data.getCreatedDate()!=null); + assertTrue(data.getModifiedDate()!=null); + } +} |