+++ /dev/null
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- * * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- * * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.client.test;\r
-\r
-import java.net.HttpURLConnection;\r
-import java.net.URI;\r
-import java.util.Properties;\r
-\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.Locator;\r
-import org.onap.aaf.cadi.PropAccess;\r
-import org.onap.aaf.cadi.SecuritySetter;\r
-import org.onap.aaf.cadi.Locator.Item;\r
-import org.onap.aaf.cadi.client.Future;\r
-import org.onap.aaf.cadi.client.Rcli;\r
-import org.onap.aaf.cadi.client.Retryable;\r
-import org.onap.aaf.cadi.config.Config;\r
-import org.onap.aaf.cadi.config.SecurityInfoC;\r
-import org.onap.aaf.cadi.http.HBasicAuthSS;\r
-import org.onap.aaf.cadi.http.HMangr;\r
-import org.onap.aaf.cadi.locator.DME2Locator;\r
-\r
-import com.att.aft.dme2.api.DME2Manager;\r
-import org.onap.aaf.inno.env.APIException;\r
-\r
-public class JU_TestHClient {\r
- public static void main(String[] args) {\r
- try {\r
- PropAccess access = new PropAccess();\r
- DME2Manager dm = new DME2Manager("DME2Manager TestHClient",access.getProperties());\r
- Locator<URI> loc = new DME2Locator(access,dm,"com.att.authz.AuthorizationService","2.0","DEV","BAU_SE");\r
-\r
- for(Item item = loc.first(); item!=null; item=loc.next(item)) {\r
- System.out.println(loc.get(item));\r
- }\r
- \r
- \r
- SecurityInfoC<HttpURLConnection> si = new SecurityInfoC<HttpURLConnection>(access);\r
- SecuritySetter<HttpURLConnection> ss = new HBasicAuthSS("m12345@aaf.att.com", \r
- access.decrypt("enc:7K6yjLQqha_S9yApkIul2K_by5Moemcos1HRAVnhMXu",false), si);\r
-// SecuritySetter<HttpURLConnection> ss = new X509SS(si, "aaf");\r
- \r
- HMangr hman = new HMangr(access,loc);\r
- try {\r
- hman.best(ss, new Retryable<Void>() {\r
- @Override\r
- public Void code(Rcli<?> cli) throws APIException, CadiException {\r
- Future<String> ft = cli.read("/authz/nss/com.att.aaf","text/json"); \r
- if(ft.get(10000)) {\r
- System.out.println("Hurray,\n"+ft.body());\r
- } else {\r
- System.out.println("not quite: " + ft.code());\r
- }\r
- return null;\r
- }});\r
- } finally {\r
- hman.close();\r
- }\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- \r
-}\r