2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.pdpx.main.rest;
25 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
26 import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator;
27 import org.onap.policy.xacml.pdp.application.guard.GuardPdpApplication;
28 import org.onap.policy.xacml.pdp.application.guard.GuardTranslator;
30 public class TestGuardOverrideApplication extends GuardPdpApplication {
31 public static final String MY_EXTRAGUARD_POLICY_TYPE = "onap.policies.controlloop.guard.common.myGuard";
33 private static class MyTranslator extends GuardTranslator {
37 private final GuardTranslator myTranslator = new MyTranslator();
40 * Constructor calls the super to add all the default policy types,
41 * and then adds the extra supported guard policy type.
43 public TestGuardOverrideApplication() {
45 this.supportedPolicyTypes.add(new ToscaConceptIdentifier(
46 MY_EXTRAGUARD_POLICY_TYPE,
52 protected ToscaPolicyTranslator getTranslator(String type) {
53 if (MY_EXTRAGUARD_POLICY_TYPE.equals(type)) {
56 return super.getTranslator(type);
60 public boolean canSupportPolicyType(ToscaConceptIdentifier policyTypeId) {
61 boolean canSuper = super.canSupportPolicyType(policyTypeId);
65 if (MY_EXTRAGUARD_POLICY_TYPE.equals(policyTypeId.getName())) {