X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fauthorization%2FAuthorizationTest.java;fp=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fauthorization%2FAuthorizationTest.java;h=0000000000000000000000000000000000000000;hp=869d7ff5203d53043d548e79dd04dca0110c1ef4;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java deleted file mode 100644 index 869d7ff520..0000000000 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/authorization/AuthorizationTest.java +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.sal.authorization; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.junit.Assert; -import org.junit.Test; - -import org.opendaylight.controller.sal.core.Node; -import org.opendaylight.controller.sal.utils.NodeCreator; - - public class AuthorizationTest { - - @Test - public void testResources () { - Privilege p = Privilege.WRITE; - ResourceGroup resourceGroup = new ResourceGroup("NodeGroup", p); - Map> resourceMap = new HashMap>(); - ArrayList resourceList = new ArrayList(); - - for (int i = 0; i < 5; i++) { - Node node = NodeCreator.createOFNode((long)i); - Resource resource = new Resource (node, p); - resourceList.add(resource); - } - - resourceMap.put(resourceGroup, resourceList); - - ArrayList retrievedResourceList = resourceMap.get(resourceGroup); - for (Entry> entry : resourceMap.entrySet()) { - ResourceGroup rGroup = entry.getKey(); - Assert.assertTrue(rGroup.getGroupName().equals(resourceGroup.getGroupName())); - for (int i = 0; i < 5; i++) { - Resource resource = retrievedResourceList.get(i); - Assert.assertTrue(resource.getPrivilege().equals(Privilege.WRITE)); - Assert.assertTrue(((Long)((Node)resource.getResource()).getID()).equals((long)i)); - } - } - } - - @Test - public void testAppRoleLevel() { - AppRoleLevel appRoleLevel = AppRoleLevel.APPOPERATOR; - Assert.assertTrue(appRoleLevel.toString().equals("App-Operator")); - Assert.assertTrue(appRoleLevel.toNumber() == 2); - Assert.assertTrue(appRoleLevel.toStringPretty().equals("Application Operator")); - } - - @Test - public void testUserLevel() { - UserLevel userLevel = UserLevel.SYSTEMADMIN; - Assert.assertTrue(userLevel.toString().equals("System-Admin")); - Assert.assertTrue(userLevel.toNumber() == 0); - Assert.assertTrue(userLevel.toStringPretty().equals("System Administrator")); - } - - @Test - public void testAppRoleLevelFromString() { - Assert.assertTrue(AppRoleLevel.fromString("App-Admin") == AppRoleLevel.APPADMIN); - Assert.assertTrue(AppRoleLevel.fromString("App-User") == AppRoleLevel.APPUSER); - Assert.assertTrue(AppRoleLevel.fromString("App-Operator") == AppRoleLevel.APPOPERATOR); - Assert.assertTrue(AppRoleLevel.fromString(" ") == null); - Assert.assertTrue(AppRoleLevel.fromString("") == null); - Assert.assertTrue(AppRoleLevel.fromString("App-Admini") == null); - } -}