jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.56k stars 4.02k forks source link

Failing integration tests for reactive apps #9398

Closed pvliss closed 5 years ago

pvliss commented 5 years ago
Overview of the issue

The integration tests fail for sample webflux-mongo that tests reactive support. See https://jhipster.visualstudio.com/generator-jhipster/_build/results?buildId=2494

The problem

Motivation for or Use Case

The integration tests should pass

Reproduce the error

Run integration tests for webflux-mongo

Related issues

The problem is more likely due to the changes in #9326 and was hidden while the integration tests were not properly executed. This is now fixed with #9396

Suggest a Fix

Not sure

JHipster Version(s)

Current master (6.x)

travis-webflux@0.0.0 /home/pav/Development/temp/jhipster-java/webflux-mongodb
└── generator-jhipster@5.8.2  -> /home/pav/Development/oss/generator-jhipster
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "reactive": true,
    "baseName": "travisWebflux",
    "packageName": "io.github.jhipster.travis",
    "packageFolder": "io/github/jhipster/travis",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "prodDatabaseType": "mongodb",
    "searchEngine": false,
    "useSass": false,
    "buildTool": "maven",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "fr"
    ],
    "testFrameworks": [
      "gatling"
    ],
    "serverPort": "8080",
    "jhiPrefix": "jhi",
    "travis": true,
    "clientPackageManager": "npm",
    "skipClient": true,
    "jhipsterVersion": "5.8.2",
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "otherModules": [],
    "entitySuffix": "",
    "dtoSuffix": "DTO"
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity DocumentBankAccount {
  name String required,
  bankNumber Integer,
  agencyNumber Long,
  lastOperationDuration Float,
  meanOperationDuration Double,
  balance BigDecimal required,
  openingDay LocalDate,
  lastOperationDate Instant,
  active Boolean,
  accountType BankAccountType,
  attachment AnyBlob,
  description TextBlob
}
entity FieldTestEntity {
  stringTom String,
  stringRequiredTom String required,
  stringMinlengthTom String minlength(0),
  stringMaxlengthTom String maxlength(20),
  stringPatternTom String pattern(/^[a-zA-Z0-9]*$/),
  integerTom Integer,
  integerRequiredTom Integer required,
  integerMinTom Integer min(0),
  integerMaxTom Integer max(100),
  longTom Long,
  longRequiredTom Long required,
  longMinTom Long min(0),
  longMaxTom Long max(100),
  floatTom Float,
  floatRequiredTom Float required,
  floatMinTom Float min(0),
  floatMaxTom Float max(100),
  doubleRequiredTom Double required,
  doubleMinTom Double min(0),
  doubleMaxTom Double max(100),
  bigDecimalRequiredTom BigDecimal required,
  bigDecimalMinTom BigDecimal min(0),
  bigDecimalMaxTom BigDecimal max(100),
  localDateTom LocalDate,
  localDateRequiredTom LocalDate required,
  instantTom Instant,
  instantRequiredTom Instant required,
  zonedDateTimeTom ZonedDateTime,
  zonedDateTimeRequiredTom ZonedDateTime required,
  booleanTom Boolean,
  booleanRequiredTom Boolean required,
  enumTom EnumFieldClass,
  enumRequiredTom EnumRequiredFieldClass required,
  byteImageTom ImageBlob,
  byteImageRequiredTom ImageBlob required,
  byteImageMinbytesTom ImageBlob minbytes(0),
  byteImageMaxbytesTom ImageBlob maxbytes(10000),
  byteAnyTom AnyBlob,
  byteAnyRequiredTom AnyBlob required,
  byteAnyMinbytesTom AnyBlob minbytes(0),
  byteAnyMaxbytesTom AnyBlob maxbytes(10000),
  byteTextTom TextBlob,
  byteTextRequiredTom TextBlob required,
  byteTextMinbytesTom TextBlob minbytes(0),
  byteTextMaxbytesTom TextBlob maxbytes(10000)
}
entity FieldTestInfiniteScrollEntity {
  stringHugo String,
  stringRequiredHugo String required,
  stringMinlengthHugo String minlength(0),
  stringMaxlengthHugo String maxlength(20),
  stringPatternHugo String pattern(/^[a-zA-Z0-9]*$/),
  integerHugo Integer,
  integerRequiredHugo Integer required,
  integerMinHugo Integer min(0),
  integerMaxHugo Integer max(100),
  longHugo Long,
  longRequiredHugo Long required,
  longMinHugo Long min(0),
  longMaxHugo Long max(100),
  floatHugo Float,
  floatRequiredHugo Float required,
  floatMinHugo Float min(0),
  floatMaxHugo Float max(100),
  doubleRequiredHugo Double required,
  doubleMinHugo Double min(0),
  doubleMaxHugo Double max(100),
  bigDecimalRequiredHugo BigDecimal required,
  bigDecimalMinHugo BigDecimal min(0),
  bigDecimalMaxHugo BigDecimal max(100),
  localDateHugo LocalDate,
  localDateRequiredHugo LocalDate required,
  instantHugo Instant,
  instanteRequiredHugo Instant required,
  zonedDateTimeHugo ZonedDateTime,
  zonedDateTimeRequiredHugo ZonedDateTime required,
  booleanHugo Boolean,
  booleanRequiredHugo Boolean required,
  enumHugo EnumFieldClass,
  enumRequiredHugo EnumRequiredFieldClass required,
  byteImageHugo ImageBlob,
  byteImageRequiredHugo ImageBlob required,
  byteImageMinbytesHugo ImageBlob minbytes(0),
  byteImageMaxbytesHugo ImageBlob maxbytes(10000),
  byteAnyHugo AnyBlob,
  byteAnyRequiredHugo AnyBlob required,
  byteAnyMinbytesHugo AnyBlob minbytes(0),
  byteAnyMaxbytesHugo AnyBlob maxbytes(10000),
  byteTextHugo TextBlob,
  byteTextRequiredHugo TextBlob required,
  byteTextMinbytesHugo TextBlob minbytes(0),
  byteTextMaxbytesHugo TextBlob maxbytes(10000)
}
entity FieldTestMapstructEntity {
  stringEva String,
  stringRequiredEva String required,
  stringMinlengthEva String minlength(0),
  stringMaxlengthEva String maxlength(20),
  stringPatternEva String pattern(/^[a-zA-Z0-9]*$/),
  integerEva Integer,
  integerRequiredEva Integer required,
  integerMinEva Integer min(0),
  integerMaxEva Integer max(100),
  longEva Long,
  longRequiredEva Long required,
  longMinEva Long min(0),
  longMaxEva Long max(100),
  floatEva Float,
  floatRequiredEva Float required,
  floatMinEva Float min(0),
  floatMaxEva Float max(100),
  doubleRequiredEva Double required,
  doubleMinEva Double min(0),
  doubleMaxEva Double max(100),
  bigDecimalRequiredEva BigDecimal required,
  bigDecimalMinEva BigDecimal min(0),
  bigDecimalMaxEva BigDecimal max(100),
  localDateEva LocalDate,
  localDateRequiredEva LocalDate required,
  instantEva Instant,
  instanteRequiredEva Instant required,
  zonedDateTimeEva ZonedDateTime,
  zonedDateTimeRequiredEva ZonedDateTime required,
  booleanEva Boolean,
  booleanRequiredEva Boolean required,
  enumEva EnumFieldClass,
  enumRequiredEva EnumRequiredFieldClass required,
  byteImageEva ImageBlob,
  byteImageRequiredEva ImageBlob required,
  byteImageMinbytesEva ImageBlob minbytes(0),
  byteImageMaxbytesEva ImageBlob maxbytes(10000),
  byteAnyEva AnyBlob,
  byteAnyRequiredEva AnyBlob required,
  byteAnyMinbytesEva AnyBlob minbytes(0),
  byteAnyMaxbytesEva AnyBlob maxbytes(10000),
  byteTextEva TextBlob,
  byteTextRequiredEva TextBlob required,
  byteTextMinbytesEva TextBlob minbytes(0),
  byteTextMaxbytesEva TextBlob maxbytes(10000)
}
entity FieldTestPagerEntity {
  stringJade String,
  stringRequiredJade String required,
  stringMinlengthJade String minlength(0),
  stringMaxlengthJade String maxlength(20),
  stringPatternJade String pattern(/^[a-zA-Z0-9]*$/),
  integerJade Integer,
  integerRequiredJade Integer required,
  integerMinJade Integer min(0),
  integerMaxJade Integer max(100),
  longJade Long,
  longRequiredJade Long required,
  longMinJade Long min(0),
  longMaxJade Long max(100),
  floatJade Float,
  floatRequiredJade Float required,
  floatMinJade Float min(0),
  floatMaxJade Float max(100),
  doubleRequiredJade Double required,
  doubleMinJade Double min(0),
  doubleMaxJade Double max(100),
  bigDecimalRequiredJade BigDecimal required,
  bigDecimalMinJade BigDecimal min(0),
  bigDecimalMaxJade BigDecimal max(100),
  localDateJade LocalDate,
  localDateRequiredJade LocalDate required,
  instantJade Instant,
  instanteRequiredJade Instant required,
  zonedDateTimeJade ZonedDateTime,
  zonedDateTimeRequiredJade ZonedDateTime required,
  booleanJade Boolean,
  booleanRequiredJade Boolean required,
  enumJade EnumFieldClass,
  enumRequiredJade EnumRequiredFieldClass required,
  byteImageJade ImageBlob,
  byteImageRequiredJade ImageBlob required,
  byteImageMinbytesJade ImageBlob minbytes(0),
  byteImageMaxbytesJade ImageBlob maxbytes(10000),
  byteAnyJade AnyBlob,
  byteAnyRequiredJade AnyBlob required,
  byteAnyMinbytesJade AnyBlob minbytes(0),
  byteAnyMaxbytesJade AnyBlob maxbytes(10000),
  byteTextJade TextBlob,
  byteTextRequiredJade TextBlob required,
  byteTextMinbytesJade TextBlob minbytes(0),
  byteTextMaxbytesJade TextBlob maxbytes(10000)
}
entity FieldTestPaginationEntity {
  stringAlice String,
  stringRequiredAlice String required,
  stringMinlengthAlice String minlength(0),
  stringMaxlengthAlice String maxlength(20),
  stringPatternAlice String pattern(/^[a-zA-Z0-9]*$/),
  integerAlice Integer,
  integerRequiredAlice Integer required,
  integerMinAlice Integer min(0),
  integerMaxAlice Integer max(100),
  longAlice Long,
  longRequiredAlice Long required,
  longMinAlice Long min(0),
  longMaxAlice Long max(100),
  floatAlice Float,
  floatRequiredAlice Float required,
  floatMinAlice Float min(0),
  floatMaxAlice Float max(100),
  doubleRequiredAlice Double required,
  doubleMinAlice Double min(0),
  doubleMaxAlice Double max(100),
  bigDecimalRequiredAlice BigDecimal required,
  bigDecimalMinAlice BigDecimal min(0),
  bigDecimalMaxAlice BigDecimal max(100),
  localDateAlice LocalDate,
  localDateRequiredAlice LocalDate required,
  instantAlice Instant,
  instanteRequiredAlice Instant required,
  zonedDateTimeAlice ZonedDateTime,
  zonedDateTimeRequiredAlice ZonedDateTime required,
  booleanAlice Boolean,
  booleanRequiredAlice Boolean required,
  enumAlice EnumFieldClass,
  enumRequiredAlice EnumRequiredFieldClass required,
  byteImageAlice ImageBlob,
  byteImageRequiredAlice ImageBlob required,
  byteImageMinbytesAlice ImageBlob minbytes(0),
  byteImageMaxbytesAlice ImageBlob maxbytes(10000),
  byteAnyAlice AnyBlob,
  byteAnyRequiredAlice AnyBlob required,
  byteAnyMinbytesAlice AnyBlob minbytes(0),
  byteAnyMaxbytesAlice AnyBlob maxbytes(10000),
  byteTextAlice TextBlob,
  byteTextRequiredAlice TextBlob required,
  byteTextMinbytesAlice TextBlob minbytes(0),
  byteTextMaxbytesAlice TextBlob maxbytes(10000)
}
entity FieldTestServiceClassEntity {
  stringBob String,
  stringRequiredBob String required,
  stringMinlengthBob String minlength(0),
  stringMaxlengthBob String maxlength(20),
  stringPatternBob String pattern(/^[a-zA-Z0-9]*$/),
  integerBob Integer,
  integerRequiredBob Integer required,
  integerMinBob Integer min(0),
  integerMaxBob Integer max(100),
  longBob Long,
  longRequiredBob Long required,
  longMinBob Long min(0),
  longMaxBob Long max(100),
  floatBob Float,
  floatRequiredBob Float required,
  floatMinBob Float min(0),
  floatMaxBob Float max(100),
  doubleRequiredBob Double required,
  doubleMinBob Double min(0),
  doubleMaxBob Double max(100),
  bigDecimalRequiredBob BigDecimal required,
  bigDecimalMinBob BigDecimal min(0),
  bigDecimalMaxBob BigDecimal max(100),
  localDateBob LocalDate,
  localDateRequiredBob LocalDate required,
  instantBob Instant,
  instanteRequiredBob Instant required,
  zonedDateTimeBob ZonedDateTime,
  zonedDateTimeRequiredBob ZonedDateTime required,
  booleanBob Boolean,
  booleanRequiredBob Boolean required,
  enumBob EnumFieldClass,
  enumRequiredBob EnumRequiredFieldClass required,
  byteImageBob ImageBlob,
  byteImageRequiredBob ImageBlob required,
  byteImageMinbytesBob ImageBlob minbytes(0),
  byteImageMaxbytesBob ImageBlob maxbytes(10000),
  byteAnyBob AnyBlob,
  byteAnyRequiredBob AnyBlob required,
  byteAnyMinbytesBob AnyBlob minbytes(0),
  byteAnyMaxbytesBob AnyBlob maxbytes(10000),
  byteTextBob TextBlob,
  byteTextRequiredBob TextBlob required,
  byteTextMinbytesBob TextBlob minbytes(0),
  byteTextMaxbytesBob TextBlob maxbytes(10000)
}
entity FieldTestServiceImplEntity {
  stringMika String,
  stringRequiredMika String required,
  stringMinlengthMika String minlength(0),
  stringMaxlengthMika String maxlength(20),
  stringPatternMika String pattern(/^[a-zA-Z0-9]*$/),
  integerMika Integer,
  integerRequiredMika Integer required,
  integerMinMika Integer min(0),
  integerMaxMika Integer max(100),
  longMika Long,
  longRequiredMika Long required,
  longMinMika Long min(0),
  longMaxMika Long max(100),
  floatMika Float,
  floatRequiredMika Float required,
  floatMinMika Float min(0),
  floatMaxMika Float max(100),
  doubleRequiredMika Double required,
  doubleMinMika Double min(0),
  doubleMaxMika Double max(100),
  bigDecimalRequiredMika BigDecimal required,
  bigDecimalMinMika BigDecimal min(0),
  bigDecimalMaxMika BigDecimal max(100),
  localDateMika LocalDate,
  localDateRequiredMika LocalDate required,
  instantMika Instant,
  instanteRequiredMika Instant required,
  zonedDateTimeMika ZonedDateTime,
  zonedDateTimeRequiredMika ZonedDateTime required,
  booleanMika Boolean,
  booleanRequiredMika Boolean required,
  enumMika EnumFieldClass,
  enumRequiredMika EnumRequiredFieldClass required,
  byteImageMika ImageBlob,
  byteImageRequiredMika ImageBlob required,
  byteImageMinbytesMika ImageBlob minbytes(0),
  byteImageMaxbytesMika ImageBlob maxbytes(10000),
  byteAnyMika AnyBlob,
  byteAnyRequiredMika AnyBlob required,
  byteAnyMinbytesMika AnyBlob minbytes(0),
  byteAnyMaxbytesMika AnyBlob maxbytes(10000),
  byteTextMika TextBlob,
  byteTextRequiredMika TextBlob required,
  byteTextMinbytesMika TextBlob minbytes(0),
  byteTextMaxbytesMika TextBlob maxbytes(10000)
}

enum BankAccountType {
  CHECKING,
  SAVINGS,
  LOAN
}

enum EnumFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}

enum EnumRequiredFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}

dto DocumentBankAccount, FieldTestMapstructEntity with mapstruct
service DocumentBankAccount, FieldTestServiceImplEntity with serviceImpl
service FieldTestMapstructEntity, FieldTestServiceClassEntity with serviceClass
paginate FieldTestInfiniteScrollEntity with infinite-scroll
paginate FieldTestPagerEntity with pager
paginate FieldTestPaginationEntity with pagination
filter FieldTestServiceClassEntity

Environment and Tools

java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

git version 2.17.1

node: v10.15.2

npm: 6.8.0

yeoman: 2.0.5

Docker version 18.09.3, build 774a1f4

docker-compose version 1.23.2, build 1110ad01

INFO! Congratulations, JHipster execution is complete!

Browsers and Operating System

Ubuntu 18.04

DanielFran commented 5 years ago

@cbornet Can you help to fix the tests? Thanks

pvliss commented 5 years ago

Did a bit of investigation on this issue and it appears that the problem is the use of javax.servlet.http.HttpServletRequest which is not supported by reactive Spring as explained in this Stack Overflow answer. Further looking into the webflux docs verifies that servlet API is not supported and should be avoided. We could instead instead pass the URI and params map to PaginationUtil or find an interface that provides access to both parameters and supported by both webflux and blocking APIs.

@cbornet I could do a PR if you do not mind and have not already started work on this.

On a side note, I noticed that no integration tests are generated for the entities for the webflux-mongodb sample and otherwise we would see more errors I guess. Is this intentional(e.g. not supported yet) or maybe we have another issue?

cbornet commented 5 years ago

There are already PRs to fix this.

pvliss commented 5 years ago

Oh sorry, I did not realize. Why are they not merged then?

cbornet commented 5 years ago

See #9379. There was a change in PaginationUtils to make it use HttpServletRequest but that fails with Webflux. The fix is to use UriComponentsBuilder and RequestParam instead.

pvliss commented 5 years ago

@DanielFran @cbornet has created https://github.com/jhipster/jhipster/pull/202 and https://github.com/jhipster/generator-jhipster/pull/9379 to fix this issue. Can you have a look and merge them as they fix the CI problem?

cbornet commented 5 years ago

BTW the entity generator hasn't been done yet for Webflux.

pvliss commented 5 years ago

Cool. Thanks

pvliss commented 5 years ago

Closed by #9379