blob: d0f2aa6363499ca4a20389f8be8b53051e284b5f [file] [log] [blame]
Chanhee Lee94010482017-01-23 23:06:18 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Chanhee Lee94010482017-01-23 23:06:18 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.security;
18
19import static org.junit.Assert.assertFalse;
20import static org.junit.Assert.assertNotNull;
21import static org.junit.Assert.assertNull;
22
23import org.junit.Before;
24import org.junit.Test;
25import org.onosproject.core.DefaultApplicationId;
26
27/**
28 * Test of SecurityUtil.
29 */
30public class SecurityUtilTest {
31
32 private static SecurityAdminServiceAdapter service = new SecurityAdminServiceAdapter();
33 private DefaultApplicationId appId;
34
35 @Before
36 public void setUp() throws Exception {
37 appId = new DefaultApplicationId(1, "test");
38 }
39
40 @Test
41 public void testIsSecurityModeEnabled() {
42 assertNull(System.getSecurityManager());
43 assertNotNull(service);
44 }
45
46 @Test
47 public void testGetSecurityService() {
48 assertNull(System.getSecurityManager());
49 assertNotNull(service);
50 }
51
52 @Test
53 public void testIsAppSecured() {
54 assertFalse(service.isSecured(appId));
55 }
56
57 @Test
58 public void testRegister() {
59 service.register(appId);
60 }
61
62}