r1364 - in topia/trunk/topia-ui: . src/test/java/org/codelutin src/test/java/org/codelutin/test/web src/test/java/org/codelutin/test/web/pages src/test/java/org/codelutin/topiauitest src/test/java/org/codelutin/topiauitest/entities src/test/java/org/codelutin/topiauitest/utils src/test/java/org/codelutin/topiauitest/web src/test/java/org/codelutin/topiauitest/web/base src/test/java/org/codelutin/topiauitest/web/components src/test/java/org/codelutin/topiauitest/web/pages src/test/java/org/co
Author: chatellier Date: 2009-02-12 09:29:46 +0000 (Thu, 12 Feb 2009) New Revision: 1364 Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Contact.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/ContactDAO.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Society.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/SocietyDAO.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/utils/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/utils/HibernateUtils.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/LoginForm.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ Removed: topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/base/ topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/components/ topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/LoginForm.java topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/ Modified: topia/trunk/topia-ui/pom.xml topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/BasePage.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/SessionBean.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/ContextLink.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/Layout.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactForm.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactList.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactView.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyForm.java topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyView.java topia/trunk/topia-ui/src/test/xmi/contact.zargo Log: Suppression de topia-persistence en dependance test scope. Modified: topia/trunk/topia-ui/pom.xml =================================================================== --- topia/trunk/topia-ui/pom.xml 2009-02-12 09:09:04 UTC (rev 1363) +++ topia/trunk/topia-ui/pom.xml 2009-02-12 09:29:46 UTC (rev 1364) @@ -20,13 +20,6 @@ <dependencies> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>topia-persistence</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> <groupId>org.codelutin</groupId> <artifactId>lutinutil</artifactId> </dependency> @@ -41,6 +34,23 @@ <artifactId>tapestry-core</artifactId> </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-ehcache</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>javassist</groupId> + <artifactId>javassist</artifactId> + <scope>test</scope> + </dependency> </dependencies> <!-- ************************************************************* --> @@ -69,37 +79,15 @@ <groupId>org.codelutin</groupId> <artifactId>maven-generator-plugin</artifactId> <version>${generator.version}</version> - <configuration> - <testPhase>true</testPhase> - <fullPackagePath>org.codelutin.test</fullPackagePath> - <extractedPackages>org.codelutin.test</extractedPackages> - </configuration> <executions> - <execution> - <id>generate-objectmodel</id> - <phase>generate-test-sources</phase> - <configuration> - <!--testPhase>true</testPhase> - <fullPackagePath>org.codelutin.test</fullPackagePath> - <extractedPackages>org.codelutin.test</extractedPackages--> - <defaultPackage>org.codelutin.test</defaultPackage> - <includes>**/*.objectmodel</includes> - <templates>org.codelutin.topia.generator.TopiaMetaGenerator</templates> - </configuration> - <goals> - <goal>zargo2xmi</goal> - <goal>xmi2objectmodel</goal> - <goal>generate</goal> - </goals> - </execution> <execution> <id>generate-statemodel</id> <phase>generate-test-sources</phase> <configuration> - <!--testPhase>true</testPhase> - <fullPackagePath>org.codelutin.test</fullPackagePath> - <extractedPackages>org.codelutin.test</extractedPackages--> + <testPhase>true</testPhase> + <fullPackagePath>org.codelutin.topiauitest</fullPackagePath> + <extractedPackages>org.codelutin.topiauitest</extractedPackages> <includes>**/*.statemodel</includes> <templates>org.codelutin.topia.generator.TapestryWebGenerator</templates> <extraClassPathDirectory>target/classes</extraClassPathDirectory> @@ -111,16 +99,7 @@ </goals> </execution> </executions> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>topia-persistence</artifactId> - <version>${project.version}</version> - <!--scope>compile</scope--> - <!--scope>runtime</scope--> - </dependency> - </dependencies> + </plugin> </plugins> Deleted: topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/LoginForm.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/LoginForm.java 2009-02-12 09:09:04 UTC (rev 1363) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/LoginForm.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,88 +0,0 @@ -/* *##% - * Copyright (C) 2006 Code Lutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ - -package org.codelutin.test.web.pages; - -import org.apache.tapestry5.annotations.Component; -import org.apache.tapestry5.annotations.Persist; -import org.codelutin.test.web.components.Layout; - -/** - * ProjectForm.java - * - * @author chatellier - * @version $Revision: 1.1 $ - * - * Last update : $Date: 2007/05/14 07:56:43 $ - * By : $Author: E023931M $ - * - * Based on authentication tutorial : - * http://new2java.blogspot.com/2007/05/tsa503pageslogin-step-01.html - */ -public class LoginForm { - - /** layout */ - @SuppressWarnings("unused") - @Component - private Layout layout; - - @Persist - private String user; - private String password; - - /** - * Form validation - */ - Object onSuccess() { - - /*if(user.equals("demo") && password.equals("demo")) { - String sessionBeanAttr = "aso:" + SessionBean.class.getName(); - ((SessionBean)_request.getSession(true).getAttribute(sessionBeanAttr)).setLogged(true); - }*/ - - return null; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the user - */ - public String getUser() { - return user; - } - - /** - * @param user the user to set - */ - public void setUser(String user) { - this.user = user; - } -} Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Contact.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Contact.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Contact.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,150 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.codelutin.topiauitest.entities; + +/** + * Contact.java + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class Contact { + + private String id; + + private String name; + + private String firstName; + + private int age; + + private String fonction; + + private Society society; + + + /** + * + */ + public Contact() { + super(); + } + + /** + * @param nom + * @param prenom + * @param age + * @param fonction + */ + public Contact(String id, String name, String firstName, int age, String fonction) { + this(); + this.id = id; + this.name = name; + this.firstName = firstName; + this.age = age; + this.fonction = fonction; + } + + /** + * @return the age + */ + public int getAge() { + return age; + } + + /** + * @param age the age to set + */ + public void setAge(int age) { + this.age = age; + } + + /** + * @return the fonction + */ + public String getFonction() { + return fonction; + } + + /** + * @param fonction the fonction to set + */ + public void setFonction(String fonction) { + this.fonction = fonction; + } + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the nom + */ + public String getName() { + return name; + } + + /** + * @return the prenom + */ + public String getFirstName() { + return firstName; + } + + /** + * @param prenom the prenom to set + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * @return the society + */ + public Society getSociety() { + return society; + } + + /** + * @param society the society to set + */ + public void setSociety(Society society) { + this.society = society; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } +} Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/ContactDAO.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/ContactDAO.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/ContactDAO.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,92 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ +package org.codelutin.topiauitest.entities; + +import java.util.List; + +import org.codelutin.topiauitest.utils.HibernateUtils; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; + + +/** + * SocietyDAO.java + * + * @author chatellier + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/05/14 07:56:43$ + * By : $Author: chatellier $ + */ +public class ContactDAO { + + /** + * Session factory + */ + private SessionFactory sf; + + private Session session; + + public ContactDAO() { + sf = HibernateUtils.getSessionFactory(); + } + + public void beginTransaction() { + session = sf.getCurrentSession(); + session.beginTransaction(); + } + + public void commit() { + session.getTransaction().commit(); + } + + @SuppressWarnings("unchecked") + public Contact getContactById(String ID) { + + List<Contact> lm = (List<Contact>) session + .createCriteria(Contact.class).add(Restrictions.eq("id", ID)).list(); + Contact c = null; + if (lm.size() == 1) { + c = lm.get(0); + } + + return c; + } + + @SuppressWarnings("unchecked") + public List<Contact> getContactList() { + + List<Contact> lc = (List<Contact>) session + .createCriteria(Contact.class).list(); + + return lc; + } + + public void delete(Contact c) { + session.delete(c); + } + + public void create(Contact c) { + session.save(c); + } + + public void update(Contact c) { + session.saveOrUpdate(c); + } +} Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Society.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Society.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/Society.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,98 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.codelutin.topiauitest.entities; + +/** + * Society.java + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class Society { + + private String id; + + private String name; + + private String adress; + + /** + * + */ + public Society() { + super(); + } + + /** + * @param id + * @param name + * @param adresse + */ + public Society(String id, String name, String adress) { + this(); + this.id = id; + this.name = name; + this.adress = adress; + } + + /** + * @return the adresse + */ + public String getAdress() { + return adress; + } + + /** + * @param adresse the adresse to set + */ + public void setAdress(String adress) { + this.adress = adress; + } + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } +} Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/SocietyDAO.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/SocietyDAO.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/entities/SocietyDAO.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,93 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ +package org.codelutin.topiauitest.entities; + +import java.util.List; + +import org.codelutin.topiauitest.utils.HibernateUtils; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; + + +/** + * SocietyDAO.java + * + * @author chatellier + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/05/14 07:56:43$ + * By : $Author: chatellier $ + */ +public class SocietyDAO { + + /** + * Session factory + */ + private SessionFactory sf; + + private Session session; + + public SocietyDAO() { + sf = HibernateUtils.getSessionFactory(); + } + + public void beginTransaction() { + session = sf.getCurrentSession(); + session.beginTransaction(); + } + + public void commit() { + session.getTransaction().commit(); + } + + @SuppressWarnings("unchecked") + public Society getSocietyById(String ID) { + + List<Society> lm = (List<Society>) session + .createCriteria(Society.class).add(Restrictions.eq("id", ID)).list(); + Society s = null; + if (lm.size() == 1) { + s = lm.get(0); + } + + return s; + } + + public void delete(Society s) { + session.delete(s); + } + + public void create(Society s) { + session.save(s); + } + + public void update(Society s) { + session.saveOrUpdate(s); + } + + /** + * @return + */ + @SuppressWarnings("unchecked") + public List<Society> getSocietiesList() { + List<Society> lc = (List<Society>) session + .createCriteria(Society.class).list(); + return lc; + } +} Added: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/utils/HibernateUtils.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/utils/HibernateUtils.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/utils/HibernateUtils.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,52 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.codelutin.topiauitest.utils; + +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; + +public class HibernateUtils { + + private static final SessionFactory sessionFactory; + + static { + try { + Configuration cfg = new Configuration(); + + cfg.configure("hibernate.cfg.xml"); + + // creer le schema en base + // ca creer la base + //SchemaExport schemaExport = new SchemaExport(cfg); + //schemaExport.create(false, true); + + // Create the SessionFactory from hibernate.cfg.xml + sessionFactory = cfg.buildSessionFactory(); + + } catch (Throwable ex) { + // Make sure you log the exception, as it might be swallowed + System.err.println("Initial SessionFactory creation failed." + ex); + throw new ExceptionInInitializerError(ex); + } + } + + public static SessionFactory getSessionFactory() { + return sessionFactory; + } +} Copied: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base (from rev 1362, topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/base) Property changes on: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base ___________________________________________________________________ Name: svn:mergeinfo + Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/BasePage.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/base/BasePage.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/BasePage.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.base; +package org.codelutin.topiauitest.web.base; /** Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/SessionBean.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/base/SessionBean.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/base/SessionBean.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2006 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.base; +package org.codelutin.topiauitest.web.base; import java.io.Serializable; Copied: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components (from rev 1362, topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/components) Property changes on: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components ___________________________________________________________________ Name: svn:mergeinfo + Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/ContextLink.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/components/ContextLink.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/ContextLink.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2006 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.components; +package org.codelutin.topiauitest.web.components; import org.apache.tapestry5.MarkupWriter; import org.apache.tapestry5.annotations.Parameter; Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/Layout.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/components/Layout.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/components/Layout.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2006 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.components; +package org.codelutin.topiauitest.web.components; import java.util.Locale; Copied: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/LoginForm.java (from rev 1362, topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/LoginForm.java) =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/LoginForm.java (rev 0) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/LoginForm.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -0,0 +1,88 @@ +/* *##% + * Copyright (C) 2009 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +package org.codelutin.topiauitest.web.pages; + +import org.apache.tapestry5.annotations.Component; +import org.apache.tapestry5.annotations.Persist; +import org.codelutin.topiauitest.web.components.Layout; + +/** + * ProjectForm.java + * + * @author chatellier + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2007/05/14 07:56:43 $ + * By : $Author: E023931M $ + * + * Based on authentication tutorial : + * http://new2java.blogspot.com/2007/05/tsa503pageslogin-step-01.html + */ +public class LoginForm { + + /** layout */ + @SuppressWarnings("unused") + @Component + private Layout layout; + + @Persist + private String user; + private String password; + + /** + * Form validation + */ + Object onSuccess() { + + /*if(user.equals("demo") && password.equals("demo")) { + String sessionBeanAttr = "aso:" + SessionBean.class.getName(); + ((SessionBean)_request.getSession(true).getAttribute(sessionBeanAttr)).setLogged(true); + }*/ + + return null; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the user + */ + public String getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(String user) { + this.user = user; + } +} Property changes on: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/LoginForm.java ___________________________________________________________________ Name: svn:mergeinfo + Copied: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement (from rev 1362, topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement) Property changes on: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement ___________________________________________________________________ Name: svn:mergeinfo + Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactForm.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/ContactForm.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactForm.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,12 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.pages.contactManagement; +package org.codelutin.topiauitest.web.pages.contactManagement; import java.util.ArrayList; import java.util.List; -import org.apache.tapestry5.Link; import org.apache.tapestry5.OptionGroupModel; import org.apache.tapestry5.OptionModel; import org.apache.tapestry5.SelectModel; @@ -29,16 +28,10 @@ import org.apache.tapestry5.ValueEncoder; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.internal.OptionModelImpl; -import org.codelutin.test.TapestryTestDAOHelper; -import org.codelutin.test.entities.Contact; -import org.codelutin.test.entities.ContactDAO; -import org.codelutin.test.entities.ContactImpl; -import org.codelutin.test.entities.Society; -import org.codelutin.test.entities.SocietyDAO; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaContextFactory; -import org.codelutin.topia.TopiaException; -import org.codelutin.topia.TopiaNotFoundException; +import org.codelutin.topiauitest.entities.Contact; +import org.codelutin.topiauitest.entities.ContactDAO; +import org.codelutin.topiauitest.entities.Society; +import org.codelutin.topiauitest.entities.SocietyDAO; /** @@ -66,7 +59,7 @@ public ContactForm() { societyDao = new SocietyDAO(); contactDao = new ContactDAO(); - contact = new ContactImpl(); + contact = new Contact(); use_for_new = true; } @@ -107,21 +100,16 @@ public Object onSubmit() { // store contact // chech if update !!! - - try { - TopiaContext context = TopiaContextFactory.getContext(); - // FIXME get proper DAO - contact.setSociety(society); - if(use_for_new) { - contactDao.create(contact); - } - else { - contactDao.update(contact); - } - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } + + contactDao.beginTransaction(); + contact.setSociety(society); + if(use_for_new) { + contactDao.create(contact); + } + else { + contactDao.update(contact); + } + contactDao.commit(); return super.onActionFromContactStore(); } @@ -131,7 +119,7 @@ */ public void setEmptyContact() { - contact = new ContactImpl(); + contact = new Contact(); use_for_new = true; } @@ -164,18 +152,9 @@ * @return */ public List<Society> getSocieties() { - - List<Society> lp = null; - - try { - TopiaContext context = TopiaContextFactory.getContext(); - context.beginTransaction(); - lp = societyDao.findAll(); - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } - + societyDao.beginTransaction(); + List<Society> lp = societyDao.getSocietiesList(); + societyDao.commit(); return lp; } Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactList.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/ContactList.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactList.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,15 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.pages.contactManagement; +package org.codelutin.topiauitest.web.pages.contactManagement; import java.util.List; -import org.codelutin.test.entities.Contact; -import org.codelutin.test.entities.ContactDAO; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaContextFactory; -import org.codelutin.topia.TopiaException; +import org.codelutin.topiauitest.entities.Contact; +import org.codelutin.topiauitest.entities.ContactDAO; /** * ContactList.java @@ -71,16 +68,9 @@ * @return */ public List<Contact> getContacts() { - List<Contact> lc = null; - try { - TopiaContext context = TopiaContextFactory.getContext(); - context.beginTransaction(); - lc = dao.findAll(); - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } - + dao.beginTransaction(); + List<Contact> lc = dao.getContactList(); + dao.commit(); return lc; } @@ -97,17 +87,10 @@ public Object onActionFromViewer(String id) { - Contact c = null; - - try { - TopiaContext context = TopiaContextFactory.getContext(); - context.beginTransaction(); - c = dao.findByTopiaId(id); - c.getSociety().getName(); // lazy exception - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } + dao.beginTransaction(); + Contact c = dao.getContactById(id); + c.getSociety().getName(); // lazy exception + dao.commit(); getContactView().setContact(c); Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactView.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/ContactView.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/ContactView.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,14 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.pages.contactManagement; +package org.codelutin.topiauitest.web.pages.contactManagement; import org.apache.tapestry5.annotations.Persist; -import org.codelutin.test.entities.Contact; -import org.codelutin.test.entities.ContactDAO; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaContextFactory; -import org.codelutin.topia.TopiaException; +import org.codelutin.topiauitest.entities.Contact; +import org.codelutin.topiauitest.entities.ContactDAO; /** * ContactView.java @@ -84,14 +81,9 @@ @Override public Object onActionFromDelete() { - try { - TopiaContext context = TopiaContextFactory.getContext(); - context.beginTransaction(); - contactDAO.delete(contact); - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } + contactDAO.beginTransaction(); + contactDAO.delete(contact); + contactDAO.commit(); return super.onActionFromDelete(); } Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyForm.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/SocietyForm.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyForm.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,15 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.pages.contactManagement; +package org.codelutin.topiauitest.web.pages.contactManagement; import org.apache.tapestry5.annotations.Persist; -import org.codelutin.test.entities.Society; -import org.codelutin.test.entities.SocietyDAO; -import org.codelutin.test.entities.SocietyImpl; -import org.codelutin.topia.TopiaContext; -import org.codelutin.topia.TopiaContextFactory; -import org.codelutin.topia.TopiaException; +import org.codelutin.topiauitest.entities.Society; +import org.codelutin.topiauitest.entities.SocietyDAO; /** * SocietyForm.java @@ -47,7 +43,7 @@ public SocietyForm() { super(); - society = new SocietyImpl(); + society = new Society(); societyDAO = new SocietyDAO(); } @@ -70,7 +66,7 @@ * */ public void setEmptySociety() { - society = new SocietyImpl(); + society = new Society(); use_for_new = true; } @@ -85,17 +81,12 @@ public Object onSubmit() { - try { - TopiaContext context = TopiaContextFactory.getContext(); - context.beginTransaction(); - if(use_for_new) - societyDAO.create(society); - else - societyDAO.update(society); - context.commitTransaction(); - } catch (TopiaException e) { - // TODO log - } + societyDAO.beginTransaction(); + if(use_for_new) + societyDAO.create(society); + else + societyDAO.update(society); + societyDAO.commit(); return super.onActionFromSocietyStore(); } Modified: topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyView.java =================================================================== --- topia/trunk/topia-ui/src/test/java/org/codelutin/test/web/pages/contactManagement/SocietyView.java 2009-02-12 00:15:30 UTC (rev 1362) +++ topia/trunk/topia-ui/src/test/java/org/codelutin/topiauitest/web/pages/contactManagement/SocietyView.java 2009-02-12 09:29:46 UTC (rev 1364) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2007 Code Lutin + * Copyright (C) 2009 Code Lutin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,10 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ -package org.codelutin.test.web.pages.contactManagement; +package org.codelutin.topiauitest.web.pages.contactManagement; import org.apache.tapestry5.annotations.Persist; -import org.codelutin.test.entities.Society; +import org.codelutin.topiauitest.entities.Society; /** * SocietyList.java Modified: topia/trunk/topia-ui/src/test/xmi/contact.zargo =================================================================== (Binary files differ)
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org