3 * * ============LICENSE_START=======================================================
5 * * ================================================================================
6 * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7 * * ================================================================================
8 * * Licensed under the Apache License, Version 2.0 (the "License");
9 * * you may not use this file except in compliance with the License.
10 * * You may obtain a copy of the License at
12 * * http://www.apache.org/licenses/LICENSE-2.0
14 * * Unless required by applicable law or agreed to in writing, software
15 * * distributed under the License is distributed on an "AS IS" BASIS,
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * * See the License for the specific language governing permissions and
18 * * limitations under the License.
19 * * ============LICENSE_END=========================================================
23 package org.onap.dcaegen2.platform.mod.objectmothers;
26 import org.onap.dcaegen2.platform.mod.models.ModUser;
27 import org.onap.dcaegen2.platform.mod.models.Role;
28 import org.onap.dcaegen2.platform.mod.models.UpdateUserRequest;
29 import org.onap.dcaegen2.platform.mod.security.services.UserDetailsImpl;
30 import org.springframework.security.core.authority.SimpleGrantedAuthority;
32 import java.util.ArrayList;
33 import java.util.HashSet;
34 import java.util.List;
40 * Mock for UserController Test Case
42 public class UserObjectMother {
44 public static final String userId = "admin";
46 public static List<ModUser> getUsers() {
47 List<ModUser> users = new ArrayList();
48 ModUser modUser1 = new ModUser();
49 modUser1.set_id("123");
50 modUser1.setFullName("Admin123");
51 modUser1.setPassword("Admin123");
52 Set<Role> roles = new HashSet<>();
53 Role role = new Role();
57 modUser1.setRoles(roles);
59 ModUser modUser2 = new ModUser();
60 modUser2.set_id("1234");
61 modUser2.setFullName("Admin1234");
62 modUser2.setPassword("Admin1234");
63 Set<Role> roles1 = new HashSet<>();
64 Role role1 = new Role();
65 role.setName("test1");
68 modUser2.setRoles(roles1);
76 public static ModUser getModUser() {
77 ModUser user = new ModUser();
78 user.setUsername("test");
79 user.setFullName("test");
80 user.setPassword("password");
81 Set<Role> roles = new HashSet<>();
82 Role role = new Role();
90 public static UpdateUserRequest getUpdateUserRequest(){
91 UpdateUserRequest user = new UpdateUserRequest();
92 user.setFullName("test");
93 user.setPassword("password");
94 Set<String> roles = new HashSet<>();
95 roles.add("ROLE_PST");