2 * ============LICENSE_START====================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
22 package org.onap.aaf.auth.request.test;
24 import static junit.framework.Assert.assertEquals;
26 import java.util.GregorianCalendar;
28 import org.onap.aaf.misc.env.util.Chrono;
31 import aaf.v2_0.RolePermRequest;
33 public class RolePermCompare extends RosettaCompare<RolePermRequest> {
34 public RolePermCompare() {
35 super(RolePermRequest.class);
38 public static RolePermRequest create() {
39 RolePermRequest urr = new RolePermRequest();
40 String in = instance();
41 urr.setRole("org.osaaf.ns.role"+in);
42 Pkey pkey = new Pkey();
43 pkey.setType("org.osaaf.ns.myType"+in);
44 pkey.setInstance("myInstance"+in);
45 pkey.setAction("myAction"+in);
47 GregorianCalendar gc = new GregorianCalendar();
48 urr.setStart(Chrono.timeStamp(gc));
49 gc.add(GregorianCalendar.MONTH, 1);
50 urr.setEnd(Chrono.timeStamp(gc));
55 public void compare(RolePermRequest t1, RolePermRequest t2) {
56 assertEquals(t1.getRole(),t2.getRole());
57 assertEquals(t1.getPerm().getType(),t1.getPerm().getType());
58 assertEquals(t1.getPerm().getInstance(),t1.getPerm().getInstance());
59 assertEquals(t1.getPerm().getAction(),t1.getPerm().getAction());
60 assertEquals(t1.getStart(),t2.getStart());
61 assertEquals(t1.getEnd(),t2.getEnd());
66 public RolePermRequest newOne() {