Merge "New JUnit for PolicyEngineAPI"
[policy/engine.git] / ONAP-XACML / src / main / java / org / onap / policy / xacml / std / pap / StdPDPStatus.java
index f875995..a39ea36 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * 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,17 +38,20 @@ public class StdPDPStatus implements Serializable, PDPStatus {
        
        private Set<String> loadWarnings = new HashSet<>();
        
-       private Set<PDPPolicy> loadedPolicies = new HashSet<>();
+       private transient Set<PDPPolicy> loadedPolicies = new HashSet<>();
        
-       private Set<PDPPolicy> loadedRootPolicies = new HashSet<>();
+       private transient Set<PDPPolicy> loadedRootPolicies = new HashSet<>();
        
-       private Set<PDPPolicy> failedPolicies = new HashSet<>();
+       private transient Set<PDPPolicy> failedPolicies = new HashSet<>();
        
-       private Set<PDPPIPConfig>       loadedPIPConfigs = new HashSet<>();
+       private transient Set<PDPPIPConfig>     loadedPIPConfigs = new HashSet<>();
        
-       private Set<PDPPIPConfig>       failedPIPConfigs = new HashSet<>();
+       private transient Set<PDPPIPConfig>     failedPIPConfigs = new HashSet<>();
        
        public StdPDPStatus() {
+               //
+               // Default constructor
+               //
        }
 
        public void set(StdPDPStatus newStatus) {
@@ -151,7 +154,7 @@ public class StdPDPStatus implements Serializable, PDPStatus {
 
        @Override
        public boolean policiesOK() {
-               if (this.failedPolicies.size() > 0) {
+               if (!this.failedPolicies.isEmpty()) {
                        return false;
                }
                return true;
@@ -185,7 +188,7 @@ public class StdPDPStatus implements Serializable, PDPStatus {
 
        @Override
        public boolean pipConfigOK() {
-               if (this.failedPIPConfigs.size() > 0) {
+               if (!this.failedPIPConfigs.isEmpty()) {
                        return false;
                }
                return true;
@@ -194,13 +197,13 @@ public class StdPDPStatus implements Serializable, PDPStatus {
        @Override
        @JsonIgnore
        public boolean isOk() {
-               if (this.policiesOK() == false) {
+               if (!this.policiesOK()) {
                        return false;
                }
-               if (this.pipConfigOK() == false) {
+               if (!this.pipConfigOK()) {
                        return false;
                }
-               return (this.status == Status.UP_TO_DATE);
+               return this.status == Status.UP_TO_DATE;
        }
 
        @Override
@@ -246,6 +249,8 @@ public class StdPDPStatus implements Serializable, PDPStatus {
                        return false;
                if (!loadedPolicies.equals(other.loadedPolicies))
                        return false;
+        if (!loadedRootPolicies.equals(other.loadedRootPolicies))
+            return false;
                if (status != other.status)
                        return false;
                return true;