Hibernate-reactive: バグレポートに役立つJBangのテンプレートを作成する方法を調査します

作成日 2021年04月23日  ·  31コメント  ·  ソース: hibernate/hibernate-reactive

See https://github.com/jbangdev/jbang#init -templates 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.ユーザーがJBangを使用して基本的なテストプロジェクトを生成し、問題を再現するためのプロジェクトの作成をすばやく開始できるようにすると便利です。

I haven't checked if this is feasible or helpful yet.これが実現可能かどうかはまだ確認していません。 In my head it should make it even easier than cloning a template from our repository .私の頭の中では、リポジトリからテンプレートを複製するよりもさらに簡単になるはずです。

en
testing

全てのコメント31件

@maxandersen already played with this. @maxandersenはすでにこれで遊んでいます。 What he didn't like, and what might also be a problem here, is that he couldn't easily use a testcontainers database.彼が気に入らなかったこと、そしてここでも問題になる可能性があるのは、テストコンテナデータベースを簡単に使用できなかったことです。

en

It works but yeah users would need to manually setup the database.それは機能しますが、ユーザーはデータベースを手動でセットアップする必要があります。

But so should users using more complex setups :)しかし、ユーザーはより複雑な設定を使用する必要があります:)

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.できることは、休止状態のリアクティブでは(まだ)機能しないjdbc urlマジックを使用するのではなく、テストコンテナーを介してjbangスクリプトを手動でセットアップすることです。

en

テストスイートのtestcontainersブートストラップコードを再利用可能にすることを簡単に検討しましたが、それほど簡単なことではありませんでした。

en

つまり...testcontainersは素晴らしいツールです...しかし、私はここに足を踏み入れて、Hibernate Reactive(またはORM)を使用している人々がそれなしでdbを開始できることを期待できると言います:-)

en

It's certainly not a deal breaker to me, most of the boring part is really the configuration of the project.それは確かに私にとって取引を妨げるものではありません。退屈な部分のほとんどは実際にはプロジェクトの構成です。 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.アプリのメインを実行する前にスクリプトを手動で起動するデータベースを開始する必要がある場合、それはすでに大きな改善になります。

en

Sure, that's fine.もちろん、それで結構です。 But it's a nice-to-have.しかし、それは持っているのはいいことです。

en

それについて考えると、おそらく最初からテンプレートは必要ありません。JBangがそれを実行するために必要なすべての依存関係を含むJavaファイルを提供することができます。

en

私はあなたがデータベースタイプによってパラメータ化することを望んでいた「テンプレート」によって考えました。

en

I was talking about a JBang template, something that would allow the user to write:私はJBangテンプレートについて話していました。これは、ユーザーが次のように記述できるようにするものです。

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

but I guess this would also be possible:しかし、これも可能だと思います。

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:これで、ユーザーが次のコマンドで実行できるように、単一のファイル(またはデータベースごとに1つ)を提供して同じ結果を達成できると思います。

jbang HReactiveWithDb2.java

With the caveat that a Db2 instance with the right credentials must be already running.正しい資格情報を持つDb2インスタンスがすでに実行されている必要があることに注意してください。

Then they could start editing it with:次に、次のコマンドで編集を開始できます。

 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.必要なすべてのベルとホイッスルを追加する方法を考えることができますが、これは私にとって良い出発点になります。

en

In my previous example, HReactiveWithDb2.java is somewhere on our GitHub repository and a user has to download it first.前の例では、 HReactiveWithDb2.javaはGitHubリポジトリのどこかにあり、ユーザーは最初にそれをダウンロードする必要があります。

Although, I expect JBang to have some way to run something like:ただし、JBangには次のような実行方法があると思います。

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

jbangテンプレートはパラメータAFAIUをなんらかの形でサポートしており、特定のpersistence.xmlファイルを切り替えるにはそれで十分だと思います。

en

確かに、素晴らしいですね。

en

Very interesting!とても興味深い!

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.考慮したいもう1つのこと:Quarkusユーザーは「リプロデューサープロジェクト」を作成するように勧められることがよくありますが、ほとんどの場合、これは最終的に、Quarkusメインラインにマージするために実際の統合テストに再適応する必要があります。 。

I do wonder if we could structure our "reproducers" in such a way that it could be automatically promoted into a new integration test. 「リプロデューサー」を、新しい統合テストに自動的に昇格できるように構成できるかどうか疑問に思います。

en

「メイン」クラスは、基本的に、@Testを含むクラスを実行するjunitテストランナーにすることができます。

en

Btw.ところで。 If Properties / qute template is not enough / not working let me know.プロパティ/quteテンプレートが十分でない/機能しない場合はお知らせください。 The init templates are new so if you find things missing I Can easily fix/release new jbang. initテンプレートは新しいので、足りないものが見つかった場合は、新しいjbangを簡単に修正/リリースできます。

en

@maxandersonテンプレートを追加して、thxで初期化することができます。

en

I'm looking at our hibernate-reactive examples which use the entity manager factory and persistence.xml and separate entity classes.エンティティマネージャーファクトリとpersistence.xmlを使用し、エンティティクラスを分離するHibernate-reactiveの例を見ています。 The tests chain multiple transactions by waiting indefinitely .テストは、 indefinitelyを待機することにより、複数のトランザクションを連鎖させます。 All of our HR JUnit tests use chained CompletionStage 's as opposed to the single session transactions used in our examples .すべてのHRJUnitテストは、 examplesで使用される単一セッショントランザクションとは対照的に、連鎖されたCompletionStageを使用します。

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. JBang機能を使用すると、Jbangテンプレートレジストリに含まれるadd (または登録)プロセスにリソース(エンティティクラスとpersistence.xml )をアタッチできます。 This will result in a copy of those entities will be included in the project and build.これにより、それらのエンティティのコピーがプロジェクトとビルドに含まれるようになります。 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.したがって、理論的には、 Main.javaおよび/またはMutinyMain.javaテストクラスを生成して、これらのサンプルディレクトリに似たものにすることができます。

Note there is another feature that uses .jsh script that allows setting user-defined parameters to be replaced in a template file. .jshスクリプトを使用する別の機能があり、ユーザー定義パラメーターの設定をテンプレートファイルで置き換えることができることに注意してください。 (alluded to earlier ^^^) but @MaxAndersen indicated they could be added to the JBang init command. (以前の^^^をほのめかしました)しかし、 @ MaxAndersenは、それらをJBang initコマンドに追加できることを示しました。

Questions:質問:

  1. Is there a target hibernate-reactive user/customer and use case we're aiming for?私たちが目指しているターゲットの休止状態に反応するユーザー/顧客とユースケースはありますか?

    • Based on the complexity, we may need to build/publish a hibernate-reactive-test to maven, which would need to be maintained複雑さに基づいて、Mavenにhibernate-reactive-testをビルド/公開する必要がある場合がありますが、これは維持する必要があります
  2. Do we want to be able to test these generated tests against older or newer versions of HR & HR ORM?これらの生成されたテストを、古いバージョンまたは新しいバージョンの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 )基本的なテンプレートには、プロジェクトのビルド中にプルされる依存関係(将来のインポートなど)が必要です(例: //DEPS org.hibernate:hibernate-core:5.4.10.Final
    • This would help users define/document their build environment as part of the test generationこれは、ユーザーがテスト生成の一部としてビルド環境を定義/文書化するのに役立ちます
  3. Simple examples like we have now are still viable, of course.もちろん、今のような単純な例はまだ実行可能です。

en

今のところうまくいく可能性のある最も単純なことをすることをお勧めします。

en

@blafond , here's your use case: @blafond 、これがあなたのユースケースです:
You are User and found this issue while using hibernate reactive in yourあなたはユーザーであり、Hibernateリアクティブを使用しているときにこの問題を発見しました
project : https://github.com/hibernate/hibernate-reactive/issues/702プロジェクト: https ://github.com/hibernate/hibernate-reactive/issues/702

You want to send us a reproducer without having to clone the whole全体を複製せずに再生機を送ってほしい
hibernate reactive project and without having to spend too much time on all休止状態のリアクティブプロジェクトで、すべてに多くの時間を費やす必要はありません
the scaffolding needed to create a brand new project.まったく新しいプロジェクトを作成するために必要な足場。 Ideally, with jbang,理想的には、jbangで、
you could just send us a single file and we could run it. 1つのファイルを送信するだけで、実行できます。

Use ORM 5.4, the default, for now.今のところ、デフォルトのORM5.4を使用してください。
Not sure why we need to worry about maven, but do what you think is right.なぜMavenについて心配する必要があるのか​​わかりませんが、正しいと思うことを実行してください。

Don't worry about CI, if it's easy for a user to run, it's easy for us to CIについて心配する必要はありません。ユーザーが実行しやすい場合は、実行しやすいです。
add it to ci ciに追加

On Wed, 5 May 2021, 21:48 Gavin King, @ . 2021年5月5日水曜日、21:48 Gavin King、 @ * > wrote: * >書いた:

I would suggest just doing the Simplest Thing That Could Possibly Work forおそらくうまくいく可能性のある最も単純なことをすることをお勧めします
now.今。


You are receiving this because you authored the thread.スレッドを作成したため、これを受け取っています。
Reply to this email directly, view it on GitHubこのメールに直接返信し、GitHubで表示してください
https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 , https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030
or unsubscribeまたは購読を解除する
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明確にするために、問題はquarkusを使用して発見されましたが、再現者
should only use hibernate reactive Hibernateリアクティブのみを使用する必要があります

On Thu, 6 May 2021, 10:51 Davide D'Alto, @ . 2021年5月6日木曜日、10:51 Davide D'Alto、 @ * > wrote: * >書いた:

@blafond , here's your use case: @blafond 、これがあなたのユースケースです:
You are User and found this issue while using hibernate reactive in yourあなたはユーザーであり、Hibernateリアクティブを使用しているときにこの問題を発見しました
project : https://github.com/hibernate/hibernate-reactive/issues/702プロジェクト: https ://github.com/hibernate/hibernate-reactive/issues/702

You want to send us a reproducer without having to clone the whole全体を複製せずに再生機を送ってほしい
hibernate reactive project and without having to spend too much time on all休止状態のリアクティブプロジェクトで、すべてに多くの時間を費やす必要はありません
the scaffolding needed to create a brand new project.まったく新しいプロジェクトを作成するために必要な足場。 Ideally, with jbang,理想的には、jbangで、
you could just send us a single file and we could run it. 1つのファイルを送信するだけで、実行できます。

Use ORM 5.4, the default, for now.今のところ、デフォルトのORM5.4を使用してください。
Not sure why we need to worry about maven, but do what you think is right.なぜMavenについて心配する必要があるのか​​わかりませんが、正しいと思うことを実行してください。

Don't worry about CI, if it's easy for a user to run, it's easy for us to CIについて心配する必要はありません。ユーザーが実行しやすい場合は、実行しやすいです。
add it to ci ciに追加

On Wed, 5 May 2021, 21:48 Gavin King, @ . 2021年5月5日水曜日、21:48 Gavin King、 @ * > wrote: * >書いた:

I would suggest just doing the Simplest Thing That Could Possibly Workおそらくうまくいく可能性のある最も単純なことをすることをお勧めします
for now.今のところ。


You are receiving this because you authored the thread.スレッドを作成したため、これを受け取っています。
Reply to this email directly, view it on GitHubこのメールに直接返信し、GitHubで表示してください
https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030 , https://github.com/hibernate/hibernate-reactive/issues/721#issuecomment-832997030
or unsubscribeまたは購読を解除する
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 、常に、HRと統合するバグがあります。 For example, suppose Quarkus passes arguments to HR in the wrong order.たとえば、Quarkusが引数を間違った順序でHRに渡すとします。 This is not a use case that you need to be concerned about here.これは、ここで気にする必要のあるユースケースではありません。 Integration bugs will need to be reproduced in some other way.統合のバグは、他の方法で再現する必要があります。

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.ユーザーのリプロデューサーを単体テストに簡単に追加できるようにする1つの方法は、テンプレートにBaseReactiveTestを拡張させることです。したがって、必要なのは、テストスイートにコピーして貼り付けることだけです。 I have no idea if that is the proper approach here.それがここでの適切なアプローチであるかどうかはわかりません。 I'm just mentioning it as an example.例として言及しているだけです。

en

@maxandersen @gavinking What was the problem with JBang and testcontainers? @maxandersen @gavinking JBangとテストコンテナの問題は何でしたか? It seems to work fine to me:それは私にはうまくいくようです:

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.はい、手動で設定すれば機能します。 Issue is it won't work by just setting the jdbc or similar url.問題は、jdbcまたは同様のURLを設定するだけでは機能しないことです。

en

問題は、 tc:を含むJDBCURLの使用にあります。

en

Ah, I remember now.ああ、今覚えています。 We still have this issue open: https://github.com/hibernate/hibernate-reactive/issues/468この問題はまだ開いています: https ://github.com/hibernate/hibernate-reactive/issues/468

en

I think we have good starting point now and we can improve on it later.私たちは今、良い出発点を持っていると思います、そして私たちは後でそれを改善することができます。
In particular, when we have a solution for #468特に、#468の解決策がある場合

en

is there a reason you don't have that jbang script available as a template so you can doそのjbangスクリプトをテンプレートとして利用できない理由があるので、

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.いいえ、そうではありません。主な理由は、まだ調整中であり、テンプレートでない方が作業しやすいからです。

But I'm not sure I understand the syntax you are using.しかし、あなたが使用している構文を理解できるかどうかはわかりません。 What's testcase@hibernate/hibernate-reactive ? 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?それはjbang template add ...を介してカタログに追加されたものですか、それとも他の何かを参照していますか?

Would it be possible to refer to a github repository as the location of the template?テンプレートの場所としてgithubリポジトリを参照することは可能でしょうか?

en

testcase is the template name found in jbang-catalog. testcaseは、jbang-catalogにあるテンプレート名です。

hibernate/hibernate-reactive maps to github.com/hibernate/hibernate-reactive. hibernate/hibernate-reactiveはgithub.com/hibernate/hibernate-reactiveにマップされます。

so that is the github repository location.これがgithubリポジトリの場所です。

en

Ah nice!良いね! I will try itやってみます

en
このページは役に立ちましたか?
0 / 5 - 0 評価