Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,37 @@ Faça um ***Fork*** deste repositório e abra um ***Pull Request***, **com seu n

-----

### Diferenciais
### Propósito

- Criar um frontend para realizar a busca com uma UX elaborada
- Criar uma solução de autenticação entre o frontend e o backend
- Ter um desempenho elevado num conjunto de dados muito grande
- Utilizar o Docker
Manter o fork com a implementação da customização da imagem do wildfly (com admin definido) com datasource configurado para o postgresql.

### Como efetuar o teste

- 1
- Criar a imagem do postgres colocando os arquivos: users.csv (baixado pelo link), modelo.sql e Dockerfile (no diretório postgres do projeto) em um diretório específico da máquina host.
- Entrar no diretório criado e executar o comando: "docker build -t postgres-picpay-user:1.0 .".
- O docker criará a imagem postgres-picpay-user com a tag 1.0 a partir da imagem oficial do postgres.
- A imagem será preparada para criar um schema chamado "picpay" na criação do contêiner e também serão criadas as tabelas, assim como, ocorrerá a importação do arquivo csv.
- Para criar o contêiner execute o comando: "docker run --name dbtest -e POSTGRES_PASSWORD=picpay -d -p 5432:5432 postgres-picpay-user:1.0"
- Atenção: este processo será bem demorado visto que o container estará importando o arquivo csv. Pode ser verificado o andando rodando o comando "docker exec [containerID] ps aux|grep postgre". A saída do comando ps mostrará o processo responsável pela cópia dos dados. Continue verificando a saída do comando até que o processo não apareça mais, indicando seu término de execução.

- 2
- Criei uma imagem no docker hub para o Application Server com a aplicação implantada e tudo configurado. Basta seguir os passos a seguir para montar o ambiente para o teste.

## Baixar a imagem do Wildfly

- sudo docker pull rodrigopim/wildfly-admin-jdbc-postgresql

## Criação do contêiner

- sudo docker run -p 8080:8080 -p 9990:9990 -it --name appServer rodrigopim/wildfly-admin-jdbc-postgresql

## Configurações adicionais (comunicação entre os contêineres)

- sudo docker network create --driver=bridge wildfly-network-postgresql
- sudo docker network connect wildfly-network-postgresql dbtest
- sudo docker network connect wildfly-network-postgresql appServer

## Agora basta acessar o navegador indicando o caminho:

http://localhost:8080/ApiRestTestPicPay-1.0-SNAPSHOT/ e seguir a orientação de uso.
20 changes: 20 additions & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>WildFly</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
</properties>
</project-shared-configuration>
97 changes: 97 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>br.com.apiresttestpicpay</groupId>
<artifactId>ApiRestTestPicPay</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>ApiRestTestPicPay</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-api</artifactId>
<version>2.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.2.6.Final</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM postgres
COPY users.csv /tmp/
COPY modelo.sql /docker-entrypoint-initdb.d/
Loading