[AAF-21] Initial code import
[aaf/authz.git] / authz-certman / src / test / java / com / att / authz / cm / data / JU_CertReq.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aai\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * Copyright © 2017 Amdocs\r
7  * * ===========================================================================\r
8  * * Licensed under the Apache License, Version 2.0 (the "License");\r
9  * * you may not use this file except in compliance with the License.\r
10  * * You may obtain a copy of the License at\r
11  * * \r
12  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
13  * * \r
14  *  * Unless required by applicable law or agreed to in writing, software\r
15  * * distributed under the License is distributed on an "AS IS" BASIS,\r
16  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * * See the License for the specific language governing permissions and\r
18  * * limitations under the License.\r
19  * * ============LICENSE_END====================================================\r
20  * *\r
21  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
22  * *\r
23  ******************************************************************************/\r
24 package com.att.authz.cm.data;\r
25 \r
26 import static org.junit.Assert.*;\r
27 import static org.mockito.Mockito.mock;\r
28 import static org.mockito.Mockito.when;\r
29 \r
30 import java.io.IOException;\r
31 import java.security.cert.X509Certificate;\r
32 import java.util.ArrayList;\r
33 import java.util.List;\r
34 \r
35 import org.junit.BeforeClass;\r
36 import org.junit.Test;\r
37 import org.junit.runner.RunWith;\r
38 import org.mockito.Mock;\r
39 import org.mockito.Mockito;\r
40 import org.mockito.runners.MockitoJUnitRunner;\r
41 \r
42 import com.att.authz.cm.ca.CA;\r
43 import com.att.authz.cm.cert.BCFactory;\r
44 import com.att.authz.cm.cert.CSRMeta;\r
45 import com.att.authz.cm.cert.StandardFields;\r
46 import com.att.cadi.cm.CertException;\r
47 import com.att.inno.env.Trans;\r
48 \r
49 @RunWith(MockitoJUnitRunner.class)\r
50 public class JU_CertReq {\r
51         \r
52         private static BCFactory bcFact;\r
53         \r
54         private static CSRMeta value;\r
55         \r
56         private static CertReq req;\r
57         \r
58         @BeforeClass\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
63                 \r
64         }\r
65         \r
66         @Test\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
78                         \r
79                         @Override\r
80                         public X509Certificate sign(Trans trans, CSRMeta csrmeta) throws IOException, CertException {\r
81         \r
82                                 return null;\r
83                         }\r
84                 };\r
85                 req.sponsor = "asa@df.co";\r
86                 assertNull(req.getCSRMeta());\r
87         }\r
88 }\r