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====================================================
21 package org.onap.aaf.auth.batch.helpers.test;
23 import static org.junit.Assert.*;
25 import java.util.Date;
26 import java.util.GregorianCalendar;
29 import org.junit.Test;
30 import org.onap.aaf.auth.batch.helpers.ExpireRange;
31 import org.onap.aaf.cadi.PropAccess;
33 public class JU_ExpireRange {
36 ExpireRange expRange = new ExpireRange(new PropAccess());
37 Date now = expRange.now();
39 Set<String> names=expRange.names();
40 assertTrue(names.contains("OneMonth"));
41 assertTrue(names.contains("OneWeek"));
42 assertTrue(names.contains("Delete"));
43 assertFalse(names.contains(null));
44 assertFalse(names.contains("bogus"));
47 GregorianCalendar gc = new GregorianCalendar();
48 String[] all = new String[] {"ur","cred"};
52 gc.add(GregorianCalendar.WEEK_OF_MONTH,-3);
53 for(String rs : all) {
54 r = expRange.getRange(rs, gc.getTime());
56 assertEquals("Delete",r.name());
61 gc.add(GregorianCalendar.WEEK_OF_MONTH,-1);
62 for(String rs : all) {
63 r = expRange.getRange(rs, gc.getTime());
68 r = expRange.getRange("cred", now);