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. #41
    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 Mise à jour du tutoriel: Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate
    Bonjour à tous les lecteurs,

    Une nouvelle version du tutoriel Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate est en cours d'écriture.

    Principales nouveautés:

    • Prise en compte de la dernière version stable de spring boot-2.2.4.RELEASE
    • Mise à jour des packages et méthodes du projet suite aux évolutions liées à spring boot
    • Amélioration des tests unitaires et des tests d'intégration suite aux remarques des lecteurs
    • Amélioration de la gestion des exceptions
    • Retrait du code métier dans les contrôleurs pour les mettre dans la partie service
    • Ajout du plugin cargo-maven2-plugin pour démarrer et arrêter Tomcat9xx lors des tests d'intégration
    • Ajout du profile pour déploiement automatique de l'application
    • Mise à jour de l'IHM en mode responsive design
    • Changement de commandName par modelAttribute (nouvelle recommandation de Spring pour la classe FormTag) dans les formulaires
    • Etc.


    Cordialement
    Bertrand Nguimgo
    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

  2. #42
    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
    On attend avec impatience la nouvelle version du tuto. En attendant, il manque la partie mise à jour des données via la méthode @PutMapping. Du coup j'ai essayé de le faire mais je reçois ce message d'erreur lors de l'affichage de la page:

    Neither BindingResult nor plain target object for bean name 'modifierForm' available as request attribute
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'modifierForm' available as request attribute
    Voici mon formulaire contenu dans la page lister-utilisateur.jsp:

    Code jsp : 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
     
     <form:form action="modifier-utilisateur" modelAttribute="modifierForm" id="form_modifier_user">
     
    <form:input path="id" id="id"  />
     
             <div class="form-group">
                 <form:label path="login" cssClass="control-label" for="login">Login:<span class="text-danger">*</span></form:label>
                 <form:input path="login" id="login" class="input-login form-control" required="true"  tabindex="0" />
                 <span class="erreur erreur_login" ></span>
             </div>
             <div class="form-group">
             <form:label path="compte" cssClass="control-label">Type de compte:<span class="text-danger">*</span></form:label>
            	<form:select path="compte" id="compte" class="form-control" >
                  <form:option value="" label="Choisir le compte" />
                  <form:option value="acompta" label="ACOMPTA" />
                  <form:option value="compta" label="COMPTA" />                                                
         	 </form:select>
           <span class="erreur erreur_compte" ></span>
               </div>
               <div class="form-group">
                   <label for="modelpass">Mot de passe</label>
                   <input type="text" class="input-pwd form-control" id="password">
               </div>
               <div class="form-group">
                    <form:label path="password" cssClass="control-label">Mot de passe:<span class="text-danger">*</span></form:label>
        			 <form:password path="password" id="npwd" class="form-control" required="true" tabindex="2" />
                 <span class="erreur erreur_npwd" ></span>
             </div>
             <div class="form-group">
                 <label for="modelpass">Confirmer le mot de passe</label>
                 <input type="password" class="form-control" id="cpwd">
                 <span class="erreur erreur_cpwd" ></span>
             </div>
            <div id="load-img" >
             <img  src="assets/img/ajax-loader.gif">
          </div>
             <button type="submit" class="btn btn-primary btn-modifier-user">Valider</button>
         </form:form>

    Et voici mon controller:

    Code : 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
     @GetMapping(value = "/modifier-utilisateur")//initialisation du formulaire de modification du compte
        public String modificationView(Map<String, Object> model) {
        	UserRegistrationForm userRegistrationForm = new UserRegistrationForm();
            model.put("modifierForm", userRegistrationForm);
            return "lister-utilisateur";
        }
     
        @PutMapping(value = "/modifier-utilisateur/{id}")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm,
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException {
     
     
    		Long id = userRegistrationForm.getId();
    		String cpwd = request.getParameter(CHAMP_CPWD);
     
        	modelAndView.setViewName("lister-utilisateur");
        	if (bindingResult.hasErrors()) {
     
                return cpwd;
            }
        	Map<String, Long> variables = new HashMap<String, Long>(1);
        	variables.put("id_user", id);
     
     
            MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
            mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));
            restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter);
     
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
            User userExists = userEntity.getBody();
    		if (userExists == null) {//ceci nous évite d'écrire une page de gestion des erreurs
    			logger.debug("L'utilisateur avec l'identifiant " + id + " n'existe pas");
    	            return "L'utilisateur n'existe pas";
    		}
     
     
            //return "loginSuccess";
    		ResponseEntity<User> userEntitySaved =  restTemplate.postForEntity(configurationService.getUrl() +"user/users", new User(userRegistrationForm), User.class);//point de liaison entre le client REST et le serveur REST grace à RestTemplate
    		User userSaved = userEntitySaved.getBody();
            if(null ==userSaved){
            	modelAndView.addObject("saveError", "erreur de création du compte.");
            	return "erreur de création du compte";
            }
     
            modelAndView.addObject("userSaved", userSaved);
           return "ok"; 
        }

  3. #43
    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,
    Dans ta requête, il te manque @PathVariable("id") int id, il faut donc écrire ta requête comme ci-dessous:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @PutMapping(value = "/modifier-utilisateur/{id}")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm, @PathVariable("id") int id, 
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException { xxxxxxx}
    Ou à défaut, tu retires complètement l'id pour avoir: @PutMapping(value = "/modifier-utilisateur")

    Je te conseille aussi d'éviter d'ajouter le code métier dans ton contrôleur. C'est aussi l'une des raisons pour lesquelles je réécris le tuto. Par exemple, au lieu d'écrire:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if(null ==userSaved){
            	modelAndView.addObject("saveError", "erreur de création du compte.");
            	return "erreur de création du compte";
            }
    Il faut plutôt faire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    try {
       ResponseEntity<User> userEntitySaved =  restTemplate.postForEntity(configurationService.getUrl() +"user/users", new User(userRegistrationForm), User.class);
          } catch (HttpClientErrorException | HttpServerErrorException ex) {
        //Traitement de l'erreur ici !!!!
      modelAndView.addObject("saveError", "erreur de création du compte.");
      return "erreur de création du compte";
    }

    NB: Pour la nouvelle version, je compte la publier d'ici fin mars 2020 si tout se passe bien. Je peux te confirmer que j'ai déjà bien avancé.
    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

  4. #44
    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
    J'ai effectué les modifications que tu m'as proposées mais toujours le même message d'erreur:

    Code : 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
    @PutMapping(value = "/modifier-utilisateur")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm, @PathVariable("id") int id,
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException {
     
     
    		String cpwd = request.getParameter(CHAMP_CPWD);
     
        	modelAndView.setViewName("lister-utilisateur");
        	if (bindingResult.hasErrors()) {
     
                return cpwd;
            }
        	Map<String, String> variables = new HashMap<String, String>(1);
        	variables.put("id_user", String.valueOf(id));
     
     
            MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
            mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));
            restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter);
     
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
            User userExists = userEntity.getBody();
    		if (userExists == null) {//ceci nous évite d'écrire une page de gestion des erreurs
    			logger.debug("L'utilisateur avec l'identifiant " + id + " n'existe pas");
    	            return "L'utilisateur n'existe pas";
    		}      	
     
    		try {
    			   ResponseEntity<User> userEntitySaved =  restTemplate.postForEntity(configurationService.getUrl() +"user/users", new User(userRegistrationForm), User.class);
    			      } catch (HttpClientErrorException | HttpServerErrorException ex) {
    			    //Traitement de l'erreur ici !!!!
    			  modelAndView.addObject("saveError", "erreur de modification du compte.");
    			  return "erreur de modification du compte";
    			}
           return "ok"; 
        }
    J'ai aussi un deuxième message d'erreur:

    Error rendering view [org.springframework.web.servlet.view.JstlView: name 'lister-utilisateur'; URL [/WEB-INF/views/lister-utilisateur.jsp]]
    org.apache.jasper.JasperException: Exception lancée durent le traitement de [/WEB-INF/views/lister-utilisateur.jsp] à la ligne [120]

    117: <div class="modal-body">
    118: <form:form action="modifier-utilisateur" modelAttribute="modifierForm" id="form_modifier_user">
    119:
    120: <form:input path="id" id="id" />
    121:
    122: <div class="form-group">
    123: <form:label path="login" cssClass="control-label" for="login">Login:<span class="text-danger">*</span></form:label>

  5. #45
    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,
    Ta requête n'est pas bonne. Quand tu utilises @PathVariable(value = "id") Integer id comme paramètre de la méthode, ça suppose que l'identifiant id fait partie de ton url ==> @PutMapping(value = "/modifier-utilisateur/{id}"). Ce qui n'est le cas que tu présentes. Normalement, comme c'est une mise à jour, tu dois avoir déjà cet identifiant dans UserRegistrationForm. Donc, voici ce que je te propose si tu ne veux pas avoir {id} dans l'url:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    @PutMapping(value = "/modifier-utilisateur")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm,
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException {
     
           Map<String, String> variables = new HashMap<String, String>(1);
        	variables.put("id_user",String.valueOf(userRegistrationForm.getId()));
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
    }
    Je te conseille aussi de regarder l'utilisation du passage des paramètres: @RequestParam-vs-@PathVariable

    Espérant t'aider
    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

  6. #46
    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
    Désolé mais toujours la même erreur. Voici une fois de plus les codes concernés:

    Tout d'abord la page lister-utilisateur.jsp qui liste tous les utilisateurs. Tout marche bien sans le formulaire. Dans la Class WelcomeController.java j'ai ceci:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    @GetMapping("/lister-utilisateur")
        ModelAndView listerUser(ModelAndView modelAndView) {
            modelAndView.setViewName("lister-utilisateur");
            return modelAndView;
        }
    Ensuite j'ajoute le formulaire de modification d'un utilisateur dans lister-utilisateur.jsp :

    Code jsp : 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
    <form:form action="modifierUtilisateur" modelAttribute="modifierForm" id="form_modifier_user">
     
    		<form:input path="id" id="id" class="input-login form-control" required="true"  tabindex="0" />
     
             <div class="form-group">
                 <form:label path="login" cssClass="control-label" for="login">Login:<span class="text-danger">*</span></form:label>
                 <form:input path="login" id="login" class="input-login form-control" required="true"  tabindex="0" />
                 <span class="erreur erreur_login" ></span>
             </div>
             <div class="form-group">
    	         <form:label path="compte" cssClass="control-label">Type de compte:<span class="text-danger">*</span></form:label>
    	        	<form:select path="compte" id="compte" class="form-control" >
    	              <form:option value="" label="Choisir le compte" />
    	              <form:option value="acompta" label="ACOMPTA" />
    	              <form:option value="compta" label="COMPTA" />                                                
    	     	 </form:select>
    			<span class="erreur erreur_compte" ></span>
             </div>
             <div class="form-group">
                   <label for="modelpass">Mot de passe</label>
                   <input type="text" class="input-pwd form-control" id="password">
             </div>
             <div class="form-group">
                    <form:label path="password" cssClass="control-label">Mot de passe:<span class="text-danger">*</span></form:label>
        			<form:password path="password" id="npwd" class="form-control" required="true" tabindex="2" />
                 <span class="erreur erreur_npwd" ></span>
             </div>
             <div class="form-group">
                 <label for="modelpass">Confirmer le mot de passe</label>
                 <input type="password" class="form-control" id="cpwd" name="confirm_password">
                 <span class="erreur erreur_cpwd" ></span>
             </div>
            <div id="load-img" >
             <img  src="assets/img/ajax-loader.gif">
          </div>
             <button type="submit" class="btn btn-primary btn-modifier-user">Valider</button>
    </form:form>

    Et dans LoginController.java j'ai ceci:

    Code : 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
    @GetMapping(value = "/modifierUtilisateur")//initialisation du formulaire de création du compte
        public String modificationView(Map<String, Object> model) {
        	UserRegistrationForm userRegistrationForm = new UserRegistrationForm();
            model.put("modifierForm", userRegistrationForm);
            return "lister-utilisateur";
        }
     
        @PutMapping(value = "/modifierUtilisateur")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm,
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException {
     
    		//System.out.println("le id est: "+String.valueOf(userRegistrationForm.getId()));
     
    	//	String cpwd = request.getParameter(CHAMP_CPWD);
     
        	modelAndView.setViewName("lister-utilisateur");
        	if (bindingResult.hasErrors()) {
     
                return "erreur";
            }
        	Map<String, String> variables = new HashMap<String, String>(1);
        	variables.put("id_user", String.valueOf(userRegistrationForm.getLogin()));
     
     
            MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
            mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));
            restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter);
     
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
            User userExists = userEntity.getBody();
    		if (userExists == null) {//ceci nous évite d'écrire une page de gestion des erreurs
    			logger.debug("L'utilisateur avec l'identifiant " + String.valueOf(userRegistrationForm.getLogin()) + " n'existe pas");
    	            return "L'utilisateur n'existe pas";
    		}
     
     
     
    		try {
    			   ResponseEntity<User> userEntitySaved =  restTemplate.postForEntity(configurationService.getUrl() +"user/users", new User(userRegistrationForm), User.class);
    			   User userSaved = userEntitySaved.getBody();	 
    			   modelAndView.addObject("userSaved", userSaved);
    		} catch (HttpClientErrorException | HttpServerErrorException ex) {
    			    //Traitement de l'erreur ici !!!!
    			  modelAndView.addObject("saveError", "erreur de modification du compte.");
    			  return "erreur de modification du compte";
    			}
           return "ok"; 
        }

  7. #47
    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,

    Ta requête d'initialisation du formulaire à modifier n'est pas bonne. il faut initialiser le formulaire avec l'utilisateur que tu veux modifier.
    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

  8. #48
    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 j'ai compris mon erreur. Il fallait initialiser le formulaire de cette façon:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     @GetMapping(value = "/lister-utilisateur")//initialisation du formulaire de création du compte
        public String modificationView(Map<String, Object> model) {
        	UserRegistrationForm userRegistrationForm = new UserRegistrationForm();
            model.put("modifierForm", userRegistrationForm);
            return "lister-utilisateur";
        }
    Maintenant ça marche.

    Mais je rencontre un nouveau message d'erreur lorsque j'essaie d'envoyer les données vers le controller:

    PUT "/nitraweb-client/lister-utilisateur", parameters={}
    2020-03-17 17:40:21 - Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported]
    2020-03-17 17:40:21 - Completed 405 METHOD_NOT_ALLOWED
    2020-03-17 17:40:21 - "FORWARD" dispatch for PUT "/nitraweb-client/error", parameters={}
    2020-03-17 17:40:21 - Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
    2020-03-17 17:40:21 - Using 'application/json', given [*/*] and supported [application/json, application/*+json]
    2020-03-17 17:40:21 - Writing [{timestamp=Tue Mar 17 17:40:21 WAT 2020, status=405, error=Method Not Allowed, message=Request metho (truncated)...]
    2020-03-17 17:40:22 - Exiting from "FORWARD" dispatch, status 405
    Je rappelle que j'utilise ajax pour l'envoi des données. Voici mon code:

    Code : 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
     var form = $('#form_modifier_user');
     
    	  /* Send the data using post and put the results in a div */
    	  request =$.ajax({
    	      url: form.attr('action'),
    	      type: "PUT",
    	      data:form.serialize(),
    	      beforeSend: function() {
    	        $('#load-img').show();
    	        },
    	      success: function(data){
    	          $('#load-img').hide();
     
    	          var result=data.split("+");
     
    	          var t = result[0];
     
     
                      console.log(t);
                      if(t==="ok" )
     
                      {     
                          $('.resultat').css('color', 'green');
                          $('.resultat').html("Utilisateur modifié avec succès!"); 
                          form.trigger("reset");
                      }
                      else
                      {
                           $('.resultat').html(t);
                       $('.resultat').css('color', 'red');
                      }
     
     
    	      },
    	      error:function(){
    	           $('#load-img').hide();
                       $('.erreur_user').html("Impossible de se connecter à la BDD!");
    	      }  
    	  });
    	  return false;
    	  }
    Et voici la méthode PUT au niveau du controller:

    Code : 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
    @PutMapping(value = "/lister-utilisateur/{id}")
    	@ResponseBody
        public String updateUser(@Valid @ModelAttribute("modifierForm") UserRegistrationForm userRegistrationForm, @PathVariable("id") int id,
                BindingResult bindingResult, ModelAndView modelAndView,HttpServletRequest request) throws ServletException, IOException {
     
     
        	List<FieldError> errors = bindingResult.getFieldErrors();
        	modelAndView.setViewName("lister-utilisateur");
        	if (bindingResult.hasErrors()) {
     
        	    for (FieldError error : errors ) {
        	    	return "erreur"+error.getObjectName() + " - " + error.getDefaultMessage();
     
        	    }
     
            }
        	Map<String, String> variables = new HashMap<String, String>(1);
        	variables.put("id_user", String.valueOf(id));
     
     
            MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
            mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));
            restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter);
     
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
            User userExists = userEntity.getBody();
    		if (userExists == null) {//ceci nous évite d'écrire une page de gestion des erreurs
    			logger.debug("L'utilisateur avec l'identifiant " + String.valueOf(userRegistrationForm.getLogin()) + " n'existe pas");
    	            return "L'utilisateur n'existe pas";
    		}	
     
    		try {
    			   ResponseEntity<User> userEntitySaved =  restTemplate.postForEntity(configurationService.getUrl() +"user/users", new User(userRegistrationForm), User.class);
    			   User userSaved = userEntitySaved.getBody();	 
    			   modelAndView.addObject("userSaved", userSaved);
    		} catch (HttpClientErrorException | HttpServerErrorException ex) {
    			    //Traitement de l'erreur ici !!!!
    			  modelAndView.addObject("saveError", "erreur de modification du compte.");
    			  return "erreur de modification du compte";
    			}
           return "ok"; 
        }
    Merci

  9. #49
    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,
    Ton initialisation n'est pas toujours bonne. Il faut avoir en idée que tu veux mettre à jour un objet que tu viens de récupérer. et voici comment récupérer ton objet et l'initialiser:

    Code : 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
     @GetMapping(value = "/lister-utilisateur/{id}")//initialisation du formulaire de création du compte
        public String modificationView(@PathVariable(value = "id") int id, Model model) {
            Map<String, String> variables = new HashMap<String, String>(1);
        	variables.put("id", String.valueOf(id));
        	try{
            ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id}", User.class, variables);
            User user = userEntity.getBody();
    			UserRegistrationForm userRegistrationForm = new UserRegistrationForm(user);//il faut créer le constructeur UserRegistrationForm à partir de User
            model.put("modifierForm", userRegistrationForm);//les attributs de userRegistrationForm seront les champs de ton formulaire
            return "lister-utilisateur";
         } catch (HttpClientErrorException | HttpServerErrorException ex) {
              //log error ici !!! ou créer un message d'erreur
            model.put("userNotFound", "Erreur de recherche utilisateur"); //userNotFound --> utiliser cette variable dans la JSP
            }
         return "lister-utilisateur";
        }
    NB: Vérifier que l'identifiant id existe bien pour ta requête.

    Pour la méthode PUT, tu n'as plus besoin de vérifier l'existance de l'objet, car lors de l'initialisation, si l'objet n'existe pas, tu auras déjà géré l'erreur. Donc retire le test suivant:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    ResponseEntity<User> userEntity =  restTemplate.getForEntity(configurationService.getUrl() +"user/users/{id_user}", User.class, variables);
            User userExists = userEntity.getBody();
    		if (userExists == null) {//ceci nous évite d'écrire une page de gestion des erreurs
    			logger.debug("L'utilisateur avec l'identifiant " + String.valueOf(userRegistrationForm.getLogin()) + " n'existe pas");
    	            return "L'utilisateur n'existe pas";
    		}
    Espérant t'avoir fait avancer.
    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

  10. #50
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    Par défaut Erreur sur l'implémentation de la méthode findByLogin dans le cours
    Bonjour, je vous fais 2 retours d'erreur :

    Le premier dans la partie de gestion des exceptions, pour parvenir au résultat indiqué lors de l'appel du web service suivant:
    http://localhost:8080/user/users/5

    La méthode findByLogin de la classe UserServiceImpl doit être:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
        @Override
        public User findByLogin(String login) throws BusinessResourceException {
            User user = userRepository.findByLogin(login);
            if (user == null){
                throw new BusinessResourceException("User Not Found", "L'utilisateur avec ce login n'existe pas :" + login);
            }
            return user;
        }
    Et non pas:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        @Override
        public User findByLogin(String login) throws BusinessResourceException {
            return userRepository.findByLogin(login);
        }
    Je vous fait un second message pour vous indiquez l'erreur rencontrée concernant la partie sécurité.

  11. #51
    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 jeromevill,

    Une mise à jour du tutoriel a été faite dans son ensemble en prenant en compte la plupart des remarques. Merci pour vos suggestions et remarques d'amélioration.

    Merci d'avance.
    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

  12. #52
    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 Mise à jour du tutoriel
    Bonjour chers lecteurs,

    Une nouvelle version du tutoriel Apprendre à développer les services REST avec Spring Boot et Spring RestTemplate a été publiée.

    Principales nouveautés:

    • Prise en compte de la dernière version stable de spring boot-2.2.6.RELEASE.
    • Mise à jour des packages et méthodes du projet suite aux évolutions liées à spring boot.
    • Amélioration des tests unitaires et des tests d'intégration suite aux remarques des lecteurs.
    • Amélioration de la gestion des exceptions.
    • Retrait du code métier dans les contrôleurs pour les mettre dans la partie service.
    • Ajout du plugin cargo-maven2-plugin pour automatiser les tests d'intégration (démarrer et arrêter Tomcat9xx lors des tests d'intégration).
    • Ajout du profile pour déploiement automatique de l'application.
    • Changement de commandName par modelAttribute (nouvelle recommandation de Spring pour la classe FormTag) dans les formulaires.
    • Etc.


    Merci à tous ceux qui ont encore des suggestions d'amélioration.
    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

  13. #53
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    Par défaut La partie I-F-1. Automatisation des tests unitaires -> Ne fonctionne pas - RESOLU
    RESOLU

    Note importante : au cours du projet et de la réalisation du cours, les dépendances dans le pom.xml peuvent varier (surefire, failsafe..) , pour éviter l'erreur ci-dessous, il faut alors reprendre l'ensemble des dépendances du fichier pom.xml et vérifier qu'elle sont conformes à l'exemple donné à la fin du cours, partie
    I-H. Paramétrage complet

    Une fois le fichier conforme à l'exemple, l'ensembles des tests automatisés pour la partie TU fonctionnent.



    Bonjour, j'ai essayé de suivre l'ensemble des TU, ils fonctionnent, les TI fonctionnements mais il y a des erreurs dans le code que je vous ferais remonter. Pour la partie
    I-F-1. Automatisation des tests unitaires

    le lancement de la commande mvn clean install dans le repertoire du pom.xml donne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    15:56:26.458 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    15:56:26.470 [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)]
    15:56:26.502 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
    15:56:26.515 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests], using SpringBootContextLoader
    15:56:26.520 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests]: class path resource [fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplicationTests-context.xml] does not exist
    15:56:26.521 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests]: class path resource [fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplicationTestsContext.groovy] does not exist
    15:56:26.521 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
    15:56:26.523 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests]: SpringbootRestserverapiApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
    15:56:26.570 [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.SpringbootRestserverapiApplicationTests]
    15:56:26.649 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/home/jerome/IdeaProjects/springboot-restserverapi/target/classes/fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplication.class]
    15:56:26.650 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplicationTests
    15:56:26.750 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2fba3fc4]
    Impossible de détecter les classes de Tests. Les TU se lancement manuellement, mais pas à la commande mvn clean install avec le plugin maven surefire.

    Seule la classe SpringbootRestserverapiApplicationTests est detectée.

    Nom : Capture du 2020-03-31 16-00-27.png
Affichages : 848
Taille : 26,5 Ko

  14. #54
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    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 ?

  15. #55
    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,
    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

  16. #56
    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,

    L'erreur Completed 405 METHOD_NOT_ALLOWED veut dire que ta requête n'est pas bonne. Et si tu estimes qu'elle est bonne, alors c'est qu'il manque une méthode qui doit traiter cette requête. Voir google sur HttpStatus 405

    Courage
    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

  17. #57
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    Par défaut Paramètre wait à true - echec
    Citation Envoyé par parchemal Voir le message
    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>, mais je l'ai gardé à false et je n'ai pas de soucis
    Je viens d'essayer de passer le paramètre <wait>true</wait> dans le pom.xml, mais cela échoue également le port semble se fermer et l'ide affiche le paramètre en rouge. Je vais essayer de voir si il y a un paramètre dans le pom pour cargo qui permet d'augementer le timeout du tomcat

  18. #58
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    Par défaut RESOLU
    Citation Envoyé par parchemal Voir le message
    Bonjour,

    L'erreur Completed 405 METHOD_NOT_ALLOWED veut dire que ta requête n'est pas bonne. Et si tu estimes qu'elle est bonne, alors c'est qu'il manque une méthode qui doit traiter cette requête. Voir google sur HttpStatus 405

    Courage

    Le 405 venait dans le code pour le test spécifié de mémoire d'un probleme d'écriture de l'url de l'appel avec la méthode PUT, j'ai modifié le route et cela fonctionnait comme suit
    classe UserControllerTest

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     
    @Test
        public void testUpdateUser() throws Exception {
     
            //on exécute la requête
            mockMvc.perform(MockMvcRequestBuilders.put("/user/users/{id}",new Long(1))
                    .contentType(MediaType.APPLICATION_XML)
                    .accept(MediaType.APPLICATION_XML)
                    .content("<user><active>0</active></user>"))
                    .andExpect(status().isOk());
     
            //on s'assure que la méthode de service saveOrUpdateUser(User) a bien été appelée
            verify(userService).saveOrUpdateUser(any(User.class));
     
        }
    Je suis en train de suivre la maj du cours pour voir les changements effectués, je reviens vers vous si je constate des echecs dans le lancement manuel des TU

  19. #59
    Futur Membre du Club 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 : 33
    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
    Points : 8
    Points
    8
    Par défaut Echec des tests automatisés pour la partie Test d'integration avec cargo
    J'ai modifié le fichier pom.xml comme suit à partir de
    https://codehaus-cargo.github.io/car...r+Timeout.html

    Code XML : 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
    					<plugin>
    						<groupId>org.codehaus.cargo</groupId>
    						<artifactId>cargo-maven2-plugin</artifactId>
    						<version>${cargo.version}</version>
    						<configuration>
    							<container>
    								<containerId>tomcat9x</containerId>
    								<type>embedded</type>
    								<timeout>200000</timeout>
    							</container>
     
    							<configuration>
    								<properties>
    									<!-- les ports 8080 et 8009 sont à éviter si l'application est déjà déployée -->
    									<cargo.servlet.port>8484</cargo.servlet.port>
    									<cargo.tomcat.ajp.port>8090</cargo.tomcat.ajp.port>
    								</properties>
    							</configuration>
    						</configuration>
     
    						<executions>
    							<execution>
    								<!-- id obligatoire pour distinguer les deux phases start et stop -->
    								<id>start-server</id>
    								<phase>pre-integration-test</phase>
    								<goals>
    									<goal>start</goal>
    								</goals>
    								<configuration>
    									<container>
    										<timeout>200000</timeout>
    									</container>
    								</configuration>
    							</execution>
    							<execution>
    								<id>stop-server</id>
    								<phase>post-integration-test</phase>
    								<goals>
    									<goal>stop</goal>
    								</goals>
    								<configuration>
    									<container>
    										<timeout>200000</timeout>
    									</container>
    								</configuration>
    							</execution>
    						</executions>
    					</plugin>

    Le port est bien ouvert au lancement de cargo
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    java      9496          jerome  308u  IPv6 161278      0t0  TCP *:8484 (LISTEN)
    Malheureusement même avec le timeout j'obtiens


    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 [138 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 12:56:34 PM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-nio-8484"]
    avr. 01, 2020 12:56:34 PM org.apache.catalina.core.StandardService startInternal
    INFOS: Starting service [Tomcat]
    avr. 01, 2020 12:56:34 PM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet engine: [Apache Tomcat/9.0.30]
    avr. 01, 2020 12:56:34 PM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-nio-8484"]
    avr. 01, 2020 12:56:34 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
    INFOS: No global web.xml found
    avr. 01, 2020 12:56:37 PM org.apache.catalina.core.ApplicationContext log
    INFOS: 2 Spring WebApplicationInitializers detected on classpath
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.4.RELEASE)
    
    2020-04-01 12:56:38 - Starting ServletInitializer v0.0.1-SNAPSHOT on jerome-HP-ProBook-640-G1 with PID 9754 (/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 12:56:38 - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
    2020-04-01 12:56:38 - The following profiles are active: prod
    2020-04-01 12:56:39 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-01 12:56:39 - Finished Spring Data repository scanning in 93ms. Found 2 JPA repository interfaces.
    2020-04-01 12:56:39 - 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 12:56:39 - Initializing Spring embedded WebApplicationContext
    2020-04-01 12:56:39 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-01 12:56:39 - Root WebApplicationContext: initialization completed in 1439 ms
    2020-04-01 12:56:39 - HikariPool-1 - Starting...
    2020-04-01 12:56:40 - HikariPool-1 - Start completed.
    2020-04-01 12:56:40 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-01 12:56:40 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-01 12:56:40 - HHH000412: Hibernate Core {5.4.10.Final}
    2020-04-01 12:56:40 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-01 12:56:40 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-01 12:56:42 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-01 12:56:42 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 12:56: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-01 12:56:43 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-01 12:56:43 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-01 12:56:43 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-01 12:56:43 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-01 12:56:43 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-01 12:56:43 - Started ServletInitializer in 6.149 seconds (JVM running for 18.166)
    2020-04-01 12:56: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-01 12:56: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] -------------------------------------------------------
    12:56:44.762 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:44.765 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    12:56:44.774 [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)]
    12:56:44.807 [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]
    12:56:44.823 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    12:56:44.827 [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
    12:56:44.828 [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
    12:56:44.828 [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}.
    12:56:44.829 [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.
    12:56:44.868 [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]
    12:56:44.988 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/home/jerome/IdeaProjects/springboot-restserverapi/target/classes/fr/jerome/springbootrestserverapi/SpringbootRestserverapiApplication.class]
    12:56:44.989 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    12:56:45.081 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    12:56:45.082 [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]
    12:56:45.096 [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]
    12:56:45.100 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.101 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.136 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.136 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    12:56:45.136 [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)]
    12:56:45.137 [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]
    12:56:45.137 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest], using SpringBootContextLoader
    12:56:45.138 [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
    12:56:45.139 [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
    12:56:45.139 [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}.
    12:56:45.139 [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.
    12:56:45.141 [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]
    12:56:45.141 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration fr.jerome.springbootrestserverapi.SpringbootRestserverapiApplication for test class fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    12:56:45.142 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]: using defaults.
    12:56:45.143 [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]
    12:56:45.143 [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]
    12:56:45.143 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.144 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.195 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.195 [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
    12:56:45.205 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.206 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.206 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.206 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.210 [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].
    12:56:45.212 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.212 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest]
    12:56:45.216 [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]]].
    12:56:45.241 [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 12:56:45 - Starting UserControllerIntegrationTest on jerome-HP-ProBook-640-G1 with PID 9898 (started by jerome in /home/jerome/IdeaProjects/springboot-restserverapi)
    2020-04-01 12:56:45 - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
    2020-04-01 12:56:45 - The following profiles are active: prod
    2020-04-01 12:56:46 - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-01 12:56:46 - Finished Spring Data repository scanning in 70ms. Found 2 JPA repository interfaces.
    2020-04-01 12:56:46 - 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 12:56:47 - Tomcat initialized with port(s): 0 (http)
    2020-04-01 12:56:47 - Starting service [Tomcat]
    2020-04-01 12:56:47 - Starting Servlet engine: [Apache Tomcat/9.0.24]
    2020-04-01 12:56:47 - Initializing Spring embedded WebApplicationContext
    2020-04-01 12:56:47 - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
    2020-04-01 12:56:47 - Root WebApplicationContext: initialization completed in 1804 ms
    2020-04-01 12:56:47 - HikariPool-1 - Starting...
    2020-04-01 12:56:47 - HikariPool-1 - Start completed.
    2020-04-01 12:56:47 - H2 console available at '/console'. Database available at 'jdbc:h2:mem:testdb'
    2020-04-01 12:56:47 - Filter 'crossDomainFilter' configured for use
    2020-04-01 12:56:48 - HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-04-01 12:56:48 - HHH000412: Hibernate Core {5.4.10.Final}
    2020-04-01 12:56:48 - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-04-01 12:56:48 - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
    2020-04-01 12:56:49 - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-04-01 12:56:49 - Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 12:56: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-01 12:56:50 - Initializing ExecutorService 'applicationTaskExecutor'
    2020-04-01 12:56:50 - ControllerAdvice beans: 1 @ModelAttribute, 1 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
    2020-04-01 12:56:50 - 8 mappings in 'requestMappingHandlerMapping'
    2020-04-01 12:56:50 - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
    2020-04-01 12:56:50 - ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
    2020-04-01 12:56:50 - Tomcat started on port(s): 34951 (http) with context path ''
    2020-04-01 12:56:50 - Started UserControllerIntegrationTest in 5.261 seconds (JVM running for 6.538)
    2020-04-01 12:56:50 - HTTP POST http://localhost:8484/user/users
    2020-04-01 12:56:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 12:56:50 - Writing [User [id=null, login=PIPO, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    2020-04-01 12:56:50 - HTTP GET http://localhost:8484/user/users
    2020-04-01 12:56:50 - Accept=[application/json, application/*+json]
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    2020-04-01 12:56:50 - HTTP POST http://localhost:8484/user/users
    2020-04-01 12:56:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 12:56:50 - Writing [User [id=null, login=login3, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    2020-04-01 12:56:50 - HTTP GET http://localhost:8484/user/users/unknowUser
    2020-04-01 12:56:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    2020-04-01 12:56:50 - HTTP DELETE http://localhost:8484/user/users/2
    2020-04-01 12:56:50 - Accept=[application/json, application/*+json]
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    2020-04-01 12:56:50 - HTTP POST http://localhost:8484/user/users
    2020-04-01 12:56:50 - Accept=[application/json, application/xml, application/*+json, text/xml, application/*+xml]
    2020-04-01 12:56:50 - Writing [User [id=null, login=admin@admin.com, pass=XXXX-XXX, active=1, roles=[]]] with org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
    2020-04-01 12:56:50 - Response 404 NOT_FOUND
    [ERROR] Tests run: 6, Failures: 1, Errors: 5, Skipped: 0, Time elapsed: 5.704 s <<< FAILURE! - in fr.jerome.springbootrestserverapi.controller.UserControllerIntegrationTest
    [ERROR] testSaveUser  Time elapsed: 0.298 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.019 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.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.testUpdateUser(UserControllerIntegrationTest.java:89)
    
    [ERROR] testFindByLoginAndPassword_notFound  Time elapsed: 0.014 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.01 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.008 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 12:56:50 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-01 12:56:50 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 12:56:50 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-01 12:56:51 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-01 12:56:51 - HikariPool-1 - Shutdown initiated...
    2020-04-01 12:56:51 - 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:  24.629 s
    [INFO] Finished at: 2020-04-01T12:56:51+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 12:56:51 - Shutting down ExecutorService 'applicationTaskExecutor'
    2020-04-01 12:56:51 - Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-04-01 12:56:51 - HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
    2020-04-01 12:56:51 - HHH000478: Unsuccessful: drop table role if exists
    2020-04-01 12:56:51 - HikariPool-1 - Shutdown initiated...
    2020-04-01 12:56:51 - HikariPool-1 - Shutdown completed.

    Interessant de voir la ligne suivante en console
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    2020-04-01 12:56:47 - Tomcat initialized with port(s): 0 (http)
    Vous avez une idée ?

  20. #60
    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,

    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 !!
    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