+++ /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.io.FileInputStream;\r
-import java.net.URI;\r
-import java.util.Properties;\r
-\r
-import org.onap.aaf.cadi.Symm;\r
-\r
-import com.att.aft.dme2.api.DME2Client;\r
-import com.att.aft.dme2.api.DME2Manager;\r
-\r
-public class JU_TestDME2Client {\r
- public static void main(String[] args) {\r
- try {\r
- Properties props = System.getProperties();\r
- props.put("AFT_LATITUDE","32.780140");\r
- props.put("AFT_LONGITUDE","-96.800451");\r
- props.put("AFT_ENVIRONMENT","AFTUAT");\r
- \r
- //props.put("keyStore","/Volumes/Data/src/authz/common/aaf.att.jks");\r
- props.put("AFT_DME2_KEYSTORE","/Volumes/Data/src/authz/common/aaf.att.jks");\r
- props.put("AFT_DME2_KEYSTORE_PASSWORD","enc:???");\r
- props.put("AFT_DME2_TRUSTSTORE","/Volumes/Data/src/authz/common/truststore.jks");\r
- props.put("AFT_DME2_TRUSTSTORE_PASSWORD","enc:???");\r
- \r
- // Local Testing on dynamic IP PC ***ONLY***\r
-// props.put("DME2_EP_REGISTRY_CLASS","DME2FS");\r
-// props.put("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");\r
-// props.put("AFT_DME2_SSL_TRUST_ALL", "true");\r
-\r
- Symm symm;\r
- FileInputStream keyfile=new FileInputStream("/Volumes/Data/src/authz/common/keyfile");\r
- try {\r
- symm=Symm.obtain(keyfile);\r
- } finally {\r
- keyfile.close();\r
- }\r
-\r
- DME2Manager dm = new DME2Manager("DME2Manager TestHClient",props);\r
- // Standard RESOLVE format\r
- String prefix;\r
- URI uri = \r
-// new URI(\r
-// "https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE"\r
-// );\r
-// prefix = "";\r
-// Direct Format\r
-// new URI("https://mithrilcsp.sbc.com:8100/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");\r
-// prefix = "";\r
-// Go through PROXY\r
-// new URI("https://mithrilcsp.sbc.com:8095");\r
-// prefix = "/proxy";\r
- \r
-// new URI("https://mithrilcsp.sbc.com:8095");\r
- new URI("https://DME2RESOLVE/service=com.att.authz.authz-gw/version=2.0/envContext=UAT/routeOffer=BAU_SE");\r
-// prefix = "";\r
- prefix = "/proxy";\r
- DME2Client client = new DME2Client(dm,uri,3000);\r
-\r
- client.setCredentials("XX@NS", symm.depass("enc:???"));\r
- \r
- client.addHeader("Accept", "text/plain");\r
- client.setMethod("GET");\r
- client.setContext(prefix+"/authn/basicAuth");\r
- client.setPayload("");// Note: Even on "GET", you need a String in DME2\r
- \r
- String o = client.sendAndWait(5000); // There are other Asynchronous call options, see DME2 Docs\r
- \r
- System.out.println('[' + o + ']' + " (blank is good)");\r
- \r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- \r
-}\r