mvn test on a UAA microservice fails after generating an entity. The error thrown is Caused by: java.lang.IllegalStateException: No instances available for uaa (my UAA folder is 'uaa' and it is running, though this shouldn't affect tests). The application runs fine with mvn
Note: On v3.5.1, the error also mentions a liquibase problem, but the original cause is the IllegalStateException. On master, the error only mentions the IllegalStateException.
Master error stacktrace
v3.5.1 error stacktrace
Generate a UAA
Generate a microservice
Generate an entity in the microservice and run mvn test
I'm new to the UAA so can't help much.
Master and v3.5.1
.yo-rc.json file generated in the root folderAll default options (except auth is UAA)
Basic UAA App (Click to expand)
{
"generator-jhipster": {
"jhipsterVersion": "3.5.1",
"baseName": "uaa",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "9999",
"authenticationType": "uaa",
"hibernateCache": "hazelcast",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"buildTool": "maven",
"enableTranslation": true,
"applicationType": "uaa",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"skipClient": true,
"nativeLanguage": "en",
"languages": [
"en"
],
"clusteredHttpSession": "no",
"websocket": "no",
"enableSocialSignIn": false
}
}
Basic Microservice using UAA (Click to expand)
{
"generator-jhipster": {
"jhipsterVersion": "3.5.1",
"baseName": "errorservice",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8081",
"authenticationType": "uaa",
"uaaBaseName": "uaa",
"hibernateCache": "hazelcast",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"buildTool": "maven",
"jwtSecretKey": "a2242a7492e7714b950084f321e7118b2cca4b4e",
"enableTranslation": true,
"applicationType": "microservice",
"testFrameworks": [
"gatling"
],
"jhiPrefix": "jhi",
"skipClient": true,
"skipUserManagement": true,
"nativeLanguage": "en",
"languages": [
"en"
]
}
}
entityName.json files generated in the .jhipster directoryFoo entity.
{
"relationships": [],
"fields": [],
"changelogDate": "20160812220440",
"dto": "no",
"service": "no",
"entityTableName": "foo",
"pagination": "no",
"microserviceName": "errorservice",
"searchEngine": "no"
}
Hello,
I have the same bug.
We can't do unit test in the project.
You have a solution for this bug or not ? I post this question because if you have a solution, i stay with your Oaut2 (microservice) but else i go to CAS.
I think the solution is to not connect project to UAA for the unit test.
UAA is totally in BETA, I should even have written "very early alpha", so I'm not surprised it doesn't work.
I'm cc'ing @xetys as he coded this UAA support, but he's currently doing his exams, and school is much more important than an Open Source project!
Ok yes i understand. Thank you for your response.
If i resolve this problem, i tell you the solution.
A possible fix is to add @ConditionalOnProperty(value = "eureka.client.enabled") above MicroserviceSecurityConfiguration, getting an oauth key from the UAA isn't possible when eureka is disabled. Does the UAA need to be mocked in tests?
Thank you very much. This annotation work in microservice project.
I think its related to #4005
Most helpful comment
A possible fix is to add
@ConditionalOnProperty(value = "eureka.client.enabled")above MicroserviceSecurityConfiguration, getting an oauth key from the UAA isn't possible when eureka is disabled. Does the UAA need to be mocked in tests?