Merge "Add more junits misc env jaxb"
authorJonathan Gathman <jonathan.gathman@att.com>
Thu, 3 Jan 2019 16:32:34 +0000 (16:32 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 3 Jan 2019 16:32:34 +0000 (16:32 +0000)
auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/AbsCredBody.java
auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java

index ac4a132..d9ee272 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -50,7 +52,45 @@ public class Future implements CacheChange.Data, Comparable<Future> {
     public final FutureDAO.Data fdd;
     public final String role; // derived
     private static final CacheChange<Future> cache = new CacheChange<>();
-    
+
+    public static Creator<Future> v2_0_17 = new Creator<Future>() {
+        @Override
+        public Future create(Row row) {
+            return new Future(row.getUUID(0),row.getString(1),row.getString(2),
+                    row.getTimestamp(3),row.getTimestamp(4), null);
+        }
+
+        @Override
+        public String select() {
+            return "select id,memo,target,start,expires from authz.future";
+        }
+    };
+
+    public static Creator<Future> withConstruct = new Creator<Future>() {
+        @Override
+        public String select() {
+            return "select id,memo,target,start,expires,construct from authz.future";
+        }
+
+        @Override
+        public Future create(Row row) {
+            return new Future(row.getUUID(0),row.getString(1),row.getString(2),
+                    row.getTimestamp(3),row.getTimestamp(4), row.getBytes(5));
+        }
+
+    };
+
+
+    public Future(UUID id, String memo, String target, Date start, Date expires, ByteBuffer construct) {
+        fdd = new FutureDAO.Data();
+        fdd.id = id;
+        fdd.memo = memo;
+        fdd.target = target;
+        fdd.start = start;
+        fdd.expires = expires;
+        fdd.construct = construct;
+        role = Approval.roleFromMemo(memo);
+    }
     
     public final UUID id() {
         return fdd.id;
@@ -72,18 +112,6 @@ public class Future implements CacheChange.Data, Comparable<Future> {
         return fdd.expires;
     }
 
-    
-    public Future(UUID id, String memo, String target, Date start, Date expires, ByteBuffer construct) {
-        fdd = new FutureDAO.Data();
-        fdd.id = id;
-        fdd.memo = memo;
-        fdd.target = target;
-        fdd.start = start;
-        fdd.expires = expires;
-        fdd.construct = construct;
-        role = Approval.roleFromMemo(memo);
-    }
-
     public static void load(Trans trans, Session session, Creator<Future> creator) {
         trans.info().log( "query: " + creator.select() );
         ResultSet results;
@@ -118,33 +146,6 @@ public class Future implements CacheChange.Data, Comparable<Future> {
             trans.info().log("Found",count,"Futures");
         }
     }
-    
-    public static Creator<Future> v2_0_17 = new Creator<Future>() {
-        @Override
-        public Future create(Row row) {
-            return new Future(row.getUUID(0),row.getString(1),row.getString(2),
-                    row.getTimestamp(3),row.getTimestamp(4), null);
-        }
-
-        @Override
-        public String select() {
-            return "select id,memo,target,start,expires from authz.future";
-        }
-    };
-
-    public static Creator<Future> withConstruct = new Creator<Future>() {
-        @Override
-        public String select() {
-            return "select id,memo,target,start,expires,construct from authz.future";
-        }
-        
-        @Override
-        public Future create(Row row) {
-            return new Future(row.getUUID(0),row.getString(1),row.getString(2),
-                    row.getTimestamp(3),row.getTimestamp(4), row.getBytes(5));
-        }
-
-    };
 
     public Result<Void> delayedDelete(AuthzTrans trans, FutureDAO fd, boolean dryRun, String text) {
         Result<Void> rv;
index 3df72e1..cad1c12 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,11 +37,26 @@ import com.datastax.driver.core.Session;
 import com.datastax.driver.core.SimpleStatement;
 import com.datastax.driver.core.Statement;
 
-public class NS implements Comparable<NS> {
-    public final static Map<String,NS> data = new TreeMap<>();
+public class    NS implements Comparable<NS> {
+    public static final Map<String,NS> data = new TreeMap<>();
+
+    public final String name;
+    public final String description;
+    public final String parent;
+    public final int scope;
+    public final int type;
 
-    public final String name, description, parent;
-    public final int scope,type;
+    public static Creator<NS> v2_0_11 = new Creator<NS> () {
+        @Override
+        public NS create(Row row) {
+            return new NS(row.getString(0),row.getString(1), row.getString(2),row.getInt(3),row.getInt(4));
+        }
+
+        @Override
+        public String select() {
+            return "SELECT name, description, parent, type, scope FROM authz.ns ";
+        }
+    };
 
     public NS(String name, String description, String parent, int type, int scope) {
         this.name = name;
@@ -143,7 +160,9 @@ public class NS implements Comparable<NS> {
         }
     }
     public static NSSplit deriveParent(String dotted) {
-        if (dotted==null)return null;
+        if (dotted==null) {
+            return null;
+        }
         for (int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
             if (data.get(dotted.substring(0, idx))!=null) {
                 return new NSSplit(dotted,idx);
@@ -151,18 +170,6 @@ public class NS implements Comparable<NS> {
         }
         return null;
     }
-    
-    public static Creator<NS> v2_0_11 = new Creator<NS> () {
-        @Override
-        public NS create(Row row) {
-            return new NS(row.getString(0),row.getString(1), row.getString(2),row.getInt(3),row.getInt(4));
-        }
-        
-        @Override
-        public String select() {
-            return "SELECT name, description, parent, type, scope FROM authz.ns ";
-        }
-    };
 
         
 }
\ No newline at end of file
index 4b4a255..6d87ded 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -44,8 +46,11 @@ public class Role implements Comparable<Role> {
     public static final TreeMap<String,Role> byName = new TreeMap<>();
     private static List<Role> deleteRoles = new ArrayList<>();
 
-    public final String ns, name, description;
-    private String full, encode;
+    public final String ns;
+    public final String name;
+    public final String description;
+    private String full;
+    private String encode;
     public final Set<String> perms;
     
     public Role(String full) {
index c0d16b0..db45e20 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,13 +27,13 @@ import java.util.List;
 
 public abstract class AbsCredBody extends NotifyBody {
 
-       public AbsCredBody(final String name) throws IOException {
+       public AbsCredBody(final String name) {
                super("cred",name);
        }
 
        @Override
        public String user(List<String> row) {
-               if(row.size()>0) {
+               if( (row != null) && !row.isEmpty()) {
                        return row.get(1);
                }
                return null;
index 71ccf3c..9017763 100644 (file)
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +24,6 @@
 package org.onap.aaf.auth.cm.data;
 
 import java.io.IOException;
-import java.security.GeneralSecurityException;
 import java.security.KeyPair;
 import java.security.cert.X509Certificate;