Skip to content

Commit

Permalink
#ECOAPI-790 - Atualização do endpoint getUser do User
Browse files Browse the repository at this point in the history
  • Loading branch information
ssouza committed Aug 14, 2020
1 parent 95d0c4b commit b11dfbb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@
public class GetUserInput {

/**
* "Nome do usuário no formato nome@dominio_tenant"
* Nome do usuário no formato nome@dominio_tenant
*/
@NonNull
String username;

/**
* Email do usuário
*/
@NonNull
String email;

}
51 changes: 20 additions & 31 deletions src/main/java/br/com/senior/core/user/pojos/GetUserOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,83 +16,72 @@ public class GetUserOutput {
/**
* Identificador do usuário
*/
String id;

String id;
/**
* Nome do usuário
*/
String username;

String username;
/**
* Nome completo do usuário
*/
String fullName;

String fullName;
/**
* Descrição do usuário
*/
String description;

String description;
/**
* Endereço de e-mail do usuário
*/
String email;

String email;
/**
* localidade do usuário
*/
String locale;

String locale;
/**
* Domínio do tenant no login do usuário
*/
String tenantDomain;

String tenantDomain;
/**
* Nome do tenant do usuário
*/
String tenantName;

String tenantName;
/**
* Localidade do tenant do usuário
*/
String tenantLocale;

String tenantLocale;
/**
* Indica se o usuário está bloqueado
*/
Boolean blocked;

Boolean blocked;
/**
* Tipo de autenticação utilizada pelo tenant deste usuário
*/
AuthType authenticationType;

AuthType authenticationType;
/**
* Dados do usuário integrado pela G5, mas futuramente poderá ser utilizado para outras integrações se necessário
*/
Integration integration;
/**
* Indica se o usuário precisa trocar de senha no próximo logon
*/
Boolean changePassword;

Boolean changePassword;
/**
* Foto do usuário em Base64
*/
String photo;

String photo;
/**
* Lista com as propriedades que este usuário possui (opcional)
*/
List properties;

java.util.List<Property> properties;
/**
* Indica se o usuário é um admin de tenant
*/
Boolean admin;

Boolean admin;
/**
* Indica se o usuário pode alterar a sua senha.
* É possível alterar a senha quando o tipo de autenticação do tenant é G7 ou quando é G5 e o tenant está configurado para permitir alterar a senha pela G7.
*/
Boolean allowedToChangePassword;
Boolean allowedToChangePassword;

/**
* @param id - Identificador do usuário
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/br/com/senior/core/user/pojos/Integration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package br.com.senior.core.user.pojos;

import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class Integration {
/**
* Nome do usuário recebido via integração, caso não tenha um usuário informado na coluna 'integration_username' será retornado o usuário padrão
*/
String integrationName;
/**
* Código do usuário, aplicado para os usuários integrados através da G5
*/
String integrationCode;
}
45 changes: 20 additions & 25 deletions src/test/java/br/com/senior/core/user/UserIT.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
package br.com.senior.core.user;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import java.util.Arrays;
import java.util.List;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import br.com.senior.core.BaseIT;
import br.com.senior.core.base.ServiceException;
import br.com.senior.core.user.pojos.CreateGroupInput;
import br.com.senior.core.user.pojos.CreateGroupOutput;
import br.com.senior.core.user.pojos.CreateUserInput;
Expand All @@ -29,7 +20,15 @@
import br.com.senior.core.user.pojos.UpdateGroupUsersOutput;
import br.com.senior.core.user.pojos.UpdateUserInput;
import br.com.senior.core.user.pojos.UpdateUserOutput;
import br.com.senior.core.base.ServiceException;

import java.util.List;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

/**
* Exemplos de código do {@link br.com.senior.core.user.UserClient UserClient}
Expand All @@ -38,22 +37,26 @@ public class UserIT extends BaseIT {

private static final String USER_NAME = "teste";
private static final String USER_EMAIL = "teste@test.com.br";
private static final String GROUP_NAME = "GrupoParaTestes";
private static String USER_ID;

private static String GROUP_ID;
private static final String GROUP_NAME = "GrupoParaTestes";

private static String usernameExpected;
private static String token;
private static UserClient client;

@BeforeClass
public static void beforeClass() throws ServiceException {
usernameExpected = Arrays.stream(System.getenv("SENIOR_USERNAME").split("@")).findFirst().orElse(null);
token = login().getJsonToken().getAccess_token();
client = new UserClient(token);
}

private static void deleteGroup() throws ServiceException {
client.deleteGroup(GROUP_ID);
}

private static void deleteUser() throws ServiceException {
client.deleteUser(USER_ID);
}

@Test
public void testCreateAndGetGroup() throws ServiceException {
try {
Expand Down Expand Up @@ -204,14 +207,6 @@ public void testDeleteGroup() throws Exception {
}
}

private static void deleteGroup() throws ServiceException {
client.deleteGroup(GROUP_ID);
}

private static void deleteUser() throws ServiceException {
client.deleteUser(USER_ID);
}

private GetGroupOutput getGroup() throws ServiceException {
GetGroupInput input = new GetGroupInput(GROUP_ID);
return client.getGroup(input);
Expand Down Expand Up @@ -248,7 +243,7 @@ private ListGroupUsersOutput listGroupUsers() throws ServiceException {
}

private GetUserOutput getUser() throws ServiceException {
GetUserInput input = new GetUserInput(USER_NAME, USER_EMAIL);
GetUserInput input = new GetUserInput(USER_NAME);
return client.getUser(input);
}

Expand Down

0 comments on commit b11dfbb

Please sign in to comment.