Hibernate-reactive: Investigue como criar um template para JBang para ajudar com relatórios de bugs

Criado em 23 abr. 2021  ·  31Comentários  ·  Fonte: hibernate/hibernate-reactive

See https://github.com/jbangdev/jbang#init -templates Veja https://github.com/jbangdev/jbang#init -templates

It would be nice if users could generate a basic test project using JBang so that they have a quick way to start creating a project for reproducing the issue they are having. Seria bom se os usuários pudessem gerar um projeto de teste básico usando JBang para que eles tenham uma maneira rápida de começar a criar um projeto para reproduzir o problema que estão tendo.

I haven't checked if this is feasible or helpful yet. Ainda não verifiquei se isso é viável ou útil. In my head it should make it even easier than cloning a template from our repository . Na minha cabeça deve ser ainda mais fácil do que clonar um template do nosso repositório .

en
testing

Todos 31 comentários

@maxandersen already played with this. @maxandersen já brincou com isso. What he didn't like, and what might also be a problem here, is that he couldn't easily use a testcontainers database. O que ele não gostou, e o que também pode ser um problema aqui, é que ele não poderia usar facilmente um banco de dados testcontainers.

en

It works but yeah users would need to manually setup the database. Funciona, mas sim os usuários precisariam configurar manualmente o banco de dados.

But so should users using more complex setups :) Mas também os usuários que usam configurações mais complexas :)

What you can do is to have the jbang script setup via test containers manually rather than using the jdbc url magic which does not work (yet) with hibernate reactive. O que você pode fazer é configurar o script jbang manualmente por meio de contêineres de teste, em vez de usar o jdbc url magic que não funciona (ainda) com o hibernate reactive.

en

Eu olhei brevemente para tornar o código de bootstrap testcontainers em nosso conjunto de testes reutilizável, mas não seria tão trivial.

en

Quero dizer... testcontainers é uma ótima ferramenta... mas estou me arriscando aqui e dizer que podemos esperar que as pessoas que usam Hibernate Reactive (ou ORM) sejam capazes de iniciar um db sem ele :-)

en

It's certainly not a deal breaker to me, most of the boring part is really the configuration of the project. Certamente não é um problema para mim, a maior parte da parte chata é realmente a configuração do projeto. If I have to start a db launching a script manually before being able to run the main of the app, it would already be a great improvement. Se eu tivesse que iniciar um db lançando um script manualmente antes de poder rodar o main do app, já seria uma grande melhoria.

en

Sure, that's fine. Claro, tudo bem. But it's a nice-to-have. Mas é um bom ter.

en

Pensando nisso, provavelmente nem precisamos de um template para começar, poderíamos fornecer um arquivo java com todas as dependências necessárias para o JBang executá-lo.

en

Eu imaginei por "modelo" que você esperava parametrizar por tipo de banco de dados.

en

I was talking about a JBang template, something that would allow the user to write: Eu estava falando sobre um template JBang, algo que permitiria ao usuário escrever:

jbang init --template=hibernate-reactive Issue456.java

but I guess this would also be possible: mas acho que isso também seria possível:

jbang init --template=hibernate-reactive-db2 Issue456.java

Now I think we could achieve the same result providing a single file (or one per database) so that a user can run it with: Agora acho que poderíamos obter o mesmo resultado fornecendo um único arquivo (ou um por banco de dados) para que um usuário possa executá-lo com:

jbang HReactiveWithDb2.java

With the caveat that a Db2 instance with the right credentials must be already running. Com a ressalva de que uma instância do Db2 com as credenciais corretas já deve estar em execução.

Then they could start editing it with: Então eles poderiam começar a editá-lo com:

 jbang edit --open=idea  HReactiveWithDb2.java

We can think of ways to add all the bells and whistles we want, but this would be a good starting point for me. Podemos pensar em maneiras de adicionar todos os sinos e assobios que queremos, mas isso seria um bom ponto de partida para mim.

en

In my previous example, HReactiveWithDb2.java is somewhere on our GitHub repository and a user has to download it first. No meu exemplo anterior, HReactiveWithDb2.java está em algum lugar em nosso repositório GitHub e um usuário precisa baixá-lo primeiro.

Although, I expect JBang to have some way to run something like: Embora, espero que o JBang tenha alguma maneira de executar algo como:

jbang https://github.com/hibernate/hibernate-reactive/HReactiveWithDb2.java
en

Bem, os modelos jbang têm algum tipo de suporte para os parâmetros AFAIU, e acho que isso deve ser suficiente para dizer switch em um determinado arquivo persistence.xml .

en

Claro, parece ótimo.

en

Very interesting! Muito interessante!

One additional thing that maybe you want to consider: very often Quarkus users are encouraged to create a "reproducer project" but in most cases this then ends up being something I have to re-adapt into a real integration test to be merged in Quarkus mainline. Uma coisa adicional que talvez você queira considerar: muitas vezes os usuários do Quarkus são incentivados a criar um "projeto reprodutor", mas na maioria dos casos isso acaba sendo algo que eu tenho que readaptar em um teste de integração real para ser mesclado no Quarkus mainline .

I do wonder if we could structure our "reproducers" in such a way that it could be automatically promoted into a new integration test. Eu me pergunto se poderíamos estruturar nossos "reprodutores" de forma que eles pudessem ser automaticamente promovidos a um novo teste de integração.

en

Você pode fazer com que a classe "principal" seja basicamente um executor de testes junit que executa classes com @Test nela.

en

Btw. Por falar nisso. If Properties / qute template is not enough / not working let me know. Se o modelo Propriedades / qute não for suficiente / não estiver funcionando, avise-me. The init templates are new so if you find things missing I Can easily fix/release new jbang. Os modelos de inicialização são novos, portanto, se você encontrar coisas ausentes, posso facilmente corrigir/lançar o novo jbang.

en

@maxanderson eu sou capaz de adicionar modelos e init com eles thx!

en

I'm looking at our hibernate-reactive examples which use the entity manager factory and persistence.xml and separate entity classes. Estou olhando para nossos exemplos reativos à hibernação que usam a fábrica do gerenciador de entidades e persistence.xml e classes de entidade separadas. The tests chain multiple transactions by waiting indefinitely . Os testes encadeiam várias transações esperando indefinitely . All of our HR JUnit tests use chained CompletionStage 's as opposed to the single session transactions used in our examples . Todos os nossos testes HR JUnit usam CompletionStage encadeados em oposição às transações de sessão única usadas em nosso examples .

JBang features allow attaching resources (entity classes and persistence.xml ) on the add (or registration) process which will be included in the Jbang template registry. Os recursos do JBang permitem anexar recursos (classes de entidade e persistence.xml ) no processo add (ou registro) que serão incluídos no registro do modelo Jbang. This will result in a copy of those entities will be included in the project and build. Isso resultará em uma cópia dessas entidades que serão incluídas no projeto e na compilação. So in theory, we can generate the Main.java and/or MutinyMain.java test classes and end up with something similar to these example directories. Então, em teoria, podemos gerar as classes de teste Main.java e/ou MutinyMain.java e terminar com algo semelhante a esses diretórios de exemplo.

Note there is another feature that uses .jsh script that allows setting user-defined parameters to be replaced in a template file. Observe que há outro recurso que usa o script .jsh que permite a substituição de parâmetros definidos pelo usuário em um arquivo de modelo. (alluded to earlier ^^^) but @MaxAndersen indicated they could be added to the JBang init command. (aludiu anteriormente ^^^), mas @MaxAndersen indicou que eles poderiam ser adicionados ao comando JBang init .

Questions: Questões:

  1. Is there a target hibernate-reactive user/customer and use case we're aiming for? Existe um usuário/cliente alvo reativo à hibernação e caso de uso que estamos buscando?

    • Based on the complexity, we may need to build/publish a hibernate-reactive-test to maven, which would need to be maintained Com base na complexidade, podemos precisar construir/publicar um hibernate-reactive-test no maven, que precisaria ser mantido
  2. Do we want to be able to test these generated tests against older or newer versions of HR & HR ORM? Queremos poder testar esses testes gerados em relação a versões mais antigas ou mais recentes do HR & HR ORM?

    • The basic templates require dependencies (like future imports) that are pulled in during project build (example: //DEPS org.hibernate:hibernate-core:5.4.10.Final ) Os modelos básicos exigem dependências (como importações futuras) que são extraídas durante a compilação do projeto (exemplo: //DEPS org.hibernate:hibernate-core:5.4.10.Final )
    • This would help users define/document their build environment as part of the test generation Isso ajudaria os usuários a definir/documentar seu ambiente de construção como parte da geração de teste
  3. Simple examples like we have now are still viable, of course. Exemplos simples como os que temos agora ainda são viáveis, é claro.

en

Eu sugeriria apenas fazer a coisa mais simples que poderia funcionar por enquanto.

en

@blafond , here's your use case: @blafond , aqui está seu caso de uso:
You are User and found this issue while using hibernate reactive in your Você é usuário e encontrou este problema ao usar o reativo de hibernação em seu
project : https://github.com/hibernate/hibernate-reactive/issues/702 projeto: https://github.com/hibernate/hibernate-reactive/issues/702

You want to send us a reproducer without having to clone the whole Você quer nos enviar um reprodutor sem ter que clonar o todo
hibernate reactive project and without having to spend too much time on all projeto reativo de hibernação e sem ter que gastar muito tempo em todos
the scaffolding needed to create a brand new project. os andaimes necessários para criar um novo projeto. Ideally, with jbang, Idealmente, com jbang,
you could just send us a single file and we could run it. você poderia apenas nos enviar um único arquivo e nós poderíamos executá-lo.

Use ORM 5.4, the default, for now. Use o ORM 5.4, o padrão, por enquanto.
Not sure why we need to worry about maven, but do what you think is right. Não sei por que precisamos nos preocupar com maven, mas faça o que você acha certo.

Don't worry about CI, if it's easy for a user to run, it's easy for us to Não se preocupe com CI, se é fácil para um usuário executar, é fácil para nós
add it to ci adicione-o a ci

On Wed, 5 May 2021, 21:48 Gavin King, @ . Na quarta-feira, 5 de maio de 2021, 21:48 Gavin King, @ . * > wrote: * > escreveu:

I would suggest just doing the Simplest Thing That Could Possibly Work for Eu sugeriria apenas fazer a coisa mais simples que poderia funcionar para
now. agora.


You are receiving this because you authored the thread. Você está recebendo isso porque foi o autor do tópico.
Reply to this email directly, view it on GitHub Responda a este e-mail diretamente, visualize-o no GitHub
https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 , https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 ,
or unsubscribe ou cancelar
https://github.com/notifications/unsubscribe-auth/AAEIQ5JQIPGKCNFSHOWKCD3TMGVKTANCNFSM43OEZPUQ https://github.com/notifications/unsubscribe-auth/AAEIQ5JQIPGKCNFSHOWKCD3TMGVKTANCNFSM43OEZPUQ
. .

en

Just to clarify, the issue was found using quarkus, but the reproducer Apenas para esclarecer, o problema foi encontrado usando quarkus, mas o reprodutor
should only use hibernate reactive deve usar apenas o reativo de hibernação

On Thu, 6 May 2021, 10:51 Davide D'Alto, @ . Em qui, 6 de maio de 2021, 10:51 Davide D'Alto, @ . * > wrote: * > escreveu:

@blafond , here's your use case: @blafond , aqui está seu caso de uso:
You are User and found this issue while using hibernate reactive in your Você é usuário e encontrou este problema ao usar o reativo de hibernação em seu
project : https://github.com/hibernate/hibernate-reactive/issues/702 projeto: https://github.com/hibernate/hibernate-reactive/issues/702

You want to send us a reproducer without having to clone the whole Você quer nos enviar um reprodutor sem ter que clonar o todo
hibernate reactive project and without having to spend too much time on all projeto reativo de hibernação e sem ter que gastar muito tempo em todos
the scaffolding needed to create a brand new project. os andaimes necessários para criar um novo projeto. Ideally, with jbang, Idealmente, com jbang,
you could just send us a single file and we could run it. você poderia apenas nos enviar um único arquivo e nós poderíamos executá-lo.

Use ORM 5.4, the default, for now. Use o ORM 5.4, o padrão, por enquanto.
Not sure why we need to worry about maven, but do what you think is right. Não sei por que precisamos nos preocupar com maven, mas faça o que você acha certo.

Don't worry about CI, if it's easy for a user to run, it's easy for us to Não se preocupe com CI, se é fácil para um usuário executar, é fácil para nós
add it to ci adicione-o a ci

On Wed, 5 May 2021, 21:48 Gavin King, @ . Na quarta-feira, 5 de maio de 2021, 21:48 Gavin King, @ . * > wrote: * > escreveu:

I would suggest just doing the Simplest Thing That Could Possibly Work Eu sugeriria apenas fazer a coisa mais simples que poderia funcionar
for now. por enquanto.


You are receiving this because you authored the thread. Você está recebendo isso porque foi o autor do tópico.
Reply to this email directly, view it on GitHub Responda a este e-mail diretamente, visualize-o no GitHub
https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 , https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 ,
or unsubscribe ou cancelar
https://github.com/notifications/unsubscribe-auth/AAEIQ5JQIPGKCNFSHOWKCD3TMGVKTANCNFSM43OEZPUQ https://github.com/notifications/unsubscribe-auth/AAEIQ5JQIPGKCNFSHOWKCD3TMGVKTANCNFSM43OEZPUQ
. .

en

@blafond , invariably, there will be bugs integrating with HR. @blafond , invariavelmente, haverá bugs na integração com o RH. For example, suppose Quarkus passes arguments to HR in the wrong order. Por exemplo, suponha que o Quarkus passe argumentos para RH na ordem errada. This is not a use case that you need to be concerned about here. Este não é um caso de uso com o qual você precisa se preocupar aqui. Integration bugs will need to be reproduced in some other way. Os bugs de integração precisarão ser reproduzidos de alguma outra maneira.

One way to make it easy for us to add a user's reproducer to a unit test is to have the template somehow extend BaseReactiveTest , so all we have to do is copy/paste into the test suite. Uma maneira de tornar mais fácil para nós adicionar um reprodutor de usuário a um teste de unidade é fazer com que o modelo de alguma forma estenda BaseReactiveTest , então tudo o que temos a fazer é copiar/colar no conjunto de testes. I have no idea if that is the proper approach here. Eu não tenho idéia se essa é a abordagem adequada aqui. I'm just mentioning it as an example. Estou apenas citando como exemplo.

en

@maxandersen @gavinking What was the problem with JBang and testcontainers? @maxandersen @gavinking Qual era o problema com JBang e testcontainers? It seems to work fine to me: Parece funcionar bem para mim:

jbang https://github.com/DavideD/hibernate-reactive/blob/721-jbang-executable-test/tooling/jbang/SampleIssueTest.java
en

Yes if you set it up manually it works. Sim, se você configurar manualmente, funciona. Issue is it won't work by just setting the jdbc or similar url. O problema é que não funcionará apenas definindo o jdbc ou url semelhante.

en

O problema é com o uso de URLs JDBC contendo tc: .

en

Ah, I remember now. Ah, eu me lembro agora. We still have this issue open: https://github.com/hibernate/hibernate-reactive/issues/468 Ainda temos este problema em aberto: https://github.com/hibernate/hibernate-reactive/issues/468

en

I think we have good starting point now and we can improve on it later. Acho que temos um bom ponto de partida agora e podemos melhorar mais tarde.
In particular, when we have a solution for #468 Em particular, quando temos uma solução para #468

en

is there a reason you don't have that jbang script available as a template so you can do existe uma razão para você não ter esse script jbang disponível como modelo para que você possa fazer

jbang init -t testcase@hibernate/hibernate-reactive mytest.java ? jbang init -t testcase@hibernate/hibernate-reactive mytest.java ?

en

No, not really, mainly because I'm still tweaking it and I find it easier to work when it's not a template. Não, na verdade não, principalmente porque ainda estou ajustando e acho mais fácil trabalhar quando não é um modelo.

But I'm not sure I understand the syntax you are using. Mas não tenho certeza se entendi a sintaxe que você está usando. What's testcase@hibernate/hibernate-reactive ? O que é testcase@hibernate/hibernate-reactive ? Is it something that's been added to the catalog via jbang template add ... or does it refer to something else? É algo que foi adicionado ao catálogo via jbang template add ... ou se refere a outra coisa?

Would it be possible to refer to a github repository as the location of the template? Seria possível se referir a um repositório do github como o local do modelo?

en

testcase is the template name found in jbang-catalog. testcase é o nome do template encontrado em jbang-catalog.

hibernate/hibernate-reactive maps to github.com/hibernate/hibernate-reactive. mapas hibernate/hibernate-reactive para github.com/hibernate/hibernate-reactive.

so that is the github repository location. então esse é o local do repositório do github.

en

Ah nice! Ah legal! I will try it Eu vou tentar isso

en
Esta página foi útil?
0 / 5 - 0 avaliações

Questões relacionadas

gavinking picture gavinking  ·  16Comentários

pqab picture pqab  ·  21Comentários

Sanne picture Sanne  ·  12Comentários

blafond picture blafond  ·  7Comentários

akoufa picture akoufa  ·  30Comentários