From 255628b20d825a6253a994e8da0ff5f2d748613b Mon Sep 17 00:00:00 2001 From: Sai Gandham Date: Mon, 14 Jan 2019 11:06:13 -0600 Subject: Add junits to auth certman Issue-ID: AAF-111 Change-Id: I6c5c973383ff53099dcd4a865366494034830cbd Signed-off-by: Sai Gandham --- .../src/main/java/org/onap/aaf/auth/cm/AAF_CM.java | 12 +++++- .../java/org/onap/aaf/auth/cm/LocalCAImpl.java | 48 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java (limited to 'auth/auth-certman/src/main') diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java index 689326e1..bfdb977d 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java @@ -80,7 +80,12 @@ public class AAF_CM extends AbsService { public final Cluster cluster; public final LocateDAO locateDAO; public static AuthzEnv envLog; + CMService service; + //Added for junits + public CMService getService() { + return null; + } /** * Construct AuthzAPI with all the Context Supporting Routes that Authz needs * @@ -117,7 +122,6 @@ public class AAF_CM extends AbsService { if (key.startsWith(CA.CM_CA_PREFIX)) { int idx = key.indexOf('.'); if (idx==key.lastIndexOf('.')) { // else it's a regular property - env.log(Level.INIT, "Loading Certificate Authority Module: " + key.substring(idx+1)); String[] segs = Split.split(',', env.getProperty(key)); if (segs.length>0) { @@ -145,7 +149,10 @@ public class AAF_CM extends AbsService { throw new APIException("No Certificate Authorities have been configured in CertMan"); } - CMService service = new CMService(trans, this); + service = getService(); + if(service == null) { + service = new CMService(trans, this); + } // note: Service knows how to shutdown Cluster on Shutdown, etc. See Constructor facade1_0 = FacadeFactory.v1_0(this,trans, service,Data.TYPE.JSON); // Default Facade facade1_0_XML = FacadeFactory.v1_0(this,trans,service,Data.TYPE.XML); @@ -172,6 +179,7 @@ public class AAF_CM extends AbsService { public CA getCA(String key) { return certAuths.get(key); } + /** * Setup XML and JSON implementations for each supported Version type diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java new file mode 100644 index 00000000..632e719e --- /dev/null +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java @@ -0,0 +1,48 @@ +/** + * ============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.cm; + +import java.io.IOException; + +import org.onap.aaf.auth.cm.ca.CA; +import org.onap.aaf.auth.cm.ca.X509andChain; +import org.onap.aaf.auth.cm.cert.CSRMeta; +import org.onap.aaf.cadi.Access; +import org.onap.aaf.cadi.configure.CertException; +import org.onap.aaf.misc.env.Trans; + +public class LocalCAImpl extends CA { + + protected LocalCAImpl(Access access, String caName, String env) throws IOException, CertException { + super(access, caName, env); + // TODO Auto-generated constructor stub + } + + public LocalCAImpl(Access access, final String name, final String env, final String[][] params) throws IOException, CertException { + super(access, name, env); + } + + @Override + public X509andChain sign(Trans trans, CSRMeta csrmeta) throws IOException, CertException { + // TODO Auto-generated method stub + return null; + } +} \ No newline at end of file -- cgit 1.2.3-korg