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

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre à l'essai Avatar de jeromevill
    Homme Profil pro
    Développeur JEE - VueJS
    Inscrit en
    Juin 2018
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur JEE - VueJS
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2018
    Messages : 6
    Par défaut I-F-2. Automatisation des tests d'intégration -> ANOMALIE, ECHEC des TI
    Suite au lancement des TI avec la commande
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    mvn clean install -PintegrationTest
    Cargo se lance bien, le tomcat 9 également, il n'y a pas d'erreur, cependant, après avoir configurer le bon port dans la classe de Test d'intégration :

    Je suis allé sur la doc officielle de cargo, j'ai essayé de lancer un "container" glassfish ou jetty également, mais lors de l'appel, la même erreur se reproduit.
    Il semblerait que le port se ferme avant le lancement des différentes méthodes de la classe TI, ce qui produit des erreurs 404 not found.

    Je vous mets le retour console obtenu au lancement de la commande :

    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
    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 [250 msecs]
    [INFO] Building war: /home/jerome/IdeaProjects/springboot-restserverapi/target/springboot-restserver.war
    [INFO] 
    [INFO] --- spring-boot-maven-plugin:2.2.4.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. 01, 2020 10:08:36 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-nio-8484"]
    avr. 01, 2020 10:08:36 AM org.apache.catalina.core.StandardService startInternal
    INFOS: Starting service [Tomcat]
    avr. 01, 2020 10:08:36 AM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet engine: [Apache Tomcat/9.0.30]
    avr. 01, 2020 10:08:36 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-nio-8484"]
    avr. 01, 2020 10:08:37 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
    INFOS: No global web.xml found
    avr. 01, 2020 10:08:40 AM org.apache.catalina.core.ApplicationContext log
    INFOS: 2 Spring WebApplicationInitializers detected on classpath
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.4.RELEASE)
    
    2020-04-01 10:08:41 - Starting ServletInitializer v0.0.1-SNAPSHOT on jerome-HP-ProBook-640-G1 with PID 9674 (/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-01 10:08:41 - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
    2020-04-01 10:08:41 - The following profiles are active: prod
    2020-04-01 10:08:42 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-01 10:08:42 - Finished Spring Data repository scanning in 87ms. Found 2 JPA repository interfaces.
    2020-04-01 10:08:42 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-04-01 10:08:42 - Initializing Spring embedded WebApplicationContext
    2020-04-01 10:08:42 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-01 10:08:42 - Root WebApplicationContext: initialization completed in 1643 ms
    2020-04-01 10:08:43 - HikariPool-1 - Starting...
    2020-04-01 10:08:43 - HikariPool-1 - Start completed.
    2020-04-01 10:08:43 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-01 10:08:43 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-01 10:08:43 - HHH000412: Hibernate Core {5.4.10.Final}
    2020-04-01 10:08:43 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-01 10:08:44 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-01 10:08:45 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-01 10:08:45 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 10:08:46 - 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-01 10:08:46 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-01 10:08:46 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-01 10:08:46 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-01 10:08:46 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-01 10:08:46 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-01 10:08:46 - Started ServletInitializer in 6.383 seconds (JVM running for 20.311)
    2020-04-01 10:08:46 - 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-01 10:08:46 - 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:08:48.341 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.346 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    10:08:48.359 [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:08:48.403 [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:08:48.422 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    10:08:48.429 [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:08:48.431 [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:08:48.431 [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:08:48.432 [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:08:48.484 [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:08:48.602 [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:08:48.603 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    10:08:48.699 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    10:08:48.700 [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:08:48.725 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@13bc8645, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@24c22fe, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@93081b6, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@cd1e646, org.springframework.test.context.support.DirtiesContextTestExecutionListener@7ba8c737, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1890516e, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@15a04efb, org.springframework.test.context.event.EventPublishingTestExecutionListener@16c069df, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@2bec854f, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@31edaa7d, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@26adfd2d, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@3336e6b6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@7c3fdb62]
    10:08:48.731 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.732 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.775 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.776 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    10:08:48.778 [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:08:48.780 [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:08:48.782 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    10:08:48.784 [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:08:48.784 [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:08:48.785 [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:08:48.785 [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:08:48.789 [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:08:48.790 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    10:08:48.792 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    10:08:48.792 [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:08:48.793 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@4b34fff9, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1187c9e8, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@127a7a2e, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@14008db3, org.springframework.test.context.support.DirtiesContextTestExecutionListener@78a773fd, org.springframework.test.context.transaction.TransactionalTestExecutionListener@57c03d88, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@16aa8654, org.springframework.test.context.event.EventPublishingTestExecutionListener@6d7fc27, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@45ac5f9b, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@135606db, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@518caac3, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@68034211, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@4f74980d]
    10:08:48.795 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.795 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.881 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.881 [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:08:48.885 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.885 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.885 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.886 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.889 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@60df60da testClass = UserControllerIntegrationTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@5a2d131d testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@3754a4bf, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@175c2241, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7586beff, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@15de0b3c], 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:08:48.892 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.892 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    10:08:48.899 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@60df60da testClass = UserControllerIntegrationTest, testInstance = fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest@66c92293, testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@5a2d131d testClass = UserControllerIntegrationTest, locations = '{}', classes = '{class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@3754a4bf, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@175c2241, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7586beff, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@15de0b3c], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]]].
    10:08:48.936 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=0}
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.4.RELEASE)
    
    2020-04-01 10:08:49 - Starting UserControllerIntegrationTest on jerome-HP-ProBook-640-G1 with PID 9775 (started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi)
    2020-04-01 10:08:49 - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
    2020-04-01 10:08:49 - The following profiles are active: prod
    2020-04-01 10:08:50 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-01 10:08:50 - Finished Spring Data repository scanning in 71ms. Found 2 JPA repository interfaces.
    2020-04-01 10:08:50 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-04-01 10:08:51 - Tomcat initialized with port(s): 0 (http)
    2020-04-01 10:08:51 - Starting service [Tomcat]
    2020-04-01 10:08:51 - Starting Servlet engine: [Apache Tomcat/9.0.24]
    2020-04-01 10:08:51 - Initializing Spring embedded WebApplicationContext
    2020-04-01 10:08:51 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-01 10:08:51 - Root WebApplicationContext: initialization completed in 2045 ms
    2020-04-01 10:08:51 - HikariPool-1 - Starting...
    2020-04-01 10:08:51 - HikariPool-1 - Start completed.
    2020-04-01 10:08:51 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-01 10:08:51 - Filter 'crossDomainFilter' configured for use
    2020-04-01 10:08:52 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-01 10:08:52 - HHH000412: Hibernate Core {5.4.10.Final}
    2020-04-01 10:08:52 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-01 10:08:52 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-01 10:08:53 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-01 10:08:53 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 10:08:53 - 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-01 10:08:54 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-01 10:08:54 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-01 10:08:54 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-01 10:08:54 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-01 10:08:54 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-01 10:08:54 - Tomcat started on port(s): 42101 (http) with context path ''
    2020-04-01 10:08:54 - Started UserControllerIntegrationTest in 5.783 seconds (JVM running for 7.404)
    2020-04-01 10:08:54 - HTTP POST http://localhost:8484/user/users
    2020-04-01 10:08:55 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 10:08:55 - Writing [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    2020-04-01 10:08:55 - HTTP GET http://localhost:8484/user/users
    2020-04-01 10:08:55 - Accept=[application/json, application/*+json]
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    2020-04-01 10:08:55 - HTTP POST http://localhost:8484/user/users
    2020-04-01 10:08:55 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 10:08:55 - Writing [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    2020-04-01 10:08:55 - HTTP GET http://localhost:8484/user/users/unknowUser
    2020-04-01 10:08:55 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    2020-04-01 10:08:55 - HTTP DELETE http://localhost:8484/user/users/2
    2020-04-01 10:08:55 - Accept=[application/json, application/*+json]
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    2020-04-01 10:08:55 - HTTP POST http://localhost:8484/user/users
    2020-04-01 10:08:55 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 10:08:55 - Writing [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 10:08:55 - Response 404 NOT_FOUND
    [ERROR] Tests run: 6, Failures: 1, Errors: 5, Skipped: 0, Time elapsed: 6.45 s <<< FAILURE! - in fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    [ERROR] testSaveUser  Time elapsed: 0.425 s  <<< ERROR!
    org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class fr.jerome.springbootrestserverapi.model.User] and content type [text/html;charset=utf-8]
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testSaveUser(UserControllerIntegrationTest.java:49)
    
    [ERROR] testFindAllUsers  Time elapsed: 0.055 s  <<< ERROR!
    org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class java.lang.Object] and content type [text/html;charset=utf-8]
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testFindAllUsers(UserControllerIntegrationTest.java:35)
    
    [ERROR] testUpdateUser  Time elapsed: 0.027 s  <<< ERROR!
    org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class fr.jerome.springbootrestserverapi.model.User] and content type [text/html;charset=utf-8]
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testUpdateUser(UserControllerIntegrationTest.java:89)
    
    [ERROR] testFindByLoginAndPassword_notFound  Time elapsed: 0.012 s  <<< ERROR!
    org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class fr.jerome.springbootrestserverapi.model.User] and content type [text/html;charset=utf-8]
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testFindByLoginAndPassword_notFound(UserControllerIntegrationTest.java:81)
    
    [ERROR] testDeleteUser  Time elapsed: 0.04 s  <<< FAILURE!
    java.lang.AssertionError: Réponse inattendue expected:<410> but was:<404>
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testDeleteUser(UserControllerIntegrationTest.java:118)
    
    [ERROR] testFindByLoginAndPassword  Time elapsed: 0.023 s  <<< ERROR!
    org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class fr.jerome.springbootrestserverapi.model.User] and content type [text/html;charset=utf-8]
            at fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest.testFindByLoginAndPassword(UserControllerIntegrationTest.java:66)
    
    2020-04-01 10:08:55 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-01 10:08:55 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 10:08:55 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-01 10:08:55 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-01 10:08:55 - HikariPool-1 - Shutdown initiated...
    2020-04-01 10:08:55 - HikariPool-1 - Shutdown completed.
    [INFO] 
    [INFO] Results:
    [INFO] 
    [ERROR] Failures: 
    [ERROR]   UserControllerIntegrationTest.testDeleteUser:118 Réponse inattendue expected:<410> but was:<404>
    [ERROR] Errors: 
    [ERROR]   UserControllerIntegrationTest.testFindAllUsers:35 » RestClient Could not extra...
    [ERROR]   UserControllerIntegrationTest.testFindByLoginAndPassword:66 » RestClient Could...
    [ERROR]   UserControllerIntegrationTest.testFindByLoginAndPassword_notFound:81 » RestClient
    [ERROR]   UserControllerIntegrationTest.testSaveUser:49 » RestClient Could not extract r...
    [ERROR]   UserControllerIntegrationTest.testUpdateUser:89 » RestClient Could not extract...
    [INFO] 
    [ERROR] Tests run: 6, Failures: 1, Errors: 5, Skipped: 0
    [INFO] 
    [INFO] 
    [INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ springboot-restserverapi ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  27.781 s
    [INFO] Finished at: 2020-04-01T10:08:55+02:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.2:verify (default) on project springboot-restserverapi: There are test failures.
    [ERROR] 
    [ERROR] Please refer to /home/jerome/IdeaProjects/springboot-restserverapi/target/failsafe-reports for the individual test results.
    [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
    [ERROR] -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    2020-04-01 10:08:55 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-01 10:08:55 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 10:08:55 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-01 10:08:55 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-01 10:08:55 - HikariPool-1 - Shutdown initiated...
    2020-04-01 10:08:56 - HikariPool-1 - Shutdown completed.



    Il n'y a que cette partie qui semble ne pas fonctionner, il y a t'il une manipulation spécifique à effectuer au niveau de la configuration afin d'éviter la fermeture du port avant l'appel des web services ?

  2. #2
    Membre très actif
    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
    Par défaut
    Bonjour,
    Je suppose que tu as configuré le port serveur des deux côtés comme ci-dessous: )

    • Dans le pom.xml: <cargo.servlet.port>8484</cargo.servlet.port>
    • Dans ta classe de tests d'intégration: String URL = "http://localhost:8484"
    • Il faut aussi augmenter le timeout de ton serveur tomcat, car par défaut, Tomcat c'est 45 secondes
    • Tu peux aussi jouer dans le pom avec le paramètre: <wait>false</wait> du plugin cargo, mais je l'ai gardé à false et je n'ai pas de soucis


    Je rappelle que tu peux directement jouer tous les tests dans ton IDE, mais seulement, tu ne peux pas jouer à plusieurs reprises les tests d'intégration, d'où son automatisation avec le plugin cargo qui permet cela.
    Nguimgo Bertrand
    Ingénieur Etudes et Développement JAVA/JEE

    - Guide d'implémentation des services REST avec Spring Boot et Spring RestTemplate
    - Je vous propose de lire le guide d'implémentation du design pattern MVP-GWT
    - N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

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