[GitHub] [tomee] Daniel-Dos commented on pull request #661: TOMEE-2836 Translate to Portuguese: examples/mp-metrics-histogram
Daniel-Dos commented on pull request #661: URL: https://github.com/apache/tomee/pull/661#issuecomment-640299966 thanks @daniel-augusto for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #641: TOMEE-2816 -Translate to Portuguese: examples/groovy-spock
Daniel-Dos commented on pull request #641: URL: https://github.com/apache/tomee/pull/641#issuecomment-640299642 thanks @cesarhernandezgt and @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #642: TOMEE-2817-Translate to Portuguese: examples/injection-of-ejbs
Daniel-Dos commented on pull request #642: URL: https://github.com/apache/tomee/pull/642#issuecomment-640299294 thanks @cesarhernandezgt and @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #643: TOMEE-2818-Translate to Portuguese: examples/injection-of-entitymanager
Daniel-Dos commented on pull request #643: URL: https://github.com/apache/tomee/pull/643#issuecomment-640299044 thanks @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #646: TOMEE-2821-Translate to Portuguese: examples/jaxrs-json-provider-jett…
Daniel-Dos commented on pull request #646: URL: https://github.com/apache/tomee/pull/646#issuecomment-640299009 thanks @cesarhernandezgt and @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #647: TOMEE-2822-Translate to Portuguese: examples/jsonb-configuration
Daniel-Dos commented on pull request #647: URL: https://github.com/apache/tomee/pull/647#issuecomment-640298792 thanks @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #648: TOMEE-2824-Translate to Portuguese: examples/jsonb-custom-serializer
Daniel-Dos commented on pull request #648: URL: https://github.com/apache/tomee/pull/648#issuecomment-640297633 thanks @hbelmiro for review. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #651: Translate to Portuguese: examples/MovieFun REST
Daniel-Dos commented on pull request #651: URL: https://github.com/apache/tomee/pull/651#issuecomment-640296005 thanks @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #651: Translate to Portuguese: examples/MovieFun REST
Daniel-Dos commented on a change in pull request #651: URL: https://github.com/apache/tomee/pull/651#discussion_r436412018 ## File path: examples/moviefun-rest/README_pt.adoc ## @@ -0,0 +1,410 @@ +:index-group: REST +:jbake-type: page +:jbake-status: status=published += MovieFun REST + +Este exemplo mostra o CRUD de um aplicativo engraçado para filmes. +O web client é construído usando o backbone e o back-end é construído com +JAX-RS, JPA para a persistência em um banco de dados H2. + +== O código + +=== ApplicationConfig + +Aqui, use anotações JAX-RS para criar recursos. +@ApplicationPath identifica o caminho do aplicativo que serve como o URI base para todos os recursos. +A implementação do método getClasses será chamada pela estrutura JAX-RS para obter informações sobre este aplicativo. No exemplo a seguir, ele define dois recursos: LoadRest e MoviesRest. + + +package org.superbiz.moviefun.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +@ApplicationPath("/rest") +public class ApplicationConfig extends Application { + +@Override +@SuppressWarnings("unchecked") +public Set> getClasses() { +return new HashSet>(Arrays.asList(LoadRest.class, MoviesRest.class)); +} +} + + +=== LoadRest + +É um POJO que é mapeado para um URL raiz (`load`) com o anotação @Path e possui métodos Java para servir solicitações a este URL raiz e seus sub-URLs. Nesse caso, só tenha uma solicitação POST onde use um EJB (MoviesBean) injetado na sua classe para fazer um carregamento inicial de dados no banco de dados. + + +package org.superbiz.moviefun.rest; + +import org.superbiz.moviefun.Movie; +import org.superbiz.moviefun.MoviesBean; + +import javax.ejb.EJB; +import javax.ws.rs.POST; +import javax.ws.rs.Path; + +@Path("load") +public class LoadRest { +@EJB +private MoviesBean moviesBean; + +@POST +public void load() { +moviesBean.addMovie(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005)); +moviesBean.addMovie(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004)); +moviesBean.addMovie(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003)); +moviesBean.addMovie(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002)); +moviesBean.addMovie(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001)); +moviesBean.addMovie(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001)); +moviesBean.addMovie(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000)); +} + +} + + +=== MovieRest + +É um POJO que é mapeado para um URL raiz (`filmes`) com o anotação @Path e possui métodos Java para veicular solicitações de filmes de entidades no formato JSON de acordo com a anotação @Produces. Aqui tem um método para cada método HTTP (GET, POST, PUT, DELETE). + + +package org.superbiz.moviefun.rest; + +import org.superbiz.moviefun.Movie; +import org.superbiz.moviefun.MoviesBean; + +import javax.ejb.EJB; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import java.util.List; + +@Path("movies") +@Produces({"application/json"}) +public class MoviesRest { + +@EJB +private MoviesBean service; + +@GET +@Path("{id}") +public Movie find(@PathParam("id") Long id) { +return service.find(id); +} + +@GET +public List getMovies(@QueryParam("first") Integer first, @QueryParam("max") Integer max, + @QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { +return service.getMovies(first, max, field, searchTerm); +} + +@POST +@Consumes("application/json") +public Movie addMovie(Movie movie) { +service.addMovie(movie); +return movie; +} + +@PUT +@Path("{id}") +@Consumes("application/json") +public Movie editMovie(Movie movie) { +service.editMovie(movie); +return movie; +} + +@DELETE +@Path("{id}") +public void deleteMovie(@PathParam("id") long id) { +service.deleteMovie(id); +} + +@GET +@Path("count") +@Produces(MediaType.TEXT_PLAIN) +public int count(@QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { +return service.count(field, searchTerm); +} + +} + + +=== Movie + +Essa é a entidade Movie que será persistida pela JPA. + + +package org.superbiz.moviefun; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #651: Translate to Portuguese: examples/MovieFun REST
Daniel-Dos commented on a change in pull request #651: URL: https://github.com/apache/tomee/pull/651#discussion_r436411999 ## File path: examples/moviefun-rest/README_pt.adoc ## @@ -0,0 +1,410 @@ +:index-group: REST +:jbake-type: page +:jbake-status: status=published += MovieFun REST + +Este exemplo mostra o CRUD de um aplicativo engraçado para filmes. +O web client é construído usando o backbone e o back-end é construído com +JAX-RS, JPA para a persistência em um banco de dados H2. + +== O código + +=== ApplicationConfig + +Aqui, use anotações JAX-RS para criar recursos. +@ApplicationPath identifica o caminho do aplicativo que serve como o URI base para todos os recursos. +A implementação do método getClasses será chamada pela estrutura JAX-RS para obter informações sobre este aplicativo. No exemplo a seguir, ele define dois recursos: LoadRest e MoviesRest. + + +package org.superbiz.moviefun.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +@ApplicationPath("/rest") +public class ApplicationConfig extends Application { + +@Override +@SuppressWarnings("unchecked") +public Set> getClasses() { +return new HashSet>(Arrays.asList(LoadRest.class, MoviesRest.class)); +} +} + + +=== LoadRest + +É um POJO que é mapeado para um URL raiz (`load`) com o anotação @Path e possui métodos Java para servir solicitações a este URL raiz e seus sub-URLs. Nesse caso, só tenha uma solicitação POST onde use um EJB (MoviesBean) injetado na sua classe para fazer um carregamento inicial de dados no banco de dados. Review comment: done thanks This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #652: Translate to Portuguese: examples/mp-config-source-database
Daniel-Dos commented on pull request #652: URL: https://github.com/apache/tomee/pull/652#issuecomment-640294876 thanks @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #652: Translate to Portuguese: examples/mp-config-source-database
Daniel-Dos commented on a change in pull request #652: URL: https://github.com/apache/tomee/pull/652#discussion_r436411386 ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + Review comment: done thanks ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um `ConfigSource` para a configuração personalizada de MicroProfile. +O ConfigSource personalizado le os valores de configuração de uma base de dados. Review comment: done thanks ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um `ConfigSource` para a configuração personalizada de MicroProfile. +O ConfigSource personalizado le os valores de configuração de uma base de dados. + +[discrete] + ConfigSource Feature + +Para proporcionar um ConfigSource personalizado de uma base de dados, devemos começar com uma classe que implemente la interface `ConfigSource`, sobreescrevendo 3 métodos: `getProperties`, `getValue`, e `getName`. + +[source,java] + +public class DatabaseConfigSource implements ConfigSource { +private DataSource dataSource; + +public DatabaseConfigSource() { +try { +dataSource = (DataSource) new InitialContext().lookup("openejb:Resource/config-source-database"); +} catch (final NamingException e) { +throw new IllegalStateException(e); +} +} + +@Override +public Map getProperties() { +final Map properties = new HashMap<>(); + +try { +final Connection connection = dataSource.getConnection(); +final PreparedStatement query = connection.prepareStatement("SELECT NAME, VALUE FROM CONFIGURATIONS"); +final ResultSet names = query.executeQuery(); + +while (names.next()) { +properties.put(names.getString(0), names.getString(1)); +} + +DbUtils.closeQuietly(names); +DbUtils.closeQuietly(query); +DbUtils.closeQuietly(connection); +} catch (final SQLException e) { +e.printStackTrace(); +} + +return properties; +} + +@Override +public String getValue(final String propertyName) { +try { +final Connection connection = dataSource.getConnection(); +final PreparedStatement query = +connection.prepareStatement("SELECT VALUE FROM CONFIGURATIONS WHERE NAME = ?"); +query.setString(1, propertyName); +final ResultSet value = query.executeQuery(); + +if (value.next()) { +return value.getString(1); +} + +DbUtils.closeQuietly(value); +DbUtils.closeQuietly(query); +DbUtils.closeQuietly(connection); +} catch (final SQLException e) { +e.printStackTrace(); +} + +return null; +} + +@Override +public String getName() { +return DatabaseConfigSource.class.getSimpleName(); +} +} + +Para simplificar, no exemplo anterior, a definição da base de dados e os dados que se utilizaram para a configuração correspondem a um `Resource`, declarado em um arquivo de configuração `tomee.xml` como `Resource` do tipo: `DataSource` da seguinte maneira: Review comment: done thanks ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um
[GitHub] [tomee] Daniel-Dos commented on pull request #653: Translate to Portuguese: examples/mp-jsonb-configuration
Daniel-Dos commented on pull request #653: URL: https://github.com/apache/tomee/pull/653#issuecomment-640293664 thanks @hbelmiro for review. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #653: Translate to Portuguese: examples/mp-jsonb-configuration
Daniel-Dos commented on a change in pull request #653: URL: https://github.com/apache/tomee/pull/653#discussion_r436410603 ## File path: examples/mp-jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,308 @@ +:index-group: Unrevised +:jbake-type: page +:jbake-status: status=published += Configurando JSON-B + +Este exemplo mostra como personalizar jsonb para uma aplicação JAX-RS. +JSONB é o novo padrão `javaee-api: 8.0` para serialização/desserialização de json. +Poucas anotações são necessárias e o `JsonbConfig` oferece muitas configurações. + +== Executando e testando o Endpoint + +A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponivel,pode invocar o seguinte endpoint: Review comment: done thanks ## File path: examples/mp-jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,308 @@ +:index-group: Unrevised +:jbake-type: page +:jbake-status: status=published += Configurando JSON-B + +Este exemplo mostra como personalizar jsonb para uma aplicação JAX-RS. +JSONB é o novo padrão `javaee-api: 8.0` para serialização/desserialização de json. +Poucas anotações são necessárias e o `JsonbConfig` oferece muitas configurações. + +== Executando e testando o Endpoint + +A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponivel,pode invocar o seguinte endpoint: + +[source,bash] + +$ curl -X GET http://localhost:8080/mp-jsonb-configuration/api/users + + +que deve responder com o seguinte json: + +[source,bash] + +[ + { +"Id":1, +"Name":"user 1", +"Registration":"2018 - 12 - 28" + }, + { +"Id":2, +"Name":"user 2", +"Registration":"2018 - 12 - 28" + } +] + + +== @ApplicationPath + +A classe de ponto de partida JAX-RS + +A classe de ponto de entrada JAXRS, da seguinte forma, os jaxrs carregarão todas as classes e métodos anotados com `@Path` sem especificá-los. + +[source,java] + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("api") +public class JAXRSApplication extends Application { + +} + + +== @Path Recurso Rest + +Classe jaxrs simples com um método GET + +[source,java] + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.superbiz.model.User; + +@Path("users") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Stateless +public class UserService { + +@GET +public List users() { +List users = new ArrayList<>(); +User user1 = new User(1, "user 1"); +User user2 = new User(2, "user 2"); +users.add(user1); +users.add(user2); + +return users; +} +} + + +== Configurando JSONB + +A implementação de `ContextResolver<>` pode personalizar os padrões de jaxrs; neste exemplo, vamos personalizar a serialização/desserialização JSONB + +[source,java] + +import javax.json.bind.Jsonb; +import javax.json.bind.JsonbBuilder; +import javax.json.bind.JsonbConfig; +import javax.json.bind.config.PropertyNamingStrategy; +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +@Provider +public class JSONBConfiguration implements ContextResolver { + +private Jsonb jsonb; + +public JSONBConfiguration() { +// jsonbConfig offers a lot of configurations. +JsonbConfig config = new JsonbConfig().withFormatting(true) + .withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE) +.withDateFormat(" - MM - dd", Locale.ENGLISH); + +jsonb = JsonbBuilder.create(config); +} + +@Override +public Jsonb getContext(Class type) { +return jsonb; +} + +} + + +`JsonbConfig` oferece muitas configurações. + +== Acessando o Recurso Rest + +O teste ativa um aplicativo da web openejb e chama o restante do recurso `/users` + +[source,java] + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.jee.WebApp; +import org.apache.openejb.junit.ApplicationComposer; +import org.apache.openejb.testing.Classes; +import org.apache.openejb.testing.EnableServices; +import org.apache.openejb.testing.Module; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.superbiz.JAXRSApplication; +import org.superbiz.JSONBConfiguration; + +@EnableServices(value = "jaxrs") +@RunWith(ApplicationComposer.class) +public class UserServiceTest { + +@Module +@Classes({ UserService.class, JAXRSApplication.class, JSONBConfiguration.class }) +public WebApp app() { +return new WebApp().contextRoot("test"); +} + +@Test +public void get() throws IOException { +
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #654: Translate to Portuguese: examples/mp-jwt-bean-validation
Daniel-Dos commented on a change in pull request #654: URL: https://github.com/apache/tomee/pull/654#discussion_r436409774 ## File path: examples/mp-jwt-bean-validation/README_pt.adoc ## @@ -0,0 +1,48 @@ +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + += MicroProfile JWT com validação de bean + +TomEE tem uma caracteristica particular que permite o uso de Validação de Bean como alternativa ao complemento da anotação `@RolesAllowed`. + +A motivação para esta função é que `JsonWebToken` é efetivamente um bean, e uma verificação de seguraça é, em última instancia, um ato de produzir um resultado booleano utilizando uma entrada minima. È um problema perfeito para a validação de Bean. + +A caracteristica em última instancia lhe permite implementar um método como este: Review comment: done thanks This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on pull request #654: Translate to Portuguese: examples/mp-jwt-bean-validation
Daniel-Dos commented on pull request #654: URL: https://github.com/apache/tomee/pull/654#issuecomment-640292305 thanks @hbelmiro for review . This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] Daniel-Dos commented on a change in pull request #654: Translate to Portuguese: examples/mp-jwt-bean-validation
Daniel-Dos commented on a change in pull request #654: URL: https://github.com/apache/tomee/pull/654#discussion_r436409767 ## File path: examples/mp-jwt-bean-validation/README_pt.adoc ## @@ -0,0 +1,48 @@ +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + += MicroProfile JWT com validação de bean + +TomEE tem uma caracteristica particular que permite o uso de Validação de Bean como alternativa ao complemento da anotação `@RolesAllowed`. + +A motivação para esta função é que `JsonWebToken` é efetivamente um bean, e uma verificação de seguraça é, em última instancia, um ato de produzir um resultado booleano utilizando uma entrada minima. È um problema perfeito para a validação de Bean. Review comment: done thanks This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] hbelmiro commented on a change in pull request #654: Translate to Portuguese: examples/mp-jwt-bean-validation
hbelmiro commented on a change in pull request #654: URL: https://github.com/apache/tomee/pull/654#discussion_r436401902 ## File path: examples/mp-jwt-bean-validation/README_pt.adoc ## @@ -0,0 +1,48 @@ +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + += MicroProfile JWT com validação de bean + +TomEE tem uma caracteristica particular que permite o uso de Validação de Bean como alternativa ao complemento da anotação `@RolesAllowed`. + +A motivação para esta função é que `JsonWebToken` é efetivamente um bean, e uma verificação de seguraça é, em última instancia, um ato de produzir um resultado booleano utilizando uma entrada minima. È um problema perfeito para a validação de Bean. Review comment: ```suggestion A motivação para esta função é que `JsonWebToken` é efetivamente um bean, e uma verificação de seguraça é, em última instância, um ato de produzir um resultado booleano utilizando uma entrada mínima. É um problema perfeito para a validação de Bean. ``` ## File path: examples/mp-jwt-bean-validation/README_pt.adoc ## @@ -0,0 +1,48 @@ +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + += MicroProfile JWT com validação de bean + +TomEE tem uma caracteristica particular que permite o uso de Validação de Bean como alternativa ao complemento da anotação `@RolesAllowed`. + +A motivação para esta função é que `JsonWebToken` é efetivamente um bean, e uma verificação de seguraça é, em última instancia, um ato de produzir um resultado booleano utilizando uma entrada minima. È um problema perfeito para a validação de Bean. + +A caracteristica em última instancia lhe permite implementar um método como este: Review comment: ```suggestion A funcionalidade lhe permite implementar um método como este: ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] hbelmiro commented on a change in pull request #653: Translate to Portuguese: examples/mp-jsonb-configuration
hbelmiro commented on a change in pull request #653: URL: https://github.com/apache/tomee/pull/653#discussion_r436400800 ## File path: examples/mp-jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,308 @@ +:index-group: Unrevised +:jbake-type: page +:jbake-status: status=published += Configurando JSON-B + +Este exemplo mostra como personalizar jsonb para uma aplicação JAX-RS. +JSONB é o novo padrão `javaee-api: 8.0` para serialização/desserialização de json. +Poucas anotações são necessárias e o `JsonbConfig` oferece muitas configurações. + +== Executando e testando o Endpoint + +A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponivel,pode invocar o seguinte endpoint: Review comment: ```suggestion A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponível, pode invocar o seguinte endpoint: ``` ## File path: examples/mp-jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,308 @@ +:index-group: Unrevised +:jbake-type: page +:jbake-status: status=published += Configurando JSON-B + +Este exemplo mostra como personalizar jsonb para uma aplicação JAX-RS. +JSONB é o novo padrão `javaee-api: 8.0` para serialização/desserialização de json. +Poucas anotações são necessárias e o `JsonbConfig` oferece muitas configurações. + +== Executando e testando o Endpoint + +A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponivel,pode invocar o seguinte endpoint: + +[source,bash] + +$ curl -X GET http://localhost:8080/mp-jsonb-configuration/api/users + + +que deve responder com o seguinte json: + +[source,bash] + +[ + { +"Id":1, +"Name":"user 1", +"Registration":"2018 - 12 - 28" + }, + { +"Id":2, +"Name":"user 2", +"Registration":"2018 - 12 - 28" + } +] + + +== @ApplicationPath + +A classe de ponto de partida JAX-RS + +A classe de ponto de entrada JAXRS, da seguinte forma, os jaxrs carregarão todas as classes e métodos anotados com `@Path` sem especificá-los. + +[source,java] + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("api") +public class JAXRSApplication extends Application { + +} + + +== @Path Recurso Rest + +Classe jaxrs simples com um método GET + +[source,java] + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.superbiz.model.User; + +@Path("users") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Stateless +public class UserService { + +@GET +public List users() { +List users = new ArrayList<>(); +User user1 = new User(1, "user 1"); +User user2 = new User(2, "user 2"); +users.add(user1); +users.add(user2); + +return users; +} +} + + +== Configurando JSONB + +A implementação de `ContextResolver<>` pode personalizar os padrões de jaxrs; neste exemplo, vamos personalizar a serialização/desserialização JSONB + +[source,java] + +import javax.json.bind.Jsonb; +import javax.json.bind.JsonbBuilder; +import javax.json.bind.JsonbConfig; +import javax.json.bind.config.PropertyNamingStrategy; +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +@Provider +public class JSONBConfiguration implements ContextResolver { + +private Jsonb jsonb; + +public JSONBConfiguration() { +// jsonbConfig offers a lot of configurations. +JsonbConfig config = new JsonbConfig().withFormatting(true) + .withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE) +.withDateFormat(" - MM - dd", Locale.ENGLISH); + +jsonb = JsonbBuilder.create(config); +} + +@Override +public Jsonb getContext(Class type) { +return jsonb; +} + +} + + +`JsonbConfig` oferece muitas configurações. + +== Acessando o Recurso Rest + +O teste ativa um aplicativo da web openejb e chama o restante do recurso `/users` Review comment: ```suggestion O teste ativa um aplicativo da web openejb e invoca o endpoint `/users` ``` ## File path: examples/mp-jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,308 @@ +:index-group: Unrevised +:jbake-type: page +:jbake-status: status=published += Configurando JSON-B + +Este exemplo mostra como personalizar jsonb para uma aplicação JAX-RS. +JSONB é o novo padrão `javaee-api: 8.0` para serialização/desserialização de json. +Poucas anotações são necessárias e o `JsonbConfig` oferece muitas configurações. + +== Executando e testando o Endpoint + +A aplicação pode ser executada com `mvn clean install tomee: run` e se a porta 8080 estiver disponivel,pode invocar o seguinte endpoint: + +[source,bash] + +$
[GitHub] [tomee] hbelmiro commented on a change in pull request #652: Translate to Portuguese: examples/mp-config-source-database
hbelmiro commented on a change in pull request #652: URL: https://github.com/apache/tomee/pull/652#discussion_r436400386 ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um `ConfigSource` para a configuração personalizada de MicroProfile. +O ConfigSource personalizado le os valores de configuração de uma base de dados. + +[discrete] + ConfigSource Feature + +Para proporcionar um ConfigSource personalizado de uma base de dados, devemos começar com uma classe que implemente la interface `ConfigSource`, sobreescrevendo 3 métodos: `getProperties`, `getValue`, e `getName`. Review comment: ```suggestion Para proporcionar um ConfigSource personalizado de uma base de dados, devemos começar com uma classe que implemente a interface `ConfigSource`, sobrescrevendo 3 métodos: `getProperties`, `getValue`, e `getName`. ``` ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + Review comment: Remove those lines ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um `ConfigSource` para a configuração personalizada de MicroProfile. +O ConfigSource personalizado le os valores de configuração de uma base de dados. Review comment: ```suggestion O ConfigSource personalizado lê os valores de configuração de uma base de dados. ``` ## File path: examples/mp-config-source-database/README_pt.adoc ## @@ -0,0 +1,327 @@ += Banco de dados ConfigSource da configuração do MicroProfile +:index-group: MicroProfile +:jbake-type: page +:jbake-status: published + +Este es un ejemplo sobre cómo implementar un ConfigSource para la configuración personalizada de MicroProfile. El ConfigSource personalizado lee los valores +de configuración de una base de datos. + +Este é um exemplo sobre como implementar um `ConfigSource` para a configuração personalizada de MicroProfile. +O ConfigSource personalizado le os valores de configuração de uma base de dados. + +[discrete] + ConfigSource Feature + +Para proporcionar um ConfigSource personalizado de uma base de dados, devemos começar com uma classe que implemente la interface `ConfigSource`, sobreescrevendo 3 métodos: `getProperties`, `getValue`, e `getName`. + +[source,java] + +public class DatabaseConfigSource implements ConfigSource { +private DataSource dataSource; + +public DatabaseConfigSource() { +try { +dataSource = (DataSource) new InitialContext().lookup("openejb:Resource/config-source-database"); +} catch (final NamingException e) { +throw new IllegalStateException(e); +} +} + +@Override +public Map getProperties() { +final Map properties = new HashMap<>(); + +try { +final Connection connection = dataSource.getConnection(); +final PreparedStatement query = connection.prepareStatement("SELECT NAME, VALUE FROM CONFIGURATIONS"); +final ResultSet names = query.executeQuery(); + +while (names.next()) { +properties.put(names.getString(0), names.getString(1)); +} + +DbUtils.closeQuietly(names); +DbUtils.closeQuietly(query); +DbUtils.closeQuietly(connection); +} catch (final SQLException e) { +e.printStackTrace(); +} + +return properties; +} + +@Override +public String getValue(final String propertyName) { +try { +final Connection connection = dataSource.getConnection(); +final PreparedStatement query = +connection.prepareStatement("SELECT VALUE FROM CONFIGURATIONS WHERE NAME = ?"); +query.setString(1, propertyName); +final ResultSet value = query.executeQuery(); + +
[GitHub] [tomee] hbelmiro commented on a change in pull request #651: Translate to Portuguese: examples/MovieFun REST
hbelmiro commented on a change in pull request #651: URL: https://github.com/apache/tomee/pull/651#discussion_r436399956 ## File path: examples/moviefun-rest/README_pt.adoc ## @@ -0,0 +1,410 @@ +:index-group: REST +:jbake-type: page +:jbake-status: status=published += MovieFun REST + +Este exemplo mostra o CRUD de um aplicativo engraçado para filmes. +O web client é construído usando o backbone e o back-end é construído com +JAX-RS, JPA para a persistência em um banco de dados H2. + +== O código + +=== ApplicationConfig + +Aqui, use anotações JAX-RS para criar recursos. +@ApplicationPath identifica o caminho do aplicativo que serve como o URI base para todos os recursos. +A implementação do método getClasses será chamada pela estrutura JAX-RS para obter informações sobre este aplicativo. No exemplo a seguir, ele define dois recursos: LoadRest e MoviesRest. + + +package org.superbiz.moviefun.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +@ApplicationPath("/rest") +public class ApplicationConfig extends Application { + +@Override +@SuppressWarnings("unchecked") +public Set> getClasses() { +return new HashSet>(Arrays.asList(LoadRest.class, MoviesRest.class)); +} +} + + +=== LoadRest + +É um POJO que é mapeado para um URL raiz (`load`) com o anotação @Path e possui métodos Java para servir solicitações a este URL raiz e seus sub-URLs. Nesse caso, só tenha uma solicitação POST onde use um EJB (MoviesBean) injetado na sua classe para fazer um carregamento inicial de dados no banco de dados. + + +package org.superbiz.moviefun.rest; + +import org.superbiz.moviefun.Movie; +import org.superbiz.moviefun.MoviesBean; + +import javax.ejb.EJB; +import javax.ws.rs.POST; +import javax.ws.rs.Path; + +@Path("load") +public class LoadRest { +@EJB +private MoviesBean moviesBean; + +@POST +public void load() { +moviesBean.addMovie(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005)); +moviesBean.addMovie(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004)); +moviesBean.addMovie(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003)); +moviesBean.addMovie(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002)); +moviesBean.addMovie(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001)); +moviesBean.addMovie(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001)); +moviesBean.addMovie(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000)); +} + +} + + +=== MovieRest + +É um POJO que é mapeado para um URL raiz (`filmes`) com o anotação @Path e possui métodos Java para veicular solicitações de filmes de entidades no formato JSON de acordo com a anotação @Produces. Aqui tem um método para cada método HTTP (GET, POST, PUT, DELETE). + + +package org.superbiz.moviefun.rest; + +import org.superbiz.moviefun.Movie; +import org.superbiz.moviefun.MoviesBean; + +import javax.ejb.EJB; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import java.util.List; + +@Path("movies") +@Produces({"application/json"}) +public class MoviesRest { + +@EJB +private MoviesBean service; + +@GET +@Path("{id}") +public Movie find(@PathParam("id") Long id) { +return service.find(id); +} + +@GET +public List getMovies(@QueryParam("first") Integer first, @QueryParam("max") Integer max, + @QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { +return service.getMovies(first, max, field, searchTerm); +} + +@POST +@Consumes("application/json") +public Movie addMovie(Movie movie) { +service.addMovie(movie); +return movie; +} + +@PUT +@Path("{id}") +@Consumes("application/json") +public Movie editMovie(Movie movie) { +service.editMovie(movie); +return movie; +} + +@DELETE +@Path("{id}") +public void deleteMovie(@PathParam("id") long id) { +service.deleteMovie(id); +} + +@GET +@Path("count") +@Produces(MediaType.TEXT_PLAIN) +public int count(@QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { +return service.count(field, searchTerm); +} + +} + + +=== Movie + +Essa é a entidade Movie que será persistida pela JPA. + + +package org.superbiz.moviefun; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import
[GitHub] [tomee] hbelmiro commented on a change in pull request #647: TOMEE-2822-Translate to Portuguese: examples/jsonb-configuration
hbelmiro commented on a change in pull request #647: URL: https://github.com/apache/tomee/pull/647#discussion_r436398060 ## File path: examples/jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,281 @@ +:index-group: JSON-B +:jbake-type: page +:jbake-status: status=published += Configuração JSON-B + +Este exemplo mostra como customizar jsonb para uma aplicaçao JAX-RS. +JSONB é o novo padrão javaee-api: 8.0 para json serialização/desserialização. +São necessárias poucas anotações e o JsonbConfig oferece muitas configurações. + +== Executando e testando o Endpoint + +o aplicativo pode ser executado com `mvn clean install tomee:run' se porta Review comment: ```suggestion o aplicativo pode ser executado com `mvn clean install tomee:run' se a porta ``` ## File path: examples/jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,281 @@ +:index-group: JSON-B +:jbake-type: page +:jbake-status: status=published += Configuração JSON-B + +Este exemplo mostra como customizar jsonb para uma aplicaçao JAX-RS. +JSONB é o novo padrão javaee-api: 8.0 para json serialização/desserialização. +São necessárias poucas anotações e o JsonbConfig oferece muitas configurações. + +== Executando e testando o Endpoint + +o aplicativo pode ser executado com `mvn clean install tomee:run' se porta +8080 está disponível, você pode chamar o seguinte terminal:(GET) +http://localhost:8080/jsonb-configuration/api/users que deve responder com o seguinte json: [ \{ ``Id'':1, ``Name'':``user 1'', +``Registration'':``2018 - 12 - 28'' }, \{ ``Id'':2, ``Name'':``user 2'', +``Registration'':``2018 - 12 - 28'' }] + +== @ApplicationPath + +Classe de ponto de entrada JAXRS, da seguinte maneira jaxrs carregará todas as classes e métodos @Path anotados sem especificá-los. + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("api") +public class JAXRSApplication extends Application { + +} + + +== Recurso @Path Rest + +Classe jaxrs simples com um endpoint GET + + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.superbiz.model.User; + +@Path("users") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Stateless +public class UserService { + +@GET +public List users() { +List users = new ArrayList<>(); +User user1 = new User(1, "user 1"); +User user2 = new User(2, "user 2"); +users.add(user1); +users.add(user2); + +return users; +} +} + + +== Configuração JSONB + +Implementando ContextResolver<>, você pode personalizar os padrões jaxrs; neste exemplo, vamos personalizar a serialização/desserialização JSONB + + +import javax.json.bind.Jsonb; +import javax.json.bind.JsonbBuilder; +import javax.json.bind.JsonbConfig; +import javax.json.bind.config.PropertyNamingStrategy; +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +@Provider +public class JSONBConfiguration implements ContextResolver { + +private Jsonb jsonb; + +public JSONBConfiguration() { +// jsonbConfig oferece muitas configurações. +JsonbConfig config = new JsonbConfig().withFormatting(true) + .withPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE) +.withDateFormat(" - MM - dd", Locale.ENGLISH); + +jsonb = JsonbBuilder.create(config); +} + +@Override +public Jsonb getContext(Class type) { +return jsonb; +} + +} + + +== Acessando o endpoint rest + +O teste gera um aplicativo da web openejb e chama o terminal do usuário Review comment: ```suggestion O teste gera uma aplicação web openejb e chama o endpoint do usuário ``` ## File path: examples/jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,281 @@ +:index-group: JSON-B +:jbake-type: page +:jbake-status: status=published += Configuração JSON-B + +Este exemplo mostra como customizar jsonb para uma aplicaçao JAX-RS. +JSONB é o novo padrão javaee-api: 8.0 para json serialização/desserialização. +São necessárias poucas anotações e o JsonbConfig oferece muitas configurações. + +== Executando e testando o Endpoint + +o aplicativo pode ser executado com `mvn clean install tomee:run' se porta Review comment: ```suggestion o aplicativo pode ser executado com `mvn clean install tomee:run' se a porta ``` ## File path: examples/jsonb-configuration/README_pt.adoc ## @@ -0,0 +1,281 @@ +:index-group: JSON-B +:jbake-type: page +:jbake-status: status=published += Configuração JSON-B + +Este exemplo mostra como customizar jsonb para uma aplicaçao JAX-RS. +JSONB é o novo padrão javaee-api: 8.0 para json serialização/desserialização. +São necessárias poucas anotações e o JsonbConfig
[GitHub] [tomee] hbelmiro commented on a change in pull request #646: TOMEE-2821-Translate to Portuguese: examples/jaxrs-json-provider-jett…
hbelmiro commented on a change in pull request #646: URL: https://github.com/apache/tomee/pull/646#discussion_r436397853 ## File path: examples/jaxrs-json-provider-jettison/README_pt.adoc ## @@ -0,0 +1,146 @@ += Provedor JAX-RS JSON com Jettison +:index-group: REST +:jbake-type: page +:jbake-status: status=published + +Este é um exemplo de como configurar no TomEE 7.x ou posterior o provedor JSON herdado, Jettison, usado pelo TomEE 1.7.x. + +Este cenário é util quando aplicações REST são migrado de TomEE 1.7.x para TomEE 7.x ou posterior e você quer manter a saída JSON herdada do Jettison 1.3.7. Review comment: ```suggestion Este cenário é util quando aplicações REST são migradas de TomEE 1.7.x para TomEE 7.x ou posterior e você quer manter a saída JSON herdada do Jettison 1.3.7. ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] hbelmiro commented on a change in pull request #642: TOMEE-2817-Translate to Portuguese: examples/injection-of-ejbs
hbelmiro commented on a change in pull request #642: URL: https://github.com/apache/tomee/pull/642#discussion_r436397075 ## File path: examples/injection-of-ejbs/README_pt.adoc ## @@ -0,0 +1,206 @@ +:index-group: Referencing EJBs +:jbake-type: page +:jbake-status: status=published += Injeção de Ejbs + +Este exemplo mostra como usar a anotação `@EJB` em uma classe bean referir a outros beans. Review comment: ```suggestion Este exemplo mostra como usar a anotação `@EJB` em uma classe bean para referenciar outros beans. ``` ## File path: examples/injection-of-ejbs/README_pt.adoc ## @@ -0,0 +1,206 @@ +:index-group: Referencing EJBs +:jbake-type: page +:jbake-status: status=published += Injeção de Ejbs + +Este exemplo mostra como usar a anotação `@EJB` em uma classe bean referir a outros beans. + +Essa funcionalidade é geralmente chamada de injeção de dependência (consulte +http://www.martinfowler.com/articles/injection.html) e foi +recentemente introduzido no Java EE 5. + +Neste exemplo particula, nós vamos criar dois bean de sessão sem estado Review comment: ```suggestion Neste exemplo em particular, nós vamos criar dois bean de sessão sem estado ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [tomee] hbelmiro commented on a change in pull request #641: TOMEE-2816 -Translate to Portuguese: examples/groovy-spock
hbelmiro commented on a change in pull request #641: URL: https://github.com/apache/tomee/pull/641#discussion_r436396758 ## File path: examples/groovy-spock/README_pt.adoc ## @@ -0,0 +1,87 @@ +:index-group: Misc +:jbake-type: page +:jbake-status: status=published += Projeto Groovy com Spock Framework + +Este é um guia de como implementar http://spockframework.org[Spock Framework] para testes. + +== Hello + +[source,groovy] + +include::src/main/groovy/org/superbiz/groovy/Hello.groovy[] + + +== HelloSpecification + +Esta classe extende de `*_spock.lang.Specification_*` para registrar a especificaçao de testes. Review comment: ```suggestion Esta classe estende de `*_spock.lang.Specification_*` para registrar a especificação de testes. ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: Help wanted (Re: Javax to Jakarta Bytecode transformation progress)
On my side of the fence it's pretty clear we will end up with some edge cases that won't be handled by the Eclipse Transformer; we will definitely end up with some transformations that are pretty specific to a line or two of code in a specific class. We'll likely need to handle those by doing another pass with a more specialized transformer. I'll see what I can do about creating a tool that can catch those edgecases and fix them. -- David Blevins http://twitter.com/dblevins http://www.tomitribe.com > On Jun 7, 2020, at 12:24 PM, David Blevins wrote: > > Hey Daniel! > > We'd need to search in the source code for this related project. Using > OpenWebBeans as an example it, the report shows four uses of "javax." that > need some investigation. One of them is: > > - methodVisitor.visitLdcInsn("javax."); > org/apache/webbeans/proxy/AbstractProxyFactory:335 > > The above output basically means somewhere in OpenWebBeans source there's a > class called "org.apache.webbeans.proxy.AbstractProxyFactory" In that class > there's some logic that uses "javax." in a string. > > Investigating that basically entails: > > - Find in github were OpenWebBeans source lives > - Find the git tag associated with the version we're using > - Find the file AbstractProxyFactory.java file > - Find the line that has "javax." as a string > - Update the ticket with a link to that line (all the line numbers down the > left in github's source view are links) > > And then separately, try and see if you can figure out what that code is > doing and if it's something that might be affected by the javax-to-jakarta > rename. > > For example if the string is being used in an `if` block that has some logic > like "if the class starts with javax., we need to treat it separately", then > possibly the code would need to be adjusted to, "if the class starts with > javax. or jakarta., we need to treat it separately." > > Now there's no part of the task that involves updating the code. Those of us > who are familiar with ASM and bytecode manipulation could handle that. But > if we divide and conquer on the investigation side, those of us who do have > bytecode manipulation skills can be heads-down on that while others are doing > the work associated with investigating code that might need to be bytecode > modified. > > In actuality this is kind of a code-review task and very much could help to > have several perspectives on what the code might be doing and thoughts on if > it needs to be updated and how. It could be smart to find the code, post the > link with some initial thoughts and then ask "here's what I see, what do > others think?" > > Ultimately, we'll all need to be very confident of what the updated code > should look like (if changes are needed) in order to do any bytecode > modification. > > That whole process will likely take input from a few of us and likely the > project itself, but we do need some brave souls to get the process started > for each item that needs investigation. > > > -- > David Blevins > http://twitter.com/dblevins > http://www.tomitribe.com > >> On Jun 7, 2020, at 11:38 AM, Daniel Dias Dos Santos >> wrote: >> >> Hello David, >> >> a doubt. >> this process of investigation of the items reported, is for searching >> within the TomEE code or the dependencies that it uses. >> for example, for OpenWebBeans, search the code for this project. >> >> thank you . >> -- >> >> *Daniel Dias dos Santos* >> Java Developer >> SouJava & JCP Member >> GitHub: https://github.com/Daniel-Dos >> Linkedin: www.linkedin.com/in/danieldiasjava >> Twitter: http://twitter.com/danieldiasjava >> >> >> Em dom., 7 de jun. de 2020 às 15:08, David Blevins >> escreveu: >> >>> Ok, everyone. If you're looking for a concrete way to help we have >>> several "needs a pair of eyes" tasks. >>> >>> The short version of the tasks: >>> >>> - Locate the source code in github and see if you can find the file and >>> line number of the indicated "javax" references. >>> - Post the github links to file & line number to jira ticket >>> - Bonus, see if you can figure out what the code is doing (at least a >>> little) and update the ticket >>> >>> See the slightly longer description here: >>> >>> - https://issues.apache.org/jira/browse/TOMEE-2839 >>> >>> These are the things that need investigation: >>> >>> - BatchEE uses of "javax" >>> https://issues.apache.org/jira/browse/TOMEE-2840 >>> >>> - CXF uses of "javax" >>> https://issues.apache.org/jira/browse/TOMEE-2841 >>> >>> - Eclipselink uses of "javax" >>> https://issues.apache.org/jira/browse/TOMEE-2842 >>> >>> - Jackson uses "javax.xml." >>> https://issues.apache.org/jira/browse/TOMEE-2838 >>> >>> - Mojarra uses of "javax" >>> https://issues.apache.org/jira/browse/TOMEE-2843 >>> >>> - MyFaces use of "javax" >>> https://issues.apache.org/jira/browse/TOMEE-2844 >>> >>> - OpenWebBeans uses of "javax" >>>
Re: Help wanted (Re: Javax to Jakarta Bytecode transformation progress)
Hey Daniel! We'd need to search in the source code for this related project. Using OpenWebBeans as an example it, the report shows four uses of "javax." that need some investigation. One of them is: - methodVisitor.visitLdcInsn("javax."); org/apache/webbeans/proxy/AbstractProxyFactory:335 The above output basically means somewhere in OpenWebBeans source there's a class called "org.apache.webbeans.proxy.AbstractProxyFactory" In that class there's some logic that uses "javax." in a string. Investigating that basically entails: - Find in github were OpenWebBeans source lives - Find the git tag associated with the version we're using - Find the file AbstractProxyFactory.java file - Find the line that has "javax." as a string - Update the ticket with a link to that line (all the line numbers down the left in github's source view are links) And then separately, try and see if you can figure out what that code is doing and if it's something that might be affected by the javax-to-jakarta rename. For example if the string is being used in an `if` block that has some logic like "if the class starts with javax., we need to treat it separately", then possibly the code would need to be adjusted to, "if the class starts with javax. or jakarta., we need to treat it separately." Now there's no part of the task that involves updating the code. Those of us who are familiar with ASM and bytecode manipulation could handle that. But if we divide and conquer on the investigation side, those of us who do have bytecode manipulation skills can be heads-down on that while others are doing the work associated with investigating code that might need to be bytecode modified. In actuality this is kind of a code-review task and very much could help to have several perspectives on what the code might be doing and thoughts on if it needs to be updated and how. It could be smart to find the code, post the link with some initial thoughts and then ask "here's what I see, what do others think?" Ultimately, we'll all need to be very confident of what the updated code should look like (if changes are needed) in order to do any bytecode modification. That whole process will likely take input from a few of us and likely the project itself, but we do need some brave souls to get the process started for each item that needs investigation. -- David Blevins http://twitter.com/dblevins http://www.tomitribe.com > On Jun 7, 2020, at 11:38 AM, Daniel Dias Dos Santos > wrote: > > Hello David, > > a doubt. > this process of investigation of the items reported, is for searching > within the TomEE code or the dependencies that it uses. > for example, for OpenWebBeans, search the code for this project. > > thank you . > -- > > *Daniel Dias dos Santos* > Java Developer > SouJava & JCP Member > GitHub: https://github.com/Daniel-Dos > Linkedin: www.linkedin.com/in/danieldiasjava > Twitter: http://twitter.com/danieldiasjava > > > Em dom., 7 de jun. de 2020 às 15:08, David Blevins > escreveu: > >> Ok, everyone. If you're looking for a concrete way to help we have >> several "needs a pair of eyes" tasks. >> >> The short version of the tasks: >> >> - Locate the source code in github and see if you can find the file and >> line number of the indicated "javax" references. >> - Post the github links to file & line number to jira ticket >> - Bonus, see if you can figure out what the code is doing (at least a >> little) and update the ticket >> >> See the slightly longer description here: >> >> - https://issues.apache.org/jira/browse/TOMEE-2839 >> >> These are the things that need investigation: >> >> - BatchEE uses of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2840 >> >> - CXF uses of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2841 >> >> - Eclipselink uses of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2842 >> >> - Jackson uses "javax.xml." >> https://issues.apache.org/jira/browse/TOMEE-2838 >> >> - Mojarra uses of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2843 >> >> - MyFaces use of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2844 >> >> - OpenWebBeans uses of "javax" >> https://issues.apache.org/jira/browse/TOMEE-2845 >> >> >> Any help is incredibly welcome. Questions are even more welcome. I tried >> to keep this email short-ish so people would read, but that just means >> there's a lot of good questions waiting to be asked :) >> >> Ask away :) >> >> >> -- >> David Blevins >> http://twitter.com/dblevins >> http://www.tomitribe.com >> >>> On Jun 6, 2020, at 3:26 PM, David Blevins >> wrote: >>> >>> Ok, I think I finally have a report that is useful to consume. What I >> did was grep the asmified bytecode for "javax", wrote a second regex to >> filter out false matches, then collected, filtered duplicates and sorted >> the remaining: >>> >>> - >>
Re: Help wanted (Re: Javax to Jakarta Bytecode transformation progress)
Hello David, a doubt. this process of investigation of the items reported, is for searching within the TomEE code or the dependencies that it uses. for example, for OpenWebBeans, search the code for this project. thank you . -- *Daniel Dias dos Santos* Java Developer SouJava & JCP Member GitHub: https://github.com/Daniel-Dos Linkedin: www.linkedin.com/in/danieldiasjava Twitter: http://twitter.com/danieldiasjava Em dom., 7 de jun. de 2020 às 15:08, David Blevins escreveu: > Ok, everyone. If you're looking for a concrete way to help we have > several "needs a pair of eyes" tasks. > > The short version of the tasks: > > - Locate the source code in github and see if you can find the file and > line number of the indicated "javax" references. > - Post the github links to file & line number to jira ticket > - Bonus, see if you can figure out what the code is doing (at least a > little) and update the ticket > > See the slightly longer description here: > > - https://issues.apache.org/jira/browse/TOMEE-2839 > > These are the things that need investigation: > > - BatchEE uses of "javax" >https://issues.apache.org/jira/browse/TOMEE-2840 > > - CXF uses of "javax" >https://issues.apache.org/jira/browse/TOMEE-2841 > > - Eclipselink uses of "javax" >https://issues.apache.org/jira/browse/TOMEE-2842 > > - Jackson uses "javax.xml." >https://issues.apache.org/jira/browse/TOMEE-2838 > > - Mojarra uses of "javax" >https://issues.apache.org/jira/browse/TOMEE-2843 > > - MyFaces use of "javax" >https://issues.apache.org/jira/browse/TOMEE-2844 > > - OpenWebBeans uses of "javax" >https://issues.apache.org/jira/browse/TOMEE-2845 > > > Any help is incredibly welcome. Questions are even more welcome. I tried > to keep this email short-ish so people would read, but that just means > there's a lot of good questions waiting to be asked :) > > Ask away :) > > > -- > David Blevins > http://twitter.com/dblevins > http://www.tomitribe.com > > > On Jun 6, 2020, at 3:26 PM, David Blevins > wrote: > > > > Ok, I think I finally have a report that is useful to consume. What I > did was grep the asmified bytecode for "javax", wrote a second regex to > filter out false matches, then collected, filtered duplicates and sorted > the remaining: > > > > - > https://github.com/dblevins/tomee-analysis/tree/3da78d1282d19cd5e710cdfd5ef174e80c909b2d > > > > From a bytecode perspective I see a few scenarios which aren't covered: > > > > - Outer class references > > - Switch case with Enums > > - module-info import/export > > > > From a string perspective the big areas: > > > > - Bean validation message keys in annotations > > - JSF references to /javax.faces.resource and "javax_faces" > > - Several ambiguous references to "javax." > > > > After that there are several smaller occurrences. > > > > All total about 2508 hits. > > > > Now the big question, how to fix them :) > > > > > > -- > > David Blevins > > http://twitter.com/dblevins > > http://www.tomitribe.com > > > >> On Jun 5, 2020, at 12:50 PM, David Blevins > wrote: > >> > >> Looks like both my scanning tool and the Eclipse Transformer are not > picking up calls to outer classes. A couple examples: > >> > >> - > https://github.com/dblevins/tomee-analysis/blob/master/apache-tomee-plume-8.0.3-SNAPSHOT.zip/apache-tomee-plume-8.0.3-SNAPSHOT/lib/jakarta.xml.bind-api-2.3.2.jar/jakarta/xml/bind/util/JAXBSource%241-asmified.java#L27 > >> > >> - > https://github.com/dblevins/tomee-analysis/blob/master/apache-tomee-plume-8.0.3-SNAPSHOT.zip/apache-tomee-plume-8.0.3-SNAPSHOT/lib/jakarta.xml.bind-api-2.3.2.jar/jakarta/xml/bind/ContextFinder$2-asmified.java#L27 > >> > >> > >> > >> -- > >> David Blevins > >> http://twitter.com/dblevins > >> http://www.tomitribe.com > >> > >>> On Jun 5, 2020, at 12:31 PM, David Blevins > wrote: > >>> > >>> Here's the diff of the changed bytecode from revision > d429ba420dbdba7ea07c6a0c91f3135ef2343f28 > >>> > >>> - > https://github.com/dblevins/tomee-analysis/commit/b6026b56eaad3a19c8a3bd89eb5c92620dd5b5d7 > >>> > >>> Haven't had a chance to pick through it. > >>> > >>> -- > >>> David Blevins > >>> http://twitter.com/dblevins > >>> http://www.tomitribe.com > >>> > On Jun 5, 2020, at 12:26 PM, Jonathan Gallimore < > jonathan.gallim...@gmail.com> wrote: > > Deployed Moviefun. EJBs now scanned ok... now have an issue with > EclipseLink. We're still moving forward... > > 05-Jun-2020 20:23:21.976 INFO [main] > sun.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web > application directory > [/home/jgallimore/srv/apache-tomee-plume-8.0.3-SNAPSHOT/webapps/ROOT] > has > finished in [161] ms > 05-Jun-2020 20:23:22.011 INFO [main] > sun.reflect.DelegatingMethodAccessorImpl.invoke Starting > ProtocolHandler > ["http-nio-8080"] > 05-Jun-2020 20:23:22.028 INFO [main] > sun.reflect.DelegatingMethodAccessorImpl.invoke Server startup in > [48,389] >
Help wanted (Re: Javax to Jakarta Bytecode transformation progress)
Ok, everyone. If you're looking for a concrete way to help we have several "needs a pair of eyes" tasks. The short version of the tasks: - Locate the source code in github and see if you can find the file and line number of the indicated "javax" references. - Post the github links to file & line number to jira ticket - Bonus, see if you can figure out what the code is doing (at least a little) and update the ticket See the slightly longer description here: - https://issues.apache.org/jira/browse/TOMEE-2839 These are the things that need investigation: - BatchEE uses of "javax" https://issues.apache.org/jira/browse/TOMEE-2840 - CXF uses of "javax" https://issues.apache.org/jira/browse/TOMEE-2841 - Eclipselink uses of "javax" https://issues.apache.org/jira/browse/TOMEE-2842 - Jackson uses "javax.xml." https://issues.apache.org/jira/browse/TOMEE-2838 - Mojarra uses of "javax" https://issues.apache.org/jira/browse/TOMEE-2843 - MyFaces use of "javax" https://issues.apache.org/jira/browse/TOMEE-2844 - OpenWebBeans uses of "javax" https://issues.apache.org/jira/browse/TOMEE-2845 Any help is incredibly welcome. Questions are even more welcome. I tried to keep this email short-ish so people would read, but that just means there's a lot of good questions waiting to be asked :) Ask away :) -- David Blevins http://twitter.com/dblevins http://www.tomitribe.com > On Jun 6, 2020, at 3:26 PM, David Blevins wrote: > > Ok, I think I finally have a report that is useful to consume. What I did > was grep the asmified bytecode for "javax", wrote a second regex to filter > out false matches, then collected, filtered duplicates and sorted the > remaining: > > - > https://github.com/dblevins/tomee-analysis/tree/3da78d1282d19cd5e710cdfd5ef174e80c909b2d > > From a bytecode perspective I see a few scenarios which aren't covered: > > - Outer class references > - Switch case with Enums > - module-info import/export > > From a string perspective the big areas: > > - Bean validation message keys in annotations > - JSF references to /javax.faces.resource and "javax_faces" > - Several ambiguous references to "javax." > > After that there are several smaller occurrences. > > All total about 2508 hits. > > Now the big question, how to fix them :) > > > -- > David Blevins > http://twitter.com/dblevins > http://www.tomitribe.com > >> On Jun 5, 2020, at 12:50 PM, David Blevins wrote: >> >> Looks like both my scanning tool and the Eclipse Transformer are not picking >> up calls to outer classes. A couple examples: >> >> - >> https://github.com/dblevins/tomee-analysis/blob/master/apache-tomee-plume-8.0.3-SNAPSHOT.zip/apache-tomee-plume-8.0.3-SNAPSHOT/lib/jakarta.xml.bind-api-2.3.2.jar/jakarta/xml/bind/util/JAXBSource%241-asmified.java#L27 >> >> - >> https://github.com/dblevins/tomee-analysis/blob/master/apache-tomee-plume-8.0.3-SNAPSHOT.zip/apache-tomee-plume-8.0.3-SNAPSHOT/lib/jakarta.xml.bind-api-2.3.2.jar/jakarta/xml/bind/ContextFinder$2-asmified.java#L27 >> >> >> >> -- >> David Blevins >> http://twitter.com/dblevins >> http://www.tomitribe.com >> >>> On Jun 5, 2020, at 12:31 PM, David Blevins wrote: >>> >>> Here's the diff of the changed bytecode from revision >>> d429ba420dbdba7ea07c6a0c91f3135ef2343f28 >>> >>> - >>> https://github.com/dblevins/tomee-analysis/commit/b6026b56eaad3a19c8a3bd89eb5c92620dd5b5d7 >>> >>> Haven't had a chance to pick through it. >>> >>> -- >>> David Blevins >>> http://twitter.com/dblevins >>> http://www.tomitribe.com >>> On Jun 5, 2020, at 12:26 PM, Jonathan Gallimore wrote: Deployed Moviefun. EJBs now scanned ok... now have an issue with EclipseLink. We're still moving forward... 05-Jun-2020 20:23:21.976 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory [/home/jgallimore/srv/apache-tomee-plume-8.0.3-SNAPSHOT/webapps/ROOT] has finished in [161] ms 05-Jun-2020 20:23:22.011 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler ["http-nio-8080"] 05-Jun-2020 20:23:22.028 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Server startup in [48,389] milliseconds [EL Info]: 2020-06-05 20:23:27.156--ServerSession(1764341773)--EclipseLink, version: Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a [EL Info]: 2020-06-05 20:23:27.215--ServerSession(1764341773)--/file:/home/jgallimore/srv/apache-tomee-plume-8.0.3-SNAPSHOT/webapps/moviefun/WEB-INF/classes/_movie-unit login successful [EL Warning]: 2020-06-05 20:23:27.27--The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units. Please verify that your entity classes are referenced in persistence.xml using either elements or a global
Re: How can I help?
Hi Nagasitaram! It's very great to from you and it's truly awesome when a user of TomEE decides to contribute. Big applause to you and OpenText! First of all, do not get intimidated by your first ticket. If it ends up being too hard or just not fun, let's find something else for you. There is always plenty of do. People have a way of 1) putting too much pressure on themselves and 2) not asking questions for fear of being seen as "not smart." Don't let that happen to you. Be chatty and talk, that's the only way :) I created this ticket for you which is an area we're working on now with the javax-to-jakarta namespace change. - https://issues.apache.org/jira/browse/TOMEE-2838 The short version is "grab the jackson source code and see if you can find where in the code `javax.xml` is being referenced. Bonus, see if you can figure out at least a little what it's doing" I suspect their source is on github somewhere, if it is find the file and post a link to the list. You can then dig into the source itself with the help of anyone else in the community who is interested. There are actually about 2500 of these kind of references we need to investigate, so really even a "I kind of think it might be doing x, but I'm not sure" is super helpful. - https://github.com/dblevins/tomee-analysis If there are others reading who are interested in helping, I can give you a chunk of references too. There are plenty! -- David Blevins http://twitter.com/dblevins http://www.tomitribe.com > On Jun 6, 2020, at 10:48 PM, Nagasitaram Thigulla > wrote: > > Hello, > > I am Nagasitaram, currently working as a Software Developer at Opentext on > Appworks Platform. Appworks uses TomEE Plus as the Server. As working on > this tool for a long time I got interested in its underlying technology. > > I am good at Java and Groovy, and unit testing with JUnit and TestNG. I > have worked on building REST API's using JAX-RS and config sources using > Microprofile API. I am ready to contribute to TomEE. > > I am expecting a simple task to start with. > > -- > *Regards* > *Nagasitaram* smime.p7s Description: S/MIME cryptographic signature