IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Boot Java Discussion :

Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate


Sujet :

Spring Boot Java

  1. #61
    Candidat au Club Avatar de jerome villiseck
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2020
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2020
    Messages : 1
    Points : 2
    Points
    2
    Par défaut RESOLU - Tests d'intégration continue - mvn clean install -PintegrationTest
    Citation Envoyé par parchemal Voir le message
    Bonjour,

    Ce n'est pas normal d'avoir Tomcat initialized with port(s): 0 (http). Vous devez avoir le port 8484 ou 8080 et non 0, selon votre configuration
    Par ailleurs, vous avez la version Spring Boot 2.2.4.RELEASE, essayez plutôt Spring Boot-2.2.6-RELEASE comme dans le tutoriel. Mais, je dois avoué que je n'ai pas rencontré tous ces problèmes.

    Courage !!
    Bonjour, après avoir cherché un moment, je viens de trouver pourquoi le lancement des tests avec la commande
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    mvn clean install -PintegrationTest
    ne fonctionnait pas.

    Il faut mettre dans la classe UserControllerIntegrationTest en value de l'annotation @SpringBootTest la valeur suivante DEFINED_PORT :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    @RunWith(SpringRunner.class)
    @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) //Mettre DEFINED_PORT pour avoir le port 8080 pour les TI
    //Lors du lancement de la commande mvn clean install -PintegrationTest, fera les tests d'integration continue sur le port 8080
    public class UserControllerIntegrationTest {
        //En cas de lancement manuel des tests avec l'IDE, lancer l'application spring au préalable comme pour les TU
     
        @Autowired
        private TestRestTemplate restTemplate; //dépendance nécessaire pour écrire les requêtes HTTP.
        private static final String URL = "http://localhost:8080";//url du serveur REST. Cet url peut être celle d'un serveur distant
     
        private String getURLWithPort(String uri) {
            return URL + uri;
        }
    Ceci va avoir pour effet de lancer en console
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Tomcat initialized with port(s): 8080 (http)
    Le cours mentionne de mettre RANDOM PORT comme valeur de l'annotation. J'ai essayé de mettre un port spécifié type 8484, mais l'enum WebEnvironment de la classe SpringBootTest ne le permet pas, la redéfinition de l'interface également de cette classe ne m'a pas permis pour l'heure de pouvoir spécifié un port également.

    Le tomcat embedded démarre sur le port 8484, mais les appels sur ce port échouent. Grâce à la valeur DEFINED_PORT, et en faisant les appels sur le port 8080 dans les tests d'intégration, les tests d'intégration fonctionnent.

    Code x : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
    WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [INFO] Scanning for projects...
    [INFO] 
    [INFO] -----------------< fr.jerome:springboot-restserverapi >-----------------
    [INFO] Building springboot-restserverapi 0.0.1-SNAPSHOT
    [INFO] --------------------------------[ war ]---------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ springboot-restserverapi ---
    [INFO] Deleting /home/jerome/IdeaProjects/springboot-restserverapi/target
    [INFO] 
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ springboot-restserverapi ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 4 resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ springboot-restserverapi ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 20 source files to /home/jerome/IdeaProjects/springboot-restserverapi/target/classes
    [INFO] 
    [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ springboot-restserverapi ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /home/jerome/IdeaProjects/springboot-restserverapi/src/test/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ springboot-restserverapi ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 5 source files to /home/jerome/IdeaProjects/springboot-restserverapi/target/test-classes
    [INFO] /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java: /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java uses or overrides a deprecated API.
    [INFO] /home/jerome/IdeaProjects/springboot-restserverapi/src/test/java/fr/jerome/springbootrestserverapi/controller/UserControllerTest.java: Recompile with -Xlint:deprecation for details.
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ springboot-restserverapi ---
    [INFO] Tests are skipped.
    [INFO] 
    [INFO] --- maven-war-plugin:3.2.3:war (default-war) @ springboot-restserverapi ---
    [INFO] Packaging webapp
    [INFO] Assembling webapp [springboot-restserverapi] in [/home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver]
    [INFO] Processing war project
    [INFO] Webapp assembled in [125 msecs]
    [INFO] Building war: /home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver.war
    [INFO] 
    [INFO] --- spring-boot-maven-plugin:2.2.6.RELEASE:repackage (repackage) @ springboot-restserverapi ---
    [INFO] Replacing main artifact with repackaged archive
    [INFO] 
    [INFO] --- cargo-maven2-plugin:1.7.10:start (start-server) @ springboot-restserverapi ---
    [INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.7.10 for container tomcat9x
    [INFO] [beddedLocalContainer] Tomcat 9.x Embedded starting...
    avr. 02, 2020 10:19:33 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-nio-8484"]
    avr. 02, 2020 10:19:33 AM org.apache.catalina.core.StandardService startInternal
    INFOS: Starting service [Tomcat]
    avr. 02, 2020 10:19:33 AM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet engine: [Apache Tomcat/9.0.30]
    avr. 02, 2020 10:19:33 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-nio-8484"]
    avr. 02, 2020 10:19:34 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
    INFOS: No global web.xml found
    avr. 02, 2020 10:19:36 AM org.apache.catalina.core.ApplicationContext log
    INFOS: 2 Spring WebApplicationInitializers detected on classpath
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.6.RELEASE)
    
    2020-04-02 10:19:37 - Starting ServletInitializer v0.0.1-SNAPSHOT on jerome-HP-ProBook-640-G1 with PID 12132 (/home/jerome/IdeaProjects/springboot-restserverapi/target/cargo/configurations/tomcat9x/webapps/springboot-restserver/WEB-INF/classes started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi)
    2020-04-02 10:19:37 - Running with Spring Boot v2.2.6.RELEASE, Spring v5.2.5.RELEASE
    2020-04-02 10:19:37 - The following profiles are active: prod
    2020-04-02 10:19:38 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-02 10:19:38 - Finished Spring Data repository scanning in 77ms. Found 2 JPA repository interfaces.
    2020-04-02 10:19:39 - Initializing Spring embedded WebApplicationContext
    2020-04-02 10:19:39 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-02 10:19:39 - Root WebApplicationContext: initialization completed in 1445 ms
    2020-04-02 10:19:39 - HikariPool-1 - Starting...
    2020-04-02 10:19:39 - HikariPool-1 - Start completed.
    2020-04-02 10:19:39 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-02 10:19:39 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-02 10:19:40 - HHH000412: Hibernate ORM core version 5.4.12.Final
    2020-04-02 10:19:40 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-02 10:19:40 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-02 10:19:41 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-02 10:19:41 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-02 10:19:42 - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
    2020-04-02 10:19:42 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-02 10:19:42 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-02 10:19:43 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-02 10:19:43 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-02 10:19:43 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-02 10:19:43 - Started ServletInitializer in 6.35 seconds (JVM running for 18.325)
    2020-04-02 10:19:43 - At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    2020-04-02 10:19:43 - Filter 'crossDomainFilter' configured for use
    [INFO] [beddedLocalContainer] Tomcat 9.x Embedded started on port [8484]
    [INFO] 
    [INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) @ springboot-restserverapi ---
    [INFO] 
    [INFO] -------------------------------------------------------
    [INFO]  T E S T S
    [INFO] -------------------------------------------------------
    10:19:44.738 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:44.742 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    10:19:44.747 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
    10:19:44.787 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
    10:19:44.800 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    10:19:44.805 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTest-context.xml] does not exist
    10:19:44.807 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTestContext.groovy] does not exist
    10:19:44.807 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: no resource found for suffixes {-context.xml, Context.groovy}.
    10:19:44.808 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: UserControllerIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
    10:19:44.848 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:44.953 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/home/jerome/IdeaProjects/springboot-restserverapi/target/classes/fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplication.class]
    10:19:44.954 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    10:19:45.034 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    10:19:45.035 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
    10:19:45.054 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@39b43d60, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@44be0077, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@2205a05d, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@72ef8d15, org.springframework.test.context.support.DirtiesContextTestExecutionListener@6aa8e115, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5e21e98f, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@51a9ad5e, org.springframework.test.context.event.EventPublishingTestExecutionListener@5f20155b, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@72ade7e3, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@239105a8, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@3fce8fd9, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@609bcfb6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@7d94beb9]
    10:19:45.058 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.059 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.093 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
    10:19:45.094 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
    10:19:45.095 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    10:19:45.096 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTest-context.xml] does not exist
    10:19:45.097 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: class path resource [fr/jerome/springbootrestserverapi/controller/UserControllerIntegrationTestContext.groovy] does not exist
    10:19:45.097 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: no resource found for suffixes {-context.xml, Context.groovy}.
    10:19:45.097 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: UserControllerIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
    10:19:45.100 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.101 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    10:19:45.103 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    10:19:45.103 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
    10:19:45.104 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@5b3f61ff, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@3e2059ae, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@398dada8, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@7cb502c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@275bf9b3, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1b8a29df, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@4fbe37eb, org.springframework.test.context.event.EventPublishingTestExecutionListener@12a94400, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@6a47b187, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@2049a9c1, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@1ef6d34c, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@46271dd6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@11bb571c]
    10:19:45.104 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.105 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.184 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.184 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    [INFO] Running fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    10:19:45.198 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.198 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.199 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.200 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.204 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@c9d0d6 testClass = UserControllerIntegrationTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@6ccdb29f testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@776aec5c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@75d4a5c2, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@44c03695, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3bf7ca37], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]], class annotated with @DirtiesContext [false] with mode [null].
    10:19:45.208 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.208 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:19:45.213 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@c9d0d6 testClass = UserControllerIntegrationTest, testInstance = fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest@7ae42ce3, testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@6ccdb29f testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@776aec5c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@75d4a5c2, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@44c03695, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3bf7ca37], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]]].
    10:19:45.240 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.6.RELEASE)
    
    2020-04-02 10:19:45 - Starting UserControllerIntegrationTest on jerome-HP-ProBook-640-G1 with PID 12230 (started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi)
    2020-04-02 10:19:45 - Running with Spring Boot v2.2.6.RELEASE, Spring v5.2.5.RELEASE
    2020-04-02 10:19:45 - The following profiles are active: prod
    2020-04-02 10:19:46 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-02 10:19:46 - Finished Spring Data repository scanning in 64ms. Found 2 JPA repository interfaces.
    2020-04-02 10:19:47 - Tomcat initialized with port(s): 8080 (http)
    2020-04-02 10:19:47 - Starting service [Tomcat]
    2020-04-02 10:19:47 - Starting Servlet engine: [Apache Tomcat/9.0.24]
    2020-04-02 10:19:47 - Initializing Spring embedded WebApplicationContext
    2020-04-02 10:19:47 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-02 10:19:47 - Root WebApplicationContext: initialization completed in 1633 ms
    2020-04-02 10:19:47 - HikariPool-1 - Starting...
    2020-04-02 10:19:47 - HikariPool-1 - Start completed.
    2020-04-02 10:19:47 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-02 10:19:47 - Filter 'crossDomainFilter' configured for use
    2020-04-02 10:19:47 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-02 10:19:47 - HHH000412: Hibernate ORM core version 5.4.12.Final
    2020-04-02 10:19:48 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-02 10:19:48 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-02 10:19:48 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-02 10:19:48 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-02 10:19:49 - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
    2020-04-02 10:19:49 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-02 10:19:49 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-02 10:19:49 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-02 10:19:49 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-02 10:19:49 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-02 10:19:50 - Tomcat started on port(s): 8080 (http) with context path ''
    2020-04-02 10:19:50 - Started UserControllerIntegrationTest in 4.916 seconds (JVM running for 6.426)
    2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-02 10:19:50 - Initializing Spring DispatcherServlet 'dispatcherServlet'
    2020-04-02 10:19:50 - Initializing Servlet 'dispatcherServlet'
    2020-04-02 10:19:50 - Detected StandardServletMultipartResolver
    2020-04-02 10:19:50 - enableLoggingRequestDetails='true': request parameters and headers will be shown which may lead to unsafe logging of potentially sensitive data
    2020-04-02 10:19:50 - Completed initialization in 19 ms
    2020-04-02 10:19:50 - POST "/user/users", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User)
    2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]]
    2020-04-02 10:19:50 - userSave: User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]]
    2020-04-02 10:19:50 - Response 201 CREATED
    2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User]
    2020-04-02 10:19:50 - Completed 201 CREATED
    2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users
    2020-04-02 10:19:50 - Accept=[application/json, application/*+json]
    2020-04-02 10:19:50 - GET "/user/users", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#getAllUsers()
    2020-04-02 10:19:50 - liste des utilisateurs : [User [id=1, login=admin, pass=XXXX-XXX, active=1, roles=[Role{id=1, roleName='ROLE_ADMIN'}, Role{id=2, roleName='ROLE_USER'}]], User [id=2, login=user, pass=XXXX-XXX, active=1, roles=[Role{id=2, roleName='ROLE_USER'}]], User [id=3, login=user1, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]], User [id=4, login=PIPO, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/*+json] and supported [application/json, application/*+json, application/json, application/*+json]
    2020-04-02 10:19:50 - Writing [[User [id=1, login=admin, pass=XXXX-XXX, active=1, roles=[Role{id=1, roleName='ROLE_ADMIN'}, Role{id (truncated)...]
    2020-04-02 10:19:50 - Response 302 FOUND
    2020-04-02 10:19:50 - Reading to [java.lang.Object]
    2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-02 10:19:50 - POST "/user/users", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User)
    2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]]
    2020-04-02 10:19:50 - Completed 302 FOUND
    2020-04-02 10:19:50 - userSave: User [id=5, login=login3, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=5, login=login3, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]]
    2020-04-02 10:19:50 - Response 201 CREATED
    2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User]
    2020-04-02 10:19:50 - HTTP PUT http://localhost:8080/user/users/4
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=5, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=0, roleName='ROLE_ADMIN'}, Role{id=2, roleName='ROLE_USER'}]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-02 10:19:50 - PUT "/user/users/4", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#updateUser(Long, User)
    2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=5, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=0, roleName='ROLE_ADMIN'}, Role{ (truncated)...]
    2020-04-02 10:19:50 - Completed 201 CREATED
    2020-04-02 10:19:50 - UPDATE ROLE: [Role{id=2, roleName='ROLE_USER'}]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=4, login=newLogin, pass=XXXX-XXX, active=1, roles=[Role{id=2, roleName='ROLE_USER'}]]]
    2020-04-02 10:19:50 - Response 200 OK
    2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User]
    2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users/unknowUser
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - GET "/user/users/unknowUser", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#findUserByLogin(String)
    2020-04-02 10:19:50 - Completed 200 OK
    2020-04-02 10:19:50 - Using @ExceptionHandler fr.jerome.springbootrestserverapi.exception.GlobalHandlerControllerException#resourceNotFound(HttpServletRequest, BusinessResourceException)
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json]
    2020-04-02 10:19:50 - Writing [fr.jerome.springbootrestserverapi.exception.BusinessResourceExceptionResponse@63060233]
    2020-04-02 10:19:50 - Resolved [fr.jerome.springbootrestserverapi.exception.BusinessResourceException: L'utilisateur avec ce login n'existe pas :unknowUser]
    2020-04-02 10:19:50 - Completed 204 NO_CONTENT
    2020-04-02 10:19:50 - Response 204 NO_CONTENT
    2020-04-02 10:19:50 - HTTP DELETE http://localhost:8080/user/users/2
    2020-04-02 10:19:50 - Accept=[application/json, application/*+json]
    2020-04-02 10:19:50 - DELETE "/user/users/2", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#deleteUser(Long)
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/*+json] and supported [application/json, application/*+json, application/json, application/*+json]
    2020-04-02 10:19:50 - Nothing to write: null body
    2020-04-02 10:19:50 - Completed 410 GONE
    2020-04-02 10:19:50 - Response 410 GONE
    2020-04-02 10:19:50 - HTTP POST http://localhost:8080/user/users
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-02 10:19:50 - POST "/user/users", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#saveUser(User)
    2020-04-02 10:19:50 - Read "application/json;charset=UTF-8" to [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]]
    2020-04-02 10:19:50 - userSave: User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}] (truncated)...]
    2020-04-02 10:19:50 - Completed 201 CREATED
    2020-04-02 10:19:50 - Response 201 CREATED
    2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User]
    2020-04-02 10:19:50 - HTTP GET http://localhost:8080/user/users/admin@admin.com
    2020-04-02 10:19:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-02 10:19:50 - GET "/user/users/admin@admin.com", parameters={}
    2020-04-02 10:19:50 - Mapped to fr.jerome.springbootrestserverapi.controller.UserController#findUserByLogin(String)
    2020-04-02 10:19:50 - Utilisateur trouvé: User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}]]
    2020-04-02 10:19:50 - Using 'application/json', given [application/json, application/xml, application/*+json, text/xml, application/*+xml] and supported [application/json, application/*+json, application/json, application/*+json, application/xml, text/xml, application/*+xml]
    2020-04-02 10:19:50 - Writing [User [id=6, login=admin@admin.com, pass=XXXX-XXX, active=0, roles=[Role{id=2, roleName='ROLE_USER'}] (truncated)...]
    2020-04-02 10:19:50 - Response 302 FOUND
    2020-04-02 10:19:50 - Reading to [fr.jerome.springbootrestserverapi.model.User]
    2020-04-02 10:19:50 - Completed 302 FOUND
    [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.808 s - in fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    2020-04-02 10:19:51 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-02 10:19:51 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-02 10:19:51 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-02 10:19:51 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-02 10:19:51 - HikariPool-1 - Shutdown initiated...
    2020-04-02 10:19:51 - HikariPool-1 - Shutdown completed.
    [INFO] 
    [INFO] Results:
    [INFO] 
    [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
    [INFO] 
    [INFO] 
    [INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ springboot-restserverapi ---
    [INFO] 
    [INFO] --- cargo-maven2-plugin:1.7.10:stop (stop-server) @ springboot-restserverapi ---
    [INFO] [beddedLocalContainer] Tomcat 9.x Embedded is stopping...
    2020-04-02 10:19:51 - Stopping service [Tomcat]
    2020-04-02 10:19:51 - Closing Spring root WebApplicationContext
    2020-04-02 10:19:51 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-02 10:19:51 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-02 10:19:51 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-02 10:19:51 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-02 10:19:51 - HikariPool-1 - Shutdown initiated...
    2020-04-02 10:19:51 - HikariPool-1 - Shutdown completed.
    [INFO] [beddedLocalContainer] Tomcat 9.x Embedded is stopped
    [INFO] 
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ springboot-restserverapi ---
    [INFO] Installing /home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver.war to /home/jerome/.m2/repository/fr/jerome/springboot-restserverapi/0.0.1-SNAPSHOT/springboot-restserverapi-0.0.1-SNAPSHOT.war
    [INFO] Installing /home/jerome/IdeaProjects/springboot-restserverapi/pom.xml to /home/jerome/.m2/repository/fr/jerome/springboot-restserverapi/0.0.1-SNAPSHOT/springboot-restserverapi-0.0.1-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  30.575 s
    [INFO] Finished at: 2020-04-02T10:19:56+02:00
    [INFO] ------------------------------------------------------------------------

    Bien sur il faudra penser avant de lancer une compilation à arrêter le lancement de l'application en local. Egalement pour lancer les tests d'intégration depuis la classe directement
    Mais cela ne pose pas de problème du coup pour les outils d'intégration continue et de déploiement type jenkins.

    Si vous pouvez mettre une petite note dans le cours en ce sens ce serait cool .

    Bonne journée

  2. #62
    Membre averti
    Avatar de parchemal
    Homme Profil pro
    Ingénieur Développeur Java
    Inscrit en
    Août 2009
    Messages
    144
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Ingénieur Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2009
    Messages : 144
    Points : 320
    Points
    320
    Par défaut
    Bonjour Jerome,

    Ravi de savoir que vous avez pu faire marcher vos tests d'intégration. Merci aussi pour vos recherches de solutions.
    Cependant, je n'ai pas rencontré tous ces problèmes.
    L'objectif aussi était de jouer les tests d'intégration sans utiliser forcément le port 8080, ou d'arrêter l'application qui tourne déjà sur ce port.

    Mais, je vais encore me pencher sur le sujet en prenant en compte vos remarques.

    J'espère que le tuto vous a aidé ?

    Courage !!

  3. #63
    Membre actif
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Points : 240
    Points
    240
    Par défaut
    Bonjour

    J'ai un problème concernant le transfert de la session à travers les différentes pages de l'application. En effet, lorsqu'on se connecte à travers la page loginForm.jsp, on est immédiatement redirigé vers la page loginSucces lorsque le login et le mot de passe sont bons. Sur cette page on récupère le login saisi grâce à ceci:

    Maintenant lorsque j'essaie de récupérer le login dans les autres pages par exemple next.jsp en ajoutant , ça ne s'affiche pas.

    J'aimerai donc garder le login en session et le transférer de page en page. Mais dans votre tuto, il me semble que ceci n'est pas pris en compte.

    Merci

  4. #64
    Membre averti
    Avatar de parchemal
    Homme Profil pro
    Ingénieur Développeur Java
    Inscrit en
    Août 2009
    Messages
    144
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Ingénieur Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2009
    Messages : 144
    Points : 320
    Points
    320
    Par défaut
    Bonjour Junior,
    c'est normal, car l'utilisateur courant a été initialisé lors du chargement de la page de login par la variable "currentUser" comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    modelAndView.addObject("currentUser", new UserDto(userExists.getBody()));
    Pour avoir cette variable partout, il faut la mettre en session en utilisant un HttpSession, voici un exemple à adapter selon ton cas. Si on veut mettre la var unserName en session, voici comment procéder:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    @GetMapping("/login")
    public String login(@ModelAttribute("users") Users user, HttpSession session)
    {
        if(userService.authUser(user)) { //adapter tes contrôles ici
            session.setAttribute("username", user.getUsername());//Mise en session de la variable "username"
            view.setViewName("homepage"); //Page cible en cas de succès
        }
        else{
            return new ModelAndView("Login");//revenir à la page initiale en cas de soucis
        }
    }
    Source: Mettre une variable en session

  5. #65
    Membre actif
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Points : 240
    Points
    240
    Par défaut
    Ok je vois, en fait je pensais que spring avait sa propre façon de gérer les sessions. Merci

Discussions similaires

  1. [Web Services] Tutoriel sur le développement des services REST avec Spring 3
    Par regis1512 dans le forum Spring
    Réponses: 0
    Dernier message: 11/02/2015, 12h34
  2. Premier développement de services web avec Spring-WS
    Par Arnaud_03 dans le forum Services Web
    Réponses: 5
    Dernier message: 02/12/2008, 16h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo