aboutsummaryrefslogtreecommitdiffstats
path: root/client/src/test/java/com
diff options
context:
space:
mode:
authorsg481n <sg481n@att.com>2017-08-25 01:57:24 -0400
committersg481n <sg481n@att.com>2017-08-25 01:57:37 -0400
commit62c4eb45e157d502463d797c1353802ca8e1e307 (patch)
treef79566b55c2535fd4be51b52cb4e5cb258391114 /client/src/test/java/com
parenta623b7658783e9a66f6131821de9447d58951cfe (diff)
Update project structure for aaf/cadi
Update project structure from com.att to org.onap and add distribution management and staging plugin. Issue-id: AAF-22 Change-Id: Idf2b591139e38921ad28782a51486714a05dee92 Signed-off-by: sg481n <sg481n@att.com>
Diffstat (limited to 'client/src/test/java/com')
-rw-r--r--client/src/test/java/com/client/test/BasicDME2Client.java61
-rw-r--r--client/src/test/java/com/client/test/JU_DNSLocator.java57
-rw-r--r--client/src/test/java/com/client/test/JU_PropertyLocator.java98
-rw-r--r--client/src/test/java/com/client/test/PaulUzee.java145
-rw-r--r--client/src/test/java/com/client/test/TestAccess.java90
-rw-r--r--client/src/test/java/com/client/test/TestDME2Client.java97
-rw-r--r--client/src/test/java/com/client/test/TestDME2RcliClient.java78
-rw-r--r--client/src/test/java/com/client/test/TestHClient.java83
8 files changed, 0 insertions, 709 deletions
diff --git a/client/src/test/java/com/client/test/BasicDME2Client.java b/client/src/test/java/com/client/test/BasicDME2Client.java
deleted file mode 100644
index f26d3b1..0000000
--- a/client/src/test/java/com/client/test/BasicDME2Client.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.net.URI;
-import java.util.Properties;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Manager;
-
-public class BasicDME2Client {
- public static void main(String[] args) {
- try {
- Properties props = System.getProperties();
-
- DME2Manager dm = new DME2Manager("DME2Manager TestBasicDME2Client",props);
- URI uri = new URI(System.getProperty("aaf_url"));
- DME2Client client = new DME2Client(dm,uri,3000);
-
- System.out.println(props.getProperty("aaf_id"));
- client.setCredentials(props.getProperty("aaf_id"),props.getProperty("aaf_password"));
-
- String path = String.format("/authz/perms/user/%s@csp.att.com",args.length>0?args[0]:"xx9999");
- System.out.printf("Path: %s\n",path);
- client.addHeader("Accept", "application/Perms+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*");
- client.setMethod("GET");
- client.setContext(path);
- client.setPayload("");// Note: Even on "GET", you need a String in DME2
-
- String o = client.sendAndWait(5000); // There are other Asynchronous call options, see DME2 Docs
- if(o==null) {
- System.out.println('[' + o + ']' + " (blank is good)");
- }
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/client/src/test/java/com/client/test/JU_DNSLocator.java b/client/src/test/java/com/client/test/JU_DNSLocator.java
deleted file mode 100644
index 04a4f17..0000000
--- a/client/src/test/java/com/client/test/JU_DNSLocator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.junit.AfterClass;
-import org.junit.Test;
-
-import com.att.cadi.locator.DNSLocator;
-import com.att.cadi.PropAccess;
-import com.att.cadi.Locator.Item;
-
-public class JU_DNSLocator {
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
-
- DNSLocator dl = new DNSLocator(new PropAccess(), "https", "aaf.it.att.com","8150-8152");
- try {
- Item item = dl.best();
- URI uri = dl.get(item);
- URL url = uri.toURL();
- URLConnection conn = url.openConnection();
- conn.connect();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/client/src/test/java/com/client/test/JU_PropertyLocator.java b/client/src/test/java/com/client/test/JU_PropertyLocator.java
deleted file mode 100644
index 89bef62..0000000
--- a/client/src/test/java/com/client/test/JU_PropertyLocator.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.net.URI;
-
-import org.junit.AfterClass;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.att.cadi.Locator.Item;
-import com.att.cadi.locator.PropertyLocator;
-
-public class JU_PropertyLocator {
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() throws Exception {
- PropertyLocator pl = new PropertyLocator("https://localhost:2345,https://fred.wilma.com:26444,https://tom.jerry.com:534");
-
- Item i;
- int count;
- boolean print = false;
- for(int j=0;j<900000;++j) {
- count = 0;
- for(i = pl.first();i!=null;i=pl.next(i)) {
- URI loc = pl.get(i);
- if(print)System.out.println(loc.toString());
- ++count;
- }
- assertEquals(3,count);
- assertTrue(pl.hasItems());
- if(print)System.out.println("---");
- pl.invalidate(pl.best());
-
- count = 0;
- for(i = pl.first();i!=null;i=pl.next(i)) {
- URI loc = pl.get(i);
- if(print)System.out.println(loc.toString());
- ++count;
- }
-
- assertEquals(2,count);
- assertTrue(pl.hasItems());
- if(print)System.out.println("---");
- pl.invalidate(pl.best());
-
- count = 0;
- for(i = pl.first();i!=null;i=pl.next(i)) {
- URI loc = pl.get(i);
- if(print)System.out.println(loc.toString());
- ++count;
- }
-
- assertEquals(1,count);
- assertTrue(pl.hasItems());
- if(print)System.out.println("---");
- pl.invalidate(pl.best());
-
- count = 0;
- for(i = pl.first();i!=null;i=pl.next(i)) {
- URI loc = pl.get(i);
- if(print)System.out.println(loc.toString());
- ++count;
- }
-
- assertEquals(0,count);
- assertFalse(pl.hasItems());
-
- pl.refresh();
- }
- }
-
-}
diff --git a/client/src/test/java/com/client/test/PaulUzee.java b/client/src/test/java/com/client/test/PaulUzee.java
deleted file mode 100644
index 24aeb49..0000000
--- a/client/src/test/java/com/client/test/PaulUzee.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.net.URI;
-import java.util.Properties;
-
-import com.att.aft.dme2.api.DME2Manager;
-import com.att.cadi.Access;
-import com.att.cadi.Locator;
-import com.att.cadi.Access.Level;
-import com.att.cadi.Locator.Item;
-import com.att.cadi.dme2.DME2Locator;
-
-public class PaulUzee {
- public static void main(String[] args) {
- try {
- // You'll want to put this on Command line "-D" probably
- Properties props = System.getProperties();
- props.put("AFT_LATITUDE","32.780140");
- props.put("AFT_LONGITUDE","-96.800451");
- props.put("AFT_ENVIRONMENT","AFTPRD");
-
- //
- // Use an "Access" class to hook up logging, properties, etc.
- // Make one that ties into your code's logging, property mechanism, etc.
- //
- Access access = new PaulAccess();
-
- DME2Manager dm = new DME2Manager("Paul Uzee's Test",props);
- Locator loc = new DME2Locator(access ,dm,"com.att.authz.AuthorizationService","2.0","PROD","DEFAULT");
-
-
- for(Item item = loc.first(); item!=null; item=loc.next(item)) {
- URI location = (URI) loc.get(item);
- access.log(Level.INFO,location);
- access.log(Level.INFO,location.getScheme());
- access.log(Level.INFO,location.getHost());
- access.log(Level.INFO, location.getPort());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- private static class PaulAccess implements Access {
- private Level willWrite = Level.INFO;
-
- @Override
- public ClassLoader classLoader() {
- return getClass().getClassLoader();
- }
-
- @Override
- public String decrypt(String data, boolean def) throws IOException {
- return data;
- }
-
- @Override
- public String getProperty(String tag, String def) {
- return System.getProperty(tag, def);
- }
-
- @Override
- public void load(InputStream is) throws IOException {
- System.getProperties().load(is);
- }
-
- @Override
- public void log(Level level, Object... obj) {
- if(level.compareTo(willWrite)<0) return;
- PrintStream ps;
- switch(level) {
- case DEBUG:
- case AUDIT:
- case ERROR:
- case WARN:
- ps = System.err;
- break;
- case INFO:
- case INIT:
- default:
- ps = System.out;
- }
- boolean first = true;
- for(Object o : obj) {
- if(first)first=false;
- else ps.print(' ');
- ps.print(o.toString());
- }
- ps.println();
- }
-
- @Override
- public void log(Exception e, Object... obj) {
- Object[] objs = new Object[obj.length+1];
- objs[0]=e.getMessage();
- System.arraycopy(objs, 1, obj, 0, obj.length);
- log(Level.ERROR,e,objs);
- }
-
- @Override
- public void setLogLevel(Level l) {
- willWrite = l;
- }
-
- /* (non-Javadoc)
- * @see com.att.cadi.Access#willLog(com.att.cadi.Access.Level)
- */
- @Override
- public boolean willLog(Level level) {
- return true;
- }
-
- @Override
- public void printf(Level level, String fmt, Object... elements) {
- // TODO Auto-generated method stub
-
- }
- };
-}
diff --git a/client/src/test/java/com/client/test/TestAccess.java b/client/src/test/java/com/client/test/TestAccess.java
deleted file mode 100644
index 434ae62..0000000
--- a/client/src/test/java/com/client/test/TestAccess.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.att.cadi.Access;
-import com.att.cadi.Symm;
-
-public class TestAccess implements Access {
- private Symm symm;
-
- public TestAccess() {
- symm = Symm.obtain(this);
- }
-
- public void log(Level level, Object... elements) {
- boolean first = true;
- for(int i=0;i<elements.length;++i) {
- if(first)first = false;
- else System.out.print(' ');
- System.out.print(elements[i].toString());
- }
- System.out.println();
- }
-
- public void log(Exception e, Object... elements) {
- e.printStackTrace();
- log(Level.ERROR,elements);
- }
-
- public void setLogLevel(Level level) {
-
- }
-
- public ClassLoader classLoader() {
- return ClassLoader.getSystemClassLoader();
- }
-
- public String getProperty(String string, String def) {
- String rv = System.getProperty(string);
- return rv==null?def:rv;
- }
-
- public void load(InputStream is) throws IOException {
-
- }
-
- public String decrypt(String encrypted, boolean anytext) throws IOException {
- return (encrypted!=null && (anytext==true || encrypted.startsWith(Symm.ENC)))
- ? symm.depass(encrypted)
- : encrypted;
- }
-
- /* (non-Javadoc)
- * @see com.att.cadi.Access#willLog(com.att.cadi.Access.Level)
- */
- @Override
- public boolean willLog(Level level) {
- return true;
- }
-
- @Override
- public void printf(Level level, String fmt, Object... elements) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/client/src/test/java/com/client/test/TestDME2Client.java b/client/src/test/java/com/client/test/TestDME2Client.java
deleted file mode 100644
index 415f992..0000000
--- a/client/src/test/java/com/client/test/TestDME2Client.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.io.FileInputStream;
-import java.net.URI;
-import java.util.Properties;
-
-import com.att.aft.dme2.api.DME2Client;
-import com.att.aft.dme2.api.DME2Manager;
-import com.att.cadi.Symm;
-
-public class TestDME2Client {
- public static void main(String[] args) {
- try {
- Properties props = System.getProperties();
- props.put("AFT_LATITUDE","32.780140");
- props.put("AFT_LONGITUDE","-96.800451");
- props.put("AFT_ENVIRONMENT","AFTUAT");
-
- //props.put("keyStore","/Volumes/Data/src/authz/common/aaf.att.jks");
- props.put("AFT_DME2_KEYSTORE","/Volumes/Data/src/authz/common/aaf.att.jks");
- props.put("AFT_DME2_KEYSTORE_PASSWORD","enc:???");
- props.put("AFT_DME2_TRUSTSTORE","/Volumes/Data/src/authz/common/truststore.jks");
- props.put("AFT_DME2_TRUSTSTORE_PASSWORD","enc:???");
-
- // Local Testing on dynamic IP PC ***ONLY***
-// props.put("DME2_EP_REGISTRY_CLASS","DME2FS");
-// props.put("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");
-// props.put("AFT_DME2_SSL_TRUST_ALL", "true");
-
- Symm symm;
- FileInputStream keyfile=new FileInputStream("/Volumes/Data/src/authz/common/keyfile");
- try {
- symm=Symm.obtain(keyfile);
- } finally {
- keyfile.close();
- }
-
- DME2Manager dm = new DME2Manager("DME2Manager TestHClient",props);
- // Standard RESOLVE format
- String prefix;
- URI uri =
-// new URI(
-// "https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE"
-// );
-// prefix = "";
-// Direct Format
-// new URI("https://mithrilcsp.sbc.com:8100/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");
-// prefix = "";
-// Go through PROXY
-// new URI("https://mithrilcsp.sbc.com:8095");
-// prefix = "/proxy";
-
-// new URI("https://mithrilcsp.sbc.com:8095");
- new URI("https://DME2RESOLVE/service=com.att.authz.authz-gw/version=2.0/envContext=UAT/routeOffer=BAU_SE");
-// prefix = "";
- prefix = "/proxy";
- DME2Client client = new DME2Client(dm,uri,3000);
-
- client.setCredentials("XX@NS", symm.depass("enc:???"));
-
- client.addHeader("Accept", "text/plain");
- client.setMethod("GET");
- client.setContext(prefix+"/authn/basicAuth");
- client.setPayload("");// Note: Even on "GET", you need a String in DME2
-
- String o = client.sendAndWait(5000); // There are other Asynchronous call options, see DME2 Docs
-
- System.out.println('[' + o + ']' + " (blank is good)");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/client/src/test/java/com/client/test/TestDME2RcliClient.java b/client/src/test/java/com/client/test/TestDME2RcliClient.java
deleted file mode 100644
index 6ff5d6f..0000000
--- a/client/src/test/java/com/client/test/TestDME2RcliClient.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.net.URI;
-import java.util.Properties;
-
-import com.att.aft.dme2.api.DME2Manager;
-import com.att.cadi.Access;
-import com.att.cadi.client.Future;
-import com.att.cadi.dme2.DME2ClientSS;
-import com.att.cadi.dme2.DRcli;
-
-public class TestDME2RcliClient {
- public static void main(String[] args) {
- try {
- Properties props = System.getProperties();
- props.put("AFT_LATITUDE","32.780140");
- props.put("AFT_LONGITUDE","-96.800451");
- props.put("AFT_ENVIRONMENT","AFTUAT");
-// props.put("DME2_EP_REGISTRY_CLASS","DME2FS");
-// props.put("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");
-
- props.put("cadi_keystore","/Volumes/Data/src/authz/common/aaf.att.jks");
- props.put("cadi_keystore_password","enc:???");
- props.put("cadi_truststore","/Volumes/Data/src/authz/common/truststore.jks");
- props.put("cadi_truststore_password","enc:???");
- props.put("cadi_keyfile", "/Volumes/Data/src/authz/common/keyfile");
-
- // Local Testing on dynamic IP PC ***ONLY***
-// props.put("cadi_trust_all_x509", "true");
-
-
-
- URI uri = new URI("https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");
-
- Access access = new TestAccess();
- DME2Manager dm = new DME2Manager("DME2Manager TestHClient",props);
- DRcli client = new DRcli(
- uri,
- new DME2ClientSS(access,"XX@NS","enc:???"));
-
- client.setManager(dm)
- .apiVersion("2.0")
- .readTimeout(3000);
-
- Future<String> ft = client.read("/authz/nss/com.att.aaf","text/json");
- if(ft.get(10000)) {
- System.out.println("Hurray,\n"+ft.body());
- } else {
- System.out.println("not quite: " + ft.code());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/client/src/test/java/com/client/test/TestHClient.java b/client/src/test/java/com/client/test/TestHClient.java
deleted file mode 100644
index 7fcd113..0000000
--- a/client/src/test/java/com/client/test/TestHClient.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-package com.client.test;
-
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.util.Properties;
-
-import com.att.aft.dme2.api.DME2Manager;
-import com.att.cadi.CadiException;
-import com.att.cadi.Locator;
-import com.att.cadi.Locator.Item;
-import com.att.cadi.PropAccess;
-import com.att.cadi.SecuritySetter;
-import com.att.cadi.client.Future;
-import com.att.cadi.client.Rcli;
-import com.att.cadi.client.Retryable;
-import com.att.cadi.config.Config;
-import com.att.cadi.config.SecurityInfoC;
-import com.att.cadi.http.HBasicAuthSS;
-import com.att.cadi.http.HMangr;
-import com.att.cadi.locator.DME2Locator;
-import com.att.inno.env.APIException;
-
-public class TestHClient {
- public static void main(String[] args) {
- try {
- PropAccess access = new PropAccess();
- DME2Manager dm = new DME2Manager("DME2Manager TestHClient",access.getProperties());
- Locator<URI> loc = new DME2Locator(access,dm,"com.att.authz.AuthorizationService","2.0","DEV","BAU_SE");
-
- for(Item item = loc.first(); item!=null; item=loc.next(item)) {
- System.out.println(loc.get(item));
- }
-
-
- SecurityInfoC<HttpURLConnection> si = new SecurityInfoC<HttpURLConnection>(access);
- SecuritySetter<HttpURLConnection> ss = new HBasicAuthSS("m12345@aaf.att.com",
- access.decrypt("enc:7K6yjLQqha_S9yApkIul2K_by5Moemcos1HRAVnhMXu",false), si);
-// SecuritySetter<HttpURLConnection> ss = new X509SS(si, "aaf");
-
- HMangr hman = new HMangr(access,loc);
- try {
- hman.best(ss, new Retryable<Void>() {
- @Override
- public Void code(Rcli<?> cli) throws APIException, CadiException {
- Future<String> ft = cli.read("/authz/nss/com.att.aaf","text/json");
- if(ft.get(10000)) {
- System.out.println("Hurray,\n"+ft.body());
- } else {
- System.out.println("not quite: " + ft.code());
- }
- return null;
- }});
- } finally {
- hman.close();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}