jhipster / generator-jhipster-quarkus

Quarkus blueprint for JHipster
https://www.jhipster.tech/blueprints/quarkus/
Apache License 2.0
141 stars 56 forks source link

Tests failing in a newly generated application with JdbcSQLException: NULL not allowed for column "ID" #111

Closed GeraldScott closed 3 years ago

GeraldScott commented 4 years ago

Describe the bug A newly generated application fails multiple tests when running ./mvnw verify, even though the application is generated successfully, and the newly created application runs as expected.

To Reproduce Steps to reproduce the behavior:

  1. Install generator-jhipster and generator-jhipster-quarkus
  2. Generate application:
    mkdir test && cd $_
    jhipster --blueprints quarkus
    ? What is the base name of your application? test
     info Using blueprint generator-jhipster-quarkus for server subgenerator
    ? What is your default Java package name? com.taung.test
    ? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
    ? Which *production* database would you like to use? PostgreSQL
    ? Which *development* database would you like to use? H2 with in-memory persistence
    ? Which *Framework* would you like to use for the client? Angular
    ? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Lux
    ? Choose a Bootswatch variant navbar theme (https://bootswatch.com/)? Dark
     info Using blueprint generator-jhipster-quarkus for common subgenerator
    ? Would you like to enable internationalization support? No
  3. Run ./mvnw verify
  4. See multiple instances of the same error:
    ERROR [org.hib.eng.jdb.spi.SqlExceptionHelper] (executor-thread-1) NULL not allowed for column "ID"; SQL statement:
    insert into jhi_user (id, activated, activation_key, created_by, created_date, email, first_name, image_url, lang_key, last_modified_by, last_modified_date, last_name, login, password_hash, reset_date, reset_key) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23502-197]
    2020-10-15 12:06:03,349 ERROR [io.und.req.io] (executor-thread-1) Exception handling request ba407178-956e-472f-adb5-3088aadc8744-12 to /api/users: org.jboss.resteasy.spi.UnhandledException: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
    at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
    at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
    at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:515)
    at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
    at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
    [...]
    Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
    at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:716)
    at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:696)
    ... 106 more
    Caused by: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "ID"; SQL statement:
    insert into jhi_user (id, activated, activation_key, created_by, created_date, email, first_name, image_url, lang_key, last_modified_by, last_modified_date, last_name, login, password_hash, reset_date, reset_key) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23502-197]

    Expected behavior The test execution on a newly generated, unmodified application should pass all tests.

Errors Running ./mvnw verify runs 57 tests, but there are 32 failures:

ERROR] Tests run: 57, Failures: 32, Errors: 0, Skipped: 0

The tests that fail are as follows:

[ERROR]   AccountResourceTest.testActivateAccount:480->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testAuthenticatedUser:135->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testChangePassword:676->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testChangePasswordEmpty:751->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testChangePasswordTooLong:726->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testChangePasswordTooSmall:701->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testChangePasswordWrongExistingPassword:651->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testFinishPasswordReset:836->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testFinishPasswordResetTooSmall:878->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testGetExistingAccount:159->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testRegisterDuplicateEmail:377 1 expectation failed.
[ERROR]   AccountResourceTest.testRegisterDuplicateLogin:331 1 expectation failed.
[ERROR]   AccountResourceTest.testRegisterValid:198->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testRequestPasswordReset:776->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testRequestPasswordResetUpperCaseEmail:796->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testRequestPasswordResetWrongEmail:816->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testSaveAccount:500->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testSaveExistingEmail:575->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testSaveExistingEmailAndLogin:617->registerUser:82 1 expectation failed.
[ERROR]   AccountResourceTest.testSaveInvalidEmail:541->registerUser:82 1 expectation failed.
[ERROR]   UserJWTControllerTest.testAuthorize:78->registerUser:53 1 expectation failed.
[ERROR]   UserJWTControllerTest.testAuthorizeWithRememberMe:108->registerUser:53 1 expectation failed.
[ERROR]   UserResourceTest.createUser:113 1 expectation failed.
[ERROR]   UserResourceTest.createUserWithExistingEmail:196 1 expectation failed.
[ERROR]   UserResourceTest.createUserWithExistingLogin:157 1 expectation failed.
[ERROR]   UserResourceTest.deleteUser:549 1 expectation failed.
[ERROR]   UserResourceTest.getAllUsers:235 1 expectation failed.
[ERROR]   UserResourceTest.getUser:269 1 expectation failed.
[ERROR]   UserResourceTest.updateUser:302 1 expectation failed.
[ERROR]   UserResourceTest.updateUserExistingEmail:413 1 expectation failed.
[ERROR]   UserResourceTest.updateUserExistingLogin:481 1 expectation failed.
[ERROR]   UserResourceTest.updateUserLogin:356 1 expectation failed.

Additional information):

joewhite101 commented 4 years ago

Thanks for reporting. Can you post your .yo-rc.json file?

GeraldScott commented 4 years ago
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.taung.test"
    },
    "jhipsterVersion": "6.8.0",
    "applicationType": "monolith",
    "baseName": "test",
    "packageName": "com.taung.test",
    "packageFolder": "com/taung/test",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "prodDatabaseType": "postgresql",
    "messageBroker": false,
    "buildTool": "maven",
    "jwtSecretKey": "ZjM1NzgyYTc1MmJlZWUyMDM1MzU0YzhmMGU4MDI1ZDQxNTYzMWUxOTcwNjNjMWI3NWNjYzBiMmVmOWY3MjhjZWM3ODBjNjc4Y2UxOTg5N2RlZDFkZjJlOTE2OGIzOTllMjQ1NGYzMmZlNGUxMmNkMDg5ZDAxOWI0MDliMWU1YzY=",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "lux",
    "clientThemeVariant": "dark",
    "creationTimestamp": 1602763926012,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "0.1.6"
      }
    ],
    "enableTranslation": false,
    "blueprints": [
      {
        "name": "generator-jhipster-quarkus",
        "version": "0.1.6"
      }
    ]
  }
}
inngvar commented 4 years ago

@GeraldScott this is fixed in main branch, wait for release or build blueprint locally and use it to generate application

GeraldScott commented 4 years ago

@inngvar I built the blueprint locally and can confirm that the fix works. Many thanks