Refine Agent to create CADI Configs
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / aaf / TestConnectivity.java
index 101fd60..cd08cd4 100644 (file)
@@ -64,7 +64,7 @@ public class TestConnectivity {
                        PropAccess access = new PropAccess(args);
                        String aaflocate;
                        if(args.length>1) {
-                               aaflocate = "https://" + args[1] + "/locate";
+                               aaflocate = "https://" + args[1];
                                access.setProperty(Config.AAF_LOCATE_URL, "https://" + args[1]);
                        } else {
                                aaflocate = access.getProperty(Config.AAF_LOCATE_URL);
@@ -79,16 +79,15 @@ public class TestConnectivity {
                                List<SecuritySetter<HttpURLConnection>> lss = loadSetters(access,si);
                                /////////
                                print(true,"Test Connections driven by AAFLocator");
-                               URI serviceURI = new URI(aaflocate+"/AAF_NS.service/2.0");
+                               URI serviceURI = new URI(aaflocate+"/locate/AAF_NS.service/2.0");
 
                                for(URI uri : new URI[] {
                                                serviceURI,
-                                               new URI(aaflocate+"/AAF_NS.service:2.0"),
-                                               new URI(aaflocate+"/AAF_NS.service"),
-                                               new URI(aaflocate+"/AAF_NS.gw:2.0"),
-                                               new URI(aaflocate+"/AAF_NS.token:2.0"),
-                                               new URI(aaflocate+"/AAF_NS.certman:2.0"),
-                                               new URI(aaflocate+"/AAF_NS.hello")
+                                               new URI(aaflocate+"/locate/AAF_NS.service:2.0"),
+                                               new URI(aaflocate+"/locate/AAF_NS.locate:2.0"),
+                                               new URI(aaflocate+"/locate/AAF_NS.token:2.0"),
+                                               new URI(aaflocate+"/locate/AAF_NS.certman:2.0"),
+                                               new URI(aaflocate+"/locate/AAF_NS.hello")
                                }) {
                                        Locator<URI> locator = new AAFLocator(si, uri);
                                        try {
@@ -100,24 +99,25 @@ public class TestConnectivity {
                                }
 
                                /////////
-                               print(true,"Test Service driven by AAFLocator");
-                               Locator<URI> locator = new AAFLocator(si,new URI(aaflocate+"/AAF_NS.service:2.0"));
+                               print(true,"Test Service for Perms driven by AAFLocator");
+                               Locator<URI> locator = new AAFLocator(si,serviceURI);
                                for(SecuritySetter<HttpURLConnection> ss : lss) {
                                        permTest(locator,ss);
                                }
 
                                /////////
-                               print(true,"Test Proxy Access driven by AAFLocator");
-                               locator = new AAFLocator(si, new URI(aaflocate+"/AAF_NS.gw:2.0/proxy"));
-                               for(SecuritySetter<HttpURLConnection> ss : lss) {
-                                       permTest(locator,ss);
-                               }
+                               // Removed for ONAP
+//                             print(true,"Test Proxy Access driven by AAFLocator");
+//                             locator = new AAFLocator(si, new URI(aaflocate+"/AAF_NS.gw:2.0/proxy"));
+//                             for(SecuritySetter<HttpURLConnection> ss : lss) {
+//                                     permTest(locator,ss);
+//                             }
 
                                //////////
                                print(true,"Test essential BasicAuth Service call, driven by AAFLocator");
                                for(SecuritySetter<HttpURLConnection> ss : lss) {
                                        if(ss instanceof HBasicAuthSS) {
-                                               basicAuthTest(new AAFLocator(si, new URI(aaflocate+"/AAF_NS.service:2.0")),ss);
+                                               basicAuthTest(new AAFLocator(si, serviceURI),ss);
                                        }
                                }
                                
@@ -223,17 +223,20 @@ public class TestConnectivity {
                        if((uri = dl.get(li)) == null) {
                                System.out.println("Locator Item empty");
                        } else {
+                               socket = new Socket();
                                try {
-                                       socket = new Socket();
-                                       socket.connect(new InetSocketAddress(uri.getHost(),  uri.getPort()),3000);
-                                       System.out.printf("Can Connect a Socket to %s %d\n",uri.getHost(),uri.getPort());
+                                       try {
+                                               socket.connect(new InetSocketAddress(uri.getHost(),  uri.getPort()),3000);
+                                               System.out.printf("Can Connect a Socket to %s %d\n",uri.getHost(),uri.getPort());
+                                       } catch (IOException e) {
+                                               System.out.printf("Cannot Connect a Socket to  %s %d: %s\n",uri.getHost(),uri.getPort(),e.getMessage());
+                                       }
+                               } finally {
                                        try {
                                                socket.close();
                                        } catch (IOException e1) {
                                                System.out.printf("Could not close Socket Connection: %s\n",e1.getMessage());
                                        }
-                               } catch (IOException e) {
-                                       System.out.printf("Cannot Connect a Socket to  %s %d: %s\n",uri.getHost(),uri.getPort(),e.getMessage());
                                }
                        }
                }