Update project structure for aaf/cadi
[aaf/cadi.git] / client / src / test / java / org / onap / aaf / client / test / TestDME2RcliClient.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 package org.onap.aaf.client.test;\r
24 \r
25 import java.net.URI;\r
26 import java.util.Properties;\r
27 \r
28 import org.onap.aaf.cadi.Access;\r
29 import org.onap.aaf.cadi.client.Future;\r
30 import org.onap.aaf.cadi.dme2.DME2ClientSS;\r
31 import org.onap.aaf.cadi.dme2.DRcli;\r
32 \r
33 import com.att.aft.dme2.api.DME2Manager;\r
34 \r
35 public class TestDME2RcliClient {\r
36         public static void main(String[] args) {\r
37                 try {\r
38                         Properties props = System.getProperties();\r
39                         props.put("AFT_LATITUDE","32.780140");\r
40                         props.put("AFT_LONGITUDE","-96.800451");\r
41                         props.put("AFT_ENVIRONMENT","AFTUAT");\r
42 //                      props.put("DME2_EP_REGISTRY_CLASS","DME2FS");\r
43 //                      props.put("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");\r
44 \r
45                         props.put("cadi_keystore","/Volumes/Data/src/authz/common/aaf.att.jks");\r
46                         props.put("cadi_keystore_password","enc:???");\r
47                         props.put("cadi_truststore","/Volumes/Data/src/authz/common/truststore.jks");\r
48                         props.put("cadi_truststore_password","enc:???");\r
49                         props.put("cadi_keyfile", "/Volumes/Data/src/authz/common/keyfile");\r
50                         \r
51                         // Local Testing on dynamic IP PC ***ONLY***\r
52 //                      props.put("cadi_trust_all_x509", "true");               \r
53                         \r
54                         \r
55                         \r
56                         URI uri = new URI("https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");\r
57                                  \r
58                         Access access = new TestAccess();\r
59                         DME2Manager dm = new DME2Manager("DME2Manager TestHClient",props);\r
60                         DRcli client = new DRcli(\r
61                                         uri, \r
62                                         new DME2ClientSS(access,"XX@NS","enc:???"));\r
63                         \r
64                         client.setManager(dm)\r
65                                   .apiVersion("2.0")\r
66                                   .readTimeout(3000);\r
67                         \r
68                         Future<String> ft = client.read("/authz/nss/com.att.aaf","text/json");  \r
69                         if(ft.get(10000)) {\r
70                                 System.out.println("Hurray,\n"+ft.body());\r
71                         } else {\r
72                                 System.out.println("not quite: " + ft.code());\r
73                         }\r
74                 } catch (Exception e) {\r
75                         e.printStackTrace();\r
76                 }\r
77         }\r
78         \r
79 }\r