diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-06-20 07:22:59 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-06-20 07:23:22 -0500 |
commit | 2c3cb70208785cf0272eae075206074318ca74cc (patch) | |
tree | 23a9e75c4370739ba99accd657037180f6d2a8cc /cadi | |
parent | a77e3d6e9180c1722a9d18f7717034bb0650a130 (diff) |
Fixes/Refinements from Testing
Issue-ID: AAF-857
Change-Id: I2c5a542982b77011ad4ed5c41e08e045c83e2e3f
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi')
-rw-r--r-- | cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java | 3 | ||||
-rw-r--r-- | cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java | 49 |
2 files changed, 44 insertions, 8 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java index be1d3922..037ee8be 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java @@ -83,6 +83,9 @@ public class AAFPermission implements Permission { * If you want a simple field comparison, it is faster without REGEX */ public boolean match(Permission p) { + if(p==null) { + return false; + } String aafNS; String aafType; String aafInstance; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java index cbf0339b..8b879e4f 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java @@ -90,10 +90,11 @@ public class RegistrationCreator { } if(specificVersion!=null) { String split[] = Split.splitTrim('.', specificVersion); - locate.setPkg(split.length>3?Integer.parseInt(split[3]):0); - locate.setPatch(split.length>2?Integer.parseInt(split[2]):0); - locate.setMinor(split.length>1?Integer.parseInt(split[1]):0); - locate.setMajor(split.length>0?Integer.parseInt(split[0]):0); + String deply[]= Split.splitTrim('.', access.getProperty(Config.AAF_DEPLOYED_VERSION, "")); + locate.setMajor(best(split,deply,0)); + locate.setMinor(best(split,deply,1)); + locate.setPatch(best(split,deply,2)); + locate.setPkg(best(split,deply,3)); } String protocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL + dot_le, defProtocol); @@ -131,7 +132,39 @@ public class RegistrationCreator { return me; } - private StringBuilder print(StringBuilder sb, List<MgmtEndpoint> lme) { + /* + * Find the best version between Actual Interface and Deployed version + */ + private int best(String[] split, String[] deploy, int i) { + StringBuilder sb = new StringBuilder(); + char c; + String s; + if(split.length>i) { + s=split[i]; + for(int j=0;j<s.length();++j) { + if(Character.isDigit(c=s.charAt(j))) { + sb.append(c); + } else { + break; + } + } + } + + if(sb.length()==0 && deploy.length>i) { + s=deploy[i]; + for(int j=0;j<s.length();++j) { + if(Character.isDigit(c=s.charAt(j))) { + sb.append(c); + } else { + break; + } + } + } + + return sb.length()==0?0:Integer.parseInt(sb.toString()); + } + + private StringBuilder print(StringBuilder sb, List<MgmtEndpoint> lme) { int cnt = 0; for(MgmtEndpoint m : lme) { print(sb,cnt++,m); @@ -155,9 +188,9 @@ public class RegistrationCreator { out.append('.'); out.append(mep.getMinor()); out.append('.'); - out.append(mep.getPkg()); - out.append('.'); out.append(mep.getPatch()); + out.append('.'); + out.append(mep.getPkg()); out.append("\n\tPort: "); out.append(mep.getPort()); out.append("\n\tProtocol: "); @@ -201,8 +234,8 @@ public class RegistrationCreator { out.setLongitude(mep.getLongitude()); out.setMajor(mep.getMajor()); out.setMinor(mep.getMinor()); - out.setPkg(mep.getPkg()); out.setPatch(mep.getPatch()); + out.setPkg(mep.getPkg()); out.setPort(mep.getPort()); out.setProtocol(mep.getProtocol()); out.getSpecialPorts().addAll(mep.getSpecialPorts()); |