From ba989d05eca8d2a98c51ed9d38c4c3345db23349 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Wed, 26 Jun 2019 07:05:51 -0500 Subject: Changes from Onsite Tests Issue-ID: AAF-857 Change-Id: I3fbed32ff5b2bb8f05f4f932c8dc2f4012c8b429 Signed-off-by: Instrumental --- .../src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java | 2 +- cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java | 9 ++++++--- cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java | 8 ++++++-- cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'cadi') diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java index e5a0a28c..f02c17f8 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java @@ -76,7 +76,7 @@ public class TestConnectivity { List> lss = loadSetters(access,si); ///////// String directAAFURL = aaf_urls.get(Config.AAF_URL); - if(directAAFURL!=null && !directAAFURL.contains("/locate/")) { + if(directAAFURL!=null && !directAAFURL.contains("/locate/") || !directAAFURL.contains("AAF_LOCATE_URL")) { print(true,"Test Connections by non-located aaf_url"); Locator locator = new SingleEndpointLocator(directAAFURL); connectTest(locator,new URI(directAAFURL)); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java index 4dd86fe0..49bab49c 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java @@ -86,7 +86,8 @@ import locate.v1_1.Configuration; import locate.v1_1.Configuration.Props; public class Agent { - private static final String HASHES = "################################################################"; + private static final String AGENT_LOAD_URLS = "Agent:loadURLs"; + private static final String HASHES = "################################################################"; private static final String PRINT = "print"; private static final String FILE = "file"; public static final String PKCS12 = "pkcs12"; @@ -311,7 +312,7 @@ public class Agent { String dot_le = access.getProperty(Config.AAF_LOCATOR_CONTAINER,null); dot_le=dot_le==null?"":'.'+dot_le; String version = access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION); - for(String u : new String[] {"aaf","locate","oauth","cm","gui","fs","hello","token","introspect"}) { + for(String u : new String[] {"locate","aaf","oauth","cm","gui","fs","hello","token","introspect"}) { String tag; String append=null; switch(u) { @@ -336,12 +337,14 @@ public class Agent { } else { lhost=Config.AAF_LOCATE_URL_TAG; } - value = rph.replacements("Agent:loadURLs", + value = rph.replacements(AGENT_LOAD_URLS, proto + lhost + "/%CNS.%AAF_NS." + ("aaf".equals(u)?"service":u) + ':' + version, null,dot_le); if(append!=null) { value+=append; } + } else { + value = rph.replacements(AGENT_LOAD_URLS, value,null,dot_le); } rv.put(tag, value); }; diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java index d6b8d56d..4737880e 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java @@ -42,7 +42,7 @@ import org.onap.aaf.cadi.util.Split; public class PropAccess implements Access { // Sonar says cannot be static... it's ok. not too many PropAccesses created. - private final SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + private final static SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); public static final Level DEFAULT = Level.AUDIT; @@ -101,7 +101,7 @@ public class PropAccess implements Access { init(nprops); } - protected void init(Properties p) { + protected synchronized void init(Properties p) { // Make sure these two are set before any changes in Logging name = "cadi"; level=DEFAULT.maskOf(); @@ -262,6 +262,10 @@ public class PropAccess implements Access { return buildMsg(name,iso8601,level,elements); } + public static StringBuilder buildMsg(final String name, Level level, Object[] elements) { + return buildMsg(name,iso8601,level,elements); + } + public static StringBuilder buildMsg(final String name, final DateFormat sdf, Level level, Object[] elements) { final StringBuilder sb; int end = elements.length; diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java index 38afa629..f74f194b 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java @@ -878,7 +878,7 @@ public class Config { Method meth = lcls.getMethod("create",Access.class,String.class); locator = (Locator)meth.invoke(null,access,url); } catch (Exception e) { - access.log(Level.TRACE, "(Not fatal) Cannot load by create(String)", e); + access.log(Level.NONE, "(Not fatal) Cannot load by create(String)", e); } if (locator==null) { URI locatorURI = new URI(url); -- cgit 1.2.3-korg