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;
25 import static junit.framework.Assert.assertTrue;
27 import java.util.GregorianCalendar;
29 import org.onap.aaf.misc.env.util.Chrono;
31 import aaf.v2_0.NsRequest;
33 public class NSCompare extends RosettaCompare<NsRequest> {
35 super(NsRequest.class);
38 public static NsRequest create() {
39 NsRequest nsr = new NsRequest();
40 String in = instance();
41 nsr.setName("org.osaaf.ns"+in);
42 nsr.setDescription("Hello World"+in);
43 nsr.getAdmin().add("Fred"+in);
44 nsr.getAdmin().add("Barney"+in);
45 nsr.getResponsible().add("Wilma"+in);
46 nsr.getResponsible().add("Betty"+in);
47 nsr.setType("Hello"+in);
48 GregorianCalendar gc = new GregorianCalendar();
49 nsr.setStart(Chrono.timeStamp(gc));
50 gc.add(GregorianCalendar.MONTH, 1);
51 nsr.setEnd(Chrono.timeStamp(gc));
56 public void compare(NsRequest t1, NsRequest t2) {
57 assertEquals(t1.getName(),t2.getName());
58 assertEquals(t1.getDescription(),t2.getDescription());
59 for(String s : t1.getAdmin()) {
60 assertTrue(t2.getAdmin().contains(s));
62 for(String s : t2.getAdmin()) {
63 assertTrue(t1.getAdmin().contains(s));
65 assertEquals(t1.getType(),t2.getType());
66 assertEquals(t1.getStart(),t2.getStart());
67 assertEquals(t1.getEnd(),t2.getEnd());
72 public NsRequest newOne() {