/** * (non-Javadoc) * * @see org.apache.commons.digester.ObjectCreationFactory#createObject(org.xml.sax.Attributes) */ public Object createObject(Attributes attributes) throws Exception { String profileName = attributes.getValue("name"); ProjectProfileBO profile = (ProjectProfileBO) mProfiles.get(profileName); if (null == profile) { profile = new ProjectProfileBO(); profile.setName(profileName); mProfiles.put(profileName, profile); } else { throw new Exception( XmlConfigMessages.getString("profile.duplicate", new Object[] {profileName})); } return profile; }
/** Test du update */ public void testUpdate() { try { ISession session = PERSISTENTPROVIDER.getSession(); ApplicationBO application = getComponentFactory().createApplication(session); QualityGridBO grid = getComponentFactory().createGrid(session); ProjectProfileBO profile = getComponentFactory().createProjectProfile(session); SourceManagementBO manager = getComponentFactory().createSourceManagement(session); MapParameterBO parameters = getComponentFactory().createParameters(session); ProjectBO project = getComponentFactory() .createProject(session, application, grid, profile, manager, parameters); assertEquals(0, project.getParameters().getParameters().size()); ApplicationConfDTO applicationConf = new ApplicationConfDTO(); applicationConf.setId(application.getId()); ProjectConfDTO projectConf = new ProjectConfDTO(); projectConf.setId(project.getId()); projectConf.setName(project.getName()); // Création des paramètres MapParameterDTO params = new MapParameterDTO(); StringParameterDTO strParam = new StringParameterDTO("strParam"); params.getParameters().put("strParam", strParam); projectConf.setParameters(params); // La grille QualityGridDTO gridDTO = new QualityGridDTO(); gridDTO.setName(grid.getName()); projectConf.setQualityGrid(gridDTO); // Le profil ProjectProfileDTO profileDTO = new ProjectProfileDTO(); profileDTO.setName(profile.getName()); projectConf.setProfile(profileDTO); // Le source manager SourceManagementDTO managerDTO = new SourceManagementDTO(); managerDTO.setName(manager.getName()); projectConf.setSourceManager(managerDTO); ProjectFacade.update(projectConf, applicationConf, getSession()); ProjectConfDTO projectconfGetting = ProjectFacade.get(projectConf); MapParameterDTO paramsDTOGetting = projectconfGetting.getParameters(); Map mapGetting = paramsDTOGetting.getParameters(); assertEquals(1, mapGetting.size()); FacadeHelper.closeSession(session, ""); } catch (Exception e) { e.printStackTrace(); fail("unexpected exception"); } }