1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\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
11 * * http://www.apache.org/licenses/LICENSE-2.0
\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
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.client.test;
\r
25 import java.net.URI;
\r
26 import java.util.Properties;
\r
28 import com.att.aft.dme2.api.DME2Client;
\r
29 import com.att.aft.dme2.api.DME2Manager;
\r
31 public class JU_BasicDME2Client {
\r
32 public static void main(String[] args) {
\r
34 Properties props = System.getProperties();
\r
36 DME2Manager dm = new DME2Manager("DME2Manager TestBasicDME2Client",props);
\r
37 URI uri = new URI(System.getProperty("aaf_url"));
\r
38 DME2Client client = new DME2Client(dm,uri,3000);
\r
40 System.out.println(props.getProperty("aaf_id"));
\r
41 client.setCredentials(props.getProperty("aaf_id"),props.getProperty("aaf_password"));
\r
43 String path = String.format("/authz/perms/user/%s@csp.att.com",args.length>0?args[0]:"xx9999");
\r
44 System.out.printf("Path: %s\n",path);
\r
45 client.addHeader("Accept", "application/Perms+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*");
\r
46 client.setMethod("GET");
\r
47 client.setContext(path);
\r
48 client.setPayload("");// Note: Even on "GET", you need a String in DME2
\r
50 String o = client.sendAndWait(5000); // There are other Asynchronous call options, see DME2 Docs
\r
52 System.out.println('[' + o + ']' + " (blank is good)");
\r
56 } catch (Exception e) {
\r
57 e.printStackTrace();
\r