X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Faaf%2Ftest%2FTestHClient.java;h=8cb4e906b085240f36c0b576090fd6af59036360;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=2e509b0fdc281108a91a71b3251e3b60c267d397;hpb=77c4d760a54c6c8ed3efb74024a11225f9573a64;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java index 2e509b0f..8cb4e906 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java @@ -40,44 +40,44 @@ import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.impl.BasicTrans; public class TestHClient { - public static void main(String[] args) { - try { - PropAccess access = new PropAccess(args); - String aaf_url = access.getProperty(Config.AAF_URL); - if(aaf_url == null) { - access.log(Level.ERROR, Config.AAF_URL," is required"); - } else { - HMangr hman = null; - try { - SecurityInfoC si = SecurityInfoC.instance(access, HttpURLConnection.class); - AbsAAFLocator loc = new AAFLocator(si,new URI(aaf_url)); - for(Item item = loc.first(); item!=null; item=loc.next(item)) { - System.out.println(loc.get(item)); - } - - hman = new HMangr(access,loc); - final String path = String.format("/authz/perms/user/%s", - access.getProperty(Config.AAF_APPID,"xx9999@people.osaaf.org")); - hman.best(si.defSS, new Retryable() { - @Override - public Void code(Rcli cli) throws APIException, CadiException { - Future ft = cli.read(path,"application/json"); - if(ft.get(10000)) { - System.out.println("Hurray,\n"+ft.body()); - } else { - System.out.println("not quite: " + ft.code()); - } - return null; - }}); - } finally { - if(hman!=null) { - hman.close(); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - + public static void main(String[] args) { + try { + PropAccess access = new PropAccess(args); + String aaf_url = access.getProperty(Config.AAF_URL); + if(aaf_url == null) { + access.log(Level.ERROR, Config.AAF_URL," is required"); + } else { + HMangr hman = null; + try { + SecurityInfoC si = SecurityInfoC.instance(access, HttpURLConnection.class); + AbsAAFLocator loc = new AAFLocator(si,new URI(aaf_url)); + for(Item item = loc.first(); item!=null; item=loc.next(item)) { + System.out.println(loc.get(item)); + } + + hman = new HMangr(access,loc); + final String path = String.format("/authz/perms/user/%s", + access.getProperty(Config.AAF_APPID,"xx9999@people.osaaf.org")); + hman.best(si.defSS, new Retryable() { + @Override + public Void code(Rcli cli) throws APIException, CadiException { + Future ft = cli.read(path,"application/json"); + if(ft.get(10000)) { + System.out.println("Hurray,\n"+ft.body()); + } else { + System.out.println("not quite: " + ft.code()); + } + return null; + }}); + } finally { + if(hman!=null) { + hman.close(); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }