X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineClient%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicyengine%2FPushPoliciesToPDP.java;h=3a3b9e70497dde51ea43eae0900dab7e046a93c1;hb=refs%2Fchanges%2F14%2F97314%2F3;hp=880af06108cdecbc302fa24842ce987b595d7606;hpb=3c4b4fcb076e90f2d2a2582d27f316e60dba6ac3;p=policy%2Fengine.git 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()); + + } + + } }