1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.authz.cm.data;
\r
25 import static org.junit.Assert.*;
\r
26 import static org.mockito.Mockito.mock;
\r
27 import static org.mockito.Mockito.when;
\r
29 import java.io.IOException;
\r
30 import java.security.cert.X509Certificate;
\r
31 import java.util.ArrayList;
\r
32 import java.util.List;
\r
34 import org.junit.BeforeClass;
\r
35 import org.junit.Test;
\r
36 import org.junit.runner.RunWith;
\r
37 import org.mockito.Mock;
\r
38 import org.mockito.Mockito;
\r
39 import org.mockito.runners.MockitoJUnitRunner;
\r
40 import org.onap.aaf.authz.cm.ca.CA;
\r
41 import org.onap.aaf.authz.cm.cert.BCFactory;
\r
42 import org.onap.aaf.authz.cm.cert.CSRMeta;
\r
43 import org.onap.aaf.authz.cm.cert.StandardFields;
\r
44 import org.onap.aaf.authz.cm.data.CertReq;
\r
46 import org.onap.aaf.cadi.cm.CertException;
\r
47 import org.onap.aaf.inno.env.Trans;
\r
49 @RunWith(MockitoJUnitRunner.class)
\r
50 public class JU_CertReq {
\r
52 private static BCFactory bcFact;
\r
54 private static CSRMeta value;
\r
56 private static CertReq req;
\r
59 public static void setUp() {
\r
60 bcFact = mock(BCFactory.class);
\r
61 value = mock(CSRMeta.class);
\r
62 req = mock(CertReq.class);
\r
67 public void getCSRMeta() throws CertException {
\r
68 //req = new CertReq();
\r
69 req.mechid = "1213";
\r
70 List<String> fqdnsas = new ArrayList<String>();
\r
71 fqdnsas.add("String1");
\r
72 List<String> emails = new ArrayList<String>();
\r
73 emails.add("pupleti@hotmail.com");
\r
74 req.emails = emails;
\r
75 req.fqdns = fqdnsas;
\r
76 StandardFields sf = mock(StandardFields.class);
\r
77 req.certAuthority = new CA("testName", sf, "ALL") {
\r
80 public X509Certificate sign(Trans trans, CSRMeta csrmeta) throws IOException, CertException {
\r
85 req.sponsor = "asa@df.co";
\r
86 assertNull(req.getCSRMeta());
\r