import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.util.XACMLPolicyWriter;
import com.att.research.xacml.util.XACMLProperties;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
-
import oasis.names.tc.xacml._3_0.core.schema.wd_17.IdReferenceType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
-
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-
import org.onap.policy.models.decisions.concepts.DecisionRequest;
@Getter
// contain potential matchables
//
if (propertyValue instanceof List) {
- for (Object listValue : ((List<?>)propertyValue)) {
+ for (Object listValue : ((List<?>) propertyValue)) {
if (listValue instanceof Map) {
fillTargetTypeWithMatchables(target, matchablePolicyType, (Map<String, Object>) listValue);
}
import com.att.research.xacml.std.pip.StdMutablePIPResponse;
import com.att.research.xacml.std.pip.StdPIPRequest;
import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
-
import java.math.BigInteger;
import java.util.Base64;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Properties;
-
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import org.onap.policy.pdp.xacml.application.common.ToscaDictionary;
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-
import org.junit.Test;
public class ToscaDictionaryTest {
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
// contain potential matchables
//
if (propertyValue instanceof List) {
- for (Object listValue : ((List<?>)propertyValue)) {
+ for (Object listValue : ((List<?>) propertyValue)) {
if (listValue instanceof Map) {
generateTargetType(target, matchablePolicyType, (Map<String, Object>) listValue);
}
* ============LICENSE_START=======================================================
* guard
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import java.io.Serializable;
import java.util.List;
-
import lombok.Data;
@Data
import com.att.research.xacml.api.Request;
import com.att.research.xacml.api.Response;
import com.att.research.xacml.util.XACMLPolicyScanner;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator;
import org.onap.policy.pdp.xacml.application.common.std.StdXacmlApplicationServiceProvider;
@Override
protected ToscaPolicyTranslator getTranslator(String type) {
LOGGER.debug("Policy type {}", type);
- if ( type.contains("coordination") ) {
+ if (type.contains("coordination")) {
LOGGER.debug("returning coordinationTranslator");
return coordinationTranslator;
} else {
import com.att.research.xacml.std.annotations.XACMLRequest;
import com.att.research.xacml.std.annotations.XACMLResource;
import com.att.research.xacml.std.annotations.XACMLSubject;
-
import java.util.Map;
-
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionException;
if (! (rule instanceof RuleType)) {
continue;
}
- assertThat(((RuleType)rule).getCondition()).isNotNull();
- assertThat(((RuleType)rule).getCondition().getExpression()).isNotNull();
+ assertThat(((RuleType) rule).getCondition()).isNotNull();
+ assertThat(((RuleType) rule).getCondition().getExpression()).isNotNull();
}
}
if (! (rule instanceof RuleType)) {
continue;
}
- for (AnyOfType anyOf : ((RuleType)rule).getTarget().getAnyOf()) {
+ for (AnyOfType anyOf : ((RuleType) rule).getTarget().getAnyOf()) {
assertThat(anyOf.getAllOf()).isNotEmpty();
for (AllOfType allOf : anyOf.getAllOf()) {
assertThat(allOf.getMatch()).isNotEmpty();
}
assertThat(((RuleType) rule).getTarget()).isNotNull();
assertThat(((RuleType) rule).getTarget().getAnyOf()).hasSize(1);
- for (AnyOfType anyOf : ((RuleType)rule).getTarget().getAnyOf()) {
+ for (AnyOfType anyOf : ((RuleType) rule).getTarget().getAnyOf()) {
assertThat(anyOf.getAllOf()).isNotEmpty();
for (AllOfType allOf : anyOf.getAllOf()) {
assertThat(allOf.getMatch()).isNotEmpty();
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import com.att.research.xacml.std.annotations.XACMLRequest;
import com.att.research.xacml.std.annotations.XACMLResource;
import com.att.research.xacml.std.annotations.XACMLSubject;
-
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
-
import org.junit.ClassRule;
import org.junit.rules.TemporaryFolder;
}).doesNotThrowAnyException();
*/
}
-}
\ No newline at end of file
+}
//
// Add US to the geography list
//
- ((List<String>)baseRequest.getResource().get("geography")).add("US");
+ ((List<String>) baseRequest.getResource().get("geography")).add("US");
//
// Ask for a decision for default US Policy
//
//
// Add vCPE to the service list
//
- ((List<String>)baseRequest.getResource().get("services")).add("vCPE");
+ ((List<String>) baseRequest.getResource().get("services")).add("vCPE");
//
// Ask for a decision for default US policy for vCPE service
//
//
// Add vG to the resource list
//
- ((List<String>)baseRequest.getResource().get("resources")).add("vG");
+ ((List<String>) baseRequest.getResource().get("resources")).add("vG");
//
// Ask for a decision for default US service vCPE resource vG policy
//
//
// Add gold as a scope
//
- ((List<String>)baseRequest.getContext().get("subscriberName")).add("subscriber_a");
+ ((List<String>) baseRequest.getContext().get("subscriberName")).add("subscriber_a");
//
// Ask for a decision for specific US vCPE vG gold
//
//
// Add platinum to the scope list: this is now gold OR platinum
//
- ((List<String>)baseRequest.getResource().get("scope")).remove("gold");
- ((List<String>)baseRequest.getContext().get("subscriberName")).add("subscriber_x");
+ ((List<String>) baseRequest.getResource().get("scope")).remove("gold");
+ ((List<String>) baseRequest.getContext().get("subscriberName")).add("subscriber_x");
//
// Ask for a decision for specific US vCPE vG (gold or platinum)
//
//
// Add gold as a scope
//
- ((List<String>)baseRequest.getResource().get("scope")).remove("gold");
- ((List<String>)baseRequest.getResource().get("scope")).remove("platinum");
- ((List<String>)baseRequest.getContext().get("subscriberName")).remove("subscriber_a");
+ ((List<String>) baseRequest.getResource().get("scope")).remove("gold");
+ ((List<String>) baseRequest.getResource().get("scope")).remove("platinum");
+ ((List<String>) baseRequest.getContext().get("subscriberName")).remove("subscriber_a");
//
// Ask for a decision for specific US vCPE vG gold
//
@SuppressWarnings("unchecked")
private void cleanOutResources() {
- ((List<String>)baseRequest.getResource().get("scope")).clear();
- ((List<String>)baseRequest.getResource().get("services")).clear();
- ((List<String>)baseRequest.getResource().get("resources")).clear();
- ((List<String>)baseRequest.getResource().get("geography")).clear();
- if (((List<String>)baseRequest.getResource().get("policy-type")) != null) {
+ ((List<String>) baseRequest.getResource().get("scope")).clear();
+ ((List<String>) baseRequest.getResource().get("services")).clear();
+ ((List<String>) baseRequest.getResource().get("resources")).clear();
+ ((List<String>) baseRequest.getResource().get("geography")).clear();
+ if (((List<String>) baseRequest.getResource().get("policy-type")) != null) {
baseRequest.getResource().remove("policy-type");
}
}
@ResponseHeader(name = "X-ONAP-RequestID",
description = "Used to track REST transactions for logging purpose",
response = UUID.class)},
- authorizations = @Authorization(value = "basicAuth"), tags = {"HealthCheck",},
+ authorizations = @Authorization(value = "basicAuth"), tags = {"HealthCheck", },
extensions = {@Extension(name = "interface info",
properties = {@ExtensionProperty(name = "pdpx-version", value = "1.0.0"),
@ExtensionProperty(name = "last-mod-release", value = "Dublin")})})
@ResponseHeader(name = "X-ONAP-RequestID",
description = "Used to track REST transactions for logging purpose",
response = UUID.class)},
- authorizations = @Authorization(value = "basicAuth"), tags = {"Statistics",},
+ authorizations = @Authorization(value = "basicAuth"), tags = {"Statistics", },
extensions = {@Extension(name = "interface info",
properties = {@ExtensionProperty(name = "pdpx-version", value = "1.0.0"),
@ExtensionProperty(name = "last-mod-release", value = "Dublin")})})
@ResponseHeader(name = "X-ONAP-RequestID",
description = "Used to track REST transactions for logging purpose",
response = UUID.class)},
- authorizations = @Authorization(value = "basicAuth"), tags = {"Decision",},
+ authorizations = @Authorization(value = "basicAuth"), tags = {"Decision", },
extensions = {@Extension(name = "interface info",
properties = {@ExtensionProperty(name = "pdpx-version", value = "1.0.0"),
@ExtensionProperty(name = "last-mod-release", value = "Dublin")})})
@ResponseHeader(name = "X-ONAP-RequestID",
description = "Used to track REST transactions for logging purpose",
response = UUID.class)},
- authorizations = @Authorization(value = "basicAuth"), tags = {"Decision",},
+ authorizations = @Authorization(value = "basicAuth"), tags = {"Decision", },
extensions = {@Extension(name = "interface info",
properties = {@ExtensionProperty(name = "pdpx-version", value = "1.0.0"),
@ExtensionProperty(name = "last-mod-release", value = "Frankfurt")})})
// create a plain listener to test the "real" makeTimer() method
publisher = new XacmlPdpHearbeatPublisher(client, state);
- assertThatCode( () -> {
+ assertThatCode(() -> {
publisher.start();
publisher.restart(100L);
publisher.terminate();
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import com.openpojo.validation.rule.impl.SetterMustExistRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-
import org.junit.Test;
import org.onap.policy.common.utils.test.ToStringTester;
import org.onap.policy.pdpx.main.rest.model.StatisticsReport;