changed to unmaintained
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / test / JU_Access.java
1 /*******************************************************************************
2  * ============LICENSE_START====================================================
3  * * org.onap.aaf
4  * * ===========================================================================
5  * * Copyright © 2017 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
23 package org.onap.aaf.cadi.test;
24
25 import static org.junit.Assert.*;
26 import static org.hamcrest.CoreMatchers.*;
27 import org.junit.*;
28
29 import java.io.IOException;
30
31 import org.onap.aaf.cadi.Access;
32 import org.onap.aaf.cadi.Access.Level;
33
34 public class JU_Access {
35
36     @Test
37     public void levelTests() {
38         assertTrue(Level.DEBUG.inMask(0x1));
39         for (int i = 2; i > 0; i <<= 1) {
40             assertFalse(Level.DEBUG.inMask(i));
41         }
42         assertFalse(Level.DEBUG.inMask(0x80000000));
43
44         assertThat(Level.DEBUG.addToMask(0x2), is(0x3));
45         assertThat(Level.DEBUG.delFromMask(0x1), is(0x0));
46         assertThat(Level.DEBUG.toggle(0x2), is(0x3));
47         assertThat(Level.DEBUG.toggle(0x1), is(0x0));
48         assertThat(Level.DEBUG.maskOf(), is(123153));
49         assertThat(Level.NONE.maskOf(), is(0));
50     }
51
52     @Test
53     public void nullTests() throws IOException {
54         // These are entirely for coverage
55         Access.NULL.log(Level.DEBUG);
56         Access.NULL.printf(Level.DEBUG, "");
57         Access.NULL.log(new Exception());
58         Access.NULL.classLoader();
59         assertThat(Access.NULL.getProperty("", ""), is(nullValue()));
60         Access.NULL.load(System.in);
61         Access.NULL.setLogLevel(Level.DEBUG);
62         assertThat(Access.NULL.decrypt("test", true), is("test"));
63         assertFalse(Access.NULL.willLog(Level.DEBUG));
64         assertThat(Access.NULL.getProperties(), is(not(nullValue())));
65     }
66
67 }