024a523752dea2e62c96751b086978306c671ab7
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / request / test / MultiCompare.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.assertEquals;
25
26 import java.util.GregorianCalendar;
27
28 import org.onap.aaf.misc.env.util.Chrono;
29
30 import aaf.v2_0.MultiRequest;
31
32 public class MultiCompare extends RosettaCompare<MultiRequest>  {
33     public MultiCompare() {
34         super(MultiRequest.class);
35     }
36     
37     @Override
38     public MultiRequest newOne() {
39         MultiRequest multi = new MultiRequest();
40         multi.setNsRequest(NSCompare.create());
41         multi.getNsAttribRequest().add(NSAttribCompare.create());
42         multi.getNsAttribRequest().add(NSAttribCompare.create());
43         multi.getRoleRequest().add(RoleCompare.create());
44         multi.getRoleRequest().add(RoleCompare.create());
45         multi.getPermRequest().add(PermCompare.create());
46         multi.getPermRequest().add(PermCompare.create());
47         multi.getCredRequest().add(CredCompare.create());
48         multi.getCredRequest().add(CredCompare.create());
49         multi.getUserRoleRequest().add(UserRoleCompare.create());
50         multi.getUserRoleRequest().add(UserRoleCompare.create());
51         multi.getRolePermRequest().add(RolePermCompare.create());
52         multi.getRolePermRequest().add(RolePermCompare.create());
53         
54         
55         GregorianCalendar gc = new GregorianCalendar();
56         multi.setStart(Chrono.timeStamp(gc));
57         gc.add(GregorianCalendar.MONTH, 1);
58         multi.setEnd(Chrono.timeStamp(gc));
59         return multi;
60     }
61     
62     public void compare(MultiRequest t1, MultiRequest t2) {
63         new NSCompare().compare(t1.getNsRequest(), t2.getNsRequest());
64         // Will have to find by key for others.
65         
66         assertEquals(t1.getStart(),t2.getStart());
67         assertEquals(t1.getEnd(),t2.getEnd());
68     }
69 }