summaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-21 20:08:11 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-24 15:30:14 -0400
commita24a985d328b97f50a41d3448d235866af625ca9 (patch)
tree06c95950000fc2b512ec1e4da5aded2c5bc84e78 /controlloop/common/guard
parent3c52de0725c942fe1f2fdeb05c8960645bc66f01 (diff)
Fix checkstyle declarations
I fixed what I thought would be tolerable for this release. Same issue as policy/common I had to defined the checkstyle in each repo where the suppressions were needed. Issue-ID: POLICY-1135 Change-Id: I8f30bee7e9cddc692ddad3cf88acedb2e6b4781b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/guard')
-rw-r--r--controlloop/common/guard/checkstyle-suppressions.xml30
-rw-r--r--controlloop/common/guard/pom.xml40
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java11
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java34
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java32
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java12
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java6
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java6
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java160
11 files changed, 119 insertions, 224 deletions
diff --git a/controlloop/common/guard/checkstyle-suppressions.xml b/controlloop/common/guard/checkstyle-suppressions.xml
new file mode 100644
index 000000000..9b071df87
--- /dev/null
+++ b/controlloop/common/guard/checkstyle-suppressions.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2018 AT&T Technologies. 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.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+
+<suppressions>
+ <suppress checks="AbbreviationAsWordInName"
+ files="PNFTargetLock.java|VNFTargetLock.java|VMTargetLock.java|PolicyGuardRequest.java|PolicyGuardResponse.java|PolicyGuardXacmlHelper.java|TargetLock.java"
+ lines="1-9999"/>
+</suppressions>
diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml
index a3ecf961f..08e403e41 100644
--- a/controlloop/common/guard/pom.xml
+++ b/controlloop/common/guard/pom.xml
@@ -107,4 +107,44 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>onap-java-style</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <!-- Use Google Java Style Guide:
+ https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
+ with minor changes -->
+ <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+ <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
+ <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory>
+ <includeResources>true</includeResources>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <includeTestResources>true</includeTestResources>
+ <excludes>
+ </excludes>
+ <consoleOutput>true</consoleOutput>
+ <failsOnViolation>true</failsOnViolation>
+ <violationSeverity>warning</violationSeverity>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${oparent.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
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 146f42170..59a1816b7 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
@@ -20,6 +20,8 @@
package org.onap.policy.guard;
+import com.att.research.xacml.api.DataTypeException;
+import com.att.research.xacml.std.annotations.RequestParser;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@@ -27,8 +29,6 @@ import java.util.function.Supplier;
import org.drools.core.WorkingMemory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.research.xacml.api.DataTypeException;
-import com.att.research.xacml.std.annotations.RequestParser;
public class CallGuardTask implements Runnable {
@@ -36,14 +36,14 @@ public class CallGuardTask implements Runnable {
/**
* Actor/recipe pairs whose guard requests need a VF Module count. Each element is of
- * the form "<actor>:<recipe>".
+ * the form "&lt;actor&gt;:&lt;recipe&gt;".
*/
private static final Set<String> NEEDS_VF_COUNT = new HashSet<>();
/**
* Actor/recipe pairs whose guard requests need the VF Module count to be incremented
* (i.e., because a module is being added). Each element is of the form
- * "<actor>:<recipe>".
+ * "&lt;actor&gt;:&lt;recipe&gt;".
*/
private static final Set<String> INCR_VF_COUNT = new HashSet<>();
@@ -69,7 +69,8 @@ public class CallGuardTask implements Runnable {
/**
* Guard url is grabbed from PolicyEngine.manager properties
*/
- public CallGuardTask(WorkingMemory wm, String cl, String act, String rec, String tar, String reqId, Supplier<Integer> vfcnt) {
+ public CallGuardTask(WorkingMemory wm, String cl, String act,
+ String rec, String tar, String reqId, Supplier<Integer> vfcnt) {
workingMemory = wm;
clname = cl;
actor = act;
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
index 40b26c847..36bb36f5c 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java
@@ -39,14 +39,12 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Properties;
import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.NoResultException;
-import javax.persistence.NonUniqueResultException;
import javax.persistence.Persistence;
import javax.persistence.Query;
@@ -66,26 +64,12 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
private static final String XML_SCHEMA_STRING = "http://www.w3.org/2001/XMLSchema#string";
- private static final String XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT =
- "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
- private static final String XACML_ACTOR_ACTOR_ID = "urn:oasis:names:tc:xacml:1.0:actor:actor-id";
- private static final String XACML_ATTRIBUTE_CATEGORY_ACTION =
- "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
- private static final String XACML_OPERATION_OPERATION_ID = "urn:oasis:names:tc:xacml:1.0:operation:operation-id";
private static final String XACML_ATTRIBUTE_CATEGORY_RESOURCE =
"urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
private static final String XACML_TARGET_TARGET_ID = "urn:oasis:names:tc:xacml:1.0:target:target-id";
private static final String XACML_TEST_SQL_RESOURCE_OPERATIONS_STATUS =
"com:att:research:xacml:test:sql:resource:operations:status";
- private static final PIPRequest PIP_REQUEST_ACTOR =
- new StdPIPRequest(new IdentifierImpl(XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT),
- new IdentifierImpl(XACML_ACTOR_ACTOR_ID), new IdentifierImpl(XML_SCHEMA_STRING));
-
- private static final PIPRequest PIP_REQUEST_RECIPE =
- new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_ACTION),
- new IdentifierImpl(XACML_OPERATION_OPERATION_ID), new IdentifierImpl(XML_SCHEMA_STRING));
-
private static final PIPRequest PIP_REQUEST_TARGET =
new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_RESOURCE),
new IdentifierImpl(XACML_TARGET_TARGET_ID), new IdentifierImpl(XML_SCHEMA_STRING));
@@ -121,7 +105,7 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
} else if (!issuer.contains(this.getIssuer())) {
// Notice, we are checking here for the base issuer prefix.
logger.debug("Requested issuer '{}' does not match {}", issuer, getIssuer());
- logger.debug("Status PIP - Issuer {} does not match with: ", issuer, this.getIssuer());
+ logger.debug("Status PIP - Issuer {} does not match with: {}", issuer, this.getIssuer());
return StdPIPResponse.PIP_RESPONSE_EMPTY;
}
@@ -282,13 +266,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
// Run the query
//
String ret = null;
- try{
+ try {
ret = ((String)nq.getSingleResult());
- } catch(NoResultException ex) {
+ } catch (NoResultException ex) {
logger.debug("NoResultException for getSingleResult()");
ret = "NO_MATCHING_ENTRY";
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception", ex);
}
if (ret != null) {
logger.debug("SQL query result: {}", ret);
@@ -298,13 +282,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine {
//
try {
em.close();
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception ", ex);
}
try {
emf.close();
- } catch(Exception ex){
- logger.error("getStatusFromDB threw: ", ex);
+ } catch (Exception ex) {
+ logger.error("getStatusFromDB threw an exception ", ex);
}
return ret;
}
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 a7b4f73f2..865a442b9 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
@@ -85,28 +85,28 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @return the TargetLock
* @throws IllegalArgumentException if an argument is null
*/
public static TargetLock createTargetLock(TargetType targetType, String targetInstance,
- UUID requestID, LockCallback callback) {
+ UUID requestId, LockCallback callback) {
switch (targetType) {
case PNF:
//
// 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;
@@ -118,21 +118,21 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @param callback the LockCallback
* @param holdSec maximum number of seconds to hold the lock
* @return the LockResult
* @throws IllegalArgumentException if an argument is null
*/
public static LockResult<GuardResult, TargetLock> lockTarget(TargetType targetType, String targetInstance,
- UUID requestID, LockCallback callback, int holdSec) {
- String owner = makeOwner(targetType, requestID);
+ UUID requestId, LockCallback callback, int holdSec) {
+ String owner = makeOwner(targetType, requestId);
boolean result = factory.getManager().lock(targetInstance, owner, holdSec);
if (!result) {
return LockResult.createLockResult(GuardResult.LOCK_DENIED, null);
}
- TargetLock lock = createTargetLock(targetType, targetInstance, requestID, callback);
+ TargetLock lock = createTargetLock(targetType, targetInstance, requestId, callback);
if (lock == null) {
//
// Bad lock type: unlock and return exception result
@@ -188,12 +188,12 @@ public class PolicyGuard {
*
* @param targetType the target type
* @param targetInstance the target instance
- * @param requestID the request Id
+ * @param requestId the request Id
* @return <code>true</code> if the target is locked, <code>false</code> otherwise
* @throws IllegalArgumentException if an argument is null
*/
- public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestID) {
- String owner = makeOwner(targetType, requestID);
+ public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestId) {
+ String owner = makeOwner(targetType, requestId);
return factory.getManager().isLockedBy(targetInstance, owner);
}
@@ -204,16 +204,16 @@ public class PolicyGuard {
* @return the "owner" of a resource
* @throws IllegalArgumentException if either argument is null
*/
- private static String makeOwner(TargetType targetType, UUID requestID) {
+ private static String makeOwner(TargetType targetType, UUID requestId) {
if (targetType == null) {
- throw new IllegalArgumentException("null targetType for lock request id " + requestID);
+ throw new IllegalArgumentException("null targetType for lock request id " + requestId);
}
- if (requestID == null) {
+ if (requestId == null) {
throw new IllegalArgumentException("null requestID for lock type " + targetType);
}
- return targetType + ":" + requestID;
+ return targetType + ":" + requestId;
}
/**
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 bca31d904..5cb080fa5 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 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.
@@ -33,14 +33,14 @@ public class PolicyGuardRequest {
*
* @param actor the actor
* @param target the target
- * @param requestID the request Id
+ * @param requestId the request Id
* @param operation the operation
*/
- public PolicyGuardRequest(String actor, String target, UUID requestID, String operation) {
+ public PolicyGuardRequest(String actor, String target, UUID requestId, String operation) {
super();
this.actor = actor;
this.target = target;
- this.requestId = requestID;
+ this.requestId = requestId;
this.operation = operation;
}
@@ -70,8 +70,8 @@ public class PolicyGuardRequest {
return requestId;
}
- public void setRequestID(UUID requestID) {
- this.requestId = requestID;
+ public void setRequestID(UUID requestId) {
+ this.requestId = requestId;
}
public String getOperation() {
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 e9ff435f8..d7ece3081 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 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.
@@ -49,8 +49,8 @@ public class PolicyGuardResponse {
return requestId;
}
- public void setRequestID(UUID requestID) {
- this.requestId = requestID;
+ public void setRequestID(UUID requestId) {
+ this.requestId = requestId;
}
public String getResult() {
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 53ba6075e..ec4ebf9cd 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
@@ -115,7 +115,7 @@ public class PolicyGuardXacmlHelper {
UrlEntry urlEntry = restUrls[restUrlIndex];
String jsonRequestString = jsonReq.toString();
netLogger.info("[OUT|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, jsonRequestString);
- response = callRESTfulPDP(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl,
+ response = callRestfulPdp(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl,
urlEntry.authorization, urlEntry.clientAuth, urlEntry.environment);
netLogger.info("[IN|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, response);
} catch (Exception e) {
@@ -134,7 +134,7 @@ public class PolicyGuardXacmlHelper {
* @param environment the Environment
* @return response from guard which contains "Permit" or "Deny"
*/
- private String callRESTfulPDP(InputStream is, URL restURL, String authorization, String clientauth,
+ private String callRestfulPdp(InputStream is, URL restUrl, String authorization, String clientauth,
String environment) {
HttpURLConnection connection = null;
@@ -142,7 +142,7 @@ public class PolicyGuardXacmlHelper {
//
// Open up the connection
//
- connection = (HttpURLConnection) restURL.openConnection();
+ connection = (HttpURLConnection) restUrl.openConnection();
connection.setRequestProperty("Content-Type", "application/json");
//
// Setup our method and headers
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 dc81712cd..6046e3a32 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
@@ -41,14 +41,14 @@ public class VMTargetLock implements TargetLock, Serializable {
*
* @param targetType the target type
* @param target the target
- * @param requestID the request Id
+ * @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;
- this.requestId = requestID;
+ this.requestId = requestId;
this.callback = callback;
}
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 307c11acf..418a3ed78 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
@@ -42,14 +42,14 @@ public class VNFTargetLock implements TargetLock, Serializable {
*
* @param type the type
* @param target the target
- * @param requestID the request Id
+ * @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;
- this.requestId = requestID;
+ this.requestId = requestId;
this.callback = callback;
}
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java
index cf83c883c..5e99b0605 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java
@@ -27,34 +27,14 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.att.research.xacml.api.Attribute;
-import com.att.research.xacml.api.AttributeValue;
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.api.Status;
-import com.att.research.xacml.api.pip.PIPEngine;
import com.att.research.xacml.api.pip.PIPException;
-import com.att.research.xacml.api.pip.PIPFinder;
-import com.att.research.xacml.api.pip.PIPRequest;
-import com.att.research.xacml.api.pip.PIPResponse;
-import com.att.research.xacml.std.IdentifierImpl;
-import com.att.research.xacml.std.StdAttribute;
-import com.att.research.xacml.std.StdAttributeValue;
-import com.att.research.xacml.std.StdStatus;
-import com.att.research.xacml.std.StdStatusCode;
import com.att.research.xacml.std.pip.StdPIPRequest;
import com.att.research.xacml.std.pip.StdPIPResponse;
import com.att.research.xacml.std.pip.finders.EngineFinder;
-import com.att.research.xacml.util.FactoryException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import java.util.Properties;
-import java.util.UUID;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -268,144 +248,4 @@ public class PipEngineGetStatusTest {
pegs.configure("Dorothy", new Properties());
}
- private class DummyPipFinder implements PIPFinder {
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- try {
- List<Attribute> attributeList = new ArrayList<>();
- Identifier categoryIdIn = new IdentifierImpl(new URI("http://somewhere.over.the.rainbow/category"));
- Identifier dataTypeIdIn = new IdentifierImpl(new URI("http://www.w3.org/2001/XMLSchema#string"));
-
- Identifier attributeIdIn0 = new IdentifierImpl(new URI(UUID.randomUUID().toString()));
- AttributeValue<String> valueIn0 = new StdAttributeValue<String>(dataTypeIdIn, "ActorDorothy");
- Attribute attribute0 = new StdAttribute(categoryIdIn, attributeIdIn0, valueIn0);
- attributeList.add(attribute0);
-
- Identifier attributeIdIn1 = new IdentifierImpl(new URI(UUID.randomUUID().toString()));
- AttributeValue<String> valueIn1 = new StdAttributeValue<String>(dataTypeIdIn, "OperationHomeFromOZ");
- Attribute attribute1 = new StdAttribute(categoryIdIn, attributeIdIn1, valueIn1);
- attributeList.add(attribute1);
-
- Identifier attributeIdIn2 = new IdentifierImpl(new URI(UUID.randomUUID().toString()));
- AttributeValue<String> valueIn2 = new StdAttributeValue<String>(dataTypeIdIn, "TargetWickedWitch");
- Attribute attribute2 = new StdAttribute(categoryIdIn, attributeIdIn2, valueIn2);
- attributeList.add(attribute2);
-
- return new StdPIPResponse(attributeList);
- } catch (Exception e) {
- return null;
- }
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public Collection<PIPEngine> getPIPEngines() {
- return null;
- }
- }
-
- private class DummyPipFinderPipException implements PIPFinder {
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- throw new PIPException();
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public Collection<PIPEngine> getPIPEngines() {
- return null;
- }
- }
-
- private class DummyPipFinderResponseStatusNok implements PIPFinder {
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- Status status = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Processing Error");
- return new StdPIPResponse(status);
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public Collection<PIPEngine> getPIPEngines() {
- return null;
- }
- }
-
- private class DummyPipFinderResponseEmptyAttrs implements PIPFinder {
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException {
- List<Attribute> attributeList = new ArrayList<>();
- return new StdPIPResponse(attributeList);
- }
-
- @Override
- public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent)
- throws PIPException {
- return null;
- }
-
- @Override
- public Collection<PIPEngine> getPIPEngines() {
- return null;
- }
- }
}