87a86d7cc3738affb1af289a8b980498c84f1388
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / request / test / CredCompare.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6  * ===========================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21
22 package org.onap.aaf.auth.request.test;
23
24 import static junit.framework.Assert.*;
25
26 import java.util.GregorianCalendar;
27
28 import org.onap.aaf.misc.env.util.Chrono;
29
30 import aaf.v2_0.CredRequest;
31
32 public class CredCompare extends RosettaCompare<CredRequest>  {
33     public CredCompare() {
34         super(CredRequest.class);
35     }
36     
37     public static CredRequest create() {
38         CredRequest rr = new CredRequest();
39         String in = instance();
40         rr.setId("m888"+ in + "@ns.att.com");
41         rr.setPassword("Bogus0"+in);
42         rr.setType(200);
43         GregorianCalendar gc = new GregorianCalendar();
44         rr.setStart(Chrono.timeStamp(gc));
45         gc.add(GregorianCalendar.MONTH, 1);
46         rr.setEnd(Chrono.timeStamp(gc));
47         return rr;
48     }
49     
50     @Override
51     public void compare(CredRequest t1, CredRequest t2) {
52         assertEquals(t1.getId(),t2.getId());
53         assertEquals(t1.getPassword(),t2.getPassword());
54         assertEquals(t1.getType(),t2.getType());
55         assertEquals(t1.getStart(),t2.getStart());
56         assertEquals(t1.getEnd(),t2.getEnd());
57     }
58
59
60     @Override
61     public CredRequest newOne() {
62         return create();
63     }
64 }