2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.subnets.northbound;
10 import java.util.ArrayList;
11 import java.util.List;
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;
19 public class UserManagerNorthboundTest {
22 public void testUserConfigs() {
23 List<String> roles = new ArrayList<String>();
24 roles.add("Network-Admin");
26 UserConfig userConfig = new UserConfig("test","testPass",roles);
28 Assert.assertNotNull(userConfig);
29 Assert.assertNotNull(userConfig.getUser());
30 Assert.assertNotNull(userConfig.getPassword());
31 Assert.assertTrue(userConfig.getRoles().equals(roles));
34 AuthResponse authResponse = userConfig.authenticate("testPass");
35 Assert.assertNotNull(authResponse);
37 Assert.assertEquals(AuthResultEnum.AUTH_ACCEPT_LOC,authResponse.getStatus());