Sonar Fixes, Formatting
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / request / test / PermCompare.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.PermRequest;
31
32 public class PermCompare extends RosettaCompare<PermRequest>  {
33     public PermCompare() {
34         super(PermRequest.class);
35     }
36
37     public static PermRequest create() {
38         PermRequest pr = new PermRequest();
39         String in = instance();
40         pr.setType("org.osaaf.ns.perm"+in);
41         pr.setInstance("instance"+in);
42         pr.setAction("read");
43         pr.setDescription("Hello World, Perm"+in);
44         GregorianCalendar gc = new GregorianCalendar();
45         pr.setStart(Chrono.timeStamp(gc));
46         gc.add(GregorianCalendar.MONTH, 1);
47         pr.setEnd(Chrono.timeStamp(gc));
48         return pr;
49     }
50
51     @Override
52     public void compare(PermRequest t1, PermRequest t2) {
53         assertEquals(t1.getType(),t2.getType());
54         assertEquals(t1.getInstance(),t2.getInstance());
55         assertEquals(t1.getAction(),t2.getAction());
56         assertEquals(t1.getDescription(),t2.getDescription());
57         assertEquals(t1.getStart(),t2.getStart());
58         assertEquals(t1.getEnd(),t2.getEnd());
59     }
60
61
62     @Override
63     public PermRequest newOne() {
64         return create();
65     }
66 }