Remove Code from cadi, it is now in authz
[aaf/cadi.git] / aaf / src / test / java / org / onap / aaf / cadi / lur / aaf / test / JU_JMeter.java
diff --git a/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java b/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java
deleted file mode 100644 (file)
index 69c9688..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************\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.cadi.lur.aaf.test;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.File;\r
-import java.io.FileReader;\r
-import java.io.PrintWriter;\r
-import java.io.StringWriter;\r
-import java.net.HttpURLConnection;\r
-import java.security.Principal;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Properties;\r
-\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.onap.aaf.cadi.Permission;\r
-import org.onap.aaf.cadi.PropAccess;\r
-import org.onap.aaf.cadi.aaf.v2_0.AAFAuthn;\r
-import org.onap.aaf.cadi.aaf.v2_0.AAFConHttp;\r
-import org.onap.aaf.cadi.aaf.v2_0.AAFLurPerm;\r
-import org.onap.aaf.cadi.aaf.v2_0.AAFTaf;\r
-import org.onap.aaf.cadi.config.Config;\r
-import org.onap.aaf.cadi.locator.DNSLocator;\r
-import org.onap.aaf.cadi.principal.CachedBasicPrincipal;\r
-\r
-import junit.framework.Assert;\r
-\r
-public class JU_JMeter {\r
-       private static AAFConHttp aaf;\r
-       private static AAFAuthn<HttpURLConnection> aafAuthn;\r
-       private static AAFLurPerm aafLur;\r
-       private static ArrayList<Principal> perfIDs;\r
-       \r
-       private static AAFTaf<HttpURLConnection> aafTaf;\r
-       private static PropAccess access;\r
-\r
-       @BeforeClass\r
-       public static void before() throws Exception {\r
-               if(aafLur==null) {\r
-                       Properties props = System.getProperties();\r
-                       props.setProperty("AFT_LATITUDE", "32.780140");\r
-                       props.setProperty("AFT_LONGITUDE", "-96.800451");\r
-                       props.setProperty("DME2_EP_REGISTRY_CLASS","DME2FS");\r
-                       props.setProperty("AFT_DME2_EP_REGISTRY_FS_DIR","/Volumes/Data/src/authz/dme2reg");\r
-                       props.setProperty("AFT_ENVIRONMENT", "AFTUAT");\r
-                       props.setProperty("SCLD_PLATFORM", "NON-PROD");\r
-                       props.setProperty(Config.AAF_URL,"https://DME2RESOLVE/service=com.att.authz.AuthorizationService/version=2.0/envContext=DEV/routeOffer=BAU_SE");\r
-                       props.setProperty(Config.AAF_READ_TIMEOUT, "2000");\r
-                       int timeToLive = 3000;\r
-                       props.setProperty(Config.AAF_CLEAN_INTERVAL, Integer.toString(timeToLive));\r
-                       props.setProperty(Config.AAF_HIGH_COUNT, "4");\r
-\r
-                       String aafPerfIDs = props.getProperty("AAF_PERF_IDS");\r
-                       perfIDs = new ArrayList<Principal>();\r
-                       File perfFile = null;\r
-                       if(aafPerfIDs!=null) {\r
-                               perfFile = new File(aafPerfIDs);\r
-                       }\r
-\r
-                       access = new PropAccess();\r
-                       aaf = new AAFConHttp(access, new DNSLocator(access,"https","localhost","8100"));\r
-                       aafTaf = new AAFTaf<HttpURLConnection>(aaf,false);\r
-                       aafLur = aaf.newLur(aafTaf);\r
-                       aafAuthn = aaf.newAuthn(aafTaf);\r
-                       aaf.basicAuth("testid@aaf.att.com", "whatever");\r
-\r
-                       if(perfFile==null||!perfFile.exists()) {\r
-                               perfIDs.add(new CachedBasicPrincipal(aafTaf, \r
-                                               "Basic dGVzdGlkOndoYXRldmVy", \r
-                                               "aaf.att.com",timeToLive));\r
-                               perfIDs.add(new Princ("ab1234@aaf.att.com")); // Example of Local ID, which isn't looked up\r
-                       } else {\r
-                               BufferedReader ir = new BufferedReader(new FileReader(perfFile));\r
-                               try {\r
-                                       String line;\r
-                                       while((line = ir.readLine())!=null) {\r
-                                               if((line=line.trim()).length()>0)\r
-                                                       perfIDs.add(new Princ(line));\r
-                                       }\r
-                               } finally {\r
-                                       ir.close();\r
-                               }\r
-                       }\r
-                       Assert.assertNotNull(aafLur);\r
-               }\r
-       }\r
-\r
-       private static class Princ implements Principal {\r
-               private String name;\r
-               public Princ(String name) {\r
-                       this.name = name;\r
-               }\r
-               public String getName() {\r
-                       return name;\r
-               }\r
-               \r
-       };\r
-       \r
-       private static int index = -1;\r
-       \r
-       private synchronized Principal getIndex() {\r
-               if(perfIDs.size()<=++index)index=0;\r
-               return perfIDs.get(index);\r
-       }\r
-       @Test\r
-       public void test() {\r
-               try {\r
-                               aafAuthn.validate("testid@aaf.att.com", "whatever");\r
-                               List<Permission> perms = new ArrayList<Permission>();\r
-                               aafLur.fishAll(getIndex(), perms);\r
-//                             Assert.assertFalse(perms.isEmpty());\r
-//                             for(Permission p : perms) {\r
-//                                     //access.log(Access.Level.AUDIT, p.permType());\r
-//                             }\r
-               } catch (Exception e) {\r
-                       StringWriter sw = new StringWriter();\r
-                       e.printStackTrace(new PrintWriter(sw));\r
-                       Assert.assertFalse(sw.toString(),true);\r
-               }\r
-       }\r
-\r
-}\r