X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Faaf%2FTestConnectivity.java;h=bf7ed6d92aa81b51ef7093ba451ebe41c6e48a66;hb=3505a52ac853c134ecaf40f2977667de8770ec59;hp=30ea1c212130ff3848967a228cd8c73381142602;hpb=168005a073b1ae83cb3415bcc74db925915e9b3d;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java index 30ea1c21..bf7ed6d9 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java @@ -46,6 +46,7 @@ import org.onap.aaf.cadi.config.SecurityInfoC; import org.onap.aaf.cadi.http.HBasicAuthSS; import org.onap.aaf.cadi.http.HClient; import org.onap.aaf.cadi.http.HX509SS; +import org.onap.aaf.cadi.locator.SingleEndpointLocator; import org.onap.aaf.cadi.oauth.HRenewingTokenSS; import org.onap.aaf.cadi.util.FixURIinfo; import org.onap.aaf.misc.env.APIException; @@ -80,45 +81,56 @@ public class TestConnectivity { List> lss = loadSetters(access,si); ///////// - print(true,"Test Connections driven by AAFLocator"); - URI serviceURI = uri(access,"service"); - - for (URI uri : new URI[] { - serviceURI, - uri(access,"token"), - uri(access,"introspect"), - uri(access,"cm"), - uri(access,"gui"), - uri(access,"fs"), - uri(access,"hello") - }) { - Locator locator = new AAFLocator(si, uri); - try { - connectTest(locator, uri); - } catch (Exception e) { - e.printStackTrace(); - System.err.flush(); - } - } - - ///////// - print(true,"Test Service for Perms driven by AAFLocator"); - Locator locator = new AAFLocator(si,serviceURI); - for (SecuritySetter ss : lss) { + String directAAFURL = access.getProperty(Config.AAF_URL,null); + if(directAAFURL!=null && !directAAFURL.contains("AAF_LOCATE")) { + print(true,"Test Connections by non-located aaf_url"); + Locator locator = new SingleEndpointLocator(directAAFURL); + connectTest(locator,new URI(directAAFURL)); + + SecuritySetter ss = si.defSS; permTest(locator,ss); - } + } else { + ///////// + print(true,"Test Connections driven by AAFLocator"); + URI serviceURI = uri(access,"service"); + + for (URI uri : new URI[] { + serviceURI, + uri(access,"token"), + uri(access,"introspect"), + uri(access,"cm"), + uri(access,"gui"), + uri(access,"fs"), + uri(access,"hello") + }) { + Locator locator = new AAFLocator(si, uri); + try { + connectTest(locator, uri); + } catch (Exception e) { + e.printStackTrace(); + System.err.flush(); + } + } - ////////// - print(true,"Test essential BasicAuth Service call, driven by AAFLocator"); - boolean hasBath=false; - for (SecuritySetter ss : lss) { - if (ss instanceof HBasicAuthSS) { - hasBath=true; - basicAuthTest(new AAFLocator(si, serviceURI),ss); - } - } - if(!hasBath) { - System.out.println("No User/Password to test"); + ///////// + print(true,"Test Service for Perms driven by AAFLocator"); + Locator locator = new AAFLocator(si,serviceURI); + for (SecuritySetter ss : lss) { + permTest(locator,ss); + } + + ////////// + print(true,"Test essential BasicAuth Service call, driven by AAFLocator"); + boolean hasBath=false; + for (SecuritySetter ss : lss) { + if (ss instanceof HBasicAuthSS) { + hasBath=true; + basicAuthTest(new AAFLocator(si, serviceURI),ss); + } + } + if(!hasBath) { + System.out.println("No User/Password to test"); + } } } catch (Exception e) { @@ -266,13 +278,16 @@ public class TestConnectivity { if (ss instanceof HRenewingTokenSS) { System.out.println(" " + ((HRenewingTokenSS)ss).tokenURL()); } else { - System.out.println(); + System.out.println(); } HClient client = new HClient(ss, uri, 3000); client.setMethod("GET"); String user = ss.getID(); - client.setPathInfo("/authz/perms/user/"+user); + String pathInfo = "/authz/perms/user/"+user; + client.setPathInfo(pathInfo); + System.out.println(pathInfo); + client.send(); Future future = client.futureReadString(); if (future.get(7000)) {