Index: topia2/src/test/org/codelutin/topia/PersonAbstract.java diff -u topia2/src/test/org/codelutin/topia/PersonAbstract.java:1.1.1.1 topia2/src/test/org/codelutin/topia/PersonAbstract.java:1.2 --- topia2/src/test/org/codelutin/topia/PersonAbstract.java:1.1.1.1 Mon Jan 2 13:54:35 2006 +++ topia2/src/test/org/codelutin/topia/PersonAbstract.java Tue Feb 7 19:57:02 2006 @@ -23,10 +23,10 @@ * Created: 29 déc. 2005 00:27:53 * * @author poussin - * @version $Revision: 1.1.1.1 $ + * @version $Revision: 1.2 $ * - * Last update: $Date: 2006/01/02 13:54:35 $ - * by : $Author: bpoussin $ + * Last update: $Date: 2006/02/07 19:57:02 $ + * by : $Author: thimel $ */ package org.codelutin.topia; @@ -48,7 +48,9 @@ } public void setFirstname(String firstname) { + String _oldValue = this.firstname; this.firstname = firstname; + fireOnModifyProperty("firstName", _oldValue, firstname); } public String getName() { @@ -56,9 +58,9 @@ } public void setName(String name) { + String _oldValue = this.name; this.name = name; + fireOnModifyProperty("name", _oldValue, name); } } - - Index: topia2/src/test/org/codelutin/topia/TopiaContextTest.java diff -u topia2/src/test/org/codelutin/topia/TopiaContextTest.java:1.6 topia2/src/test/org/codelutin/topia/TopiaContextTest.java:1.7 --- topia2/src/test/org/codelutin/topia/TopiaContextTest.java:1.6 Mon Jan 30 14:38:53 2006 +++ topia2/src/test/org/codelutin/topia/TopiaContextTest.java Tue Feb 7 19:57:02 2006 @@ -23,13 +23,15 @@ * * @author poussin * - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ * - * Last update: $Date: 2006/01/30 14:38:53 $ by : $Author: thimel $ + * Last update: $Date: 2006/02/07 19:57:02 $ by : $Author: thimel $ */ package org.codelutin.topia; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.Properties; import junit.framework.TestCase; @@ -397,4 +399,25 @@ } + public void testPropertyEvent() throws Exception { + PropertyChangeListener l = new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + System.out.println("entityUpdated " + evt.getSource()); + state = "entityUpdated"; + } + }; + + Properties config = getProperties(); + + TopiaContextImplementor ctx = (TopiaContextImplementor) + TopiaContextFactory.getContext(config).beginTransaction(); + + TopiaDAO personDAO = ctx.getDAO(Person.class); + Person p = personDAO.create(); + p.addPropertyListener("firstName", l); + state = null; + p.setFirstname("Arno"); + assertEquals("entityUpdated", state); + } + }