From 59ffb7d529245c3bd0233dbf6cb0ae9fe9ccb856 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Sun, 3 Feb 2019 06:09:34 -0600 Subject: Approval Batch, prep better JUnit Issue-ID: AAF-740 Change-Id: Id9e8ca121c9bf92c2f98c7a61631e2417bba70b1 Signed-off-by: Instrumental --- .../main/java/org/onap/aaf/auth/env/NullTrans.java | 7 ++++--- .../main/java/org/onap/aaf/auth/layer/Result.java | 24 +++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'auth/auth-core') diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java index d1c5d28c..942a0e54 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java @@ -93,10 +93,11 @@ public class NullTrans implements AuthzTrans { return LogTarget.NULL; } - public TimeTaken start(String name, int flag) { - return new TimeTaken(name,flag) { + @Override + public TimeTaken start(String name, int flag, Object ... values) { + return new TimeTaken(name,flag, values) { public void output(StringBuilder sb) { - sb.append(name); + sb.append(String.format(name,values)); sb.append(' '); sb.append(millis()); sb.append("ms"); diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java index e064ade3..9d7347ac 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java @@ -34,7 +34,7 @@ import java.util.Set; */ public class Result { private static final String SUCCESS = "Success"; - public static final String[] EMPTY_VARS = new String[0]; + public static final Object[] EMPTY_VARS = new Object[0]; public final static int OK=0, ERR_Security = 1, @@ -51,9 +51,9 @@ public class Result { public RV value; public final int status; public final String details; - public final String[] variables; + public final Object[] variables; - public Result(RV value, int status, String details, String[] variables) { + public Result(RV value, int status, String details, Object ... variables) { this.value = value; if (value==null) { specialCondition|=EMPTY_LIST; @@ -77,7 +77,7 @@ public class Result { * @return */ public static Result ok(R value) { - return new Result(value,OK,SUCCESS,null); + return new Result(value,OK,SUCCESS,EMPTY_VARS); } /** @@ -86,7 +86,7 @@ public class Result { * @return */ public static Result ok(R value[]) { - return new Result(value,OK,SUCCESS,null).emptyList(value.length==0); + return new Result(value,OK,SUCCESS,EMPTY_VARS).emptyList(value.length==0); } /** @@ -95,7 +95,7 @@ public class Result { * @return */ public static Result> ok(Set value) { - return new Result>(value,OK,SUCCESS,null).emptyList(value.size()==0); + return new Result>(value,OK,SUCCESS,EMPTY_VARS).emptyList(value.size()==0); } /** @@ -104,7 +104,7 @@ public class Result { * @return */ public static Result> ok(List value) { - return new Result>(value,OK,SUCCESS,null).emptyList(value.size()==0); + return new Result>(value,OK,SUCCESS,EMPTY_VARS).emptyList(value.size()==0); } /** @@ -113,7 +113,7 @@ public class Result { * @return */ public static Result> ok(Collection value) { - return new Result>(value,OK,SUCCESS,null).emptyList(value.size()==0); + return new Result>(value,OK,SUCCESS,EMPTY_VARS).emptyList(value.size()==0); } @@ -122,7 +122,7 @@ public class Result { * @return */ public static Result ok() { - return new Result(null,OK,SUCCESS,null); + return new Result(null,OK,SUCCESS,EMPTY_VARS); } /** @@ -143,7 +143,7 @@ public class Result { * @param variables * @return */ - public static Result err(int status, String details, String ... variables) { + public static Result err(int status, String details, Object ... variables) { return new Result(null,status,details,variables); } @@ -172,7 +172,7 @@ public class Result { * @param details * @return */ - public static Result create(R value, int status, String details, String ... vars) { + public static Result create(R value, int status, String details, Object ... vars) { return new Result(value,status,details,vars); } @@ -322,7 +322,7 @@ public class Result { default: sb.append("Error"); } sb.append(" - "); - sb.append(String.format(details, (Object[])variables)); + sb.append(String.format(details, variables)); return sb.toString(); } } -- cgit 1.2.3-korg