Removing supportedPolicyTypes from PdpStatus in policy/models as it is
no longer expected from the Pdps to send it as part of the heartbeat or
initial registration message. Instead the PdpGroupName is expected from
the Pdps in the initial registration message.
Issue-ID: POLICY-2256
Change-Id: I14b76a737027e146d69d89c2fe2c3f098a89e196
Signed-off-by: ramverma <ram.krishna.verma@est.tech>
/*-
* ============LICENSE_START=======================================================
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
private PdpHealthStatus healthy;
/**
private PdpHealthStatus healthy;
/**
- * Description of the PDP or the PDP type. May be left {@code null}.
+ * Description of the PDP or the PDP type. May be left {@code null}.
*/
private String description;
*/
private String description;
- private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes;
private List<ToscaPolicyIdentifier> policies;
private String deploymentInstanceInfo;
private String properties;
private List<ToscaPolicyIdentifier> policies;
private String deploymentInstanceInfo;
private String properties;
*
* @param source source from which to copy
*/
*
* @param source source from which to copy
*/
- public PdpStatus(PdpStatus source) {
+ public PdpStatus(final PdpStatus source) {
super(source);
this.pdpType = source.pdpType;
this.state = source.state;
this.healthy = source.healthy;
this.description = source.description;
super(source);
this.pdpType = source.pdpType;
this.state = source.state;
this.healthy = source.healthy;
this.description = source.description;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new,
- new ArrayList<>(0));
this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
this.deploymentInstanceInfo = source.deploymentInstanceInfo;
this.properties = source.properties;
this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
this.deploymentInstanceInfo = source.deploymentInstanceInfo;
this.properties = source.properties;
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* 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.Arrays;
import java.util.Collections;
import java.util.Arrays;
import java.util.Collections;
import org.junit.Test;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.junit.Test;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
public class PdpStatusTest {
public class PdpStatusTest {
public void testCopyConstructor() {
assertThatThrownBy(() -> new PdpStatus(null)).isInstanceOf(NullPointerException.class);
public void testCopyConstructor() {
assertThatThrownBy(() -> new PdpStatus(null)).isInstanceOf(NullPointerException.class);
- PdpStatus orig = new PdpStatus();
+ final PdpStatus orig = new PdpStatus();
// verify with null values
// verify with null values
- orig.setSupportedPolicyTypes(Collections.emptyList());
orig.setPolicies(Collections.emptyList());
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(new PdpStatus(orig).toString()));
orig.setPolicies(Collections.emptyList());
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(new PdpStatus(orig).toString()));
orig.setPolicies(Arrays.asList(new ToscaPolicyIdentifier("policy-A", "1.0.0")));
orig.setProperties("my-properties");
orig.setPolicies(Arrays.asList(new ToscaPolicyIdentifier("policy-A", "1.0.0")));
orig.setProperties("my-properties");
- PdpResponseDetails resp = new PdpResponseDetails();
+ final PdpResponseDetails resp = new PdpResponseDetails();
resp.setResponseMessage("my-response");
orig.setResponse(resp);
orig.setState(PdpState.SAFE);
resp.setResponseMessage("my-response");
orig.setResponse(resp);
orig.setState(PdpState.SAFE);
- PdpStatistics stats = new PdpStatistics();
+ final PdpStatistics stats = new PdpStatistics();
stats.setPdpInstanceId("my-pdp-id");
orig.setStatistics(stats);
stats.setPdpInstanceId("my-pdp-id");
orig.setStatistics(stats);
- orig.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("type-A", "2.0.0")));
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(new PdpStatus(orig).toString()));
}
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(new PdpStatus(orig).toString()));
}
/*-
* ============LICENSE_START=======================================================
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStatus;
pdpStatus.setHealthy(PdpHealthStatus.HEALTHY);
pdpStatus.setDescription(pdpStatusParameters.getDescription());
pdpStatus.setName(instanceId);
pdpStatus.setHealthy(PdpHealthStatus.HEALTHY);
pdpStatus.setDescription(pdpStatusParameters.getDescription());
pdpStatus.setName(instanceId);
- pdpStatus.setSupportedPolicyTypes(getSupportedPolicyTypesFromParameters(pdpStatusParameters));
pdpStatus.setState(pdpStatusContext.getState());
pdpStatus.setHealthy(pdpStatusContext.getHealthy());
pdpStatus.setDescription(pdpStatusContext.getDescription());
pdpStatus.setState(pdpStatusContext.getState());
pdpStatus.setHealthy(pdpStatusContext.getHealthy());
pdpStatus.setDescription(pdpStatusContext.getDescription());
- pdpStatus.setSupportedPolicyTypes(pdpStatusContext.getSupportedPolicyTypes());
pdpStatus.setPolicies(pdpStatusContext.getPolicies());
pdpStatus.setPdpGroup(pdpStatusContext.getPdpGroup());
pdpStatus.setPdpSubgroup(pdpStatusContext.getPdpSubgroup());
pdpStatus.setPolicies(pdpStatusContext.getPolicies());
pdpStatus.setPdpGroup(pdpStatusContext.getPdpGroup());
pdpStatus.setPdpSubgroup(pdpStatusContext.getPdpSubgroup());