diff options
Diffstat (limited to 'PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java')
-rw-r--r-- | PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java index 880af0610..3a3b9e704 100644 --- a/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java +++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * PolicyEngineClient * ================================================================================ - * 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. * 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. @@ -25,35 +25,39 @@ import org.onap.policy.api.PolicyEngine; import org.onap.policy.api.PushPolicyParameters; public class PushPoliciesToPDP { - public static void main(String[] args) { - try { - - PolicyEngine policyEngine = new PolicyEngine("config.properties"); - PushPolicyParameters policyParameters = new PushPolicyParameters(); - - //Parameter arguments - policyParameters.setPolicyName("Mike.testCase1"); - policyParameters.setPolicyType("Base"); - //policyParameters.setPolicyScope("MikeAPItesting"); - policyParameters.setPdpGroup("default"); - policyParameters.setRequestID(null); - + + /** + * main. + * + * @param args String[] args + */ + public static void main(String[] args) { + try { + PushPolicyParameters policyParameters = new PushPolicyParameters(); + + // Parameter arguments + policyParameters.setPolicyName("Mike.testCase1"); + policyParameters.setPolicyType("Base"); + // policyParameters.setPolicyScope("MikeAPItesting"); + policyParameters.setPdpGroup("default"); + policyParameters.setRequestID(null); + // API method to Push Policy to PDP PolicyChangeResponse response = null; - response = policyEngine.pushPolicy(policyParameters); + response = new PolicyEngine("config.properties").pushPolicy(policyParameters); - if(response.getResponseCode()==204){ + if (response.getResponseCode() == 204) { System.out.println(response.getResponseMessage()); System.out.println("Policy Pushed Successfully!"); - }else{ + } else { System.out.println("Error! " + response.getResponseMessage()); } - } catch (Exception e) { - System.err.println(e.getMessage()); - - } - - } + } catch (Exception e) { + System.err.println(e.getMessage()); + + } + + } } |