aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/guard/src')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java18
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java8
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java8
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java16
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java66
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java (renamed from controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java)12
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java (renamed from controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java)12
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java (renamed from controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java)12
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java4
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java6
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java8
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java48
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java26
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java32
16 files changed, 146 insertions, 142 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
index fefea39ab..046b7cfd6 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -131,7 +131,7 @@ public class CallGuardTask implements Runnable {
//
// Make guard request
//
- guardDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ guardDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
logger.debug("\n********** XACML RESPONSE START ********");
logger.debug("{}", guardDecision);
@@ -153,7 +153,7 @@ public class CallGuardTask implements Runnable {
//
if ("Indeterminate".equals(guardResponse.getResult())) {
guardResponse.setOperation(recipe);
- guardResponse.setRequestID(UUID.fromString(requestId));
+ guardResponse.setRequestId(UUID.fromString(requestId));
}
long estimatedTime = System.nanoTime() - startTime;
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
index e4849cea5..7ae0e7eb2 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -23,9 +23,9 @@ package org.onap.policy.guard;
import java.util.UUID;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.core.lock.PolicyResourceLockManager;
-import org.onap.policy.guard.impl.PNFTargetLock;
-import org.onap.policy.guard.impl.VMTargetLock;
-import org.onap.policy.guard.impl.VNFTargetLock;
+import org.onap.policy.guard.impl.PnfTargetLock;
+import org.onap.policy.guard.impl.VmTargetLock;
+import org.onap.policy.guard.impl.VnfTargetLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,17 +97,17 @@ public class PolicyGuard {
//
// Create the Lock object
//
- return new PNFTargetLock(targetType, targetInstance, requestId, callback);
+ return new PnfTargetLock(targetType, targetInstance, requestId, callback);
case VM:
//
// Create the Lock object
//
- return new VMTargetLock(targetType, targetInstance, requestId, callback);
+ return new VmTargetLock(targetType, targetInstance, requestId, callback);
case VNF:
//
// Create the Lock object
//
- return new VNFTargetLock(targetType, targetInstance, requestId, callback);
+ return new VnfTargetLock(targetType, targetInstance, requestId, callback);
default:
logger.error("invalid target type {} for lock on {}", targetType, targetInstance);
return null;
@@ -156,7 +156,7 @@ public class PolicyGuard {
* @return the result: acquired or denied
*/
public static GuardResult lockTarget(TargetLock lock, int holdSec) {
- String owner = makeOwner(lock.getTargetType(), lock.getRequestID());
+ String owner = makeOwner(lock.getTargetType(), lock.getRequestId());
boolean result = factory.getManager().refresh(lock.getTargetInstance(), owner, holdSec);
@@ -173,7 +173,7 @@ public class PolicyGuard {
* @throws IllegalArgumentException if an argument is null
*/
public static boolean unlockTarget(TargetLock lock) {
- String owner = makeOwner(lock.getTargetType(), lock.getRequestID());
+ String owner = makeOwner(lock.getTargetType(), lock.getRequestId());
boolean result = factory.getManager().unlock(lock.getTargetInstance(), owner);
if (result) {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
index 5cb080fa5..8887e00b7 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -46,7 +46,7 @@ public class PolicyGuardRequest {
@Override
public String toString() {
- return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestID=" + requestId + ", operation="
+ return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestId=" + requestId + ", operation="
+ operation + "]";
}
@@ -66,11 +66,11 @@ public class PolicyGuardRequest {
this.target = target;
}
- public UUID getRequestID() {
+ public UUID getRequestId() {
return requestId;
}
- public void setRequestID(UUID requestId) {
+ public void setRequestId(UUID requestId) {
this.requestId = requestId;
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
index d7ece3081..574c50b79 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -42,14 +42,14 @@ public class PolicyGuardResponse {
@Override
public String toString() {
- return "PolicyGuardResponse [requestID=" + requestId + ", operation=" + operation + ", result=" + result + "]";
+ return "PolicyGuardResponse [requestId=" + requestId + ", operation=" + operation + ", result=" + result + "]";
}
- public UUID getRequestID() {
+ public UUID getRequestId() {
return requestId;
}
- public void setRequestID(UUID requestId) {
+ public void setRequestId(UUID requestId) {
this.requestId = requestId;
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index 35b1d2561..c2dfc908d 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -84,7 +84,7 @@ public class PolicyGuardXacmlHelper {
* @param xacmlReq the XACML request
* @return the response
*/
- public String callPDP(PolicyGuardXacmlRequestAttributes xacmlReq) {
+ public String callPdp(PolicyGuardXacmlRequestAttributes xacmlReq) {
//
// Send it to the PDP
//
@@ -94,11 +94,11 @@ public class PolicyGuardXacmlHelper {
// Build the json request
//
JSONObject attributes = new JSONObject();
- attributes.put("actor", xacmlReq.getActorID());
- attributes.put("recipe", xacmlReq.getOperationID());
- attributes.put("target", xacmlReq.getTargetID());
- if (xacmlReq.getClnameID() != null) {
- attributes.put("clname", xacmlReq.getClnameID());
+ attributes.put("actor", xacmlReq.getActorId());
+ attributes.put("recipe", xacmlReq.getOperationId());
+ attributes.put("target", xacmlReq.getTargetId());
+ if (xacmlReq.getClnameId() != null) {
+ attributes.put("clname", xacmlReq.getClnameId());
}
if (xacmlReq.getVfCount() != null) {
attributes.put("vfCount", xacmlReq.getVfCount());
@@ -221,7 +221,7 @@ public class PolicyGuardXacmlHelper {
* @param xacmlResponse the XACML response
* @return the PolicyGuardResponse
*/
- public static PolicyGuardResponse parseXACMLPDPResponse(com.att.research.xacml.api.Response xacmlResponse) {
+ public static PolicyGuardResponse parseXacmlPdpResponse(com.att.research.xacml.api.Response xacmlResponse) {
if (xacmlResponse == null) {
//
// In case the actual XACML response was null, create an empty
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java
index d7e608cb8..da03addf9 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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,19 +29,19 @@ import com.att.research.xacml.std.annotations.XACMLSubject;
public class PolicyGuardXacmlRequestAttributes {
@XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:clname:clname-id")
- String clnameID;
+ String clnameId;
@XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:actor:actor-id")
- String actorID;
+ String actorId;
@XACMLAction(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:operation:operation-id")
- String operationID;
+ String operationId;
@XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:target:target-id")
- String targetID;
+ String targetId;
@XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:request-id")
- String requestID;
+ String requestId;
@XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:vf-count")
Integer vfCount;
@@ -59,58 +59,58 @@ public class PolicyGuardXacmlRequestAttributes {
public PolicyGuardXacmlRequestAttributes(String clnameId, String actorId, String operationId, String targetId,
String requestId, Integer vfCount) {
super();
- this.clnameID = clnameId;
- this.actorID = actorId;
- this.operationID = operationId;
- this.targetID = targetId;
- this.requestID = requestId;
+ this.clnameId = clnameId;
+ this.actorId = actorId;
+ this.operationId = operationId;
+ this.targetId = targetId;
+ this.requestId = requestId;
this.vfCount = vfCount;
}
@Override
public String toString() {
- return "PolicyGuardXacmlRequestAttributes [actorID=" + actorID + ", operationID=" + operationID + ", targetID="
- + targetID + ", requestID=" + requestID + "]";
+ return "PolicyGuardXacmlRequestAttributes [actorId=" + actorId + ", operationId=" + operationId + ", targetId="
+ + targetId + ", requestId=" + requestId + "]";
}
- public String getActorID() {
- return actorID;
+ public String getActorId() {
+ return actorId;
}
- public void setActorID(String actorID) {
- this.actorID = actorID;
+ public void setActorId(String actorId) {
+ this.actorId = actorId;
}
- public String getOperationID() {
- return operationID;
+ public String getOperationId() {
+ return operationId;
}
- public void setOperationID(String operationID) {
- this.operationID = operationID;
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
}
- public String getTargetID() {
- return targetID;
+ public String getTargetId() {
+ return targetId;
}
- public void setTargetID(String targetID) {
- this.targetID = targetID;
+ public void setTargetId(String targetId) {
+ this.targetId = targetId;
}
- public String getRequestID() {
- return requestID;
+ public String getRequestId() {
+ return requestId;
}
- public void setRequestID(String requestID) {
- this.requestID = requestID;
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
}
- public String getClnameID() {
- return clnameID;
+ public String getClnameId() {
+ return clnameId;
}
- public void setClnameID(String clnameID) {
- this.clnameID = clnameID;
+ public void setClnameId(String clnameId) {
+ this.clnameId = clnameId;
}
public Integer getVfCount() {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java
index 1e3064abd..eea46c3cc 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,12 @@ import org.onap.policy.controlloop.policy.TargetType;
public interface TargetLock {
- public UUID getLockID();
+ public UUID getLockId();
public TargetType getTargetType();
public String getTargetInstance();
- public UUID getRequestID();
+ public UUID getRequestId();
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java
index 904448591..c1ad34a22 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.guard.LockCallback;
import org.onap.policy.guard.TargetLock;
-public class PNFTargetLock implements TargetLock, Serializable {
+public class PnfTargetLock implements TargetLock, Serializable {
private static final long serialVersionUID = 2335897394577202732L;
@@ -45,7 +45,7 @@ public class PNFTargetLock implements TargetLock, Serializable {
* @param requestId the request Id
* @param callback the callback
*/
- public PNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) {
+ public PnfTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) {
this.lockId = UUID.randomUUID();
this.targetType = type;
this.target = target;
@@ -54,7 +54,7 @@ public class PNFTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getLockID() {
+ public UUID getLockId() {
return this.lockId;
}
@@ -70,7 +70,7 @@ public class PNFTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getRequestID() {
+ public UUID getRequestId() {
return this.requestId;
}
@@ -80,7 +80,7 @@ public class PNFTargetLock implements TargetLock, Serializable {
@Override
public String toString() {
- return "PNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID="
+ return "PnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId="
+ requestId + "]";
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java
index 6046e3a32..301c6ec7c 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.guard.LockCallback;
import org.onap.policy.guard.TargetLock;
-public class VMTargetLock implements TargetLock, Serializable {
+public class VmTargetLock implements TargetLock, Serializable {
private static final long serialVersionUID = -8795145054334409724L;
private final UUID lockId;
@@ -44,7 +44,7 @@ public class VMTargetLock implements TargetLock, Serializable {
* @param requestId the request Id
* @param callback the callback
*/
- public VMTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) {
+ public VmTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) {
this.lockId = UUID.randomUUID();
this.targetType = targetType;
this.target = target;
@@ -53,7 +53,7 @@ public class VMTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getLockID() {
+ public UUID getLockId() {
return this.lockId;
}
@@ -68,7 +68,7 @@ public class VMTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getRequestID() {
+ public UUID getRequestId() {
return this.requestId;
}
@@ -78,7 +78,7 @@ public class VMTargetLock implements TargetLock, Serializable {
@Override
public String toString() {
- return "VMTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID="
+ return "VmTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId="
+ requestId + "]";
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java
index 418a3ed78..2e3fc28b1 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.guard.LockCallback;
import org.onap.policy.guard.TargetLock;
-public class VNFTargetLock implements TargetLock, Serializable {
+public class VnfTargetLock implements TargetLock, Serializable {
private static final long serialVersionUID = 2335897394577202732L;
@@ -45,7 +45,7 @@ public class VNFTargetLock implements TargetLock, Serializable {
* @param requestId the request Id
* @param callback the callback
*/
- public VNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) {
+ public VnfTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) {
this.lockId = UUID.randomUUID();
this.targetType = type;
this.target = target;
@@ -54,7 +54,7 @@ public class VNFTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getLockID() {
+ public UUID getLockId() {
return this.lockId;
}
@@ -70,7 +70,7 @@ public class VNFTargetLock implements TargetLock, Serializable {
}
@Override
- public UUID getRequestID() {
+ public UUID getRequestId() {
return this.requestId;
}
@@ -80,7 +80,7 @@ public class VNFTargetLock implements TargetLock, Serializable {
@Override
public String toString() {
- return "VNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID="
+ return "VnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId="
+ requestId + "]";
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java
index b1b057542..9e4c809c2 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -72,7 +72,7 @@ public class CallGuardTaskTest {
// and has same reqID
PolicyGuardResponse response = (PolicyGuardResponse) obj;
// req ID has form 00000001-0002-0003-0004-000000000005
- return status.equals(response.getResult()) && response.getRequestID().toString().matches(REQ_MATCHER);
+ return status.equals(response.getResult()) && response.getRequestId().toString().matches(REQ_MATCHER);
}));
}
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java
index 7c9aae7b4..3b0441fc2 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 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
@@ -37,8 +39,8 @@ public class PolicyGuardRequestTest {
PolicyGuardRequest request = new PolicyGuardRequest("Dorothy", "Kansas", requestId, "GetBackHome");
- request.setRequestID(requestId);
- assertEquals(requestId, request.getRequestID());
+ request.setRequestId(requestId);
+ assertEquals(requestId, request.getRequestId());
request.setActor("Dorothy");
assertEquals("Dorothy", request.getActor());
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java
index f9bd94795..b30ae0210 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 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
@@ -37,8 +39,8 @@ public class PolicyGuardResponseTest {
PolicyGuardResponse response = new PolicyGuardResponse("BackHome", requestId, "GetBackHome");
- response.setRequestID(requestId);
- assertEquals(requestId, response.getRequestID());
+ response.setRequestId(requestId);
+ assertEquals(requestId, response.getRequestId());
response.setResult("BackHome");
assertEquals("BackHome", response.getResult());
@@ -46,6 +48,6 @@ public class PolicyGuardResponseTest {
response.setOperation("GetBackHome");
assertEquals("GetBackHome", response.getOperation());
- assertEquals("PolicyGuardResponse [requestID=", response.toString().substring(0, 31));
+ assertEquals("PolicyGuardResponse [requestId=", response.toString().substring(0, 31));
}
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
index 273d8fb01..87303623c 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -39,9 +39,9 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.core.lock.PolicyResourceLockManager;
import org.onap.policy.guard.PolicyGuard.Factory;
import org.onap.policy.guard.PolicyGuard.LockResult;
-import org.onap.policy.guard.impl.PNFTargetLock;
-import org.onap.policy.guard.impl.VMTargetLock;
-import org.onap.policy.guard.impl.VNFTargetLock;
+import org.onap.policy.guard.impl.PnfTargetLock;
+import org.onap.policy.guard.impl.VmTargetLock;
+import org.onap.policy.guard.impl.VnfTargetLock;
public class PolicyGuardTest {
private static final String INSTANCENAME = "targetInstance";
@@ -76,7 +76,7 @@ public class PolicyGuardTest {
}
@Override
- public UUID getLockID() {
+ public UUID getLockId() {
return null;
}
@@ -91,7 +91,7 @@ public class PolicyGuardTest {
}
@Override
- public UUID getRequestID() {
+ public UUID getRequestId() {
return reqid;
}
}
@@ -137,13 +137,13 @@ public class PolicyGuardTest {
assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid));
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VMTargetLock.class, result.getB().getClass());
+ assertEquals(VmTargetLock.class, result.getB().getClass());
- VMTargetLock vtl = (VMTargetLock) result.getB();
- assertNotNull(vtl.getLockID());
+ VmTargetLock vtl = (VmTargetLock) result.getB();
+ assertNotNull(vtl.getLockId());
assertEquals(INSTANCENAME, vtl.getTargetInstance());
assertEquals(TargetType.VM, vtl.getTargetType());
- assertNotNull(vtl.getRequestID());
+ assertNotNull(vtl.getRequestId());
assertEquals(dlcb, vtl.getCallback());
// Test isLocked after lock removed
@@ -161,13 +161,13 @@ public class PolicyGuardTest {
assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid));
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(PNFTargetLock.class, result.getB().getClass());
+ assertEquals(PnfTargetLock.class, result.getB().getClass());
- PNFTargetLock ptl = (PNFTargetLock) result.getB();
- assertNotNull(ptl.getLockID());
+ PnfTargetLock ptl = (PnfTargetLock) result.getB();
+ assertNotNull(ptl.getLockId());
assertEquals(INSTANCENAME, ptl.getTargetInstance());
assertEquals(TargetType.PNF, ptl.getTargetType());
- assertNotNull(ptl.getRequestID());
+ assertNotNull(ptl.getRequestId());
assertEquals(dlcb, ptl.getCallback());
// Test isLocked after lock removed
@@ -186,13 +186,13 @@ public class PolicyGuardTest {
assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid));
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VNFTargetLock.class, result.getB().getClass());
+ assertEquals(VnfTargetLock.class, result.getB().getClass());
- VNFTargetLock vtl = (VNFTargetLock) result.getB();
- assertNotNull(vtl.getLockID());
+ VnfTargetLock vtl = (VnfTargetLock) result.getB();
+ assertNotNull(vtl.getLockId());
assertEquals(INSTANCENAME, vtl.getTargetInstance());
assertEquals(TargetType.VNF, vtl.getTargetType());
- assertNotNull(vtl.getRequestID());
+ assertNotNull(vtl.getRequestId());
assertEquals(dlcb, vtl.getCallback());
// Test isLocked after lock removed
@@ -227,7 +227,7 @@ public class PolicyGuardTest {
assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid));
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VMTargetLock.class, result.getB().getClass());
+ assertEquals(VmTargetLock.class, result.getB().getClass());
// Test isLocked after lock removed
PolicyGuard.unlockTarget(new DummyTargetLock(type, uuid));
@@ -248,7 +248,7 @@ public class PolicyGuardTest {
assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid));
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VMTargetLock.class, result.getB().getClass());
+ assertEquals(VmTargetLock.class, result.getB().getClass());
UUID uuid2 = UUID.randomUUID();
result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid2, dlcb, LOCK_SEC);
@@ -272,8 +272,8 @@ public class PolicyGuardTest {
assertFalse(dlcb.releaseLock());
DummyTargetLock dtl = new DummyTargetLock(type, uuid);
- assertNull(dtl.getLockID());
- assertEquals(uuid, dtl.getRequestID());
+ assertNull(dtl.getLockId());
+ assertEquals(uuid, dtl.getRequestId());
assertEquals(INSTANCENAME, dtl.getTargetInstance());
assertEquals(type, dtl.getTargetType());
}
@@ -288,7 +288,7 @@ public class PolicyGuardTest {
result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC);
verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC);
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VMTargetLock.class, result.getB().getClass());
+ assertEquals(VmTargetLock.class, result.getB().getClass());
// diff owner - denied
UUID uuid2 = UUID.randomUUID();
@@ -308,7 +308,7 @@ public class PolicyGuardTest {
result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC);
verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC);
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
- assertEquals(VMTargetLock.class, result.getB().getClass());
+ assertEquals(VmTargetLock.class, result.getB().getClass());
TargetLock lock = result.getB();
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
index e69820a3d..8b007fdcc 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -92,7 +92,7 @@ public class PolicyGuardXacmlHelperTest {
PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes(
org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target",
"requestId", VF_COUNT);
- String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
assertNotNull(rawDecision);
assertEquals(0, Util.INDETERMINATE.compareToIgnoreCase(rawDecision));
}
@@ -101,13 +101,13 @@ public class PolicyGuardXacmlHelperTest {
public void testSimulator() {
PolicyGuardXacmlRequestAttributes request = new PolicyGuardXacmlRequestAttributes("clname_id", "actor_id",
"operation_id", "target_id", "request_id", VF_COUNT);
- String xacmlResponse = new PolicyGuardXacmlHelper().callPDP(request);
+ String xacmlResponse = new PolicyGuardXacmlHelper().callPdp(request);
assertNotNull(xacmlResponse);
}
@Test
/**
- * Tests PolicyGuardXacmlHelper.callPDP method to determine if it returns DENY, PERMIT, or
+ * Tests PolicyGuardXacmlHelper.callPdp method to determine if it returns DENY, PERMIT, or
* INDETERMINATE as expected.
*/
public void testCallPdp() {
@@ -115,13 +115,13 @@ public class PolicyGuardXacmlHelperTest {
PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes(
org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target",
"requestId", VF_COUNT);
- String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
assertNotNull(rawDecision);
assertTrue(0 == Util.DENY.compareToIgnoreCase(rawDecision));
// Permit Case
xacmlReq = new PolicyGuardXacmlRequestAttributes("clname", "actor", "recipe", "target", "requestId", VF_COUNT);
- rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
assertNotNull(rawDecision);
assertEquals(0, Util.PERMIT.compareToIgnoreCase(rawDecision));
@@ -130,21 +130,21 @@ public class PolicyGuardXacmlHelperTest {
@Test
/**
- * Tests PolicyGuardXacmlHelper.callPDP method to exercise all branches
+ * Tests PolicyGuardXacmlHelper.callPdp method to exercise all branches
*/
public void testCallPdpExtra() {
PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes(
org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target",
"requestId", VF_COUNT);
- xacmlReq.setClnameID(null);
- String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ xacmlReq.setClnameId(null);
+ String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
assertNotNull(rawDecision);
assertEquals(-5, Util.DENY.compareToIgnoreCase(rawDecision));
org.onap.policy.guard.Util.setGuardEnvProps("http://localhost:6669/pdp/api/getDecision", "", "", "", "", "");
- rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq);
+ rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq);
assertNotNull(rawDecision);
org.onap.policy.guard.Util.setGuardEnvProps("http://localhost:6669/pdp/api/getDecision", "python", "test",
@@ -154,14 +154,14 @@ public class PolicyGuardXacmlHelperTest {
@Test
public void testParseXacmlPdpResponse() throws URISyntaxException {
- PolicyGuardResponse pgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(null);
+ PolicyGuardResponse pgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(null);
assertEquals("Indeterminate", pgResponse.getResult());
Decision decision = Decision.PERMIT;
Status status = new StdStatus(StdStatus.STATUS_OK);
Result result = new StdResult(decision, status);
Response xacmlResponse = new StdResponse(result);
- pgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(xacmlResponse);
+ pgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(xacmlResponse);
assertEquals("Permit", pgResponse.getResult());
@@ -193,7 +193,7 @@ public class PolicyGuardXacmlHelperTest {
Result fullResult = new StdResult(Decision.DENY, obligationsIn, adviceIn, attributesIn, policyIdentifiersIn,
policySetIdentifiersIn);
Response fullXacmlResponse = new StdResponse(fullResult);
- PolicyGuardResponse fullPgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(fullXacmlResponse);
+ PolicyGuardResponse fullPgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(fullXacmlResponse);
assertEquals("Deny", fullPgResponse.getResult());
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java
index 7b5affd32..b4f8c443a 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 AT&T. All rights reserved.
+ * Modifications Copyright (C) 2018-2019 AT&T. 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,30 +38,30 @@ public class PolicyGuardXacmlRequestAttributesTest {
assertNotNull(attributes);
UUID requestId = UUID.randomUUID();
- attributes.setRequestID(requestId.toString());
- assertEquals(requestId.toString(), attributes.getRequestID());
+ attributes.setRequestId(requestId.toString());
+ assertEquals(requestId.toString(), attributes.getRequestId());
UUID operationId = UUID.randomUUID();
- attributes.setOperationID(operationId.toString());
- assertEquals(operationId.toString(), attributes.getOperationID());
+ attributes.setOperationId(operationId.toString());
+ assertEquals(operationId.toString(), attributes.getOperationId());
UUID actorId = UUID.randomUUID();
- attributes.setActorID(actorId.toString());
- assertEquals(actorId.toString(), attributes.getActorID());
+ attributes.setActorId(actorId.toString());
+ assertEquals(actorId.toString(), attributes.getActorId());
UUID targetId = UUID.randomUUID();
- attributes.setTargetID(targetId.toString());
- assertEquals(targetId.toString(), attributes.getTargetID());
+ attributes.setTargetId(targetId.toString());
+ assertEquals(targetId.toString(), attributes.getTargetId());
- attributes.setTargetID(targetId.toString());
- assertEquals(targetId.toString(), attributes.getTargetID());
+ attributes.setTargetId(targetId.toString());
+ assertEquals(targetId.toString(), attributes.getTargetId());
UUID controlLoopId = UUID.randomUUID();
- attributes.setClnameID(controlLoopId.toString());
- assertEquals(controlLoopId.toString(), attributes.getClnameID());
+ attributes.setClnameId(controlLoopId.toString());
+ assertEquals(controlLoopId.toString(), attributes.getClnameId());
- attributes.setClnameID(null);
- assertEquals(null, attributes.getClnameID());
+ attributes.setClnameId(null);
+ assertEquals(null, attributes.getClnameId());
Integer vfCount = 20;
attributes.setVfCount(vfCount);
@@ -70,6 +70,6 @@ public class PolicyGuardXacmlRequestAttributesTest {
attributes.setVfCount(null);
assertEquals(null, attributes.getVfCount());
- assertEquals("PolicyGuardXacmlRequestAttributes [actorID=", attributes.toString().substring(0, 43));
+ assertEquals("PolicyGuardXacmlRequestAttributes [actorId=", attributes.toString().substring(0, 43));
}
}