Merge "BUG-2329 Add test for anyxmls inside rpc resonse for netcfon-connector"
[controller.git] / opendaylight / northbound / usermanager / src / test / java / org / opendaylight / controller / subnets / northbound / UserManagerNorthboundTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.subnets.northbound;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
16 import org.opendaylight.controller.usermanager.AuthResponse;
17 import org.opendaylight.controller.usermanager.UserConfig;
18
19 public class UserManagerNorthboundTest {
20
21     @Test
22     public void testUserConfigs() {
23        List<String> roles = new ArrayList<String>();
24        roles.add("Network-Admin");
25
26        UserConfig userConfig = new UserConfig("test","testPass",roles);
27
28         Assert.assertNotNull(userConfig);
29         Assert.assertNotNull(userConfig.getUser());
30         Assert.assertNotNull(userConfig.getPassword());
31         Assert.assertTrue(userConfig.getRoles().equals(roles));
32
33
34         AuthResponse authResponse = userConfig.authenticate("testPass");
35         Assert.assertNotNull(authResponse);
36
37         Assert.assertEquals(AuthResultEnum.AUTH_ACCEPT_LOC,authResponse.getStatus());
38     }
39
40 }