X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fadsal%2Fnorthbound%2Fusermanager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsubnets%2Fnorthbound%2FUserManagerNorthboundTest.java;fp=opendaylight%2Fadsal%2Fnorthbound%2Fusermanager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsubnets%2Fnorthbound%2FUserManagerNorthboundTest.java;h=ac0307a7213312a794d3dbf4cc546eba6297f929;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hp=0000000000000000000000000000000000000000;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b;p=controller.git diff --git a/opendaylight/adsal/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java b/opendaylight/adsal/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java new file mode 100644 index 0000000000..ac0307a721 --- /dev/null +++ b/opendaylight/adsal/northbound/usermanager/src/test/java/org/opendaylight/controller/subnets/northbound/UserManagerNorthboundTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014 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.subnets.northbound; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.opendaylight.controller.sal.authorization.AuthResultEnum; +import org.opendaylight.controller.usermanager.AuthResponse; +import org.opendaylight.controller.usermanager.UserConfig; + +public class UserManagerNorthboundTest { + + @Test + public void testUserConfigs() { + List roles = new ArrayList(); + roles.add("Network-Admin"); + + UserConfig userConfig = new UserConfig("test","testPass",roles); + + Assert.assertNotNull(userConfig); + Assert.assertNotNull(userConfig.getUser()); + Assert.assertNotNull(userConfig.getPassword()); + Assert.assertTrue(userConfig.getRoles().equals(roles)); + + + AuthResponse authResponse = userConfig.authenticate("testPass"); + Assert.assertNotNull(authResponse); + + Assert.assertEquals(AuthResultEnum.AUTH_ACCEPT_LOC,authResponse.getStatus()); + } + +}