protected void tearDown() throws Exception { // suppression des membres crees et des clients crees au meme temps MembreLocalHome membreLocalHome = MembreFacadeBean.getEntityHome(); if (membreDTOcree != null) { MembreLocal membreLocal = membreLocalHome.findByPrimaryKey(membreDTOcree.getId()); membreLocal.getClientLocal().remove(); if (membreLocal.getVendeurLocal() != null) membreLocal.getVendeurLocal().remove(); membreLocal.remove(); } if (membreDTOcree2 != null) { MembreLocal membreLocal = membreLocalHome.findByPrimaryKey(membreDTOcree2.getId()); membreLocal.getClientLocal().remove(); if (membreLocal.getVendeurLocal() != null) membreLocal.getVendeurLocal().remove(); membreLocal.remove(); } }
public static boolean equalsDTO(MembreDTO membreDTO1, MembreDTO membreDTO2, boolean testerId) { boolean tRes = true; if (testerId) { tRes = tRes && ((membreDTO1.getId()).equals(membreDTO2.getId())); } tRes = tRes && ((membreDTO1.getAdresse()).equals(membreDTO2.getAdresse())); tRes = tRes && ((membreDTO1.getCodePostal()).equals(membreDTO2.getCodePostal())); tRes = tRes && ((membreDTO1.getEmail()).equals(membreDTO2.getEmail())); tRes = tRes && ((membreDTO1.getNom()).equals(membreDTO2.getNom())); tRes = tRes && ((membreDTO1.getPassword()).equals(membreDTO2.getPassword())); tRes = tRes && ((membreDTO1.getPays()).equals(membreDTO2.getPays())); tRes = tRes && ((membreDTO1.getPrenom()).equals(membreDTO2.getPrenom())); tRes = tRes && ((membreDTO1.getPseudo()).equals(membreDTO2.getPseudo())); tRes = tRes && ((membreDTO1.getTelephoneFixe()).equals(membreDTO2.getTelephoneFixe())); tRes = tRes && ((membreDTO1.getVille()).equals(membreDTO2.getVille())); return tRes; }
public void testGetMembre() { try { // Creation d un membre membreDTOcree = membreFacade.saveMembre(this.membreDTO); MembreDTO membreDTOrecup = membreFacade.getMembre(membreDTOcree.getId()); boolean testerId = true; assertTrue(equalsDTO(membreDTOrecup, membreDTOcree, testerId)); } catch (RemoteException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
public void testSaveVendeur() { try { // Creation d un membre membreDTOcree = membreFacade.saveMembre(this.membreDTO); // creation du vendeur vendeurDTOcree = membreFacade.saveVendeur(membreDTOcree, this.vendeurDTO); // verification si le vendeur est bien ajouté MembreLocalHome membreLocalHome = MembreFacadeBean.getEntityHome(); MembreLocal membreLocal = membreLocalHome.findByPrimaryKey(membreDTOcree.getId()); VendeurDTO vendeurDTOrecup = membreLocal.getVendeurLocal().getVendeurDTO(); boolean testerId = false; assertTrue(VendeurFacadeTest.equalsDTO(vendeurDTOrecup, this.vendeurDTO, testerId)); } catch (RemoteException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }