Merge "AAFcli.java -Declare "value" on a separate line"
[aaf/authz.git] / auth / auth-cass / src / test / java / org / onap / aaf / auth / dao / aaf / test / AbsJUCass.java
index 331e4c8..7780a16 100644 (file)
@@ -7,9 +7,9 @@
  * * 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.
@@ -19,6 +19,7 @@
  * *
  * *
  ******************************************************************************/
+
 package org.onap.aaf.auth.dao.aaf.test;
 
 import java.io.File;
@@ -49,7 +50,7 @@ import junit.framework.Assert;
 
 /**
  * Do Setup of Cassandra for Cassandra JUnit Testing
- * 
+ *
  *
  */
 public class AbsJUCass {
@@ -62,17 +63,17 @@ public class AbsJUCass {
     protected static float json = 0.0f;
     protected static AuthzTrans trans;
     protected static boolean details = true;
-    
-    @BeforeClass 
+
+    @BeforeClass
     public static void startup() throws APIException, IOException {
         synchronized(AUTHZ) {
-            if(env==null) {
+            if (env==null) {
                 final String resource = "cadi.properties";
                 File f = new File("etc" + resource);
                 InputStream is=null;
                 Properties props = new Properties();
                 try {
-                    if(f.exists()) {
+                    if (f.exists()) {
                         is = new FileInputStream(f);
                     } else {
                         URL rsrc = ClassLoader.getSystemResource(resource);
@@ -80,7 +81,7 @@ public class AbsJUCass {
                     }
                     props.load(is);
                 } finally {
-                    if(is==null) {
+                    if (is==null) {
                         env= new AuthzEnv();
                         Assert.fail(resource + " must exist in etc dir, or in Classpath");
                     }
@@ -94,26 +95,23 @@ public class AbsJUCass {
         env.info().log("Connecting to Cluster");
         try {
             cluster.connect(AUTHZ);
-        } catch(Exception e) {
+        } catch (Exception e) {
             cluster=null;
             env.error().log(e);
             Assert.fail("Not able to connect to DB: " + e.getLocalizedMessage());
         }
         env.info().log("Connected");
-        
+
         // Load special data here
-        
-        // WebPhone
-        env.setProperty("java.naming.provider.url","ldap://ldap.webphone.att.com:389");
-        env.setProperty("com.sun.jndi.ldap.connect.pool","true");
-        
+
+
         iterations = 0;
-        
+
     }
-    
+
     @AfterClass
     public static void shutdown() {
-        if(cluster!=null) {
+        if (cluster!=null) {
             cluster.close();
             cluster = null;
         }
@@ -122,16 +120,16 @@ public class AbsJUCass {
     @Before
     public void newTrans() {
         trans = env.newTrans();
-        
+
         trans.setProperty(CassDAOImpl.USER_NAME, System.getProperty("user.name"));
     }
-    
+
     @After
     public void auditTrail() {
-        if(totals==0) { // "updateTotals()" was not called... just do one Trans
+        if (totals==0) { // "updateTotals()" was not called... just do one Trans
             StringBuilder sb = new StringBuilder();
             Metric metric = trans.auditTrail(4, sb, Env.JSON, Env.REMOTE);
-            if(details) {
+            if (details) {
                 env.info().log(
                 sb,
                 "Total time:",
@@ -146,7 +144,7 @@ public class AbsJUCass {
             }
         }
     }
-    
+
     protected void updateTotals() {
         Metric metric = trans.auditTrail(0, null, Env.JSON, Env.REMOTE);
         totals+=metric.total;
@@ -158,14 +156,14 @@ public class AbsJUCass {
     @AfterClass
     public static void print() {
         float transTime;
-        if(iterations==0) {
+        if (iterations==0) {
             transTime=totals;
         } else {
             transTime=totals/iterations;
         }
         env.info().log(
         "Total time:",
-        totals,   
+        totals,
         "JSON time:",
         json,
         "REMOTE time:",
@@ -176,10 +174,10 @@ public class AbsJUCass {
         transTime
         );
     }
-    
+
     /**
      * Take a User/Pass and turn into an MD5 Hashed BasicAuth
-     * 
+     *
      * @param user
      * @param pass
      * @return