Update AAF Version 1.0.0
[aaf/cadi.git] / client / src / test / java / com / 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 com.client.test;\r
24 \r
25 import java.net.URI;\r
26 import java.util.Properties;\r
27 \r
28 import com.att.aft.dme2.api.DME2Manager;\r
29 import com.att.cadi.Access;\r
30 import com.att.cadi.client.Future;\r
31 import com.att.cadi.dme2.DME2ClientSS;\r
32 import com.att.cadi.dme2.DRcli;\r
33 \r
34 public class TestDME2RcliClient {\r
35         public static void main(String[] args) {\r
36                 try {\r
37                         Properties props = System.getProperties();\r
38                         props.put("AFT_LATITUDE","32.780140");\r
39                         props.put("AFT_LONGITUDE","-96.800451");\r
40                         props.put("AFT_ENVIRONMENT","AFTUAT");\r
41 //                      props.put("DME2_EP_REGISTRY_CLASS","DME2FS");\r
42 //                      props.put("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");\r
43 \r
44                         props.put("cadi_keystore","/Volumes/Data/src/authz/common/aaf.att.jks");\r
45                         props.put("cadi_keystore_password","enc:???");\r
46                         props.put("cadi_truststore","/Volumes/Data/src/authz/common/truststore.jks");\r
47                         props.put("cadi_truststore_password","enc:???");\r
48                         props.put("cadi_keyfile", "/Volumes/Data/src/authz/common/keyfile");\r
49                         \r
50                         // Local Testing on dynamic IP PC ***ONLY***\r
51 //                      props.put("cadi_trust_all_x509", "true");               \r
52                         \r
53                         \r
54                         \r
55                         URI uri = new URI("https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");\r
56                                  \r
57                         Access access = new TestAccess();\r
58                         DME2Manager dm = new DME2Manager("DME2Manager TestHClient",props);\r
59                         DRcli client = new DRcli(\r
60                                         uri, \r
61                                         new DME2ClientSS(access,"XX@NS","enc:???"));\r
62                         \r
63                         client.setManager(dm)\r
64                                   .apiVersion("2.0")\r
65                                   .readTimeout(3000);\r
66                         \r
67                         Future<String> ft = client.read("/authz/nss/com.att.aaf","text/json");  \r
68                         if(ft.get(10000)) {\r
69                                 System.out.println("Hurray,\n"+ft.body());\r
70                         } else {\r
71                                 System.out.println("not quite: " + ft.code());\r
72                         }\r
73                 } catch (Exception e) {\r
74                         e.printStackTrace();\r
75                 }\r
76         }\r
77         \r
78 }\r