diff options
24 files changed, 347 insertions, 38 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java index ae46253c..536515bc 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java @@ -135,7 +135,7 @@ public class UserRole implements Cloneable, CacheChange.Data { ); } - private static void load(Trans trans, Session session, Creator<UserRole> creator, String where, Visitor<UserRole> visitor) { + public static void load(Trans trans, Session session, Creator<UserRole> creator, String where, Visitor<UserRole> visitor) { String query = creator.query(where); trans.debug().log( "query: " + query ); TimeTaken tt = trans.start("Read UserRoles", Env.REMOTE); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java index 78c6ae3a..5cab5297 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java @@ -69,7 +69,7 @@ import org.onap.aaf.misc.env.util.Chrono; public class Analyze extends Batch { - private static final int unknown=0; + private static final int unknown=0; private static final int owner=1; private static final int supervisor=2; private static final int total=0; @@ -82,6 +82,7 @@ public class Analyze extends Batch { private static final String EXPIRED_OWNERS = "ExpiredOwners"; private static final String CSV = ".csv"; private static final String INFO = "info"; + private static final String NOT_COMPLIANT = "NotCompliant"; private int minOwners; private Map<String, CSV.Writer> writerList; private ExpireRange expireRange; @@ -89,6 +90,7 @@ public class Analyze extends Batch { private CSV.Writer deleteCW; private CSV.Writer needApproveCW; private CSV.Writer extendCW; + private CSV.Writer notCompliantCW; private Range futureRange; private final String sdate; private LastNotified ln; @@ -146,6 +148,12 @@ public class Analyze extends Batch { extendCW.row(INFO,EXTEND,sdate,1); writerList.put(EXTEND,extendCW); + // Setup NotCompliant Writer for Apps + file = new File(logDir(),NOT_COMPLIANT + sdate + CSV); + CSV ncCSV = new CSV(env.access(),file); + notCompliantCW = ncCSV.writer(); + writerList.put(NOT_COMPLIANT, notCompliantCW); + // Load full data of the following ln = new LastNotified(session); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/MassMail.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/MassMail.java new file mode 100644 index 00000000..272a41ba --- /dev/null +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/MassMail.java @@ -0,0 +1,301 @@ +/** + * ============LICENSE_START==================================================== + * org.onap.aaf + * =========================================================================== + * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * =========================================================================== + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END==================================================== + * + */ + +package org.onap.aaf.auth.batch.reports; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.onap.aaf.auth.batch.Batch; +import org.onap.aaf.auth.batch.helpers.NS; +import org.onap.aaf.auth.batch.helpers.UserRole; +import org.onap.aaf.auth.env.AuthzTrans; +import org.onap.aaf.auth.org.Organization; +import org.onap.aaf.auth.org.Organization.Identity; +import org.onap.aaf.auth.org.OrganizationException; +import org.onap.aaf.cadi.util.CSV; +import org.onap.aaf.misc.env.APIException; +import org.onap.aaf.misc.env.Env; +import org.onap.aaf.misc.env.TimeTaken; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.SimpleStatement; +import com.datastax.driver.core.Statement; + +public class MassMail extends Batch { + + private Map<String, CSV.Writer> writerList; + private final String from; + private String subject = "AAF Information"; + private boolean bOwners = true; + private boolean bAdmins = false; + private boolean bAppIDOnly = false; + private int escalate = 0; + private final File subdir; + private final String head; + private final String content; + private final String tail; + + public MassMail(AuthzTrans trans) throws APIException, IOException, OrganizationException { + super(trans.env()); + from = trans.getProperty("MAIL_FROM"); + if (from == null) { + throw new APIException("No MAIL_FROM property set"); + } + String subdirName = null; + // Flags + for (String arg : args()) { + switch (arg) { + case "-owners": + bOwners = true; + break; + case "-admins": + bAdmins = true; + break; + case "-appid_only": + bAppIDOnly = true; + break; + default: + if (arg.length() > 10 && arg.startsWith("-escalate=")) { + escalate = Integer.parseInt(arg.substring(10)); + } else if (subdirName == null) { + subdirName = arg; + } + } + } + + subdir = new File(logDir(), subdirName == null ? "mailing" : subdirName); + if (subdir.exists()) { + if (!subdir.isDirectory()) { + throw new APIException(subdirName + " is not a directory"); + } + } else { + subdir.mkdirs(); + } + + subject = readIn(subdir, "subject"); + head = readIn(subdir, "html.head"); + content = readIn(subdir,"html.content"); + tail = readIn(subdir,"html.tail"); + + trans.info().log("Starting Connection Process"); + TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB); + try { + TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE); + try { + session = cluster.connect(); + } finally { + tt.done(); + } + + // Create Intermediate Output + writerList = new HashMap<>(); + + NS.load(trans, session, NS.v2_0_11); + UserRole.load(trans, session, UserRole.v2_0_11); +// now = new Date(); +// String sdate = Chrono.dateOnlyStamp(now); + } finally { + tt0.done(); + } + } + + private String readIn(File subdir, String name) throws IOException { + File file = new File(subdir, name); + byte[] bytes = new byte[(int) file.length()]; + FileInputStream fis = new FileInputStream(file); + try { + fis.read(bytes); + return new String(bytes); + } finally { + fis.close(); + } + } + + @Override + protected void run(AuthzTrans trans) { +// try { + trans.info().log("Create a Mass Mailing"); + + final AuthzTrans transNoAvg = trans.env().newTransNoAvg(); + final Organization org = trans.org(); + if (org != null) { + StringBuilder to = new StringBuilder(); + StringBuilder cc = new StringBuilder(); + StringBuilder greet = new StringBuilder(); + for (NS ns : NS.data.values()) { + if (bAppIDOnly) { + ResultSet results; + Statement stmt = new SimpleStatement( + String.format("SELECT count(*) FROM authz.cred WHERE ns='%s';", ns.ndd.name)); + results = session.execute(stmt); + long count = results.one().getLong(0); + if (count <= 0) { + continue; + } + } + + to.setLength(0); + cc.setLength(0); + greet.setLength(0); + if (bOwners) { + StringBuilder o = to; + List<UserRole> owners = UserRole.getByRole().get(ns.ndd.name + ".owner"); + if (owners.isEmpty()) { + trans.error().log(ns.ndd.name, "has no owners!"); + } else { + for (UserRole owner : owners) { + try { + Identity identity = org.getIdentity(transNoAvg, owner.user()); + if (identity.isPerson()) { + if (o.length() > 0) { + o.append(','); + greet.append(','); + } + o.append(identity.email()); + greet.append(identity.firstName()); + for (int i = 0; i < escalate; ++i) { + identity = identity.responsibleTo(); + if (identity == null) { + break; + } + if (cc.length() > 0) { + cc.append(','); + } + cc.append(identity.email()); + } + } + } catch (OrganizationException e) { + trans.error().log(e, "Error Reading Organization"); + } + } + } + } + + if (bAdmins) { + StringBuilder a; + if (bOwners) { + a = cc; + } else { + a = to; + } + List<UserRole> admins = UserRole.getByRole().get(ns.ndd.name + ".admin"); + if (admins.isEmpty()) { + trans.warn().log(ns.ndd.name, "has no admins!"); + } else { + for (UserRole admin : admins) { + try { + Identity identity = org.getIdentity(transNoAvg, admin.user()); + if (identity.isPerson()) { + if (a.length() > 0) { + a.append(','); + } + a.append(identity.email()); + if (!bOwners) { + if (greet.length() > 0) { + greet.append(','); + } + greet.append(identity.firstName()); + } + } + } catch (OrganizationException e) { + trans.error().log(e, "Error Reading Organization"); + } + } + } + } + + try { + PrintStream ps = new PrintStream(new FileOutputStream( + subdir.getPath() + File.separatorChar + "email_" + ns.ndd.name + ".hdr")); + try { + ps.print("TO: "); + ps.println(to); + ps.print("CC: "); + ps.println(cc); + ps.print("FROM: "); + ps.println(from); + ps.print("SUBJECT: "); + ps.println(subject); + } finally { + ps.close(); + } + + ps = new PrintStream(new FileOutputStream( + subdir.getPath() + File.separatorChar + "email_" + ns.ndd.name + ".html")); + try { + ps.println(head.replaceAll("%FIRST_NAMES%", greet.toString())); + ps.println(content.replaceAll("%NS%", ns.ndd.name)); + ps.println(tail); + } finally { + ps.close(); + } + } catch (IOException e) { + trans.error().log(e); + } + + } +// UserRole.load(transNoAvg, session, UserRole.v2_0_11, ur -> { +// if("owner".equals(ur.rname())) { +// try { +// Identity identity = org.getIdentity(transNoAvg, ur.user()); +// if(identity.isPerson()) { +// System.out.println("Emailing " + identity.email()); +// } +// } catch (OrganizationException e) { +// trans.error().log(e, "Error Reading Organization"); +// } +// } +// Organization org = trans.org(); +// Identity identity = org.getIdentity(trans, ur.row); +// +// if(!check(transNoAvg, checked, ur.user())) { +// ur.row(whichWriter(transNoAvg,ur.user()),UserRole.UR); +// } +// } catch (OrganizationException e) { +// trans.error().log(e, "Error Decrypting X509"); +// } +// }); + } + +// } catch (OrganizationException e) { +// trans.info().log(e); + + } + + @Override + protected void _close(AuthzTrans trans) { + session.close(); + for (CSV.Writer cw : writerList.values()) { + cw.close(); + } + } + +} diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java index 981f300d..18c8ed6a 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java @@ -50,7 +50,7 @@ import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.PropAccess; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.TimeTaken; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java index c63a8a9f..12f0068b 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java @@ -46,7 +46,7 @@ import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.cadi.CadiException; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.cadi.util.CSV.Writer; import org.onap.aaf.misc.env.APIException; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java index 86381008..bb09c6c7 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java @@ -42,7 +42,7 @@ import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.cadi.CadiException; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.Env; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java index 7c516b10..e41b61cc 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java @@ -47,7 +47,7 @@ import org.onap.aaf.auth.dao.cass.UserRoleDAO; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.cadi.CadiException; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.Env; diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java index c19820d3..06db81c1 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java @@ -32,7 +32,7 @@ import org.onap.aaf.auth.gui.NamedCode; import org.onap.aaf.auth.gui.Page; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.client.Future; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.client.Rcli; import org.onap.aaf.cadi.client.Retryable; import org.onap.aaf.cadi.util.Vars; diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java index 221508e9..5b286fb8 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java @@ -47,7 +47,7 @@ import org.onap.aaf.auth.oauth.mapper.Mapper; import org.onap.aaf.auth.oauth.mapper.Mapper.API; import org.onap.aaf.auth.oauth.service.OAuthService; import org.onap.aaf.auth.oauth.service.OAuthService.GRANT_TYPE; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.oauth.OAuth2Principal; import org.onap.aaf.cadi.principal.OAuth2FormPrincipal; import org.onap.aaf.misc.env.APIException; diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java index 95f0217b..fb0eb865 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java @@ -27,7 +27,7 @@ import org.onap.aaf.auth.dao.cass.OAuthTokenDAO; import org.onap.aaf.auth.layer.Result; import org.onap.aaf.auth.oauth.service.OCreds; import org.onap.aaf.auth.oauth.service.OAuthService.GRANT_TYPE; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.oauth.OAuth2Principal; public interface Mapper<TOKEN_REQ,TOKEN,INTROSPECT,ERROR> extends MapperIntrospect<INTROSPECT> diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java index ddc306c4..154654c3 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java @@ -34,7 +34,7 @@ import org.onap.aaf.auth.oauth.service.OAuthService; import org.onap.aaf.auth.oauth.service.OCreds; import org.onap.aaf.auth.oauth.service.OAuthService.CLIENT_TYPE; import org.onap.aaf.auth.oauth.service.OAuthService.GRANT_TYPE; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.oauth.OAuth2Principal; import org.onap.aaf.cadi.util.Vars; import org.onap.aaf.misc.env.util.Split; diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java index a13959f1..b5d26060 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java @@ -43,7 +43,7 @@ import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.CredVal.Type; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.oauth.AAFToken; import org.onap.aaf.cadi.oauth.TokenClient; diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java index 8bee2a5b..777cfacf 100644 --- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java +++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java @@ -41,7 +41,7 @@ import org.onap.aaf.auth.layer.Result; import org.onap.aaf.auth.oauth.mapper.Mapper.API; import org.onap.aaf.auth.oauth.service.OAuthService.GRANT_TYPE; import org.onap.aaf.auth.oauth.service.OCreds; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.oauth.OAuth2Principal; import aaf.v2_0.Error; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java index caa1fcc1..8b91c74a 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java @@ -38,11 +38,11 @@ import org.onap.aaf.cadi.Permission; import org.onap.aaf.cadi.User; import org.onap.aaf.cadi.aaf.AAFPermission; import org.onap.aaf.cadi.client.Future; -import org.onap.aaf.cadi.client.Holder; import org.onap.aaf.cadi.client.Rcli; import org.onap.aaf.cadi.client.Retryable; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.lur.LocalPermission; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.Timing; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.util.Split; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java index 775e2246..155c6fa3 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java @@ -64,7 +64,7 @@ import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; import org.onap.aaf.cadi.Symm; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.misc.env.Env; import org.onap.aaf.misc.env.TimeTaken; import org.onap.aaf.misc.env.Trans; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java index ea539271..d2e01215 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java @@ -40,7 +40,7 @@ import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.Access.Level; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.client.Result; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.util.Chrono; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java index db9852ec..ca855258 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java @@ -43,7 +43,7 @@ import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.Symm; import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.Symm.Encryption; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.rosetta.env.RosettaDF; diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_Persist.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_Persist.java index 3e03eb73..1672ca19 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_Persist.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_Persist.java @@ -43,7 +43,7 @@ import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.PropAccess; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.client.Result; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.persist.Persist; diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_PersistFile.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_PersistFile.java index 25d8c474..797496a7 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_PersistFile.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/persist/test/JU_PersistFile.java @@ -43,7 +43,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.PropAccess; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.persist.PersistFile; import org.onap.aaf.misc.env.APIException; diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java index 7ad1921c..62b458ab 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java @@ -29,14 +29,13 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.xml.ws.Holder; - import org.onap.aaf.cadi.Access; import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.Symm; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.cadi.util.CSV.Visitor; +import org.onap.aaf.cadi.util.Holder; /** * This Filter is designed to help MIGRATE users from systems that don't match the FQI style. @@ -119,7 +118,7 @@ public class MapBathConverter { throw new CadiException("Invalid Authentication Credential for " + cred); } if(hpass!=null) { - hpass.value = cred.substring(colon+1); + hpass.set(cred.substring(colon+1)); } return cred.substring(0, colon); } else { @@ -144,7 +143,7 @@ public class MapBathConverter { Holder<String> hpass=null; try { if(bath.startsWith(BASIC)) { - cred = idFromBasic(bath,(hpass=new Holder<String>())); + cred = idFromBasic(bath,(hpass=new Holder<String>(null))); if(rv==null) { rv = map.get(cred); } @@ -161,7 +160,7 @@ public class MapBathConverter { } else { if(hpass!=null) { tcred = rv; - rv = BASIC + Symm.base64noSplit.encode(rv+':'+hpass.value); + rv = BASIC + Symm.base64noSplit.encode(rv+':'+hpass.get()); } } if(tcred != null) { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java index 0f69b5b0..439bca87 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java @@ -29,7 +29,8 @@ import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.xml.ws.Holder; + +import org.onap.aaf.cadi.util.Holder; /** * Add various Filters by CADI Property not in the official Chain @@ -53,20 +54,20 @@ public class SideChain { FilterChain truth = new FilterChain() { @Override public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { - hbool.value=Boolean.TRUE; + hbool.set(Boolean.TRUE); } public String toString() { - return hbool.value.toString(); + return hbool.get().toString(); } }; for(Filter f : sideChain) { - hbool.value=Boolean.FALSE; + hbool.set(Boolean.FALSE); f.doFilter(request, response, truth); - if(!hbool.value) { + if(!hbool.get()) { return; } } - if(hbool.value) { + if(hbool.get()) { chain.doFilter(request, response); } } diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Holder.java index 8744e896..3280e471 100644 --- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Holder.java @@ -19,7 +19,7 @@ * */ -package org.onap.aaf.cadi.client; +package org.onap.aaf.cadi.util; /** * Use to set Variables outside of Anonymous classes. diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java index 1681f435..fa62fe4e 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java @@ -27,8 +27,6 @@ import java.io.PrintStream; import java.util.ArrayList; import java.util.List; -import javax.xml.ws.Holder; - import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -40,6 +38,7 @@ import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.cadi.util.CSV.Visitor; import org.onap.aaf.cadi.util.CSV.Writer; +import org.onap.aaf.cadi.util.Holder; public class JU_CSV { @@ -110,7 +109,8 @@ public class JU_CSV { public void visit(List<String> row) { for(String s: row) { // System.out.println(hi.value + ") " + s); - Assert.assertEquals(expected.get(hi.value++),s); + Assert.assertEquals(expected.get(hi.get()),s); + hi.set(hi.get()+1); // increment } } }); diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Holder.java index d8c5a598..d1fa94b8 100644 --- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Holder.java @@ -20,13 +20,13 @@ * * ******************************************************************************/ -package org.onap.aaf.cadi.client.test; +package org.onap.aaf.cadi.util.test; -import static org.junit.Assert.*; -import static org.hamcrest.CoreMatchers.*; -import org.junit.Test; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; -import org.onap.aaf.cadi.client.Holder; +import org.junit.Test; +import org.onap.aaf.cadi.util.Holder; public class JU_Holder { |