Hibernate-reactive: تحقق من كيفية إنشاء نموذج لـ JBang للمساعدة في تقارير الأخطاء

تم إنشاؤها على ٢٣ أبريل ٢٠٢١  ·  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. ما يمكنك فعله هو الحصول على إعداد jbang النصي عبر حاويات الاختبار يدويًا بدلاً من استخدام jdbc url magic الذي لا يعمل (حتى الآن) مع تفاعل السبات.

en

لقد نظرت بإيجاز في جعل كود التمهيد الخاص بحاويات الاختبار في مجموعة الاختبار الخاصة بنا قابلاً لإعادة الاستخدام ، لكنه لن يكون بهذه السهولة.

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 لتشغيله.

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: الآن أعتقد أنه يمكننا تحقيق نفس النتيجة من خلال توفير ملف واحد (أو ملف واحد لكل قاعدة بيانات) بحيث يمكن للمستخدم تشغيله باستخدام:

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. شيء إضافي واحد ربما ترغب في مراعاته: في كثير من الأحيان يتم تشجيع مستخدمي Quarkus على إنشاء "مشروع إعادة إنتاج" ولكن في معظم الحالات ينتهي الأمر بهذا الأمر ليصبح شيئًا يجب أن أعيد تكييفه في اختبار تكامل حقيقي ليتم دمجه في 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. أتساءل عما إذا كان بإمكاننا هيكلة "أجهزة إعادة الإنتاج" الخاصة بنا بطريقة يمكن ترقيتها تلقائيًا إلى اختبار تكامل جديد.

en

يمكنك جعل الفصل "main" عبارة عن عداء اختبار junit يدير الفصول مع Test بداخله .

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 وفئات الكيانات المنفصلة. 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 . تستخدم جميع اختبارات HR JUnit الخاصة بنا CompletionStage المتسلسلة بدلاً من معاملات الجلسة الفردية المستخدمة في 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. تسمح ميزات JBang بإرفاق الموارد (فئات الكيانات و persistence.xml ) في عملية add (أو التسجيل) والتي سيتم تضمينها في سجل نموذج Jbang. 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 بناءً على التعقيد ، قد نحتاج إلى إنشاء / نشر 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 أنت مستخدم ووجدت هذه المشكلة أثناء استخدام تفاعل الإسبات في ملف
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. يمكنك فقط إرسال ملف واحد إلينا ويمكننا تشغيله.

Use ORM 5.4, the default, for now. استخدم ORM 5.4 ، الافتراضي ، في الوقت الحالي.
Not sure why we need to worry about maven, but do what you think is right. لست متأكدًا من سبب حاجتنا للقلق بشأن المخضرمين ، لكن افعل ما تعتقد أنه صحيح.

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, @ . في الأربعاء ، 5 مايو 2021 ، الساعة 21:48 ، جافين كينج ، @ . * > 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 يجب فقط استخدام رد الفعل السبات

On Thu, 6 May 2021, 10:51 Davide D'Alto, @ . في الخميس ، 6 مايو 2021 ، الساعة 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 أنت مستخدم ووجدت هذه المشكلة أثناء استخدام تفاعل الإسبات في ملف
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. يمكنك فقط إرسال ملف واحد إلينا ويمكننا تشغيله.

Use ORM 5.4, the default, for now. استخدم ORM 5.4 ، الافتراضي ، في الوقت الحالي.
Not sure why we need to worry about maven, but do what you think is right. لست متأكدًا من سبب حاجتنا للقلق بشأن المخضرمين ، لكن افعل ما تعتقد أنه صحيح.

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, @ . في الأربعاء ، 5 مايو 2021 ، الساعة 21:48 ، جافين كينج ، @ . * > 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 ، دائمًا ، سيكون هناك أخطاء تتكامل مع الموارد البشرية. For example, suppose Quarkus passes arguments to HR in the wrong order. على سبيل المثال ، افترض أن Quarkus يمرر الحجج إلى الموارد البشرية بالترتيب الخاطئ. 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. تتمثل إحدى طرق تسهيل إضافة أداة إعادة إنتاج المستخدم إلى اختبار الوحدة في جعل النموذج يمتد بطريقة ما 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? maxandersengavinking ما هي مشكلة JBang و testcontainers؟ 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

تكمن المشكلة في استخدام عناوين URL لـ JDBC التي تحتوي على tc: .

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? هل من الممكن الإشارة إلى مستودع جيثب كموقع للقالب؟

en

testcase is the template name found in jbang-catalog. testcase هو اسم القالب الموجود في كتالوج jbang.

hibernate/hibernate-reactive maps to github.com/hibernate/hibernate-reactive. خرائط تفاعلية السبات / السبات إلى github.com/hibernate/hibernate-reactive.

so that is the github repository location. لذلك هذا هو موقع مستودع جيثب.

en

Ah nice! آه جميل! I will try it سأجربه

en
هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات